diff --git a/app/Http/Logics/Report/InspectLogic.php b/app/Http/Logics/Report/InspectLogic.php index 9be5440..c61ee3f 100644 --- a/app/Http/Logics/Report/InspectLogic.php +++ b/app/Http/Logics/Report/InspectLogic.php @@ -67,8 +67,8 @@ class InspectLogic throw new GeneralException($response['msg'] ?? '找不到该就诊卡!', Response::HTTP_SERVICE_UNAVAILABLE); } - Redis::setex($this->getInspectReportListsKey($this->open_id, $patient_info['patient_id']), 3600, json_encode($response['data'], JSON_UNESCAPED_UNICODE)); - return $response['data']; + Redis::setex($this->getInspectReportListsKey($this->open_id, $patient_info['patient_id']), 3600, json_encode($response['response'], JSON_UNESCAPED_UNICODE)); + return $response['response']; } /** @@ -91,9 +91,9 @@ class InspectLogic $lists = json_decode($lists, true); $info = []; - foreach ($lists as $k => $v) { + foreach ($lists['body'] as $v) { if ($serial_no === $v['sourceId']) { - $info = []; + $info = $v; break; } } @@ -138,6 +138,6 @@ class InspectLogic throw new GeneralException($response['msg'] ?? '找不到该就诊卡!', Response::HTTP_SERVICE_UNAVAILABLE); } - return $response['data']; + return $response['response']; } } diff --git a/app/Http/Resources/Report/Inspect/DetailsResource.php b/app/Http/Resources/Report/Inspect/DetailsResource.php index f86f49d..0d4364f 100644 --- a/app/Http/Resources/Report/Inspect/DetailsResource.php +++ b/app/Http/Resources/Report/Inspect/DetailsResource.php @@ -18,55 +18,47 @@ class DetailsResource extends JsonResource return []; } - $lists = []; - foreach ($this->resource['response']['body'] as $k => $v) { - // 过滤掉诊断为接口调用正常的第一条数据 - if ($v['diagnose'] === '医院接口调用正常') { - continue; - } + $info = [ + 'clinic_no' => $this->resource['clinicNo'], + 'serial_no' => $this->resource['sourceId'], + 'source_form' => $this->resource['sourceFrom'], + 'dept_id' => $this->resource['dept']['localCode'], + 'dept_name' => $this->resource['dept']['localText'], + 'doctor_id' => $this->resource['doctor']['localText'], + 'doctor_name' => $this->resource['doctor']['localText'], + 'exam_type' => $this->resource['examMethod'], + 'exam_name' => $this->resource['examName'], + 'exam_purpose' => $this->resource['examPurpose'], + 'diagnose' => $this->resource['diagnose'], + 'exam_view' => $this->resource['examView'], + 'diagnose_opinion' =>$this->resource['diagnoseOpinion'], + 'created_time' => $this->resource['createDt'], + 'check_time' => $this->resource['checkDt'], + 'report_time' => $this->resource['reportDt'], + 'comment' => $this->resource['comment'] ?: '', + // 患者信息 + 'patient_name' => $this->resource['patient']['name'], + 'patient_gender' => (int)$this->resource['patient']['sex'], + 'patient_birthday' => $this->resource['patient']['dob'], + // 冗余信息 + 'org_id' => $this->resource['org']['localCode'], + 'org_name' => $this->resource['org']['localText'], + 'equipment_name' => $this->resource['equipmentName'], + 'equipment_no' => $this->resource['equipmentNameNo'] ?: '', + 'report_doctor_id' => $this->resource['rpDoctor']['localCode'], + 'report_doctor_name' => $this->resource['rpDoctor']['localText'], + 'report_org_id' => $this->resource['rpOrg']['localCode'], + 'report_org_name' => $this->resource['rpOrg']['localText'], + 'crisis_flag' => (int) ($this->resource['crisisFlag'] ?: 0), + 'crisis_desc' => $this->resource['crisisDesc'] ?: '', + 'crisis_content' => $this->resource['crisisContent'] ?: '', + 'unusual_flag' => (int) ($this->resource['unusualFlag'] ?: 0), + 'deal_flag' => (int) ($this->resource['dealFlag'] ?: 0), + 'need_deal_flag' => (int) ($this->resource['needDealFlag'] ?: 0), + // pacs 图片数组一般为空 + 'pacs_images' => (array) ($this->resource['pacs'] ?? []) + ]; - $lists[] = [ - 'clinic_no' => $v['clinicNo'], - 'serial_no' => $v['sourceId'], - 'source_form' => $v['sourceFrom'], - 'dept_id' => $v['dept']['localCode'], - 'dept_name' => $v['dept']['localText'], - 'doctor_id' => $v['doctor']['localText'], - 'doctor_name' => $v['doctor']['localText'], - 'exam_type' => $v['examMethod'], - 'exam_name' => $v['examName'], - 'exam_purpose' => $v['examPurpose'], - 'diagnose' => $v['diagnose'], - 'exam_view' => $v['examView'], - 'diagnose_opinion' =>$v['diagnose_opinion'], - 'created_time' => $v['createDt'], - 'check_time' => $v['checkDt'], - 'report_time' => $v['reportDt'], - 'comment' => $v['comment'], - // 患者信息 - 'patient_name' => $v['patient']['name'], - 'patient_gender' => $v['patient']['gender'], - 'patient_birth' => $v['patient']['birthday'], - // 冗余信息 - 'org_id' => $v['org']['localCode'], - 'org_name' => $v['org']['localText'], - 'equipment_name' => $v['equipmentName'], - 'equipment_no' => $v['equipmentNameNo'], - 'report_doctor_id' => $v['rpDoctor']['localCode'], - 'report_doctor_name' => $v['rpDoctor']['localText'], - 'report_org_id' => $v['rpOrg']['localCode'], - 'report_org_name' => $v['rpOrg']['localText'], - 'crisis_flag' => $v['crisisFlag'], - 'crisis_desc' => $v['crisisDesc'], - 'crisis_content' => $v['crisisContent'], - 'unusual_flag' => $v['unusualFlag'], - 'deal_flag' => $v['dealFlag'], - 'need_deal_flag' => $v['needDealFlag'], - // pacs 图片数组一般为空 - 'pacs_images' => (array) ($v['pacs'] ?? []) - ]; - } - - return $lists; + return $info; } } diff --git a/app/Http/Resources/Report/Inspect/ListsResource.php b/app/Http/Resources/Report/Inspect/ListsResource.php index bf7250c..0e4d549 100644 --- a/app/Http/Resources/Report/Inspect/ListsResource.php +++ b/app/Http/Resources/Report/Inspect/ListsResource.php @@ -38,11 +38,11 @@ class ListsResource extends JsonResource 'exam_purpose' => $v['examPurpose'], 'diagnose' => $v['diagnose'], 'exam_view' => $v['examView'], - 'diagnose_opinion' =>$v['diagnose_opinion'], + 'diagnose_opinion' =>$v['diagnoseOpinion'], 'created_time' => $v['createDt'], 'check_time' => $v['checkDt'], 'report_time' => $v['reportDt'], - 'comment' => $v['comment'], + 'comment' => $v['comment'] ?: '', ]; } diff --git a/app/Services/HisHttp/Client.php b/app/Services/HisHttp/Client.php index 602fd7a..de9b648 100644 --- a/app/Services/HisHttp/Client.php +++ b/app/Services/HisHttp/Client.php @@ -661,7 +661,7 @@ class Client */ public function getInspectReportLists(string $patient_name, string $card_no, string $start_date, string $end_date, string $bar_code = '', string $source_id = ''): mixed { - return $this->requestHandle('POST', '0rientQueryExaReport', [ + return $this->requestHandle('POST', 'orientQueryExamReport', [ 'json' => [ 'patientName' => $patient_name, 'orgId' => '45592623X44040211A1001', // 机构ID 珠海市香洲区第二人民医院