Commit 19b4b421 by lujunyi

开方

parent 751f01ae
...@@ -146,8 +146,8 @@ protected function form() ...@@ -146,8 +146,8 @@ protected function form()
$role = Role::where('slug', 'pharmacy')->first(); $role = Role::where('slug', 'pharmacy')->first();
// 从表单模型获取手机号和其他信息 // 从表单模型获取手机号和其他信息
$mobile = $form->mobile; $mobile = $form->model()->mobile;
$name = $form->name; $name = $form->model()->name;
$pharmacyId = $form->getKey(); $pharmacyId = $form->getKey();
// 查找当前是否已有管理员 // 查找当前是否已有管理员
......
...@@ -105,6 +105,7 @@ public function create(Request $request) ...@@ -105,6 +105,7 @@ public function create(Request $request)
} else { } else {
return $this->failed('pharmacy_id不能为空'); return $this->failed('pharmacy_id不能为空');
} }
// 生成处方 // 生成处方
$prescription = new PrescriptionModel; $prescription = new PrescriptionModel;
$prescription->status = PrescriptionModel::PRESCRIPTION_STATUS_PENDING; $prescription->status = PrescriptionModel::PRESCRIPTION_STATUS_PENDING;
...@@ -175,7 +176,7 @@ public function create(Request $request) ...@@ -175,7 +176,7 @@ public function create(Request $request)
$prescription->doctor_department = $randomDoctor->department; $prescription->doctor_department = $randomDoctor->department;
$prescription->doctor_title = $randomDoctor->doctor_title; $prescription->doctor_title = $randomDoctor->doctor_title;
$prescription->doctor_license_no = $randomDoctor->license_no; $prescription->doctor_license_no = $randomDoctor->license_no;
$prescription->doctor_signed_pic = $randomDoctor->signed_pic; $prescription->doctor_signed_pic = $randomDoctor->getRawOriginal('signed_pic');
// 药店信息 // 药店信息
$prescription->pharmacy_id = $pharmacy->id; $prescription->pharmacy_id = $pharmacy->id;
$prescription->pharmacy_name = $pharmacy->name; $prescription->pharmacy_name = $pharmacy->name;
...@@ -184,14 +185,14 @@ public function create(Request $request) ...@@ -184,14 +185,14 @@ public function create(Request $request)
->where('pharmacy_id', $pharmacy_id) ->where('pharmacy_id', $pharmacy_id)
->where(function ($query) { ->where(function ($query) {
$query->where('is_default', 1) $query->where('is_default', 1)
->orWhereNull('is_default'); ->orWhere('is_default', 0);
}) })
->inRandomOrder() ->inRandomOrder()
->first(); ->first();
$prescription->pharmacist_id = $pharmacist->id; $prescription->pharmacist_id = $pharmacist->id;
$prescription->pharmacist_name = $pharmacist->name; $prescription->pharmacist_name = $pharmacist->name;
$prescription->pharmacist_license_number = $pharmacist->license_number; $prescription->pharmacist_license_number = $pharmacist->license_number;
$prescription->pharmacist_signed_pic = $pharmacist->signed_pic; $prescription->pharmacist_signed_pic = $pharmacist->getRawOriginal('signed_pic');
// 生成处方单信息 // 生成处方单信息
$prescription_at = Carbon::now()->subMinutes(12); $prescription_at = Carbon::now()->subMinutes(12);
......
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