|
|
|
|
@ -25,6 +25,140 @@ public function PacsSaveApplyInfo(Request $request)
|
|
|
|
|
return \Yz::JsonReturn($res['status'],$res['msg'],$res['data']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 测试接口:查看即将推送给PACS的数据(不推送、不写日志、不操作数据)
|
|
|
|
|
public function PacsSaveApplyInfoTest(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$orderNo = $request->query('orderNo');
|
|
|
|
|
if (empty($orderNo)) {
|
|
|
|
|
return \Yz::JsonReturn(false, 'orderNo 不能为空', []);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$entrust = DB::table('s_list')->where(['entrust_id' => $orderNo, 'list_status' => 2, 'is_nullify' => 0])->first();
|
|
|
|
|
$reservation_time = '';
|
|
|
|
|
$reservation_end_time = '';
|
|
|
|
|
if (isset($entrust->roster_id) and !empty($entrust->roster_id)) {
|
|
|
|
|
$plan = DB::table('s_source_roster_detail')->where(['id' => $entrust->roster_id])->first();
|
|
|
|
|
if (!!$plan) {
|
|
|
|
|
$reservation_time = $plan->begin_time;
|
|
|
|
|
$reservation_end_time = $plan->end_time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($entrust) {
|
|
|
|
|
// 查询 HIS 获取检查申请单
|
|
|
|
|
$hisInfo = [];
|
|
|
|
|
$res = HisController::GetApplyDetail($entrust->episodeid, $entrust->app_num, $entrust->patient_type, '本地');
|
|
|
|
|
if ($res['code'] == 200) {
|
|
|
|
|
$res_data = $res['data'];
|
|
|
|
|
foreach ($res_data as $data_k => $data_v) {
|
|
|
|
|
$hisInfo = $data_v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$patientTypeMap = [
|
|
|
|
|
0 => 'I', // I - 住院
|
|
|
|
|
1 => 'O', // O - 门诊
|
|
|
|
|
2 => 'E', // E - 急诊
|
|
|
|
|
3 => 'H', // H - 体检
|
|
|
|
|
];
|
|
|
|
|
$jiuzhenliushuihao = [
|
|
|
|
|
0 => $hisInfo['cardNo'] ?? '', // I - 住院
|
|
|
|
|
1 => $entrust->episodeid, // O - 门诊
|
|
|
|
|
2 => $hisInfo['cardNo'] ?? '', // E - 急诊
|
|
|
|
|
3 => $hisInfo['cardNo'] ?? '', // H - 体检
|
|
|
|
|
];
|
|
|
|
|
$guid = Str::uuid()->toString();
|
|
|
|
|
$sex = 'U';
|
|
|
|
|
if ($entrust->user_sex == 1) $sex = 'M';
|
|
|
|
|
if ($entrust->user_sex == 2) $sex = 'F';
|
|
|
|
|
$hisiteminfo = collect($hisInfo['itemList'] ?? [])->firstWhere('termCode', $entrust->entrust_code);
|
|
|
|
|
|
|
|
|
|
// 获取顶级科室名称
|
|
|
|
|
$deptName = '';
|
|
|
|
|
if (!empty($entrust->department_id)) {
|
|
|
|
|
$execDept = DB::table('s_department')->where('id', $entrust->department_id)->where('is_del', 0)->first();
|
|
|
|
|
if ($execDept) {
|
|
|
|
|
if ($execDept->pid == 0) {
|
|
|
|
|
$deptName = $execDept->department_name;
|
|
|
|
|
} else {
|
|
|
|
|
$topDept = DB::table('s_department')->where('id', $execDept->pid)->where('is_del', 0)->first();
|
|
|
|
|
$deptName = $topDept->department_name ?? '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$send_data = [
|
|
|
|
|
'Request' => [
|
|
|
|
|
'Head' => [
|
|
|
|
|
'TradeCode' => 'SaveApplyInfo',
|
|
|
|
|
'TradeTime' => date('Y-m-d H:i:s'),
|
|
|
|
|
'TradeNo' => $guid,
|
|
|
|
|
'BranchCode' => '01',
|
|
|
|
|
'HospitalCode' => '01'
|
|
|
|
|
],
|
|
|
|
|
'Body' => [
|
|
|
|
|
'patientinfo' => [
|
|
|
|
|
'patientid' => $entrust->reg_num,
|
|
|
|
|
'patientname' => $entrust->user_name,
|
|
|
|
|
'patientsex' => $sex,
|
|
|
|
|
'patientbirthday' => $entrust->user_brithday,
|
|
|
|
|
'age' => \Tools::calculateAge($entrust->user_brithday),
|
|
|
|
|
'height' => '',
|
|
|
|
|
'weight' => '',
|
|
|
|
|
'identifyid' => $entrust->idCardNumber,
|
|
|
|
|
'healthcard' => '',
|
|
|
|
|
'insurance_type' => '',
|
|
|
|
|
'mobilephone' => $entrust->user_phone,
|
|
|
|
|
'home_detail_address' => $hisInfo['address'] ?? '',
|
|
|
|
|
'visitinfo' => [
|
|
|
|
|
'visitsqno' => $entrust->episodeid,
|
|
|
|
|
'inpatientno' => substr($entrust->episodeid, -10),
|
|
|
|
|
'outpatientno' => $jiuzhenliushuihao[$entrust->patient_type],
|
|
|
|
|
'caseno' => $hisInfo['markNo'] ?? '',
|
|
|
|
|
'source' => $patientTypeMap[$entrust->patient_type],
|
|
|
|
|
'hospitalization_count' => '',
|
|
|
|
|
'bed_no' => $hisInfo['bedNo'] ?? '',
|
|
|
|
|
'roomnumber' => '',
|
|
|
|
|
'inpatientareacode' => $hisInfo['areaCode'] ?? '',
|
|
|
|
|
'inpatientarea' => $hisInfo['areaName'] ?? '',
|
|
|
|
|
],
|
|
|
|
|
'applyinfo' =>
|
|
|
|
|
[
|
|
|
|
|
'accessionnumber' => $entrust->app_num,
|
|
|
|
|
'hisapplytime' => $hisInfo['requestDate'] ?? '',
|
|
|
|
|
'hisapplydeptcode' => $hisInfo['orderDeptCode'] ?? '',
|
|
|
|
|
'hisapplydept' => $hisInfo['orderDeptName'] ?? '',
|
|
|
|
|
'hisapplydoctorcode' => $hisInfo['orderPersonCode'] ?? '',
|
|
|
|
|
'hisapplydoctor' => $hisInfo['orderPersonName'] ?? '',
|
|
|
|
|
'diagnosis' => $entrust->diagnosisName,
|
|
|
|
|
'isemergency' => $entrust->his_is_emergency,
|
|
|
|
|
'isarmyman' => $hisInfo['armyFlag'] ?? '',
|
|
|
|
|
'vip_indicator' => $hisInfo['vipFlag'] ?? '',
|
|
|
|
|
'applyorderinfo' => [
|
|
|
|
|
'orderno' => $entrust->entrust_id,
|
|
|
|
|
'appoint_date' => $entrust->reservation_date . ' ' . substr($reservation_time, 0, 5),
|
|
|
|
|
'register_date' => $entrust->reservation_date . ' ' . substr($reservation_end_time, 0, 5),
|
|
|
|
|
'bodypartexamined' => $hisiteminfo['examPosiSmallName'] ?? '',
|
|
|
|
|
'dept_name' => $deptName,
|
|
|
|
|
'studyclass1' => $hisInfo['requestTypeAlias'] ?? '',
|
|
|
|
|
'studyclass1his' => $hisiteminfo['execDeptName'] ?? '',
|
|
|
|
|
'studyclass1name' => $hisiteminfo['execDeptName'] ?? '',
|
|
|
|
|
'studyclass2hiscode' => $hisiteminfo['termCode'] ?? '',
|
|
|
|
|
'studyclass2his' => $hisiteminfo['termName'] ?? '',
|
|
|
|
|
'checkitemcode' => $entrust->entrust_code,
|
|
|
|
|
'checkitemname' => $entrust->entrust,
|
|
|
|
|
'factprice' => $hisInfo['itemList'][0]['itemCost'] ?? '',
|
|
|
|
|
],
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return \Yz::JsonReturn(true, '测试数据(未推送)', ['send_data' => $send_data]);
|
|
|
|
|
} else {
|
|
|
|
|
return \Yz::JsonReturn(false, '医嘱不存在', []);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通知pacs 检查申请单推送
|
|
|
|
|
public function SaveApply($orderNo)
|
|
|
|
|
{
|
|
|
|
|
@ -123,6 +257,7 @@ public function SaveApply($orderNo)
|
|
|
|
|
'appoint_date' => $entrust->reservation_date . ' ' . substr($reservation_time, 0, 5),
|
|
|
|
|
'register_date' => $entrust->reservation_date . ' ' . substr($reservation_end_time, 0, 5),
|
|
|
|
|
'bodypartexamined' => $hisiteminfo['examPosiSmallName']??'',
|
|
|
|
|
'dept_name' => '',
|
|
|
|
|
'studyclass1' => $hisInfo['requestTypeAlias']??'',
|
|
|
|
|
'studyclass1his' => $hisiteminfo['execDeptName']??'',
|
|
|
|
|
'studyclass1name' => $hisiteminfo['execDeptName']??'',
|
|
|
|
|
|