香洲二院小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
mini_xzey/app/Http/Resources/Report/Inspect/DetailsResource.php

72 lines
2.7 KiB

<?php
namespace App\Http\Resources\Report\Inspect;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class DetailsResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request = null): array
{
if (empty($this->resource)) {
return [];
}
$lists = [];
foreach ($this->resource['response']['body'] as $k => $v) {
// 过滤掉诊断为接口调用正常的第一条数据
if ($v['diagnose'] === '医院接口调用正常') {
continue;
}
$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;
}
}