examModel = $examModel; $this->inspectModel = $inspectModel; $this->hrrecordModel = $hrrecordModel; $this->medicalInformation = $medicalInformation; $this->inspecItemtModel = $biInspectReport; } public function getMedicalData() { $data = $this->medicalInformation->field('DIAGNOSENAME,count(*) as c')->limit(50)->group('DIAGNOSENAME')->select()->toArray(); $arr = []; foreach ($data as $v) { $diagnose = explode(';',$v['DIAGNOSENAME']); foreach ($diagnose as $value) { if(isset($arr[$value])) { $arr[$value] ++; }else{ $arr[$value] = 1; } } } $return = []; foreach ($arr as $k=>$v) { $return[] = ['name'=>$k,'value'=>$v]; } return $return; } public function getAllNum() { $exam = $this->_getExamCount(); $inspect = $this->_getInspectCount(); $arr = []; foreach ($exam as $k=>$v) { $data = []; $data['name']=$k; $data['exam'] = $v; if($inspect[$k] ?? '') { $data['inspect'] = $inspect[$k]; }else{ $data['inspect'] = 0; } $arr[$data['exam']+$data['inspect']] = $data; } krsort($arr); $array = array_slice($arr, 0, 20); return $array; } public function getExamData() { $uploadNum = $this->_getExamUpload(); $hrNum = $this->_getExamHr(); $data = []; foreach ($hrNum as $k=>$v) { $arr = []; $arr['upload'] = $k; $arr['num'] = $v; $arr['hr'] = $uploadNum[$k] ?? 0; $data[] = $arr; } return $data; } public function _getExamUpload() { return $this->examModel->group('DEVICETYPE_CODE')->where("DEVICETYPE_CODE != ''")->column('count(*)','DEVICETYPE_CODE'); } public function _getExamHr() { return $this->hrrecordModel->alias('h') ->join(['dict_exam_project'=>'d'],'d.XM_CODE=h.ITEMNAMECODE') ->group('d.modality') ->column('count(*)','modality'); } public function _getExamCount() { return $this->examModel->group('ORGNAME')->column('count(*)','ORGNAME'); } public function _getInspectCount() { return $this->inspectModel->group('ORGNAME')->column('count(*)','ORGNAME'); } public function getRepeatExam() { $handelData = $this->getRepeatDatas($this->examModel,'HR_ITEMNAME'); // 获取患者数量 $count = $this->getPatientCount([]); $MPIS = $handelData['MPIS']; // 重复报告数量 $repeat = count($MPIS); $percent = round($repeat/$count*100); return ['percent'=>$percent]; } public function getRepeatDatas($model,$itemname) { $this->baseModel = $model; $this->hrItemnameKey = $itemname; // 获取重复数据 $repeatDatas = $this->getRepeatData([]); // 处理重复数据 $handelData = $this->handleRepeatData($repeatDatas); return $handelData; } public function getRepeatExamProject() { $handelData = $this->getRepeatDatas($this->examModel,'HR_ITEMNAME'); return array_slice($handelData['LAB_HR_ITEMNAMES'],0,10); } public function getRepeatInspect() { $handelData = $this->getRepeatDatas($this->inspectModel,'LAB_HR_ITEMNAME'); // 获取患者数量 $count = $this->getPatientCount([]); $MPIS = $handelData['MPIS']; // 重复报告数量 $repeat = count($MPIS); $percent = round($repeat/$count*100); return ['percent'=>$percent]; } public function getRepeatInspectDoctor() { $handelData = $this->getRepeatDatas($this->inspectModel,'LAB_HR_ITEMNAME'); $MPIS = $handelData['MPIS']; // 医生情况 $doctor = $this->getDoctor([], $MPIS); return $this->makeIdReturn($doctor['doctor']['items'],$doctor['doctor']['all']); } public function makeIdReturn($data,$all) { $i = 1; foreach ($data as $k=>$v) { $data[$k]['id'] = $i; $data[$k]['percent'] = round($v['value']/$all*100).'%'; $data[$k]['value'] = $v['value'].'次'; $i++; } return $data; } public function getRepeatExamDoctor() { $handelData = $this->getRepeatDatas($this->examModel,'HR_ITEMNAME'); $MPIS = $handelData['MPIS']; // 医生情况 $doctor = $this->getDoctor([], $MPIS); return $this->makeIdReturn($doctor['doctor']['items'],$doctor['doctor']['all']); } public function getRepeatInspectProject() { $handelData = $this->getRepeatDatas($this->inspectModel,'LAB_HR_ITEMNAME'); return array_slice($handelData['LAB_HR_ITEMNAMES'],0,10); } public function getAllBhrReason() { $record = $this->hrrecordModel->where('HR_STATUS',2)->group('BHR_REASON')->field('BHR_REASON,count(*)')->select()->toArray(); // foreach ($record as $k=>$v) // { // $record[$k]['BHR_REASON'] = mb_substr($v['BHR_REASON'],0,3); // } return $record; } public function getHrExamItem() { $this->hrBaseModel = $this->hrrecordModel; $this->ITEMNAMETYPE = 1; $hr = $this->getHrItem([]); $arr = $hr['items']; foreach ($arr as $k=>$v) { $arr[$k]['percent'] = round($v['value']/$hr['all']*100).'%'; } return $arr; } public function getHrInspectItem() { $this->hrBaseModel = $this->hrrecordModel; $this->ITEMNAMETYPE = 2; $hr = $this->getHrItem([]); $arr = $hr['items']; foreach ($arr as $k=>$v) { $arr[$k]['percent'] = round($v['value']/$hr['all']*100).'%'; } return $arr; } public function unLookRepeatInspectDoctor() { $handelData = $this->getRepeatDatas($this->inspectModel,'LAB_HR_ITEMNAME'); $MPIS = $handelData['MPIS']; // 医生情况 $doctor = $this->getDoctor([], $MPIS); // 有互认提示但未查看,直接进行了重复检查检验的医生构成比 return $this->makeLookReturn($doctor['un_call_doctor']['items']); } public function unLookRepeatExamDoctor() { $handelData = $this->getRepeatDatas($this->examModel,'HR_ITEMNAME'); $MPIS = $handelData['MPIS']; // 医生情况 $doctor = $this->getDoctor([], $MPIS); // 有互认提示但未查看,直接进行了重复检查检验的医生构成比 return $this->makeLookReturn($doctor['un_call_doctor']['items']); } public function LookRepeatExamDoctor() { $handelData = $this->getRepeatDatas($this->examModel,'HR_ITEMNAME'); $MPIS = $handelData['MPIS']; // 医生情况 $doctor = $this->getDoctor([], $MPIS); // 有互认提示并已查看,也进行了重复检查检验的医生构成比 return $this->makeLookReturn($doctor['call_doctor']['items']); } public function makeLookReturn($data) { $arr = []; foreach ($data as $k=>$v) { $arr[$k]['label'] = $v['label']; $arr[$k]['数量'] = $v['value']; } return $arr; } public function getLeida() { $types = $this->inspecItemtModel->field('count(*) c, ITEMTYPE')->group('ITEMTYPE')->select()->toArray(); $hrs = $this->hrrecordModel->field('count(*) c, ITEMTYPE')->group('ITEMTYPE')->select()->toArray(); $model = new Commondata(); $dicts = $model ->field(['code','name']) ->where('type', '13') ->where('status', 1) ->order('weigh asc, id asc') ->select() ->toArray(); $indicator = array(); $hr = [ 'name' => '互认', ]; $type = [ 'name' => '上传', ]; foreach($dicts as $dict) { $key = 'key'.$dict['code']; $tmp = [ 'key' => $key, 'name' => $dict['name'], 'max' => 0 ]; $hr[$key] = 0; $type[$key] = 0; $max = 0; foreach($types as $_type) { if('key'.$_type['ITEMTYPE'] == $key) { $type[$key] = $_type['c']; } $max = max($max, $_type['c']); } foreach($hrs as $_hr) { if('key'.$_hr['ITEMTYPE'] == $key) { $hr[$key] = $_hr['c']; } $max = max($max, $_hr['c']); } $indicator[] = $tmp; } foreach($indicator as &$_indicator) { $_indicator['max'] = $max; } $data = [ 'indicator' => $indicator, 'val' => [ $type, $hr ] ]; // $data = [ // 'indicator' => [ // ['key' => 'key1', 'max' => 10000, 'name' => 'Name1'], // ['key' => 'key2', 'max' => 10000, 'name' => 'Name2'], // ['key' => 'key3', 'max' => 10000, 'name' => 'Name3'], // ['key' => 'key4', 'max' => 10000, 'name' => 'Name4'], // ['key' => 'key5', 'max' => 10000, 'name' => 'Name5'], // ['key' => 'key6', 'max' => 10000, 'name' => 'Name6'], // ], // 'val' => [ // [ // 'name' => '上传', // 'key1' => 2342, // 'key2' => 2452, // 'key3' => 4335, // 'key4' => 7469, // 'key5' => 6572, // 'key6' => 9864, // ], // [ // 'name' => '互认', // 'key1' => 1342, // 'key2' => 5452, // 'key3' => 3335, // 'key4' => 4469, // 'key5' => 6572, // 'key6' => 2864, // ] // ] // ]; return $data; // halt($data); } public function getBhrInstitution() { $data = $this->hrrecordModel->group('ORGNAME')->field('count(*) c,ORGNAME')->order('c desc')->limit(20)->select(); foreach ($data as $k=>$v) { $data[$k]['id'] = $k+1; $data[$k]['c'] = $v['c'].'次'; } return $data; } }