修改物流
This commit is contained in:
parent
593ca490ec
commit
029c6249fd
@ -9,6 +9,7 @@ use App\Model\OrderInquiry;
|
|||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
use App\Model\OrderPrescriptionFile;
|
use App\Model\OrderPrescriptionFile;
|
||||||
use App\Model\OrderPrescriptionProduct;
|
use App\Model\OrderPrescriptionProduct;
|
||||||
|
use App\Model\ReportRegulatory;
|
||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Model\UserPatient;
|
use App\Model\UserPatient;
|
||||||
use App\Model\UserPharmacist;
|
use App\Model\UserPharmacist;
|
||||||
@ -128,7 +129,6 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log::getInstance("queue-AutoPharmacistCaVerify")->info("信息:检测执行次数");
|
Log::getInstance("queue-AutoPharmacistCaVerify")->info("信息:检测执行次数");
|
||||||
|
|
||||||
@ -177,10 +177,7 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
// 修改处方表为未通过
|
// 修改处方表为未通过
|
||||||
$this->modifyOrderPrescription($data['order_prescription_id'],2,"请联系平台客服,请勿重开处方");
|
$this->modifyOrderPrescription($data['order_prescription_id'],2,"请联系平台客服,请勿重开处方");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取处方文件数据
|
// 获取处方文件数据
|
||||||
@ -237,6 +234,14 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
// 修改处方表为通过
|
// 修改处方表为通过
|
||||||
$this->modifyOrderPrescription($data['order_prescription_id'],1);
|
$this->modifyOrderPrescription($data['order_prescription_id'],1);
|
||||||
|
|
||||||
|
// 增加上报监管平台表
|
||||||
|
$res = $this->addReportRegulatory($order_inquiry['order_inquiry_id']);
|
||||||
|
if (!$res){
|
||||||
|
Db::rollBack();
|
||||||
|
Log::getInstance("queue-AutoPharmacistCaVerify")->error("错误:增加监管平台上报表失败");
|
||||||
|
return Result::REQUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
Log::getInstance("queue-AutoPharmacistCaVerify")->info("成功");
|
Log::getInstance("queue-AutoPharmacistCaVerify")->info("成功");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -479,4 +484,29 @@ class AutoPharmacistCaVerifyDelayDirectConsumer extends ConsumerMessage
|
|||||||
|
|
||||||
OrderPrescription::edit($params,$data);
|
OrderPrescription::edit($params,$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加上报监管平台表
|
||||||
|
* @param string $order_inquiry_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function addReportRegulatory(string $order_inquiry_id): bool
|
||||||
|
{
|
||||||
|
// 检测是否已添加
|
||||||
|
$params = array();
|
||||||
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||||
|
$report_regulatory = ReportRegulatory::getOne($params);
|
||||||
|
if (!empty($report_regulatory)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['order_inquiry_id'] = $order_inquiry_id;
|
||||||
|
$report_regulatory = ReportRegulatory::addReportRegulatory($data);
|
||||||
|
if (empty($report_regulatory)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,14 +46,14 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
{
|
{
|
||||||
$this->line("开始");
|
$this->line("开始");
|
||||||
|
|
||||||
// 获取需执行总数
|
// 获取未上传监管平台订单数量
|
||||||
$order_prescription_count = $this->getOrderPrescriptionCount();
|
$report_regulatory_count = $this->getNotReportRegulatoryCount();
|
||||||
if ($order_prescription_count <= 0) {
|
if ($report_regulatory_count <= 0) {
|
||||||
$this->line("结束:无可执行订单");
|
$this->line("结束:无可执行订单");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $order_prescription_count; $i++) {
|
for ($i = 0; $i < $report_regulatory_count; $i++) {
|
||||||
// 获取待上报订单
|
// 获取待上报订单
|
||||||
$order_prescription = $this->getOrderPrescription($i);
|
$order_prescription = $this->getOrderPrescription($i);
|
||||||
if (empty($order_prescription)) {
|
if (empty($order_prescription)) {
|
||||||
@ -218,6 +218,21 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
return OrderPrescription::getStatusCount($params, $prescription_status_params);
|
return OrderPrescription::getStatusCount($params, $prescription_status_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取符合条件的订单
|
||||||
|
*/
|
||||||
|
private function getNotReportRegulatory(int $offset = 0,int $limit = 10)
|
||||||
|
{
|
||||||
|
$params = array();
|
||||||
|
$params[] = ['report_inquiry_int','<',4];
|
||||||
|
$params[] = ['report_prescription_int','<',4];
|
||||||
|
|
||||||
|
$or_params = array();
|
||||||
|
$or_params['report_inquiry_status'] = 0;
|
||||||
|
$or_params['report_prescription_status'] = 0;
|
||||||
|
return ReportRegulatory::getOrStatusLimit($params,$or_params,['*'],$offset,$limit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取符合条件的处方订单
|
* 获取符合条件的处方订单
|
||||||
* @param int $offset 起始位置
|
* @param int $offset 起始位置
|
||||||
@ -255,7 +270,7 @@ class ReportRegulatoryCommand extends HyperfCommand
|
|||||||
$redis_key = "ReportRegulatoryInquiry" . $order_prescription_id;
|
$redis_key = "ReportRegulatoryInquiry" . $order_prescription_id;
|
||||||
$redis_value = $redis->get($redis_key);
|
$redis_value = $redis->get($redis_key);
|
||||||
if (empty($redis_value)) {
|
if (empty($redis_value)) {
|
||||||
$redis->set($redis_key, 1, 60 * 60 * 24 * 5);
|
$redis->set($redis_key, 1, 60 * 60 * 24 * 6);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,6 +125,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
|||||||
// 获取对应快递公司编码
|
// 获取对应快递公司编码
|
||||||
$logistics_company_code = $this->getLogisticsCompanyCode($result['logisticsCompany']);
|
$logistics_company_code = $this->getLogisticsCompanyCode($result['logisticsCompany']);
|
||||||
if (empty($logistics_company_code)){
|
if (empty($logistics_company_code)){
|
||||||
|
Db::rollBack();
|
||||||
$this->line("处方平台已发货,快递公司编码识别失败!");
|
$this->line("处方平台已发货,快递公司编码识别失败!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
|||||||
|
|
||||||
// 检测物流编号是否已经存在并订阅
|
// 检测物流编号是否已经存在并订阅
|
||||||
if (empty($item['logistics_no']) || $item['logistics_no'] != $result['deliveryId']){
|
if (empty($item['logistics_no']) || $item['logistics_no'] != $result['deliveryId']){
|
||||||
$this->line("开始推送消息");
|
$this->line("开始订阅快递推送");
|
||||||
|
|
||||||
// 订阅快递推送
|
// 订阅快递推送
|
||||||
$Kuaidi = new Kuaidi();
|
$Kuaidi = new Kuaidi();
|
||||||
|
|||||||
@ -18,6 +18,7 @@ use App\Model\OrderPrescriptionProduct;
|
|||||||
use App\Model\OrderProduct;
|
use App\Model\OrderProduct;
|
||||||
use App\Model\OrderProductItem;
|
use App\Model\OrderProductItem;
|
||||||
use App\Model\PatientFamily;
|
use App\Model\PatientFamily;
|
||||||
|
use App\Model\ReportRegulatory;
|
||||||
use App\Model\User;
|
use App\Model\User;
|
||||||
use App\Model\UserCaCert;
|
use App\Model\UserCaCert;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
@ -333,8 +334,7 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_15(){
|
public function test_15(){
|
||||||
$data = new Data();
|
|
||||||
|
|
||||||
$data->product();
|
// dump($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ namespace App\Model;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Hyperf\Database\Model\Builder;
|
||||||
use Hyperf\Database\Model\Collection;
|
use Hyperf\Database\Model\Collection;
|
||||||
use Hyperf\Snowflake\Concern\Snowflake;
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
@ -15,10 +16,12 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property int $order_prescription_id 订单-处方表id(无需上报处方时为null)
|
* @property int $order_prescription_id 订单-处方表id(无需上报处方时为null)
|
||||||
* @property int $order_product_id 订单-商品表id(无需上报处方时为null)
|
* @property int $order_product_id 订单-商品表id(无需上报处方时为null)
|
||||||
* @property int $report_inquiry_status 问诊上报状态(0:未上报 1:已上报 2:上报失败)
|
* @property int $report_inquiry_status 问诊上报状态(0:未上报 1:已上报 2:上报失败)
|
||||||
|
* @property int $report_inquiry_int 问诊上报次数
|
||||||
* @property int $report_inquiry_type 问诊上报类型(1:网络初诊 2:网络复诊)
|
* @property int $report_inquiry_type 问诊上报类型(1:网络初诊 2:网络复诊)
|
||||||
* @property string $report_inquiry_time 问诊上报时间
|
* @property string $report_inquiry_time 问诊上报时间
|
||||||
* @property string $report_inquiry_fail_reason 问诊上报失败原因
|
* @property string $report_inquiry_fail_reason 问诊上报失败原因
|
||||||
* @property int $report_prescription_status 处方上报状态(0:未上报 1:已上报 2:上报失败)
|
* @property int $report_prescription_status 处方上报状态(0:未上报 1:已上报 2:上报失败)
|
||||||
|
* @property int $report_prescription_int 处方上报次数
|
||||||
* @property string $report_prescription_time 处方上报时间
|
* @property string $report_prescription_time 处方上报时间
|
||||||
* @property string $report_prescription_fail_reason 处方上报失败原因
|
* @property string $report_prescription_fail_reason 处方上报失败原因
|
||||||
* @property \Carbon\Carbon $created_at 创建时间
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
@ -36,7 +39,7 @@ class ReportRegulatory extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['report_regulatory_id', 'order_inquiry_id', 'order_prescription_id', 'order_product_id', 'report_inquiry_status', 'report_inquiry_type', 'report_inquiry_time', 'report_inquiry_fail_reason', 'report_prescription_status', 'report_prescription_time', 'report_prescription_fail_reason', 'created_at', 'updated_at'];
|
protected array $fillable = ['report_regulatory_id', 'order_inquiry_id', 'order_prescription_id', 'order_product_id', 'report_inquiry_status', 'report_inquiry_int', 'report_inquiry_type', 'report_inquiry_time', 'report_inquiry_fail_reason', 'report_prescription_status', 'report_prescription_int', 'report_prescription_time', 'report_prescription_fail_reason', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "report_regulatory_id";
|
protected string $primaryKey = "report_regulatory_id";
|
||||||
|
|
||||||
@ -83,4 +86,33 @@ class ReportRegulatory extends Model
|
|||||||
{
|
{
|
||||||
return self::where($params)->update($data);
|
return self::where($params)->update($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
* @param array $params
|
||||||
|
* @param array $or_params
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getOrStatusCount(array $params = [],array $or_params = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->orWhere($or_params)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param array $params
|
||||||
|
* @param array $or_params
|
||||||
|
* @param array $fields
|
||||||
|
* @param int $offset
|
||||||
|
* @param int $limit
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getOrStatusLimit(array $params = [],array $or_params = [], array $fields = ["*"],int $offset = 0,int $limit = 10): Collection|array
|
||||||
|
{
|
||||||
|
return self::where($params)
|
||||||
|
->orWhere($or_params)
|
||||||
|
->offset($offset)
|
||||||
|
->limit($limit)
|
||||||
|
->get($fields);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use App\Amqp\Producer\AssignDoctorDelayDirectProducer;
|
|||||||
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
||||||
use App\Constants\DoctorTitleCode;
|
use App\Constants\DoctorTitleCode;
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Model\BasicLogisticsCompany;
|
||||||
use App\Model\Hospital;
|
use App\Model\Hospital;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
use App\Model\OrderInquiryCase;
|
use App\Model\OrderInquiryCase;
|
||||||
@ -1211,20 +1212,27 @@ class PatientOrderService extends BaseService
|
|||||||
$params['order_product_id'] = $order_product_id;
|
$params['order_product_id'] = $order_product_id;
|
||||||
$order_product_logistics = OrderProductLogistic::getOne($params);
|
$order_product_logistics = OrderProductLogistic::getOne($params);
|
||||||
if (empty($order_product_logistics)){
|
if (empty($order_product_logistics)){
|
||||||
$logistics = array();
|
if (!empty($order_product['logistics_no']) && !empty($order_product['logistics_company_code'])){
|
||||||
$logistics['logistics_no'] = $order_product['logistics_no'] ?: "";
|
|
||||||
|
|
||||||
// 获取快递公司名称
|
// 获取快递公司名称
|
||||||
|
$params = array();
|
||||||
|
$params['company_code'] = $order_product['logistics_company_code'];
|
||||||
return success($result);
|
$params['company_type'] = 1;
|
||||||
|
$basic_logistics_company = BasicLogisticsCompany::getOne($params);
|
||||||
|
if (!empty($basic_logistics_company)){
|
||||||
|
$logistics = array();
|
||||||
|
$logistics['order_product_id'] = $order_product_id;
|
||||||
|
$logistics['company_name'] = $basic_logistics_company['company_name'];
|
||||||
|
$logistics['company_code'] = $order_product['logistics_company_code'];
|
||||||
|
$logistics['logistics_no'] = $order_product['logistics_no'];
|
||||||
|
$result['logistics'] = $logistics;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
$order_product_logistics = $order_product_logistics->toArray();
|
$order_product_logistics = $order_product_logistics->toArray();
|
||||||
|
|
||||||
$order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'],true);
|
$order_product_logistics['logistics_content'] = json_decode($order_product_logistics['logistics_content'],true);
|
||||||
$result['logistics'] = $order_product_logistics;
|
$result['logistics'] = $order_product_logistics;
|
||||||
|
}
|
||||||
return success($result);
|
return success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user