获取家庭成员详情/列表增加计算年龄

This commit is contained in:
wucongxing8150 2024-02-29 16:17:59 +08:00
parent 190be0272c
commit 6258e4f089

View File

@ -45,10 +45,21 @@ class PatientFamilyService extends BaseService
'age',
'nation_id',
'nation_name',
'id_number',
];
$patient_familys = PatientFamilyModel::getList($params, $field);
if (empty($patient_familys)){
return success();
}
return empty($patient_familys) ? success() : success($patient_familys->toArray());
$patient_familys = $patient_familys->toArray();
foreach ($patient_familys as &$value){
// 计算年龄
$value['age'] = getIdCardAge($value['id_number']);
unset($value['id_number']);
}
return success($patient_familys);
}
/**
@ -316,13 +327,17 @@ class PatientFamilyService extends BaseService
return success();
}
return success($patient_family->toArray());
$patient_family = $patient_family->toArray();
// 计算年龄
$patient_family['age'] = getIdCardAge($patient_family['id_number']);
return success($patient_family);
}
/**
* 修改家庭成员
* @return array
* @throws GuzzleException
*/
public function editFamily(): array
{