|
|
|
|
@ -18,7 +18,25 @@ public function GetList($searchInfo,$page,$pageSize){
|
|
|
|
|
}
|
|
|
|
|
//获取启用的设备列表
|
|
|
|
|
public function GetEnableList($hisExecDepts = null){
|
|
|
|
|
$list=DB::table('s_devices')->where(['is_del'=>0,'status'=>1]);
|
|
|
|
|
$list = DB::table('s_devices')->where(['s_devices.is_del' => 0, 's_devices.status' => 1]);
|
|
|
|
|
|
|
|
|
|
// 反查关联诊室和科室状态:必须存在至少一条有效的关联链路
|
|
|
|
|
$list->whereExists(function ($query) {
|
|
|
|
|
$query->select(DB::raw(1))
|
|
|
|
|
->from('s_department_resources_device')
|
|
|
|
|
->join('s_department_resources', function ($join) {
|
|
|
|
|
$join->on('s_department_resources_device.rsourece_id', '=', 's_department_resources.id')
|
|
|
|
|
->where('s_department_resources.is_del', 0)
|
|
|
|
|
->where('s_department_resources.department_resources_status', 1);
|
|
|
|
|
})
|
|
|
|
|
->join('s_department', function ($join) {
|
|
|
|
|
$join->on('s_department_resources_device.department_id', '=', 's_department.id')
|
|
|
|
|
->where('s_department.is_del', 0)
|
|
|
|
|
->where('s_department.department_status', 1)
|
|
|
|
|
->where('s_department.appointment_enabled', 1);
|
|
|
|
|
})
|
|
|
|
|
->whereColumn('s_department_resources_device.device_id', 's_devices.id');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!empty($hisExecDepts)) {
|
|
|
|
|
$deptCodes = json_decode($hisExecDepts, true);
|
|
|
|
|
@ -27,6 +45,8 @@ public function GetEnableList($hisExecDepts = null){
|
|
|
|
|
$deptIds = DB::table('s_department')
|
|
|
|
|
->whereIn('department_number', $deptCodes)
|
|
|
|
|
->where('is_del', 0)
|
|
|
|
|
->where('department_status', 1)
|
|
|
|
|
->where('appointment_enabled', 1)
|
|
|
|
|
->pluck('id')
|
|
|
|
|
->toArray();
|
|
|
|
|
|
|
|
|
|
@ -38,6 +58,8 @@ public function GetEnableList($hisExecDepts = null){
|
|
|
|
|
->where('pid', '>', 0);
|
|
|
|
|
})
|
|
|
|
|
->where('is_del', 0)
|
|
|
|
|
->where('department_status', 1)
|
|
|
|
|
->where('appointment_enabled', 1)
|
|
|
|
|
->pluck('id')
|
|
|
|
|
->toArray();
|
|
|
|
|
|
|
|
|
|
@ -49,7 +71,7 @@ public function GetEnableList($hisExecDepts = null){
|
|
|
|
|
->pluck('device_id')
|
|
|
|
|
->toArray();
|
|
|
|
|
|
|
|
|
|
$list->whereIn('id', $deviceIds);
|
|
|
|
|
$list->whereIn('s_devices.id', $deviceIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|