Commit 4b6cfc6d by 赵增煜

增加医师驳回

parent e9bdc8d7
......@@ -131,6 +131,9 @@ public function create(Request $request)
$prescription->user_id = $authInfo->id; // 获取当前用户ID
// 问诊人信息
$patient = PatientModel::find($patient_id);
if (! $patient) {
return $this->failed('问诊人不存在,请选择正确的问诊人');
}
$prescription->patient_id = $patient_id; // 问诊人编号
$prescription->patient_name = $patient->name; // 问诊人姓名
$prescription->patient_age = getAgeByIdCard($patient->id_card); // 问诊人年龄
......@@ -394,4 +397,30 @@ public function invalid(Request $request)
return $this->failed('处方作废失败');
}
public function reject(Request $request)
{
$authInfo = auth('api')->user();
// 获取医师信息
$doctor = DoctorModel::where('user_id', $authInfo->id)->first();
if (!$doctor) {
return $this->failed('你的账号可能在其他设备登录,请重新登录');
}
$prescription_id = $request->input('prescription_id');
$prescription = PrescriptionModel::where('id', $prescription_id)->where('doctor_id', $doctor->id)->first();
if (!$prescription) {
return $this->success('处方单不存在!');
}
$reject_reason = $request->input('reject_reason');
if (empty($reject_reason)) {
return $this->failed('请输入驳回原因');
}
$prescription->reject_status = PrescriptionModel::REJECT_STSATUS_TRUE;
$prescription->reject_reason = $reject_reason;
if ($prescription->save()) {
return $this->success('驳回成功');
}
return $this->failed('处方作废失败');
}
}
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