Пример #1
0
 public static function recordDiagnosisResults($input)
 {
     $diag = diagnosisRecord::create($input);
     $prescription = new prescription();
     $prescription->appointmentId = $input['appointmentId'];
     $prescription->save();
     $preId = $prescription->prescriptionId;
     for ($i = 0; $i < count($input['medName']); $i++) {
         $med = new medicinePrescription();
         $med->prescriptionId = $preId;
         $med->medicineName = $input['medName'][$i];
         $med->quantity = $input['medQuantity'][$i] . ' ' . $input['medUnit'][$i];
         $med->instruction = $input['medInstruction'][$i];
         $med->note = $input['medNote'][$i];
         $med->save();
     }
 }
Пример #2
0
 public static function addMedicineToPrescription($input)
 {
     $diagnosisRecordId = $input['diagnosisRecord'];
     $diagnosisRecord = diagnosisRecord::where('diagRecordId', $diagnosisRecordId)->first();
     $prescription = prescription::where('appointmentId', $diagnosisRecord->appointmentId)->first();
     $input['prescriptionId'] = $prescription->prescriptionId;
     //medicinePrescription::create($input);
     $medicine = medicinePrescription::where('prescriptionId', $prescription->prescriptionId)->join('medicine', 'medicinePrescription.medicineId', '=', 'medicine.medicineId')->get();
     return $medicine;
 }
 public function addMedicineToPrescription(Request $request)
 {
     $input = $request->all();
     $id = $request->diagnosisRecord;
     $diagnosisRecord = diagnosisRecord::where('diagRecordId', $id)->join('appointment', 'diagnosisRecord.appointmentId', '=', 'appointment.appointmentId')->join('users', 'appointment.patientId', '=', 'users.userId')->join('patient', 'users.userId', '=', 'patient.userId')->first();
     $medicine = medicinePrescription::addMedicineToPrescription($input);
     return view('doctor.diagMedicine')->with('medicine', $medicine)->with('diagnosisRecord', $diagnosisRecord);
 }