香洲二院小程序
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

64 lines
2.8 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 [];
}
$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'] ?? [])
];
return $info;
}
}