This commit is contained in:
commit
315adad6d0
@ -171,17 +171,27 @@ class AutoFinishInquiryDelayDirectConsumer extends ConsumerMessage
|
|||||||
$this->computeDoctorAvgPesponseTime($order_inquiry['doctor_id']);
|
$this->computeDoctorAvgPesponseTime($order_inquiry['doctor_id']);
|
||||||
|
|
||||||
// 新增上报监管平台数据,只上报 多点执业的医生 20251021 测试分支
|
// 新增上报监管平台数据,只上报 多点执业的医生 20251021 测试分支
|
||||||
if ($user_doctor['multi_point_status'] == 1){//医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
// if ($user_doctor['multi_point_status'] == 1){//医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||||
$reportRegulatoryService = new ReportRegulatoryService();
|
// $reportRegulatoryService = new ReportRegulatoryService();
|
||||||
$res = $reportRegulatoryService->addReportRegulatory($order_inquiry['order_inquiry_id']);
|
// $res = $reportRegulatoryService->addReportRegulatory($order_inquiry['order_inquiry_id']);
|
||||||
if (!$res) {
|
// if (!$res) {
|
||||||
// 新增上报失败
|
// // 新增上报失败
|
||||||
Db::rollBack();
|
// Db::rollBack();
|
||||||
Log::getInstance("queue-AutoFinishInquiry")->error("新增上报监管平台数据失败");
|
// Log::getInstance("queue-AutoFinishInquiry")->error("新增上报监管平台数据失败");
|
||||||
return Result::REQUEUE;
|
// return Result::REQUEUE;
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
Log::getInstance("queue-AutoFinishInquiry")->info("非多点执业的医生不上报监管平台");
|
// Log::getInstance("queue-AutoFinishInquiry")->info("非多点执业的医生不上报监管平台");
|
||||||
|
// }
|
||||||
|
|
||||||
|
//新增抄方功能,所有要全部保存,上报的时候再判断
|
||||||
|
$reportRegulatoryService = new ReportRegulatoryService();
|
||||||
|
$res = $reportRegulatoryService->addReportRegulatory($order_inquiry['order_inquiry_id']);
|
||||||
|
if (!$res) {
|
||||||
|
// 新增上报失败
|
||||||
|
Db::rollBack();
|
||||||
|
Log::getInstance("queue-AutoFinishInquiry")->error("新增上报监管平台数据失败");
|
||||||
|
return Result::REQUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
|||||||
@ -99,7 +99,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:医生数据错误");
|
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:医生数据错误");
|
||||||
return Result::ACK;
|
return Result::ACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户数据
|
// 获取用户数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['patient_id'] = $order_prescription['patient_id'];
|
$params['patient_id'] = $order_prescription['patient_id'];
|
||||||
@ -143,6 +143,15 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
return Result::ACK;
|
return Result::ACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$message_doctor_id = $user_doctor['user_id'];
|
||||||
|
|
||||||
|
//抄方订单 消息发给问诊医生
|
||||||
|
if(!empty($order_inquiry["transfer_doctor_id"])){
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||||
|
$user_doctor_temp = UserDoctor::getOne($params);
|
||||||
|
$message_doctor_id = $user_doctor_temp['user_id'];
|
||||||
|
}
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:超出最大执行次数或检测错误");
|
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:超出最大执行次数或检测错误");
|
||||||
|
|
||||||
@ -152,7 +161,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
$this->modifyOrderPrescription($data['order_prescription_id'], 2, "请联系平台客服,请勿重开处方");
|
$this->modifyOrderPrescription($data['order_prescription_id'], 2, "请联系平台客服,请勿重开处方");
|
||||||
|
|
||||||
// 医生-开具的处方审核未通过
|
// 医生-开具的处方审核未通过
|
||||||
$MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['inquiry_no']);
|
$MessagePush = new MessagePush($message_doctor_id, $order_inquiry['inquiry_no']);
|
||||||
$MessagePush->prescriptionVerifyFail($data['order_prescription_id']);
|
$MessagePush->prescriptionVerifyFail($data['order_prescription_id']);
|
||||||
|
|
||||||
// 患者-处方审核未通过
|
// 患者-处方审核未通过
|
||||||
@ -271,7 +280,9 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
// 药师审核成功
|
// 药师审核成功
|
||||||
// 发送IM消息-处方已开具
|
// 发送IM消息-处方已开具
|
||||||
$imService = new ImService();
|
$imService = new ImService();
|
||||||
$imService->prescriptionIssued($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id'],$product_name,(string)$data['order_prescription_id'],7);
|
|
||||||
|
//如果为抄方,则发送给原医生IM
|
||||||
|
$imService->prescriptionIssued($order_inquiry,$message_doctor_id,$order_inquiry['user_id'],$product_name,(string)$data['order_prescription_id'],7);
|
||||||
|
|
||||||
// 发送站内、短信消息-患者的处方被药师审核通过
|
// 发送站内、短信消息-患者的处方被药师审核通过
|
||||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['inquiry_no']);
|
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['inquiry_no']);
|
||||||
@ -279,7 +290,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
|
|
||||||
// 站内、订阅失败发送短信-医生开具的处方审核通过
|
// 站内、订阅失败发送短信-医生开具的处方审核通过
|
||||||
// 发送目标不同,重新实例化
|
// 发送目标不同,重新实例化
|
||||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['inquiry_no']);
|
$MessagePush = new MessagePush($message_doctor_id, $order_inquiry['inquiry_no']);
|
||||||
$MessagePush->prescriptionVerifySuccess();
|
$MessagePush->prescriptionVerifySuccess();
|
||||||
|
|
||||||
// 添加处方过期队列
|
// 添加处方过期队列
|
||||||
|
|||||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
|
use App\Model\OrderInquiry;
|
||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
use App\Model\OrderProduct;
|
use App\Model\OrderProduct;
|
||||||
use App\Model\OrderSystem;
|
use App\Model\OrderSystem;
|
||||||
@ -46,32 +47,48 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->line("开始");
|
$this->line("==================开始==================");
|
||||||
|
|
||||||
// 获取可上报商品订单
|
// 获取可上报商品订单
|
||||||
$order_product_ids = $this->getExecProductOrder();
|
$order_product_ids = $this->getExecProductOrder();
|
||||||
if (empty($order_product_ids)){
|
if (empty($order_product_ids)){
|
||||||
$this->line("结束,无可上报的商品订单");
|
$this->line("==================结束,无可上报的商品订单==================");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($order_product_ids as $item){
|
foreach ($order_product_ids as $item){
|
||||||
$this->line("本次请求订单号:" . $item['order_product_id']);
|
$this->line("--本次请求订单号(order_product_id):" . $item['order_product_id']);
|
||||||
|
|
||||||
// 获取商品订单数据
|
// 获取商品订单数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_product_id'] = $item['order_product_id'];
|
$params['order_product_id'] = $item['order_product_id'];
|
||||||
$order_product = OrderProduct::getOne($params);
|
$order_product = OrderProduct::getOne($params);
|
||||||
if (empty($order_product)) {
|
if (empty($order_product)) {
|
||||||
$this->line("结束,商品订单数据错误");
|
$this->line("--结束,商品订单数据错误");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order_product['report_pre_status'] == 1){
|
if ($order_product['report_pre_status'] == 1){
|
||||||
$this->line("结束,订单已上报");
|
$this->line("--结束,订单已上报");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取问诊订单数据
|
||||||
|
// $params = array();
|
||||||
|
// $params['order_inquiry_id'] = $item['order_inquiry_id'];
|
||||||
|
// $order_inquiry = OrderInquiry::getOne($params);
|
||||||
|
// if (empty($order_inquiry)) {
|
||||||
|
// $this->line("结束,问诊订单数据错误");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//检测是否为抄方订单
|
||||||
|
// if (!empty($order_inquiry['transfer_doctor_id'])){
|
||||||
|
// $this->line("结束,该问诊订单为抄方订单");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -81,7 +98,8 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
// 检测执行次数
|
// 检测执行次数
|
||||||
$res = $this->checkHandleNumber($item['order_product_id']);
|
$res = $this->checkHandleNumber($item['order_product_id']);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:超出最大执行次数或检测错误");
|
$this->line("--错误:超出最大执行次数或检测错误");
|
||||||
|
Log::getInstance("queue-AutoPharmacistCaVerify")->error("--错误:超出最大执行次数或检测错误");
|
||||||
|
|
||||||
// 修改药品订单表上报处方平台状态
|
// 修改药品订单表上报处方平台状态
|
||||||
$this->saveOrderProductPeportPreStatus($item['order_product_id'],2,"超出最大上报次数");
|
$this->saveOrderProductPeportPreStatus($item['order_product_id'],2,"超出最大上报次数");
|
||||||
@ -112,7 +130,7 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
// 记录失败次数
|
// 记录失败次数
|
||||||
$this->line("错误:" . $e->getMessage());
|
$this->line("--错误:" . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,16 +142,16 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
// 修改药品订单表上报处方平台状态
|
// 修改药品订单表上报处方平台状态
|
||||||
$this->saveOrderProductPeportPreStatus($item['order_product_id'],1);
|
$this->saveOrderProductPeportPreStatus($item['order_product_id'],1);
|
||||||
|
|
||||||
$this->line("成功");
|
$this->line("--成功");
|
||||||
Db::commit();
|
Db::commit();
|
||||||
continue;
|
continue;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
$this->line("错误" . $e->getMessage());
|
$this->line("--错误" . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->line("全部结束");
|
$this->line("==================全部结束==================");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,6 +170,7 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
'order_product_id',
|
'order_product_id',
|
||||||
'patient_id',
|
'patient_id',
|
||||||
'order_prescription_id',
|
'order_prescription_id',
|
||||||
|
'order_inquiry_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
$order_product = OrderProduct::getList($params,$fields);
|
$order_product = OrderProduct::getList($params,$fields);
|
||||||
|
|||||||
@ -82,8 +82,15 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
|
|
||||||
// 上报网络咨询
|
// 上报网络咨询
|
||||||
try {
|
try {
|
||||||
if ($report_regulatory['report_consult_status'] != 1 && $report_regulatory['report_consult_int'] < 5){
|
|
||||||
$this->line("上报网络咨询");
|
$this->line("A、开始上报网络咨询");
|
||||||
|
//检测是否为抄方订单
|
||||||
|
$transferInquiryOrder = $this->checkTransferInquiryOrder($order_inquiry);
|
||||||
|
if(!$transferInquiryOrder){
|
||||||
|
$this->line("A-1、该问诊不上报网络咨询");
|
||||||
|
}
|
||||||
|
if ($report_regulatory['report_consult_status'] != 1 && $report_regulatory['report_consult_int'] < 5 && $transferInquiryOrder){
|
||||||
|
$this->line("A-2、上报网络咨询");
|
||||||
|
|
||||||
// 获取上报数据-网络咨询
|
// 获取上报数据-网络咨询
|
||||||
$consult_data = $this->getConsultData($order_inquiry);
|
$consult_data = $this->getConsultData($order_inquiry);
|
||||||
@ -92,39 +99,46 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
$regulatoryPlatform = new regulatoryPlatform();
|
$regulatoryPlatform = new regulatoryPlatform();
|
||||||
$result = $regulatoryPlatform->uploadConsult([$consult_data]);
|
$result = $regulatoryPlatform->uploadConsult([$consult_data]);
|
||||||
|
|
||||||
$this->line("上报网络咨询成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
$this->line("A-3、上报网络咨询成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
// 修改上报状态-网络咨询
|
// 修改上报状态-网络咨询
|
||||||
$res = $this->modifyReportConsultStatus($report_regulatory, 1);
|
$res = $this->modifyReportConsultStatus($report_regulatory, 1);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报成功,存储记录失败");
|
$this->line("A-4、上报成功,存储记录失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (\Throwable $e){
|
}catch (\Throwable $e){
|
||||||
$this->line("上报网络咨询失败" . $e->getMessage());
|
$this->line("A-5、上报网络咨询失败" . $e->getMessage());
|
||||||
|
|
||||||
// 上报失败
|
// 上报失败
|
||||||
$res = $this->modifyReportConsultStatus($report_regulatory, 2, $e->getMessage());
|
$res = $this->modifyReportConsultStatus($report_regulatory, 2, $e->getMessage());
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报网络咨询失败,存储记录失败");
|
$this->line("A-6、上报网络咨询失败,存储记录失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 上报复诊
|
// 上报复诊
|
||||||
try {
|
try {
|
||||||
if ($report_regulatory['is_further_consult'] == 1){
|
|
||||||
|
$this->line("B、开始上报复诊");
|
||||||
|
//检测是否为抄方订单
|
||||||
|
$transferInquiryOrder = $this->checkTransferInquiryOrder($order_inquiry);
|
||||||
|
if(!$transferInquiryOrder){
|
||||||
|
$this->line("B-1、该问诊不上报复诊");
|
||||||
|
}
|
||||||
|
if ($report_regulatory['is_further_consult'] == 1 && $transferInquiryOrder){
|
||||||
if ($report_regulatory['report_further_consult_status'] != 1 && $report_regulatory['report_further_consult_int'] < 5) {
|
if ($report_regulatory['report_further_consult_status'] != 1 && $report_regulatory['report_further_consult_int'] < 5) {
|
||||||
$this->line("上报复诊");
|
$this->line("B-2、上报复诊");
|
||||||
|
|
||||||
// 获取处方数据
|
// 获取处方数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
|
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
|
||||||
$order_prescription = OrderPrescription::getOne($params);
|
$order_prescription = OrderPrescription::getOne($params);
|
||||||
if (empty($order_prescription)){
|
if (empty($order_prescription)){
|
||||||
$this->line("需上报复诊,但无处方数据");
|
$this->line("B-3、需上报复诊,但无处方数据");
|
||||||
}else{
|
}else{
|
||||||
// 获取上报数据-复诊
|
// 获取上报数据-复诊
|
||||||
$further_consult_data = $this->getFurtherConsultData($order_inquiry,$order_prescription);
|
$further_consult_data = $this->getFurtherConsultData($order_inquiry,$order_prescription);
|
||||||
@ -132,32 +146,31 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
// 上报复诊
|
// 上报复诊
|
||||||
$regulatoryPlatform = new regulatoryPlatform();
|
$regulatoryPlatform = new regulatoryPlatform();
|
||||||
$result = $regulatoryPlatform->uploadFurtherConsult([$further_consult_data]);
|
$result = $regulatoryPlatform->uploadFurtherConsult([$further_consult_data]);
|
||||||
$this->line("上报复诊成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
$this->line("B-4、上报复诊成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
// 修改上报状态-复诊
|
// 修改上报状态-复诊
|
||||||
$res = $this->modifyReportFurtherConsultStatus($report_regulatory, 1);
|
$res = $this->modifyReportFurtherConsultStatus($report_regulatory, 1);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报成功,存储记录失败");
|
$this->line("B-5、上报成功,存储记录失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (\Throwable $e){
|
}catch (\Throwable $e){
|
||||||
$this->line("上报复诊失败" . $e->getMessage());
|
$this->line("B-6、上报复诊失败" . $e->getMessage());
|
||||||
|
|
||||||
// 上报失败
|
// 上报失败
|
||||||
$res = $this->modifyReportFurtherConsultStatus($report_regulatory, 2, $e->getMessage());
|
$res = $this->modifyReportFurtherConsultStatus($report_regulatory, 2, $e->getMessage());
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报复诊失败,存储记录失败");
|
$this->line("B-7、上报复诊失败,存储记录失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上报处方
|
// 上报处方
|
||||||
try {
|
try {
|
||||||
$this->line("上报处方");
|
$this->line("C、开始上报处方");
|
||||||
|
|
||||||
// 获取处方数据
|
// 获取处方数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
|
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
|
||||||
@ -165,30 +178,41 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
if (empty($order_prescription)){
|
if (empty($order_prescription)){
|
||||||
$this->line("需上报复诊,但无处方数据");
|
$this->line("需上报复诊,但无处方数据");
|
||||||
}else{
|
}else{
|
||||||
// 获取上报数据-处方
|
|
||||||
$report_prescription_data = $this->getReportPrescriptionData($order_inquiry, $order_prescription);
|
|
||||||
|
|
||||||
|
//检测是否为抄方订单
|
||||||
|
$transferInquiryOrder = $this->checkTransferInquiryOrder($order_inquiry);
|
||||||
|
if($transferInquiryOrder){
|
||||||
|
$this->line("C-1、检测处方数据");
|
||||||
|
// 获取上报数据-处方
|
||||||
|
$report_prescription_data = $this->getReportPrescriptionData($order_inquiry, $order_prescription);
|
||||||
|
}else{
|
||||||
|
$this->line("C-2、检测处方(抄方)数据");
|
||||||
|
// 获取上报数据-处方 (抄方类型)
|
||||||
|
$report_prescription_data = $this->getReportTransferPrescriptionData($order_inquiry, $order_prescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->line("C-3、上报处方");
|
||||||
// 上报处方
|
// 上报处方
|
||||||
$regulatoryPlatform = new regulatoryPlatform();
|
$regulatoryPlatform = new regulatoryPlatform();
|
||||||
$result = $regulatoryPlatform->uploadRecipe([$report_prescription_data]);
|
$result = $regulatoryPlatform->uploadRecipe([$report_prescription_data]);
|
||||||
|
|
||||||
$this->line("上报处方成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
$this->line("C-4、上报处方成功" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
// 上报成功
|
// 上报成功
|
||||||
$res = $this->modifyReportRegulatoryPrescription($report_regulatory, 1);
|
$res = $this->modifyReportRegulatoryPrescription($report_regulatory, 1);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报处方失败,存储记录失败");
|
$this->line("C-5、上报处方失败,存储记录失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (\Throwable $e){
|
}catch (\Throwable $e){
|
||||||
$this->line("上报处方失败" . $e->getMessage());
|
$this->line("C-6、上报处方失败" . $e->getMessage());
|
||||||
|
|
||||||
// 上报失败
|
// 上报失败
|
||||||
$res = $this->modifyReportRegulatoryPrescription($report_regulatory, 2, $e->getMessage());
|
$res = $this->modifyReportRegulatoryPrescription($report_regulatory, 2, $e->getMessage());
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
// 记录失败
|
// 记录失败
|
||||||
$this->line("上报复诊失败,存储记录失败");
|
$this->line("C-7、上报复诊失败,存储记录失败");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,7 +342,33 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
$this->line("信息:订单未取消的未完成订单,不执行");
|
$this->line("信息:订单未取消的未完成订单,不执行");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测抄方订单
|
||||||
|
* @param array|object $order_inquiry 问诊订单数据
|
||||||
|
* @return bool true:可执行 false:不可执行
|
||||||
|
*/
|
||||||
|
private function checkTransferInquiryOrder(array|object $order_inquiry): bool
|
||||||
|
{
|
||||||
|
//判断该问诊是否为抄方
|
||||||
|
if(!empty($order_inquiry['transfer_doctor_id'])){
|
||||||
|
$this->line("信息:该问诊为抄方类型");
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||||
|
$user_doctor_info = UserDoctor::getOne($params);
|
||||||
|
if (empty($user_doctor_info)) {
|
||||||
|
$this->line("错误:医生详情数据错误,不执行");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($user_doctor_info['multi_point_status'] != 1) {
|
||||||
|
$this->line("错误:医生为非多点执业,不执行");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,6 +536,170 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上报数据-处方 (抄方类型)
|
||||||
|
* @param array|object $order_inquiry
|
||||||
|
* @param array|object $order_prescription
|
||||||
|
* @return bool|array
|
||||||
|
*/
|
||||||
|
private function getReportTransferPrescriptionData(array|object $order_inquiry, array|object $order_prescription): bool|array
|
||||||
|
{
|
||||||
|
// 获取医生数据
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $order_prescription['doctor_id'];
|
||||||
|
$user_doctor = UserDoctor::getOne($params);
|
||||||
|
if (empty($user_doctor)) {
|
||||||
|
$this->line("错误:医生数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $order_prescription['doctor_id'];
|
||||||
|
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||||
|
if (empty($user_doctor_info)) {
|
||||||
|
$this->line("错误:医生详情数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生自定义科室数据
|
||||||
|
$params = array();
|
||||||
|
$params['department_custom_id'] = $user_doctor['department_custom_id'];
|
||||||
|
$hospital_department_custom = HospitalDepartmentCustom::getOne($params);
|
||||||
|
if (empty($hospital_department_custom)) {
|
||||||
|
$this->line("错误:医生自定义数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取问诊患者数据
|
||||||
|
$params = array();
|
||||||
|
$params['family_id'] = $order_inquiry['family_id'];
|
||||||
|
$patient_family = PatientFamily::getOne($params);
|
||||||
|
if (empty($patient_family)) {
|
||||||
|
$this->line("错误:问诊患者数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取患者问诊病例
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||||
|
$params['status'] = 1;
|
||||||
|
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||||
|
if (empty($order_inquiry_case)) {
|
||||||
|
$this->line("错误:患者问诊病例错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取药师数据
|
||||||
|
$params = array();
|
||||||
|
$params['pharmacist_id'] = $order_prescription['pharmacist_id'];
|
||||||
|
$user_pharmacist = UserPharmacist::getOne($params);
|
||||||
|
if (empty($user_pharmacist)) {
|
||||||
|
$this->line("错误:药师数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取药师详情数据
|
||||||
|
$params = array();
|
||||||
|
$params['pharmacist_id'] = $order_prescription['pharmacist_id'];
|
||||||
|
$user_pharmacist_info = UserPharmacistInfo::getOne($params);
|
||||||
|
if (empty($user_pharmacist_info)) {
|
||||||
|
$this->line("错误:药师详情数据错误");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取患者复诊疾病诊断数据
|
||||||
|
$params = array();
|
||||||
|
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||||
|
$order_prescription_icd = OrderPrescriptionIcd::getList($params);
|
||||||
|
if (empty($order_prescription_icd)) {
|
||||||
|
// 复诊,但是未找到关联疾病
|
||||||
|
$this->line("错误:无复诊疾病诊断数据");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$icd_name_data = array_column($order_prescription_icd->toArray(), 'icd_name');
|
||||||
|
if (!empty($icd_name_data)) {
|
||||||
|
if (count($icd_name_data) > 1) {
|
||||||
|
$icd_name = implode('|', $icd_name_data);
|
||||||
|
} else {
|
||||||
|
$icd_name = $icd_name_data[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取处方商品数据
|
||||||
|
$order_prescription_product = $this->getPreProductData($order_prescription['order_prescription_id']);
|
||||||
|
if (empty($order_prescription_product)){
|
||||||
|
$this->line("错误:无处方商品数据");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生ca数据
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $user_doctor['user_id'];
|
||||||
|
$params['type'] = 2;
|
||||||
|
$params['is_latest'] = 1;
|
||||||
|
$doctor_user_ca_cert = UserCaCert::getOne($params);
|
||||||
|
if (empty($doctor_user_ca_cert)){
|
||||||
|
$this->line("错误:无医生ca数据");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取药师ca数据
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $user_pharmacist['user_id'];
|
||||||
|
$params['type'] = 2;
|
||||||
|
$params['is_latest'] = 1;
|
||||||
|
$pharmacist_user_ca_cert = UserCaCert::getOne($params);
|
||||||
|
if (empty($pharmacist_user_ca_cert)){
|
||||||
|
$this->line("错误:无药师ca数据");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['thirdUniqueid'] = $order_inquiry['order_inquiry_id']; // 唯一标识
|
||||||
|
$data['orgName'] = "成都金牛欣欣相照互联网医院"; // 机构名称
|
||||||
|
$data['orgCode'] = "MA6CGUDA251010619D2112"; // 机构编码
|
||||||
|
$data['section'] = $hospital_department_custom['department_name'];//科室名称
|
||||||
|
$data['sectionCode'] = $hospital_department_custom['department_code'];//科室编码
|
||||||
|
$data['docName'] = $user_doctor['user_name'];// 医师姓名
|
||||||
|
$data['docCertificateNum'] = $user_doctor_info['qualification_cert_num']; // 医师执业资格证号
|
||||||
|
$data['pharmacistName'] = $user_pharmacist_info['card_name']; // 药师姓名
|
||||||
|
$data['pharmacistOrg'] = "成都金牛欣欣相照互联网医院"; // 药师执业机构
|
||||||
|
$data['pharmacistCertificateNum'] = $user_pharmacist_info['qualification_cert_num']; // 药师执业资格证号
|
||||||
|
$data['furtherConsultNo'] = $order_inquiry['order_inquiry_id']; // 网络复诊编号
|
||||||
|
$data['furtherConsultDiagnosis'] = $icd_name; // 复诊诊断 复诊患者在实体医院的诊断名称,如有多条,使用“|”进行分隔
|
||||||
|
$data['patientName'] = $order_inquiry['patient_name']; // 患者姓名
|
||||||
|
$data['patientSex'] = $order_inquiry['patient_sex'] == 0 ?: 1; // 患者性别
|
||||||
|
$data['patientAge'] = (int)$order_inquiry['patient_age']; // 患者年龄
|
||||||
|
$data['patientIdcardType'] = 1; // 证件类型
|
||||||
|
$data['patientIdcardNum'] = $patient_family['id_number']; // 患者证件号码
|
||||||
|
$data['feeType'] = 1; // 费别 1自费 2医保
|
||||||
|
$data['medicalHistory'] = $order_inquiry_case['disease_desc']; //患者病史描述
|
||||||
|
$data['recipeTime'] = $order_prescription['doctor_created_time']; // 处方日期
|
||||||
|
$data['recipeType'] = 2; // 处方类型 1中药 2西药 3成药(三医)
|
||||||
|
$data['reviewTime'] = $order_prescription['pharmacist_verify_time']; // 审方日期
|
||||||
|
$data['recipeUnitPrice'] = $order_prescription_product['amount_total']; // 处方单价 元
|
||||||
|
$data['drugName'] = $order_prescription_product['drug_name']; // 药品名称商品名
|
||||||
|
$data['drugCode'] = $order_prescription_product['drug_code']; // 药品编码
|
||||||
|
$data['drugCommonName'] = $order_prescription_product['drug_common_name']; // 药品通用名
|
||||||
|
$data['specification'] = $order_prescription_product['specification']; // 规格
|
||||||
|
$data['frequency'] = $order_prescription_product['frequency']; // 使用频度
|
||||||
|
$data['usage'] = $order_prescription_product['usage']; // 用法
|
||||||
|
$data['doseUnit'] = $order_prescription_product['dose_unit']; // 剂量单位
|
||||||
|
$data['doseEachTime'] = $order_prescription_product['dose_each_time']; // 每次剂量
|
||||||
|
$data['medicationDays'] = $order_prescription_product['medication_days']; // 用药天数
|
||||||
|
$data['quantity'] = $order_prescription_product['quantity']; // 数量
|
||||||
|
$data['drugPackage'] = $order_prescription_product['drug_package']; // 药品包装
|
||||||
|
$data['recipeAllPrice'] = $order_prescription_product['amount_total']; // 处方总价
|
||||||
|
$data['uploadTime'] = date("Y-m-d H:i:s",time()); // 上传时间
|
||||||
|
$data['docCaSign'] = $doctor_user_ca_cert['cert_base64']; // 医师ca签名值
|
||||||
|
$data['pharmacistCaSign'] = $pharmacist_user_ca_cert['cert_base64']; // 药师ca签名值
|
||||||
|
$data['recipeNo'] = $order_prescription['order_prescription_id']; // 医院处方编号
|
||||||
|
$data['cityId'] = "510100"; // 城市ID(参考地区字段)
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取处方商品数据
|
* 获取处方商品数据
|
||||||
* @param string $order_prescription_id
|
* @param string $order_prescription_id
|
||||||
|
|||||||
@ -111,6 +111,22 @@ class UserDoctorController extends AbstractController
|
|||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取处方列表(抄方)
|
||||||
|
* @return ResponseInterface
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function getTransferPrescriptionList(): ResponseInterface
|
||||||
|
{
|
||||||
|
$request = $this->container->get(UserDoctorRequest::class);
|
||||||
|
$request->scene('getPrescriptionList')->validateResolved();
|
||||||
|
|
||||||
|
$UserDoctorService = new UserDoctorService();
|
||||||
|
$data = $UserDoctorService->getTransferPrescriptionList();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取医生个人中心数据
|
* 获取医生个人中心数据
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
|
|||||||
@ -13,11 +13,12 @@ use Hyperf\DbConnection\Db;
|
|||||||
use Hyperf\Snowflake\Concern\Snowflake;
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $order_inquiry_id 主键id
|
* @property int $order_inquiry_id 主键id
|
||||||
* @property int $order_id 订单id
|
* @property int $order_id 订单id
|
||||||
* @property int $user_id 用户id-患者
|
* @property int $user_id 用户id-患者
|
||||||
* @property int $patient_id 患者id
|
* @property int $patient_id 患者id
|
||||||
* @property int $doctor_id 医生id(未分配时为null)
|
* @property int $doctor_id 医生id(未分配时为null)
|
||||||
|
* @property int $transfer_doctor_id 接受抄方的医生id
|
||||||
* @property int $family_id 家庭成员id(就诊用户)
|
* @property int $family_id 家庭成员id(就诊用户)
|
||||||
* @property int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
* @property int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||||
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠 8:健康包 9:随访包)
|
* @property int $inquiry_mode 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠 8:健康包 9:随访包)
|
||||||
@ -65,7 +66,7 @@ class OrderInquiry extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['order_inquiry_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
protected array $fillable = ['order_inquiry_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'transfer_doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'finish_time', 'statistics_status', 'statistics_time', 'is_withdrawal', 'withdrawal_time', 'cancel_time', 'cancel_reason', 'cancel_remarks', 'times_number', 'duration', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "order_inquiry_id";
|
protected string $primaryKey = "order_inquiry_id";
|
||||||
|
|
||||||
|
|||||||
@ -83,6 +83,14 @@ class OrderPrescription extends Model
|
|||||||
return $this->hasOne(UserDoctor::class, 'doctor_id','doctor_id');
|
return $this->hasOne(UserDoctor::class, 'doctor_id','doctor_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联问诊订单表
|
||||||
|
*/
|
||||||
|
public function OrderInquiry(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(OrderInquiry::class, 'order_inquiry_id','order_inquiry_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信息-单条
|
* 获取信息-单条
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@ -163,6 +171,49 @@ class OrderPrescription extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取处方列表-分页 (抄方)
|
||||||
|
* @param array $params 条件
|
||||||
|
* @param array $fields 字段
|
||||||
|
* @param int|null $page 页码
|
||||||
|
* @param int|null $per_page 每页个数
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getTransferWithIcdPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||||
|
{
|
||||||
|
$query = self::with([
|
||||||
|
'OrderPrescriptionIcd',
|
||||||
|
'OrderInquiry'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 如果提供了 doctor_id,则添加 OrderInquiry 表的 doctor_id 条件
|
||||||
|
if (isset($params['doctor_id'])) {
|
||||||
|
$doctorId = $params['doctor_id'];
|
||||||
|
// 从 $params 中移除 doctor_id,避免在 where($params) 中重复使用
|
||||||
|
unset($params['doctor_id']);
|
||||||
|
$query->whereHas('OrderInquiry', function ($q) use ($doctorId) {
|
||||||
|
$q->where('doctor_id', $doctorId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 应用其他条件
|
||||||
|
if (!empty($params)) {
|
||||||
|
$query->where($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$raw = $query->orderBy('created_at','desc')
|
||||||
|
->paginate($per_page, $fields, "page", $page);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||||
|
$data['total'] = $raw->total();//数据总数
|
||||||
|
$data['data'] = $raw->items();//数据
|
||||||
|
$data['per_page'] = $raw->perPage();//每页个数
|
||||||
|
$data['last_page'] = $raw->lastPage();//最后一页
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
|||||||
@ -50,6 +50,7 @@ use Hyperf\Utils\Arr;
|
|||||||
* @property int $is_enterprise_deep_cooperation 是否企业深度合作医生(0:否 1:是)
|
* @property int $is_enterprise_deep_cooperation 是否企业深度合作医生(0:否 1:是)
|
||||||
* @property int $is_sys_diagno_cooperation 是否先思达合作医生(0:否 1:是)
|
* @property int $is_sys_diagno_cooperation 是否先思达合作医生(0:否 1:是)
|
||||||
* @property int $is_welfare_cooperation 是否公益问诊合作医生(可把公益问诊设为0元)
|
* @property int $is_welfare_cooperation 是否公益问诊合作医生(可把公益问诊设为0元)
|
||||||
|
* @property int $is_transfer_prescription 是否接受抄方(0:否 1:是)
|
||||||
* @property string $qr_code 分享二维码
|
* @property string $qr_code 分享二维码
|
||||||
* @property string $be_good_at 擅长
|
* @property string $be_good_at 擅长
|
||||||
* @property string $brief_introduction 医生简介
|
* @property string $brief_introduction 医生简介
|
||||||
@ -73,7 +74,7 @@ class UserDoctor extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'introduction_status', 'introduction_time', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'is_welfare_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
|
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'introduction_status', 'introduction_time', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'is_welfare_cooperation', 'is_transfer_prescription', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "doctor_id";
|
protected string $primaryKey = "doctor_id";
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use App\Model\PharmacistAuditStatistic;
|
|||||||
use App\Model\User;
|
use App\Model\User;
|
||||||
use App\Model\UserDoctor as UserDoctorModel;
|
use App\Model\UserDoctor as UserDoctorModel;
|
||||||
use App\Model\UserPharmacist;
|
use App\Model\UserPharmacist;
|
||||||
use Hyperf\Utils\Parallel;
|
use App\Model\SystemConfig;
|
||||||
use Hyperf\Utils\WaitGroup;
|
use Hyperf\Utils\WaitGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,6 +185,24 @@ class IndexService extends BaseService
|
|||||||
// 在线问诊价格
|
// 在线问诊价格
|
||||||
$inquiry_price = "";
|
$inquiry_price = "";
|
||||||
|
|
||||||
|
//检查是否有问诊购药的配置(抄方需要)
|
||||||
|
if($doctor['idcard_status'] == 1 && $doctor['iden_auth_status'] == 1 && $doctor['is_bind_bank'] == 1){
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $doctor['doctor_id'];
|
||||||
|
$params['inquiry_type'] = 4;
|
||||||
|
|
||||||
|
$doctor_inquiry_config_gouyao = DoctorInquiryConfigModel::getOne($params);
|
||||||
|
if(empty($doctor_inquiry_config_gouyao)){
|
||||||
|
$data = array();
|
||||||
|
$data['doctor_id'] = $doctor['doctor_id'];
|
||||||
|
$data['inquiry_type'] = 4;
|
||||||
|
$data['inquiry_mode'] = 1;
|
||||||
|
$data['is_enable'] = 1;
|
||||||
|
$data['inquiry_price'] = 0;
|
||||||
|
$data['last_enable_method'] = 1;
|
||||||
|
DoctorInquiryConfigModel::addInquiryConfig($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 获取医生问诊配置
|
// 获取医生问诊配置
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $doctor['doctor_id'];
|
$params['doctor_id'] = $doctor['doctor_id'];
|
||||||
@ -229,10 +247,20 @@ class IndexService extends BaseService
|
|||||||
$info['introduction_status'] = $doctor['introduction_status'];// 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)
|
$info['introduction_status'] = $doctor['introduction_status'];// 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)
|
||||||
$info['is_welfare_cooperation'] = $doctor['is_welfare_cooperation'];// 是否公益问诊合作医生(可把公益问诊设为0元)
|
$info['is_welfare_cooperation'] = $doctor['is_welfare_cooperation'];// 是否公益问诊合作医生(可把公益问诊设为0元)
|
||||||
|
|
||||||
|
// 获取系统配置
|
||||||
|
$is_annual_review = 0;
|
||||||
|
$params = array();
|
||||||
|
$params['system_config_id'] = 1;
|
||||||
|
$system_config = SystemConfig::getOne($params);
|
||||||
|
if (!empty($system_config)){
|
||||||
|
$is_annual_review = $system_config['is_annual_review'];
|
||||||
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['banner'] = $banner ?? [];// banner
|
$data['banner'] = $banner ?? [];// banner
|
||||||
$data['info'] = $info;// 医生数据
|
$data['info'] = $info;// 医生数据
|
||||||
$data['doctor_inquiry_config'] = $doctor_inquiry_config;// 医生问诊配置
|
$data['doctor_inquiry_config'] = $doctor_inquiry_config;// 医生问诊配置
|
||||||
|
$data['is_annual_review'] = $is_annual_review;// 年审开关
|
||||||
|
|
||||||
return success($data);
|
return success($data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -543,6 +543,10 @@ class MessagePush extends BaseService
|
|||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||||
|
//表示该问诊为抄方
|
||||||
|
if(!empty($this->order_inquiry['transfer_doctor_id'])){
|
||||||
|
$params['doctor_id'] = $this->order_inquiry['transfer_doctor_id'];
|
||||||
|
}
|
||||||
$params['pharmacist_audit_status'] = 1;
|
$params['pharmacist_audit_status'] = 1;
|
||||||
$order_prescription = OrderPrescription::getOne($params);
|
$order_prescription = OrderPrescription::getOne($params);
|
||||||
if (empty($order_prescription)) {
|
if (empty($order_prescription)) {
|
||||||
@ -1345,6 +1349,10 @@ class MessagePush extends BaseService
|
|||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||||
|
//表示该问诊为抄方
|
||||||
|
if(!empty($this->order_inquiry['transfer_doctor_id'])){
|
||||||
|
$params['doctor_id'] = $this->order_inquiry['transfer_doctor_id'];
|
||||||
|
}
|
||||||
$params['pharmacist_audit_status'] = 1;
|
$params['pharmacist_audit_status'] = 1;
|
||||||
$order_prescription = OrderPrescription::getOne($params);
|
$order_prescription = OrderPrescription::getOne($params);
|
||||||
if (empty($order_prescription)) {
|
if (empty($order_prescription)) {
|
||||||
@ -1377,11 +1385,17 @@ class MessagePush extends BaseService
|
|||||||
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$target_page = "user/pages/yishi/chufangsetup/index?status=1";
|
||||||
|
//抄方订单 消息点击跳转到新页面
|
||||||
|
if(!empty($this->order_inquiry["transfer_doctor_id"])){
|
||||||
|
$target_page = "user/pages/yishi/transferchufangsetup/index?status=1";
|
||||||
|
}
|
||||||
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||||
$sub_data['params']['page'] = "user/pages/yishi/chufangsetup/index?status=1";
|
$sub_data['params']['page'] = $target_page;
|
||||||
$sub_data['params']['data'] = [
|
$sub_data['params']['data'] = [
|
||||||
"phrase1" => "审方通过",// 审核结果
|
"phrase1" => "审方通过",// 审核结果
|
||||||
"thing2" => "审核通过",// 原因
|
"thing2" => "审核通过",// 原因
|
||||||
@ -1433,11 +1447,17 @@ class MessagePush extends BaseService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$target_page = "user/pages/yishi/chufangsetup/index?status=2";
|
||||||
|
//抄方订单 消息点击跳转到新页面
|
||||||
|
if(!empty($this->order_inquiry["transfer_doctor_id"])){
|
||||||
|
$target_page = "user/pages/yishi/transferchufangsetup/index?status=2";
|
||||||
|
}
|
||||||
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||||
$sub_data['params']['page'] = "user/pages/yishi/chufangsetup/index?status=2";
|
$sub_data['params']['page'] = $target_page;
|
||||||
$sub_data['params']['data'] = [
|
$sub_data['params']['data'] = [
|
||||||
"phrase1" => "审方不通过",// 审核结果
|
"phrase1" => "审方不通过",// 审核结果
|
||||||
"thing2" => (string)$order_prescription['pharmacist_fail_reason'],// 原因
|
"thing2" => (string)$order_prescription['pharmacist_fail_reason'],// 原因
|
||||||
|
|||||||
@ -661,8 +661,41 @@ class PatientOrderService extends BaseService
|
|||||||
2
|
2
|
||||||
); // 优惠金额
|
); // 优惠金额
|
||||||
|
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
$result['transfer_order'] = false;
|
||||||
|
$result['original_doctor'] = [];
|
||||||
|
|
||||||
|
//查询是否为抄方单
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_product['order_inquiry_id'];
|
||||||
|
$OrderInquiry = OrderInquiry::getOne($params);
|
||||||
|
if (!empty($OrderInquiry)) {
|
||||||
|
//为抄方订单
|
||||||
|
if (!empty($OrderInquiry['transfer_doctor_id'])) {
|
||||||
|
// 获取问诊医生数据
|
||||||
|
$fields = [
|
||||||
|
'doctor_id',
|
||||||
|
'user_name',
|
||||||
|
'multi_point_status',
|
||||||
|
'avatar',
|
||||||
|
'doctor_title',
|
||||||
|
'department_custom_name',
|
||||||
|
'be_good_at',
|
||||||
|
'hospital_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $OrderInquiry['doctor_id'];
|
||||||
|
$OriginalDoctor = UserDoctor::getWithHospitalOne($params, $fields);
|
||||||
|
if (!empty($OriginalDoctor)) {
|
||||||
|
$OriginalDoctor['avatar'] = addAliyunOssWebsite($OriginalDoctor['avatar']);
|
||||||
|
$OriginalDoctor->doctor_title = DoctorTitleCode::getMessage($OriginalDoctor->doctor_title);
|
||||||
|
$result['original_doctor'] = $OriginalDoctor;
|
||||||
|
$result['transfer_order'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result['user_doctor'] = $user_doctor ?? [];
|
$result['user_doctor'] = $user_doctor ?? [];
|
||||||
$result['order_product'] = $order_product;
|
$result['order_product'] = $order_product;
|
||||||
$result['order_product_item'] = $order_product_item;
|
$result['order_product_item'] = $order_product_item;
|
||||||
@ -1687,7 +1720,7 @@ class PatientOrderService extends BaseService
|
|||||||
$logistics_fee = 7;
|
$logistics_fee = 7;
|
||||||
}else{
|
}else{
|
||||||
//测试环境 运费
|
//测试环境 运费
|
||||||
$logistics_fee = 1.9;
|
$logistics_fee = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实际支付金额=商品总金额-优惠卷金额+运费金额
|
// 实际支付金额=商品总金额-优惠卷金额+运费金额
|
||||||
@ -1985,26 +2018,63 @@ class PatientOrderService extends BaseService
|
|||||||
*/
|
*/
|
||||||
public function getPatientPrescriptionOrderList(): array
|
public function getPatientPrescriptionOrderList(): array
|
||||||
{
|
{
|
||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
try {
|
||||||
$page = $this->request->input('page', 1);
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
$per_page = $this->request->input('per_page', 10);
|
$page = $this->request->input('page', 1);
|
||||||
|
$per_page = $this->request->input('per_page', 10);
|
||||||
|
|
||||||
// 获取处方数据
|
// 获取处方数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['patient_id'] = $user_info['client_user_id'];
|
$params['patient_id'] = $user_info['client_user_id'];
|
||||||
$params['pharmacist_audit_status'] = 1;
|
$params['pharmacist_audit_status'] = 1;
|
||||||
$params['platform_audit_status'] = 1;
|
$params['platform_audit_status'] = 1;
|
||||||
$params['is_delete'] = 0;
|
$params['is_delete'] = 0;
|
||||||
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
||||||
if (!empty($order_prescription['data'])) {
|
|
||||||
foreach ($order_prescription['data'] as &$item) {
|
if (!empty($order_prescription['data'])) {
|
||||||
if (!empty($item['UserDoctor'])) {
|
foreach ($order_prescription['data'] as &$item) {
|
||||||
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
|
||||||
|
$item['original_doctor'] = [];
|
||||||
|
$item['transfer_order'] = false;
|
||||||
|
|
||||||
|
//处理抄方情况
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
||||||
|
$OrderInquiry = OrderInquiry::getOne($params);
|
||||||
|
if (!empty($OrderInquiry)) {
|
||||||
|
//为抄方订单
|
||||||
|
if (!empty($OrderInquiry['transfer_doctor_id'])) {
|
||||||
|
$params = array();
|
||||||
|
//若为抄方订单则显示原订单
|
||||||
|
$params['doctor_id'] = $OrderInquiry['doctor_id'];
|
||||||
|
$fields = ['doctor_id','user_name','doctor_title'];
|
||||||
|
$OriginalDoctor = UserDoctor::getOne($params, $fields);
|
||||||
|
if (!empty($OriginalDoctor)) {
|
||||||
|
$OriginalDoctor->doctor_title = DoctorTitleCode::getMessage($OriginalDoctor->doctor_title);
|
||||||
|
$item['original_doctor'] = $OriginalDoctor;
|
||||||
|
$item['transfer_order'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 UserDoctor 关联对象并修改 doctor_title
|
||||||
|
$userDoctor = $item['UserDoctor'];
|
||||||
|
if (!empty($userDoctor)) {
|
||||||
|
// 修改模型属性
|
||||||
|
$userDoctor->doctor_title = DoctorTitleCode::getMessage($userDoctor->doctor_title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return success($order_prescription);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->error("获取处方订单列表异常", [
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine(),
|
||||||
|
'trace' => $e->getTraceAsString(),
|
||||||
|
]);
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR, "获取处方订单列表失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
return success($order_prescription);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2299,7 +2369,7 @@ class PatientOrderService extends BaseService
|
|||||||
$logistics_fee = 7;
|
$logistics_fee = 7;
|
||||||
}else{
|
}else{
|
||||||
//测试环境 运费
|
//测试环境 运费
|
||||||
$logistics_fee = 1.9;
|
$logistics_fee = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实际支付金额=商品总金额-优惠卷金额+运费金额
|
// 实际支付金额=商品总金额-优惠卷金额+运费金额
|
||||||
|
|||||||
@ -523,6 +523,139 @@ class UserDoctorService extends BaseService
|
|||||||
$data['platform_audit_status'] = $order_prescription['platform_audit_status'];// 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回)
|
$data['platform_audit_status'] = $order_prescription['platform_audit_status'];// 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||||
$data['platform_fail_reason'] = $order_prescription['platform_fail_reason'];// 处方平台驳回原因
|
$data['platform_fail_reason'] = $order_prescription['platform_fail_reason'];// 处方平台驳回原因
|
||||||
|
|
||||||
|
// 获取问诊订单信息
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||||
|
$order_inquiry = OrderInquiry::getOne($params);
|
||||||
|
if (empty($order_inquiry)) {
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否为抄方订单
|
||||||
|
if($order_inquiry['doctor_id'] == $order_prescription['doctor_id']){
|
||||||
|
$data['is_transfer_order'] = 0;
|
||||||
|
}else{
|
||||||
|
$data['is_transfer_order'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取病例信息
|
||||||
|
$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
|
||||||
|
*/
|
||||||
|
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'];
|
||||||
|
$order_inquiry = OrderInquiry::getOne($params);
|
||||||
|
if (empty($order_inquiry)) {
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否为抄方订单 必为抄方订单
|
||||||
|
$data['is_transfer_order'] = 1;
|
||||||
|
|
||||||
|
// 医生id
|
||||||
|
$data['order_inquiry_doctor_id'] = $order_inquiry['doctor_id'];
|
||||||
|
|
||||||
// 获取病例信息
|
// 获取病例信息
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||||
@ -987,6 +1120,8 @@ class UserDoctorService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取患者病例表
|
// 获取患者病例表
|
||||||
$fields = [
|
$fields = [
|
||||||
'inquiry_case_id',
|
'inquiry_case_id',
|
||||||
@ -1017,6 +1152,14 @@ class UserDoctorService extends BaseService
|
|||||||
return fail();
|
return fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取问诊订单信息
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||||
|
$order_inquiry = OrderInquiry::getOne($params);
|
||||||
|
if (empty($order_inquiry)) {
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
// 订单-商品订单列表
|
// 订单-商品订单列表
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
$order_prescription_product = $OrderPrescriptionService->getproductList($order_prescription_id);
|
$order_prescription_product = $OrderPrescriptionService->getproductList($order_prescription_id);
|
||||||
@ -1033,6 +1176,7 @@ class UserDoctorService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
$result['is_transfer_order'] = ($order_inquiry['doctor_id'] == $order_prescription['doctor_id']) ? 0 : 1;//判断是否为抄方订单
|
||||||
$result['inquiry_case_product'] = $inquiry_case_product;// 用药意向
|
$result['inquiry_case_product'] = $inquiry_case_product;// 用药意向
|
||||||
$result['prescription_product'] = $order_prescription_product ?? [];// 开方药品
|
$result['prescription_product'] = $order_prescription_product ?? [];// 开方药品
|
||||||
$result['case'] = $order_inquiry_case;// 病例数据
|
$result['case'] = $order_inquiry_case;// 病例数据
|
||||||
@ -1336,9 +1480,72 @@ class UserDoctorService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_doctor['multi_point_status'] != 1) {
|
$is_transfer_prescription = false; // 是否抄方医生 false:不是抄方医生 true:抄方医生
|
||||||
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
$transfer_doctor = null; // 抄方医生
|
||||||
|
|
||||||
|
Db::beginTransaction();
|
||||||
|
try {
|
||||||
|
if ($user_doctor['multi_point_status'] != 1) {
|
||||||
|
|
||||||
|
// 获取系统配置
|
||||||
|
$params = array();
|
||||||
|
$params['system_config_id'] = 1;
|
||||||
|
$system_config = SystemConfig::getOne($params);
|
||||||
|
if (empty($system_config)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||||
|
}
|
||||||
|
|
||||||
|
//检查是否年审
|
||||||
|
$is_annual_review = $system_config['is_annual_review'];
|
||||||
|
//若处于年审,则关闭抄方功能
|
||||||
|
if($is_annual_review == 1){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请先完成多点执业认证");
|
||||||
|
}
|
||||||
|
|
||||||
|
//查找可接受抄方的医生
|
||||||
|
$params = array();
|
||||||
|
$params['is_transfer_prescription'] = 1;
|
||||||
|
$params['multi_point_status'] = 1;
|
||||||
|
$transfer_prescription_list = UserDoctor::getList($params);
|
||||||
|
// 使用 count() 判断更明确,避免 empty() 对 Collection 的判断歧义
|
||||||
|
if (count($transfer_prescription_list) > 0) {
|
||||||
|
$transfer_doctor = $transfer_prescription_list[0];//取第一个抄方医生
|
||||||
|
|
||||||
|
// 获取抄方医生问诊配置-问诊购药
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $transfer_doctor['doctor_id'];
|
||||||
|
$params['inquiry_type'] = 4;
|
||||||
|
$params['inquiry_mode'] = 1;
|
||||||
|
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||||
|
if (empty($doctor_inquiry_config)) {
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请联系客服开启问诊购药服务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($doctor_inquiry_config['is_enable'] == 0){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请联系客服开启问诊购药服务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_transfer_prescription = true;
|
||||||
|
//修改抄方医生id
|
||||||
|
$data = array();
|
||||||
|
$data['transfer_doctor_id'] = $transfer_doctor['doctor_id'];
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||||
|
$res = OrderInquiry::edit($params,$data);
|
||||||
|
if (!$res) {
|
||||||
|
Db::rollBack();
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "开具处方失败");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "医师有误,请联系客服或小助手");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollBack();
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "开具处方失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取医生问诊配置-问诊购药
|
// 获取医生问诊配置-问诊购药
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -1398,7 +1605,7 @@ class UserDoctorService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, "请填写病情主诉");
|
return fail(HttpEnumCode::HTTP_ERROR, "请填写病情主诉");
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::beginTransaction();
|
|
||||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1416,12 +1623,18 @@ class UserDoctorService extends BaseService
|
|||||||
$data = array();
|
$data = array();
|
||||||
$data['order_inquiry_id'] = $order_inquiry_id;
|
$data['order_inquiry_id'] = $order_inquiry_id;
|
||||||
$data['doctor_id'] = $user_info['client_user_id'];
|
$data['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
if ($is_transfer_prescription){
|
||||||
|
$data['doctor_id'] = $transfer_doctor['doctor_id'];
|
||||||
|
}
|
||||||
$data['patient_id'] = $order_inquiry['patient_id'];
|
$data['patient_id'] = $order_inquiry['patient_id'];
|
||||||
$data['family_id'] = $order_inquiry['family_id'];
|
$data['family_id'] = $order_inquiry['family_id'];
|
||||||
$data['prescription_status'] = 1;
|
$data['prescription_status'] = 1;
|
||||||
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
|
||||||
$data['prescription_code'] = $generator->generate(); // 处方编号
|
$data['prescription_code'] = $generator->generate(); // 处方编号
|
||||||
$data['doctor_name'] = $user_doctor['user_name']; // 医生名称
|
$data['doctor_name'] = $user_doctor['user_name']; // 医生名称
|
||||||
|
if ($is_transfer_prescription){
|
||||||
|
$data['doctor_name'] = $transfer_doctor['user_name'];
|
||||||
|
}
|
||||||
$data['patient_name'] = $order_inquiry['patient_name'];
|
$data['patient_name'] = $order_inquiry['patient_name'];
|
||||||
$data['patient_sex'] = $order_inquiry['patient_sex'];
|
$data['patient_sex'] = $order_inquiry['patient_sex'];
|
||||||
$data['patient_age'] = $order_inquiry['patient_age'];
|
$data['patient_age'] = $order_inquiry['patient_age'];
|
||||||
@ -1542,8 +1755,14 @@ class UserDoctorService extends BaseService
|
|||||||
|
|
||||||
// 开具处方
|
// 开具处方
|
||||||
$OrderPrescriptionService = new OrderPrescriptionService();
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
||||||
|
$user_id = "";
|
||||||
|
if ($is_transfer_prescription){
|
||||||
|
$user_id = $transfer_doctor['user_id'];
|
||||||
|
}else{
|
||||||
|
$user_id = $user_info['user_id'];
|
||||||
|
}
|
||||||
dump($user_info['user_id']);
|
dump($user_info['user_id']);
|
||||||
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_info['user_id']);
|
$prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_id);
|
||||||
if (empty($prescription_open_result['prescription_img_oss_path']) || empty($prescription_open_result['file_id'])){
|
if (empty($prescription_open_result['prescription_img_oss_path']) || empty($prescription_open_result['file_id'])){
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||||
|
|||||||
@ -243,6 +243,9 @@ Router::addGroup('/doctor', function () {
|
|||||||
// 获取处方列表
|
// 获取处方列表
|
||||||
Router::get('', [UserDoctorController::class, 'getPrescriptionList']);
|
Router::get('', [UserDoctorController::class, 'getPrescriptionList']);
|
||||||
|
|
||||||
|
// 获取处方列表(抄方)
|
||||||
|
Router::get('/transfer', [UserDoctorController::class, 'getTransferPrescriptionList']);
|
||||||
|
|
||||||
// 获取处方详情
|
// 获取处方详情
|
||||||
Router::get('/info', [UserDoctorController::class, 'getPrescriptionInfo']);
|
Router::get('/info', [UserDoctorController::class, 'getPrescriptionInfo']);
|
||||||
|
|
||||||
|
|||||||
@ -74,10 +74,10 @@ class Dysms
|
|||||||
public static function sendSms(string $phone_numbers,array $template_param,string $template_code,string $scene_desc = ""): void
|
public static function sendSms(string $phone_numbers,array $template_param,string $template_code,string $scene_desc = ""): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$app_env = config('app_env','dev');
|
// $app_env = config('app_env','dev');
|
||||||
if ($app_env == "dev"){
|
// if ($app_env == "dev"){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$config = config("alibaba.dysms");
|
$config = config("alibaba.dysms");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user