Commit 28dc3db6 by 赵增煜

医师分派

parent 1e01f709
......@@ -109,6 +109,9 @@ public function create(Request $request)
$inquirys = $request->input('inquirys'); // [['inquiry_id'=>1, 'answer'=>1]]
$drugs = $request->input('drugs'); // [['pharmacy_drug_id'=>2, 'num'=>1]]
$prescription_type = $request->input('prescription_type', 0);
# 医师类型
$doctor_type = $prescription_type==PrescriptionModel::PRESCRIPTION_TYPE_WM ? [DoctorModel::DOCTOR_TYPE_ALL,DoctorModel::DOCTOR_TYPE_WM]: [DoctorModel::DOCTOR_TYPE_ALL,DoctorModel::DOCTOR_TYPE_TCM];
$pharmacy = null;
$open_source = 0;
// 获取当前用户信息,如果是药店则无需传pharmacy_id参数
......@@ -241,13 +244,13 @@ public function create(Request $request)
} else {
return $this->failed('医师开方数超过限制');
}
$randomDoctor = $randomQuery->inRandomOrder()->first();
$randomDoctor = $randomQuery->whereIn('type', $doctor_type)->inRandomOrder()->first();
// $randomDoctor = DoctorModel::whereIn('id', $availableDoctors)
// ->where('status', DoctorModel::STATUS_TRUE)
// ->inRandomOrder()
// ->first();
} else {
$randomDoctor = DoctorModel::inRandomOrder()->where('status', DoctorModel::STATUS_TRUE)->first();
$randomDoctor = DoctorModel::inRandomOrder()->whereIn('type', $doctor_type)->where('status', DoctorModel::STATUS_TRUE)->first();
}
if (! $randomDoctor) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment