修改新增家庭成员返回数据类型

This commit is contained in:
wucongxing 2023-04-04 14:48:16 +08:00
parent 4c23655a7c
commit bcc4d60170
3 changed files with 83 additions and 23 deletions

View File

@ -8,6 +8,8 @@ use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\DoctorInquiryTime;
use App\Model\OrderPrescriptionProduct;
use App\Model\OrderProduct;
use App\Model\OrderProductItem;
use App\Model\UserCaCert;
use App\Model\OrderInquiry;
use App\Model\OrderPrescription;
@ -40,9 +42,8 @@ class TestController extends AbstractController
// $this->test_11();
// $this->test_5();
// $this->test_1();
// $this->test_11();
$this->test_11();
// $this->test_12();
$this->test_13();
}
// 获取云证书-首次
@ -576,7 +577,7 @@ class TestController extends AbstractController
}
public function test_11(){
$order_prescription_id = "";
$order_prescription_id = "501751534291394561";
// 获取处方数据
$params = array();
@ -594,11 +595,37 @@ class TestController extends AbstractController
throw new BusinessException("处方药品数据错误");
}
// 获取问诊订单数据
$params = array();
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
$order_inquiry = OrderInquiry::getOne($params);
if (empty($order_inquiry)) {
throw new BusinessException("处方药品数据错误");
}
// 获取商品订单数据
$params = array();
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
$order_product = OrderProduct::getOne($params);
if (empty($order_product)) {
throw new BusinessException("处方药品数据错误");
}
// 获取商品订单数据
$params = array();
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
$order_product_item = OrderProductItem::getList($params);
if (empty($order_product_item)) {
throw new BusinessException("处方药品数据错误");
}
$OrderPrescriptionService = new OrderPrescriptionService();
$result = $OrderPrescriptionService->reportPrescription();
$result = $OrderPrescriptionService->reportPrescription(
$order_inquiry->toArray(),
$order_prescription->toArray(),
$order_prescription_product->toArray(),
$order_product->toArray()
);
}

View File

