1. 医生新增测试医生
2. 回调分账链路的注释 3. 减少首页访问的时候数据返回量
This commit is contained in:
@@ -85,6 +85,8 @@ class DoctorController extends BaseAppController
|
||||
|
||||
$query->joinWith(['docInfo' => function ($q) use ($id, $keyword, $depart_arr, $title_arr) {
|
||||
$q->alias('i');
|
||||
// 患者端列表不展示测试医生
|
||||
$q->andWhere(['i.is_test' => 0]);
|
||||
//搜索框搜索姓名和科室
|
||||
if (!empty($keyword)) {
|
||||
$q->andWhere([
|
||||
|
||||
@@ -21,6 +21,7 @@ use common\models\oldDb\ServicePackageRepice;
|
||||
use common\models\oldDb\Store;
|
||||
use common\models\oldDb\SystemConfig;
|
||||
use common\models\oldDb\User;
|
||||
use common\models\oldDb\UserPatient;
|
||||
use common\models\oldDb\WestRepice;
|
||||
use common\modelsgii\oldDb\RefundReason;
|
||||
use common\services\ExpressService;
|
||||
@@ -151,7 +152,7 @@ class ProductOrderController extends BaseAppController
|
||||
$this->requestValidate($post, [
|
||||
['prescription_id', 'required']
|
||||
]);
|
||||
$ProductOrder = ProductOrder::find()->select('id,order_no,is_online,su_id,p_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,order_type,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,received_time,cancel_status,refund_status,status')->where([
|
||||
$ProductOrder = ProductOrder::find()->select('id,order_no,is_online,su_id,p_id,up_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,order_type,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,received_time,cancel_status,refund_status,status')->where([
|
||||
'p_id' => $post['prescription_id'],
|
||||
'user_id' => \Yii::$app->user->identity->getId(),
|
||||
// 'store_id' => $post['store_id']
|
||||
@@ -249,6 +250,7 @@ class ProductOrderController extends BaseAppController
|
||||
'chinese' => $chinese ?? null,
|
||||
'granular' => $granular ?? null,
|
||||
'store' => $prescriptionStore ? ['store' => $prescriptionStore] : null,
|
||||
'patient' => $this->getOrderPatientInfo((int) ($ProductOrder['up_id'] ?? 0), (int) ($ProductOrder['p_id'] ?? 0)),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -406,7 +408,7 @@ class ProductOrderController extends BaseAppController
|
||||
$this->requestValidate($post, [
|
||||
['order_id', 'required']
|
||||
]);
|
||||
$ProductOrder = ProductOrder::find()->select('id,store_id,is_online,order_no,delivery_method,su_id,p_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,cancel_status,refund_status,status,pay_time')->where([
|
||||
$ProductOrder = ProductOrder::find()->select('id,store_id,is_online,order_no,delivery_method,su_id,p_id,up_id,user_id,is_pay,prescription_type,address_id,address,decoct_price,items_price,process_price,treatement_price,total_pay_price,pay_method,trans_expenses,created_at,cancel_status,refund_status,status,pay_time')->where([
|
||||
'id' => $post['order_id'],
|
||||
'user_id' => \Yii::$app->user->identity->getId(),
|
||||
// 'store_id' => $post['store_id']
|
||||
@@ -457,6 +459,7 @@ class ProductOrderController extends BaseAppController
|
||||
'hospital' => $hospital,
|
||||
'ProductOrderItems' => $ProductOrderItems,
|
||||
'store' => $prescriptionStore ? ['store' => $prescriptionStore] : null,
|
||||
'patient' => $this->getOrderPatientInfo((int) ($ProductOrder['up_id'] ?? 0), (int) ($ProductOrder['p_id'] ?? 0)),
|
||||
];
|
||||
|
||||
}
|
||||
@@ -593,4 +596,52 @@ class ProductOrderController extends BaseAppController
|
||||
return $express;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品订单关联的就诊人信息
|
||||
* 优先订单 up_id,其次处方 up_id,最后从处方 content 兜底(兼容历史数据)
|
||||
*
|
||||
* @param int $upId 订单就诊人 id
|
||||
* @param int $prescriptionId 处方 id
|
||||
* @return array|null
|
||||
*/
|
||||
private function getOrderPatientInfo(int $upId, int $prescriptionId = 0): ?array
|
||||
{
|
||||
$patientUpId = $upId;
|
||||
$prescription = null;
|
||||
|
||||
if (!$patientUpId && $prescriptionId > 0) {
|
||||
$prescription = Prescription::find()->select('up_id,content')->where(['id' => $prescriptionId])->asArray()->one();
|
||||
if ($prescription && !empty($prescription['up_id'])) {
|
||||
$patientUpId = (int) $prescription['up_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($patientUpId > 0) {
|
||||
$patient = UserPatient::find()->select('id,name,mobile')->where([
|
||||
'id' => $patientUpId,
|
||||
'is_delete' => 0,
|
||||
])->asArray()->one();
|
||||
if ($patient) {
|
||||
return $patient;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$prescription && $prescriptionId > 0) {
|
||||
$prescription = Prescription::find()->select('content')->where(['id' => $prescriptionId])->asArray()->one();
|
||||
}
|
||||
|
||||
if ($prescription && !empty($prescription['content'])) {
|
||||
$content = Json::decode($prescription['content']);
|
||||
if (!empty($content['patient']['name'])) {
|
||||
return [
|
||||
'id' => (int) ($content['patient']['id'] ?? 0),
|
||||
'name' => $content['patient']['name'],
|
||||
'mobile' => $content['patient']['mobile'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user