@@ -560,6 +560,111 @@ class UserDoctorService extends BaseService
|
||||
return success($order_prescriptions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取处方列表(抄方)
|
||||
* @return array
|
||||
*/
|
||||
public function getTransferPrescriptionList(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$pharmacist_audit_status = $this->request->input('pharmacist_audit_status');
|
||||
$page = $this->request->input('page', 1);
|
||||
$per_page = $this->request->input('per_page', 10);
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
$fields = [
|
||||
'doctor_id',
|
||||
'iden_auth_status',
|
||||
'idcard_status',
|
||||
'multi_point_status',
|
||||
];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||
}
|
||||
|
||||
if ($user_doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成身份认证");
|
||||
}
|
||||
|
||||
if ($user_doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成实名认证");
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['pharmacist_audit_status'] = $pharmacist_audit_status;
|
||||
$params['is_delete'] = 0;
|
||||
|
||||
if ($pharmacist_audit_status == 1){
|
||||
// 审核通过
|
||||
$params['platform_audit_status'] = 1;
|
||||
}
|
||||
|
||||
$order_prescriptions = OrderPrescription::getTransferWithIcdPage($params,['*'],$page,$per_page);
|
||||
if (empty($order_prescriptions)) {
|
||||
return success($order_prescriptions);
|
||||
}
|
||||
|
||||
// 处理数据
|
||||
$result = array();
|
||||
|
||||
foreach ($order_prescriptions['data'] as $order_prescription) {
|
||||
$data = array();
|
||||
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$data['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$data['patient_name'] = $order_prescription['patient_name'];
|
||||
$data['patient_sex'] = $order_prescription['patient_sex'];
|
||||
$data['patient_age'] = $order_prescription['patient_age'];
|
||||
$data['created_at'] = date('Y-m-d H:i:s',strtotime($order_prescription['created_at'])); // 开方时间
|
||||
$data['pharmacist_audit_status'] = $order_prescription['pharmacist_audit_status'];// 药师审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
$data['pharmacist_fail_reason'] = $order_prescription['pharmacist_fail_reason'];// 驳回原因
|
||||
$data['platform_audit_status'] = $order_prescription['platform_audit_status'];// 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
$data['platform_fail_reason'] = $order_prescription['platform_fail_reason'];// 处方平台驳回原因
|
||||
|
||||
// 获取病例信息
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$params['status'] = 1;
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 病情描述
|
||||
$data['disease_desc'] = $order_inquiry_case['disease_desc'];
|
||||
|
||||
// 患病时长
|
||||
if (empty($order_inquiry_case['diagnosis_date'])) {
|
||||
$data['diagnosis_date'] = "";
|
||||
} else {
|
||||
$data['diagnosis_date'] = date('Y-m-d', strtotime($order_inquiry_case['diagnosis_date']));
|
||||
}
|
||||
|
||||
// 疾病信息
|
||||
$data['order_prescription_icd'] = $order_prescription['OrderPrescriptionIcd'] ?? [];
|
||||
|
||||
// 患者id
|
||||
$data['patient_id'] = $order_inquiry_case['patient_id'];
|
||||
|
||||
// 医生id
|
||||
$data['doctor_id'] = $order_prescription['doctor_id'];
|
||||
|
||||
$result[] = $data;
|
||||
}
|
||||
|
||||
unset($order_prescriptions['data']);
|
||||
$order_prescriptions['data'] = $result;
|
||||
|
||||
return success($order_prescriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生个人中心数据
|
||||
* @return array
|
||||
|
||||
Reference in New Issue
Block a user