修改问诊配置
This commit is contained in:
parent
095ad1d327
commit
b3897354e8
@ -370,14 +370,22 @@ class TestController extends AbstractController
|
||||
}
|
||||
|
||||
public function test_15(){
|
||||
$oss = new Oss();
|
||||
$pic = $oss->getObjectToRAM("applet/patient/detection/pdf/SDBA23S16881.pdf");
|
||||
if (empty($pic)){
|
||||
throw new BusinessException("检测管图片错误");
|
||||
}
|
||||
$params = array();
|
||||
$params[] = ['inquiry_type','=',2];
|
||||
$params[] = ['inquiry_mode','=',1];
|
||||
$params[] = ['start_time','<',date('H',time()) . date('i',time())];
|
||||
$params[] = ['end_time','>',date('H',time()) . date('i',time())];
|
||||
|
||||
$pic = base64_encode($pic);
|
||||
Log::getInstance("请求参数")->info($pic);
|
||||
$user_doctor_params = array();
|
||||
$user_doctor_params['is_platform_deep_cooperation'] = 1;
|
||||
|
||||
$doctor_inquiry_config_params = array();
|
||||
$doctor_inquiry_config_params['inquiry_type'] = 2;
|
||||
$doctor_inquiry_config_params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config_params['is_enable'] = 1;
|
||||
|
||||
$doctor_inquiry_times = DoctorInquiryTime::getMinPlatDeepCooperationDoctor($params,$user_doctor_params,[],$doctor_inquiry_config_params);
|
||||
dump($doctor_inquiry_times);
|
||||
}
|
||||
|
||||
// 设置坐班医生
|
||||
|
||||
@ -9,6 +9,7 @@ namespace App\Model;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
/**
|
||||
* @property int $inquiry_time_id 主键id
|
||||
@ -112,10 +113,30 @@ class DoctorInquiryTime extends Model
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function add(array $data): \Hyperf\Database\Model\Model|DoctorInquiryTime
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取坐班时间包含某时间的平台深度合作医生
|
||||
* @param array $params
|
||||
* @param array $user_doctor_params
|
||||
* @param array $user_doctor_not_in_params
|
||||
* @param array $doctor_inquiry_config_params
|
||||
* @param array $fields
|
||||
* @return array|\Hyperf\Collection\Collection|Collection
|
||||
*/
|
||||
public static function getMinPlatDeepCooperationDoctor(array $params = [],array $user_doctor_params = [], array $user_doctor_not_in_params = [],array $doctor_inquiry_config_params = [], array $fields = ['*']): Collection|array|\Hyperf\Collection\Collection
|
||||
{
|
||||
$doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id");
|
||||
|
||||
$result = self::whereHas('UserDoctor' , function($query) use ($user_doctor_params,$user_doctor_not_in_params){
|
||||
$query->where($user_doctor_params)->whereNotIn('doctor_id',$user_doctor_not_in_params);
|
||||
})
|
||||
->where($params)
|
||||
->whereIn("doctor_id",$doctor_ids)
|
||||
->get($fields);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,4 +397,22 @@ class UserDoctor extends Model
|
||||
->where($params)
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生数据-医生配置
|
||||
* @param array $params
|
||||
* @param array $not_in_params
|
||||
* @param array $doctor_inquiry_config_params
|
||||
* @param array $fields
|
||||
* @return Collection|array|\Hyperf\Utils\Collection
|
||||
*/
|
||||
public static function getListWithConfig(array $params = [], array $not_in_params = [],array $doctor_inquiry_config_params = [],array $fields = ['*']): Collection|array|\Hyperf\Utils\Collection
|
||||
{
|
||||
$doctor_ids = Db::table('doctor_inquiry_config')->where($doctor_inquiry_config_params)->select("doctor_id");
|
||||
|
||||
return self::where($params)
|
||||
->whereNotIn('doctor_id',$not_in_params)
|
||||
->whereIn("doctor_id",$doctor_ids)
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,8 +589,6 @@ class PatientDoctorService extends BaseService
|
||||
"department_custom_name",
|
||||
"hospital_id",
|
||||
"is_online",
|
||||
"is_img_expert_reception",
|
||||
"is_img_welfare_reception",
|
||||
"be_good_at",
|
||||
];
|
||||
|
||||
@ -610,11 +608,10 @@ class PatientDoctorService extends BaseService
|
||||
$data['doctor_title'] = empty($recommend_doctor['doctor_title']) ? "" : DoctorTitleCode::getMessage($recommend_doctor['doctor_title']);
|
||||
$data['department_custom_name'] = $recommend_doctor['department_custom_name'];
|
||||
$data['is_online'] = $recommend_doctor['is_online'];
|
||||
$data['is_img_expert_reception'] = $recommend_doctor['is_img_expert_reception'];
|
||||
$data['is_img_welfare_reception'] = $recommend_doctor['is_img_welfare_reception'];
|
||||
$data['be_good_at'] = $recommend_doctor['be_good_at'];
|
||||
$data['hospital_name'] = $recommend_doctor['Hospital']['hospital_name'] ?? "";
|
||||
$data['hospital_level_name'] = $recommend_doctor['Hospital']['hospital_level_name'] ?? "";
|
||||
$data['multi_point_enable'] = 0; // 是否开启问诊购药
|
||||
|
||||
// 处理接诊价格
|
||||
$data['price'] = 0;
|
||||
@ -630,6 +627,10 @@ class PatientDoctorService extends BaseService
|
||||
// 公益
|
||||
$data['free_clinic_price'] = $doctor_inquiry_config['inquiry_price'];
|
||||
}
|
||||
|
||||
if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['inquiry_mode'] == 1 && $doctor_inquiry_config['is_enable'] == 1) {
|
||||
$data['multi_point_enable'] = 1; // 是否开启问诊购药
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1981,7 +1981,7 @@ class UserDoctorService extends BaseService
|
||||
|
||||
if ($is_system_time_pass){
|
||||
// 获取坐班时间包含当前时间的深度合作医生
|
||||
$doctor_ids = $this->getMinPlatDeepCooperationDoctorId($inquiry_type,time(),$not_doctor_ids);
|
||||
$doctor_ids = $this->getNowTimePlatDeepCooperationDoctorId($inquiry_type,time(),$not_doctor_ids);
|
||||
Log::getInstance()->info("获取坐班时间包含当前时间的深度合作医生:" ,$doctor_ids);
|
||||
|
||||
// 检测医生是否可被分配
|
||||
@ -2067,64 +2067,19 @@ class UserDoctorService extends BaseService
|
||||
|
||||
$user_doctor_params = array();
|
||||
$user_doctor_params['is_platform_deep_cooperation'] = 1;
|
||||
if ($inquiry_type == 2){
|
||||
// 快速问诊
|
||||
$user_doctor_params['is_img_quick_reception'] = 1;
|
||||
}elseif ($inquiry_type == 4){
|
||||
// 问诊购药
|
||||
|
||||
// 问诊购药
|
||||
if ($inquiry_type == 4){
|
||||
$user_doctor_params['multi_point_status'] = 1;
|
||||
}
|
||||
$doctor_inquiry_times = DoctorInquiryTime::getWithDoctorNotInList($params,$user_doctor_params,$not_doctor_ids);
|
||||
if (!empty($doctor_inquiry_times)){
|
||||
foreach ($doctor_inquiry_times as $item){
|
||||
// 检测是否存在日期
|
||||
if (!empty($item['inquiry_date'])){
|
||||
// 获取当前日期
|
||||
$now_day = date('Y-m-d',time());
|
||||
if ($item['inquiry_date'] == $now_day){
|
||||
$doctor_ids[] = $item['doctor_id'];
|
||||
}
|
||||
}else{
|
||||
$doctor_ids[] = $item['doctor_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($doctor_ids)){
|
||||
$doctor_ids = array_unique($doctor_ids);
|
||||
$doctor_ids = array_values($doctor_ids);
|
||||
}
|
||||
// 问诊配置
|
||||
$doctor_inquiry_config_params = array();
|
||||
$doctor_inquiry_config_params['inquiry_type'] = $inquiry_type;
|
||||
$doctor_inquiry_config_params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config_params['is_enable'] = 1;
|
||||
|
||||
return $doctor_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取坐班时间包含某时间的平台深度合作医生
|
||||
* @param string $inquiry_type
|
||||
* @param string $time 时间戳
|
||||
* @param array $not_doctor_ids 不可选择的医生id数组
|
||||
* @return array 医生id
|
||||
*/
|
||||
public function getMinPlatDeepCooperationDoctorId(string $inquiry_type,string $time,array $not_doctor_ids = []): array
|
||||
{
|
||||
$doctor_ids = [];
|
||||
|
||||
$params = array();
|
||||
$params[] = ['inquiry_type','=',$inquiry_type];
|
||||
$params[] = ['inquiry_mode','=',1];
|
||||
$params[] = ['start_time','<',date('H',$time) . date('i',$time)];
|
||||
$params[] = ['end_time','>',date('H',$time) . date('i',$time)];
|
||||
|
||||
$user_doctor_params = array();
|
||||
$user_doctor_params['is_platform_deep_cooperation'] = 1;
|
||||
if ($inquiry_type == 2){
|
||||
// 快速问诊
|
||||
$user_doctor_params['is_img_quick_reception'] = 1;
|
||||
}elseif ($inquiry_type == 4){
|
||||
// 问诊购药
|
||||
$user_doctor_params['multi_point_status'] = 1;
|
||||
}
|
||||
$doctor_inquiry_times = DoctorInquiryTime::getWithDoctorNotInList($params,$user_doctor_params,$not_doctor_ids);
|
||||
$doctor_inquiry_times = DoctorInquiryTime::getMinPlatDeepCooperationDoctor($params,$user_doctor_params,$not_doctor_ids,$doctor_inquiry_config_params);
|
||||
if (!empty($doctor_inquiry_times)){
|
||||
foreach ($doctor_inquiry_times as $item){
|
||||
// 检测是否存在日期
|
||||
@ -2215,16 +2170,20 @@ class UserDoctorService extends BaseService
|
||||
$params['iden_auth_status'] = 1;
|
||||
$params['is_bind_bank'] = 1;
|
||||
$params['is_online'] = 1;
|
||||
if ($inquiry_type == 2){
|
||||
// 快速问诊
|
||||
$params['is_img_quick_reception'] = 1;
|
||||
}elseif ($inquiry_type == 4){
|
||||
// 问诊购药
|
||||
|
||||
// 问诊购药
|
||||
if ($inquiry_type == 4){
|
||||
$params['multi_point_status'] = 1;
|
||||
}
|
||||
|
||||
$doctor_inquiry_config_params = array();
|
||||
$doctor_inquiry_config_params['inquiry_type'] = $inquiry_type;
|
||||
$doctor_inquiry_config_params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config_params['is_enable'] = 1;
|
||||
|
||||
$params['is_platform_deep_cooperation'] = 1;
|
||||
|
||||
$user_doctor = UserDoctor::getUserDoctorNotInList($params,$not_doctor_ids);
|
||||
$user_doctor = UserDoctor::getListWithConfig($params,$not_doctor_ids,$doctor_inquiry_config_params);
|
||||
return $user_doctor->toArray();
|
||||
}
|
||||
|
||||
@ -2241,16 +2200,19 @@ class UserDoctorService extends BaseService
|
||||
$params['idcard_status'] = 1;
|
||||
$params['iden_auth_status'] = 1;
|
||||
$params['is_bind_bank'] = 1;
|
||||
if ($inquiry_type == 2){
|
||||
// 快速问诊
|
||||
$params['is_img_quick_reception'] = 1;
|
||||
}elseif ($inquiry_type == 4){
|
||||
// 问诊购药
|
||||
|
||||
// 问诊购药
|
||||
if ($inquiry_type == 4){
|
||||
$params['multi_point_status'] = 1;
|
||||
}
|
||||
|
||||
$doctor_inquiry_config_params = array();
|
||||
$doctor_inquiry_config_params['inquiry_type'] = $inquiry_type;
|
||||
$doctor_inquiry_config_params['inquiry_mode'] = 1;
|
||||
$doctor_inquiry_config_params['is_enable'] = 1;
|
||||
|
||||
$params['is_platform_deep_cooperation'] = 0;
|
||||
$user_doctor = UserDoctor::getUserDoctorNotInList($params,$not_doctor_ids);
|
||||
$user_doctor = UserDoctor::getListWithConfig($params,$not_doctor_ids,$doctor_inquiry_config_params);
|
||||
return $user_doctor->toArray();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user