request->post(); try{ // var_dump($params['DATA']);die; $data = $servies->makeMappingData($params['DATA'],'DATA'); $patientData = $data['PATIENT']; $medical = $data['MEDICAL_INFORMATION']; $application = $data['EXAM_APPLICATIONS']; $orders = $data['MEDICAL_ORDERS']; $exam = $data['EXAM_REPORTS']; $inspect = $data['INSPECT_REPORTS']; $diagnoses = $data['DIAGNOSES']; $mpiData = $servies->getMpi($patientData['ID_CARDNUM']); $mpiKey = $mpiData['MPI_KEY'] ?? ''; $mpi = $mpiData['MPI'] ?? ''; if(empty($mpiKey)) { $mpiKey = Handle::makeMpiKey($patientData['ID_CARDNUM']); $mpi = Handle::makeMpi(); $servies->saveMpi($mpi,$patientData['ID_CARDNUM'],$mpiKey); } // $patientCode = Handle::makePatientCode($medical['ORGCODE'],$medical['SERIESNUM']); $patientCode = Handle::makePatientCode($mpiKey, $medical['ORGCODE'],$medical['SERIESNUM']); $servies->savePatient($patientData,$mpi,$mpiKey,$patientCode); //患者表patient $servies->saveMedical($medical,$mpiKey,$patientCode); //medicalinformation表 $servies->saveDiagnose($diagnoses,$patientCode); //diagnoses表 $servies->saveApplication($application,$mpiKey,$patientCode); //examapplication表 $servies->saveOrders($orders,$mpiKey,$patientCode); // 检验医嘱表 返回检验申请单标识 // $servies->saveExamReport($exam,$mpiKey,$patientCode,$application['EXAM_ITEMNAME_CODE']); //检查报告表 $servies->saveExamReport($exam,$mpiKey,$patientCode); //检查报告表 $servies->saveInspectReport($inspect,$mpiKey,$patientCode); // 检验报告表 // 管理后台-医院医院数据-患者信息表 $servies->saveHospitalPatient($mpiKey, $mpi, $patientCode, $patientData, $medical, $diagnoses, $orders, $application); $servies->updateMiddleStatus($params['middleId'],['status'=>3]); Db::commit(); }catch (\Exception $e) { // 9 $servies->updateMiddleStatus($params['middleId'],['status'=>9]); Db::rollback(); $this->error($e->getMessage()); } $this->success('', 'success'); } /** * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException */ public function getPatientInfo(PatientServies $servies): void { $params = $this->request->post(); $patientCode = $params['PATIENT_CODE']; $data = $servies->getPatient(['PATIENT_CODE'=>$patientCode]); $this->success('',$data); } /** * 上传检查数据 */ public function postExamInfo(PatientServies $servies): void { try { $params = $this->request->post(); $params = $this->getDecryptData($params['data']); $params = $servies->makeMappingData($params,'0','postExamInfo'); $data = $servies->postExamInfo($params); $data = $this->makeEncryptData($data); $this->success($data,''); }catch (\Exception $e) { $this->error($e->getMessage()); } } /** * 上传检查数据 */ public function postExamReport(PatientServies $servies): void { try { $params = $this->request->post(); $params = $this->getDecryptData($params['data']); $params = $servies->makeMappingData($params,'0','postExamReport'); $data = $servies->postExamReport($params); $data = $this->makeEncryptData($data); $this->success($data,''); }catch (\Exception $e) { $this->error($e->getMessage()); } } /** * 上传检验数据 */ public function postLisReport(PatientServies $servies): void { try { $params = $this->request->post(); $params = $this->getDecryptData($params['data']); $params = $servies->makeMappingData($params,'0','postLabReport'); $data = $servies->postLabReport($params); $data = $this->makeEncryptData($data); $this->success($data,''); }catch (\Exception $e) { $this->error($e->getMessage()); } } }