1. 挂号的时候校验挂号类型、绑定诊所
This commit is contained in:
@@ -120,19 +120,20 @@ class RegisterForm extends BaseModel
|
||||
$t = \Yii::$app->db->beginTransaction();
|
||||
try {
|
||||
// 确定实际使用的门店ID(履约诊所)
|
||||
// 在线场景优先使用前端传入的 store_id(如委托诊所);药店复诊再按配置覆盖为委托诊所
|
||||
// 在线场景:有委托诊所配置时服务端强制写成委托诊所;发起方写入 origin_store_id
|
||||
$actualStoreId = (int) ($this->store_id ?: \Yii::$app->store);
|
||||
if ($this->register_type == 3) {
|
||||
if (in_array((int) $this->register_type, [2, 3], true)) {
|
||||
$currentStore = Store::findOne(\Yii::$app->store);
|
||||
if ($this->register_type == 2) {
|
||||
// 诊所在线复诊:发起方诊所校验(会话门店须为诊所)
|
||||
if ($currentStore && $currentStore->type != 0) {
|
||||
throw new Exception('诊所在线复诊只能在诊所进行');
|
||||
}
|
||||
}
|
||||
// type=2/3:配置了委托诊所则履约店强制为委托诊所(不单靠前端传参)
|
||||
if ($currentStore && !empty($currentStore->delegate_store_id)) {
|
||||
$actualStoreId = (int) $currentStore->delegate_store_id;
|
||||
}
|
||||
} elseif ($this->register_type == 2) {
|
||||
// 诊所在线复诊:发起方诊所校验(会话门店须为诊所)
|
||||
$currentStore = Store::findOne(\Yii::$app->store);
|
||||
if ($currentStore && $currentStore->type != 0) {
|
||||
throw new Exception('诊所在线复诊只能在诊所进行');
|
||||
}
|
||||
}
|
||||
|
||||
$originStoreId = (int) ($this->origin_store_id ?: \Yii::$app->store);
|
||||
|
||||
Reference in New Issue
Block a user