You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.8 KiB
PHP
76 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Third;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class EntrustController extends Controller
|
|
{
|
|
//创建医嘱记录进入 s_list表
|
|
public function CreateRecord()
|
|
{
|
|
$Info = request('info');
|
|
|
|
$params=[
|
|
'list_status'=>0,
|
|
'reg_num'=>$Info['reg_num'] ?? null,
|
|
'user_name'=>$Info['user_name'] ?? null,
|
|
'user_sex'=>$Info['user_sex'] ?? null,
|
|
'entrust'=>$Info['entrust'] ?? null,
|
|
'is_pay'=>$Info['is_pay'] ?? null,
|
|
'reservation_department'=>$Info['reservation_department'] ?? null,
|
|
'entrust_date'=>$Info['entrust_date'] ?? null,
|
|
'entrust_time'=>$Info['entrust_time'] ?? null,
|
|
'user_brithday'=>$Info['user_brithday'] ?? null,
|
|
'docotr'=>$Info['docotr'] ?? null,
|
|
'patient_type'=>$Info['patient_type'] ?? null,
|
|
'user_phone'=>$Info['user_phone'] ?? null,
|
|
'implement_department'=>$Info['implement_department'] ?? null,
|
|
'entrust_id'=>$Info['entrust_id'] ?? null,//his传过来的本地医嘱id
|
|
'episodeid'=>$Info['episodeid'] ?? null, //就诊号
|
|
'RISRExamID'=>$Info['RISRExamID'] ?? null, //检查号
|
|
'RISRAcceptDeptCode'=>$Info['RISRAcceptDeptCode'] ?? null, //接收科室代码
|
|
];
|
|
$requiredFields = [
|
|
'reg_num', 'user_name', 'user_sex', 'entrust', 'is_pay',
|
|
'reservation_department', 'entrust_date', 'entrust_time',
|
|
'user_brithday', 'docotr', 'patient_type', 'user_phone',
|
|
'implement_department', 'entrust_id', 'episodeid',
|
|
'RISRExamID', 'RISRAcceptDeptCode'
|
|
];
|
|
|
|
// 判断是否为空
|
|
foreach ($requiredFields as $field) {
|
|
if (!isset($params[$field]) || $params[$field] === null) {
|
|
return \Yz::echoError1('参数'.$field.'不能为空');
|
|
}
|
|
}
|
|
DB::beginTransaction();
|
|
$insertListId=DB::table('s_list')->insertGetId($params);
|
|
if($insertListId){
|
|
$data=[
|
|
'list_id'=>$insertListId,
|
|
'reg_num'=>$Info['reg_num'],
|
|
'new_status'=>0,
|
|
'create_user'=>'接口',
|
|
'note'=>'创建记录',
|
|
'data'=>json_encode($Info,JSON_UNESCAPED_UNICODE),//原始数据
|
|
];
|
|
$insertLog=DB::table('s_list_log')->insert($data);
|
|
if($insertLog){
|
|
DB::commit();
|
|
return \Yz::Return(true,'保存成功',[]);
|
|
}else{
|
|
DB::rollBack();
|
|
return \Yz::echoError1('保存失败');
|
|
}
|
|
}else{
|
|
DB::rollBack();
|
|
return \Yz::echoError1('保存失败');
|
|
}
|
|
|
|
}
|
|
}
|