@ -21,6 +21,7 @@ use App\Model\UserPharmacistInfo;
use Extend\Alibaba\Oss;
use Extend\Ca\Ca;
use Hyperf\Contract\LengthAwarePaginatorInterface;
use Hyperf\Utils\WaitGroup;
use Intervention\Image\ImageManager;
use TCPDF;
@ -225,9 +226,9 @@ class OrderPrescriptionService extends BaseService
// 处理疾病数据
$icd_name = array_column($order_prescription_icd->toArray(), 'icd_name');
if (!empty($icd_name)) {
if (count($icd_name > 1)){
if (count($icd_name > 1)) {
$icd_name = implode(';', $icd_name);
}else{
} else {
$icd_name = $icd_name[0];
}
} else {
@ -560,11 +561,42 @@ class OrderPrescriptionService extends BaseService
// 上报处方平台
public function reportPrescription(array $order_inquiry, array $order_prescription, array $order_prescription_product, array $order_product)
{
$wg = new WaitGroup();
$wg->add(2);
$user = []; // 就诊患者用户数据
$patient_family = []; // 家庭成员-基本信息
$order_prescription_icd = []; // 处方关联疾病数据
$user_doctor = []; // 医生数据
$hospital_department_custom = []; // 医生科室
$user_doctor_info = []; // 医生详情数据
$user_pharmacist = []; // 药师数据
$user_pharmacist_info = []; // 药师详数据
$order_inquiry_case = []; // 病例数据
// 获取就诊患者用户数据
$params = array();
$params['user_id'] = $order_inquiry['user_id'];
$user = User::getOne($params);
if (empty($user)){
$user_id = $order_inquiry['user_id'];
co(function () use ($wg,&$user,$user_id) {
$params = array();
$params['user_id'] = $user_id;
$user = User::getOne($params);
// 计数器减一
$wg->done();
});
// 获取家庭成员-基本信息
$family_id = $order_inquiry['family_id'];
co(function () use ($wg,&$patient_family,$family_id) {
$params = array();
$params['family_id'] = $family_id;
$patient_family = PatientFamily::getOne($params);
// 计数器减一
$wg->done();
});
if (empty($user)) {
throw new BusinessException("用户数据错误");
}
@ -572,7 +604,7 @@ class OrderPrescriptionService extends BaseService
$params = array();
$params['family_id'] = $order_inquiry['family_id'];
$patient_family = PatientFamily::getOne($params);
if (empty($patient_family)){
if (empty($patient_family)) {
throw new BusinessException("用户家庭成员错误");
}
@ -587,9 +619,9 @@ class OrderPrescriptionService extends BaseService
// 处理疾病数据
$icd_name = array_column($order_prescription_icd->toArray(), 'icd_name');
if (!empty($icd_name)) {
if (count($icd_name > 1)){
if (count($icd_name) > 1) {
$icd_name = implode(';', $icd_name);
}else{
} else {
$icd_name = $icd_name[0];
}
} else {
@ -616,7 +648,7 @@ class OrderPrescriptionService extends BaseService
$params = array();
$params['doctor_id'] = $order_prescription['doctor_id'];
$user_doctor_info = UserDoctorInfo::getOne($params);
if (empty($user_doctor_info)){
if (empty($user_doctor_info)) {
throw new BusinessException("医生详情数据错误");
}
@ -624,7 +656,7 @@ class OrderPrescriptionService extends BaseService
$params = array();
$params['pharmacist_id'] = $order_prescription['pharmacist_id'];
$user_pharmacist = UserPharmacist::getOne($params);
if (empty($user_pharmacist)){
if (empty($user_pharmacist)) {
throw new BusinessException("药师数据错误");
}
@ -632,7 +664,7 @@ class OrderPrescriptionService extends BaseService
$params = array();
$params['pharmacist_id'] = $order_prescription['pharmacist_id'];
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
if (empty($user_pharmacist_info)){
if (empty($user_pharmacist_info)) {
throw new BusinessException("药师详情数据错误");
}
@ -641,7 +673,7 @@ class OrderPrescriptionService extends BaseService
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
$params['status'] = 1;
$order_inquiry_case = OrderInquiryCase::getOne($params);
if (empty($order_inquiry_case)){
if (empty($order_inquiry_case)) {
throw new BusinessException("病例数据错误");
}
@ -680,7 +712,7 @@ class OrderPrescriptionService extends BaseService
$arg['thirdLastPharmacistImg'] = addAliyunOssWebsite($user_pharmacist_info['sign_image']); // 终审药师签名 链接
$arg['ThirdLastTime'] = $order_prescription['pharmacist_verify_time']; // 终审时间
$arg['thirdSignImg'] = addAliyunOssWebsite("/basic/file/hospital_signature.png"); // 处方签章链接
$arg['referenceCharge'] = $order_product['amount_total']; // 处方费用
$arg['referenceCharge'] = $order_product['amount_total']; // 处方费用(不包含运费)
$arg['chiefComplaint'] = $order_inquiry_case['disease_desc'] ?: ""; // 主诉
$arg['historyPresent'] = $order_inquiry_case['disease_class_name'] ?: ""; // 现病史
$arg['pastHistory'] = $order_inquiry_case['family_history'] ?: ""; // 既往史
@ -689,12 +721,12 @@ class OrderPrescriptionService extends BaseService
$arg['allergicHistory'] = $order_inquiry_case['allergy_history'] ?: ""; // 过敏史
// 药品数据
foreach ($order_prescription_product as $key => $item){
foreach ($order_prescription_product as $key => $item) {
// 获取商品数据
$pamras = array();
$pamras['product_id'] = $item['product_id'];
$product = Product::getOne($pamras);
if (empty($product)){
if (empty($product)) {
throw new BusinessException("药品数据错误");
}
@ -703,7 +735,7 @@ class OrderPrescriptionService extends BaseService
$arg['drugList'][$key]['drugName'] = $product['product_name']; // 药品名称
$arg['drugList'][$key]['specifications'] = $product['product_spec']; // 药品规格
$arg['drugList'][$key]['price'] = $product['product_price']; // 药品单价
$arg['drugList'][$key]['packingCount'] = $item['amount']; // 药品数量
$arg['drugList'][$key]['packingCount'] = $item['prescription_product_num']; // 药品数量
$arg['drugList'][$key]['surplusPackingCount'] = 0; // 处方药品剩余使用数量
$arg['drugList'][$key]['packingUnit'] = $product['packaging_unit']; // 药品单位
$arg['drugList'][$key]['singleDosage'] = $product['single_unit']; // 单次用量
@ -717,10 +749,11 @@ class OrderPrescriptionService extends BaseService
$arg['orderDrugList'][$key]['drugName'] = $product['product_name']; // 药品名称
$arg['orderDrugList'][$key]['specifications'] = $product['product_spec']; // 药品规格
$arg['orderDrugList'][$key]['price'] = $product['product_price']; // 药品单价
$arg['orderDrugList'][$key]['drugCount'] = $item['amount']; // 药品数量
$arg['orderDrugList'][$key]['drugCount'] = $item['prescription_product_num']; // 药品数量
$arg['orderDrugList'][$key]['packingUnit'] = $product['packaging_unit']; // 药品单位
}
return $arg;
}
}

View File

@ -229,7 +229,7 @@ class PatientFamilyService extends BaseService
}
$result = array();
$result['family_id'] = $patient_family['family_id'];
$result['family_id'] = (string)$patient_family['family_id'];
return success($result);
}