优化日志
Some checks are pending
Build Docker / build (push) Waiting to run

This commit is contained in:
haomingming 2026-01-06 09:26:25 +08:00
parent e825269798
commit 10e46b2f8c
2 changed files with 41 additions and 28 deletions

View File

@ -47,29 +47,29 @@ class ReportPreProductOrderCommand extends HyperfCommand
*/
public function handle(): void
{
$this->line("开始");
$this->line("==================开始==================");
// 获取可上报商品订单
$order_product_ids = $this->getExecProductOrder();
if (empty($order_product_ids)){
$this->line("结束,无可上报的商品订单");
$this->line("==================结束,无可上报的商品订单==================");
return;
}
foreach ($order_product_ids as $item){
$this->line("本次请求订单号:" . $item['order_product_id']);
$this->line("--本次请求订单号order_product_id" . $item['order_product_id']);
// 获取商品订单数据
$params = array();
$params['order_product_id'] = $item['order_product_id'];
$order_product = OrderProduct::getOne($params);
if (empty($order_product)) {
$this->line("结束,商品订单数据错误");
$this->line("--结束,商品订单数据错误");
continue;
}
if ($order_product['report_pre_status'] == 1){
$this->line("结束,订单已上报");
$this->line("--结束,订单已上报");
continue;
}
@ -98,7 +98,8 @@ class ReportPreProductOrderCommand extends HyperfCommand
// 检测执行次数
$res = $this->checkHandleNumber($item['order_product_id']);
if (!$res) {
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:超出最大执行次数或检测错误");
$this->line("--错误:超出最大执行次数或检测错误");
Log::getInstance("queue-AutoPharmacistCaVerify")->error("--错误:超出最大执行次数或检测错误");
// 修改药品订单表上报处方平台状态
$this->saveOrderProductPeportPreStatus($item['order_product_id'],2,"超出最大上报次数");
@ -129,7 +130,7 @@ class ReportPreProductOrderCommand extends HyperfCommand
}catch(\Exception $e){
Db::rollBack();
// 记录失败次数
$this->line("错误:" . $e->getMessage());
$this->line("--错误:" . $e->getMessage());
continue;
}
@ -141,16 +142,16 @@ class ReportPreProductOrderCommand extends HyperfCommand
// 修改药品订单表上报处方平台状态
$this->saveOrderProductPeportPreStatus($item['order_product_id'],1);
$this->line("成功");
$this->line("--成功");
Db::commit();
continue;
} catch (\Exception $e) {
Db::rollBack();
$this->line("错误" . $e->getMessage());
$this->line("--错误" . $e->getMessage());
continue;
}
}
$this->line("全部结束");
$this->line("==================全部结束==================");
}
/**

View File

@ -82,10 +82,15 @@ class ReportRegulatoryCommand extends HyperfCommand
// 上报网络咨询
try {
$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("上报网络咨询");
$this->line("A-2、上报网络咨询");
// 获取上报数据-网络咨询
$consult_data = $this->getConsultData($order_inquiry);
@ -94,41 +99,46 @@ class ReportRegulatoryCommand extends HyperfCommand
$regulatoryPlatform = new regulatoryPlatform();
$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);
if (!$res) {
// 记录失败
$this->line("上报成功,存储记录失败");
$this->line("A-4、上报成功,存储记录失败");
}
}
}catch (\Throwable $e){
$this->line("上报网络咨询失败" . $e->getMessage());
$this->line("A-5、上报网络咨询失败" . $e->getMessage());
// 上报失败
$res = $this->modifyReportConsultStatus($report_regulatory, 2, $e->getMessage());
if (!$res) {
// 记录失败
$this->line("上报网络咨询失败,存储记录失败");
$this->line("A-6、上报网络咨询失败,存储记录失败");
}
}
// 上报复诊
try {
$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) {
$this->line("上报复诊");
$this->line("B-2、上报复诊");
// 获取处方数据
$params = array();
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)){
$this->line("需上报复诊,但无处方数据");
$this->line("B-3、需上报复诊,但无处方数据");
}else{
// 获取上报数据-复诊
$further_consult_data = $this->getFurtherConsultData($order_inquiry,$order_prescription);
@ -136,32 +146,31 @@ class ReportRegulatoryCommand extends HyperfCommand
// 上报复诊
$regulatoryPlatform = new regulatoryPlatform();
$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);
if (!$res) {
// 记录失败
$this->line("上报成功,存储记录失败");
$this->line("B-5、上报成功,存储记录失败");
}
}
}
}
}catch (\Throwable $e){
$this->line("上报复诊失败" . $e->getMessage());
$this->line("B-6、上报复诊失败" . $e->getMessage());
// 上报失败
$res = $this->modifyReportFurtherConsultStatus($report_regulatory, 2, $e->getMessage());
if (!$res) {
// 记录失败
$this->line("上报复诊失败,存储记录失败");
$this->line("B-7、上报复诊失败,存储记录失败");
}
}
// 上报处方
try {
$this->line("上报处方");
$this->line("C、开始上报处方");
// 获取处方数据
$params = array();
$params['order_prescription_id'] = $report_regulatory['order_prescription_id'];
@ -173,34 +182,37 @@ class ReportRegulatoryCommand extends HyperfCommand
//检测是否为抄方订单
$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();
$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);
if (!$res) {
// 记录失败
$this->line("上报处方失败,存储记录失败");
$this->line("C-5、上报处方失败,存储记录失败");
}
}
}catch (\Throwable $e){
$this->line("上报处方失败" . $e->getMessage());
$this->line("C-6、上报处方失败" . $e->getMessage());
// 上报失败
$res = $this->modifyReportRegulatoryPrescription($report_regulatory, 2, $e->getMessage());
if (!$res) {
// 记录失败
$this->line("上报复诊失败,存储记录失败");
$this->line("C-7、上报复诊失败,存储记录失败");
return ;
}
}
@ -342,7 +354,7 @@ class ReportRegulatoryCommand extends HyperfCommand
{
//判断该问诊是否为抄方
if(!empty($order_inquiry['transfer_doctor_id'])){
$this->line("信息:该问诊为抄方类型,不执行");
$this->line("信息:该问诊为抄方类型");
return false;
}else{
$params = array();