|
|
|
|
@ -26,6 +26,7 @@ public function CheckAppointment()
|
|
|
|
|
$url = "";
|
|
|
|
|
$entrust_ids = [];
|
|
|
|
|
$termCodes = [];
|
|
|
|
|
$execDeptCodes = [];
|
|
|
|
|
if (!is_array($requestNoList)) {
|
|
|
|
|
return \Yz::JsonReturn(false, 'requestNoList 参数必须是数组', []);
|
|
|
|
|
}
|
|
|
|
|
@ -74,6 +75,7 @@ public function CheckAppointment()
|
|
|
|
|
// 检查科室是否参与预约
|
|
|
|
|
$entrust_ids[] = $item['orderNo'];
|
|
|
|
|
$termCodes[] = $item['termCode'];
|
|
|
|
|
$execDeptCodes[] = $item['execDeptCode'];
|
|
|
|
|
//查询库里是否存在该检医嘱
|
|
|
|
|
$db_item = DB::table('s_list')->where(['entrust_id' => $item['orderNo']])->first();
|
|
|
|
|
if (!$db_item) {
|
|
|
|
|
@ -147,6 +149,18 @@ public function CheckAppointment()
|
|
|
|
|
|
|
|
|
|
// 检查是否有诊室参与预约
|
|
|
|
|
$termCodes = array_unique($termCodes);
|
|
|
|
|
$execDeptCodes = array_unique($execDeptCodes);
|
|
|
|
|
|
|
|
|
|
// 检查 HIS 执行科室是否参与预约
|
|
|
|
|
$departmentEnabled = false;
|
|
|
|
|
if (!empty($execDeptCodes)) {
|
|
|
|
|
$enabledCount = DB::table("s_department")
|
|
|
|
|
->whereIn("department_number", $execDeptCodes)
|
|
|
|
|
->where("appointment_enabled", 1)
|
|
|
|
|
->count();
|
|
|
|
|
$departmentEnabled = ($enabledCount == count($execDeptCodes));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$hasEnabledRoom = 0;
|
|
|
|
|
if (!empty($termCodes)) {
|
|
|
|
|
$hasEnabledRoom = DB::table('s_check_item')
|
|
|
|
|
@ -155,18 +169,16 @@ public function CheckAppointment()
|
|
|
|
|
->join('s_source_roster_detail_device', 's_check_item_device.device_id', '=', 's_source_roster_detail_device.device_id')
|
|
|
|
|
->join('s_source_roster_detail', 's_source_roster_detail_device.roster_detail_id', '=', 's_source_roster_detail.id')
|
|
|
|
|
->join('s_department_resources', 's_source_roster_detail.resources_id', '=', 's_department_resources.id')
|
|
|
|
|
->join('s_department', 's_department_resources.department_id', '=', 's_department.id')
|
|
|
|
|
->where('s_source_roster_detail.status', 1)
|
|
|
|
|
->where('s_source_roster_detail.is_del', 0)
|
|
|
|
|
->where('s_department_resources.is_del', 0)
|
|
|
|
|
->where('s_department_resources.department_resources_status', 1)
|
|
|
|
|
->where('s_department_resources.appointment_enabled', 1)
|
|
|
|
|
->where('s_department.appointment_enabled', 1)
|
|
|
|
|
->whereRaw("FIND_IN_SET(?, s_source_roster_detail.patient_type)", [$patientType])
|
|
|
|
|
->count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($hasEnabledRoom > 0) {
|
|
|
|
|
if ($departmentEnabled && $hasEnabledRoom > 0) {
|
|
|
|
|
$is_redirect = true;
|
|
|
|
|
$url = $this->build_yiji_url($cardNo, $entrust_ids, $visitSqNo);
|
|
|
|
|
} else {
|
|
|
|
|
@ -183,13 +195,11 @@ public function CheckAppointment()
|
|
|
|
|
->join('s_source_roster_detail_device', 's_check_item_device.device_id', '=', 's_source_roster_detail_device.device_id')
|
|
|
|
|
->join('s_source_roster_detail', 's_source_roster_detail_device.roster_detail_id', '=', 's_source_roster_detail.id')
|
|
|
|
|
->join('s_department_resources', 's_source_roster_detail.resources_id', '=', 's_department_resources.id')
|
|
|
|
|
->join('s_department', 's_department_resources.department_id', '=', 's_department.id')
|
|
|
|
|
->where('s_source_roster_detail.status', 1)
|
|
|
|
|
->where('s_source_roster_detail.is_del', 0)
|
|
|
|
|
->where('s_department_resources.is_del', 0)
|
|
|
|
|
->where('s_department_resources.department_resources_status', 1)
|
|
|
|
|
->where('s_department_resources.appointment_enabled', 1)
|
|
|
|
|
->where('s_department.appointment_enabled', 1)
|
|
|
|
|
->whereRaw("FIND_IN_SET(?, s_source_roster_detail.patient_type)", [$patientType])
|
|
|
|
|
->distinct()
|
|
|
|
|
->pluck('s_department_resources.department_resources_name')
|
|
|
|
|
|