新增订单完成 回写患者病情记录
This commit is contained in:
parent
90eac1a58f
commit
08af3ff63e
@ -12,6 +12,7 @@ use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
use App\Model\PatientPathography;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserPatient;
|
||||
use App\Services\ImService;
|
||||
@ -121,6 +122,9 @@ class AutoFinishInquiryDelayDirectConsumer extends ConsumerMessage
|
||||
// 处理回写患者病例-回写失败不做处理
|
||||
$this->handleOrderInquiryCase($order_inquiry);
|
||||
|
||||
// 处理回写患者病情记录-回写失败不做处理
|
||||
$this->handlePatientPathography($order_inquiry['order_inquiry_id']);
|
||||
|
||||
// 处理医生服务患者数量
|
||||
$this->handleDoctorServedPatientsNum($order_inquiry['doctor_id']);
|
||||
|
||||
@ -522,4 +526,77 @@ class AutoFinishInquiryDelayDirectConsumer extends ConsumerMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理回写患者病情记录
|
||||
* 回写失败不做处理
|
||||
* @param array|object $order_inquiry
|
||||
* @return bool
|
||||
*/
|
||||
protected function handlePatientPathography(array|object $order_inquiry): bool
|
||||
{
|
||||
if ($order_inquiry['inquiry_type'] != 1 && $order_inquiry['inquiry_type'] != 2 && $order_inquiry['inquiry_type'] != 3 && $order_inquiry['inquiry_type'] != 4){
|
||||
// 非问诊订单,不进行处理
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取患者家庭成员病情记录
|
||||
$params = array();
|
||||
$params['user_id'] = $order_inquiry['user_id'];
|
||||
$params['patient_id'] = $order_inquiry['patient_id'];
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$patient_pathography = PatientPathography::getOne($params);
|
||||
if (!empty($patient_pathography)){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取订单-问诊病例表
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry["order_inquiry_id"];
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)){
|
||||
Log::getInstance("queue-AutoFinishInquiry")->error("错误:缺少问诊病例表");
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
foreach ($order_inquiry_case as $key => $value) {
|
||||
// 主键跳过
|
||||
if ($key == "inquiry_case_id"){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key == "created_at"){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key == "updated_at"){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($value == null){
|
||||
continue;
|
||||
}
|
||||
|
||||
$data[$key] = $value;
|
||||
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (!empty($order_prescription)){
|
||||
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
}
|
||||
|
||||
// 新增病情记录
|
||||
$patient_pathography = PatientPathography::addPatientPathography($data);
|
||||
if (empty($patient_pathography)){
|
||||
Log::getInstance("queue-AutoFinishInquiry")->error("错误:回写病情记录失败");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user