/** * Display a listing of the resource. * * @return Response */ public function index() { $medicine = new Medicine(); $medicines = $medicine->findMedicines(); $msg = 'Medicine results are retrieved successfully.'; return $data = $this->successMessageWithVar($msg, $medicines, 'medicines'); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Medicine::create([]); } }
public function actionUpdateAll() { $data = Yii::$app->request->post(); if (!isset($data['$id']) || !is_array($data['$id'])) { throw new BadRequestHttpException(); } $condition = $data['$id']; $attr = array_intersect_key($data, ['status' => 1]); $number = Medicine::updateAll($attr, ['id' => $condition]); return $number; }
public function medicine_details($id) { $medicine = Medicine::find($id); return View::make('medicines.medicine_details', compact('medicine')); }
function pdf_record() { $appointment = Appointment::find(Input::get('id')); $patient = $appointment->patient; // Personal Information $dob = date('j F, Y', strtotime($patient->dob)); $html = "<html><body>" . " <img src='./images/logo_new1.jpg'/>\n <center>\n <h1><u> {$patient->name} Medical Record </u></h1>\n </center>\n <table style='width: 80%; border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Personal Information)</caption>\n <tr>\n <td height='20'><label>Patient Name:</label></td>\n <td><label> {$patient->name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Patient ID:</label></td>\n <td><label> {$patient->patient_id} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Date of Birth:</label></td>\n <td><label> {$dob} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Gender:</label></td>\n <td><label> {$patient->gender} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Age:</label></td>\n <td><label> {$patient->age} Years</label></td>\n </tr>\n <tr>\n <td height='20'><label>Email:</label></td>\n <td><label> {$patient->email} </label></td>\n </tr>\n <tr>\n <td height='20'><label>City:</label></td>\n <td><label> {$patient->city} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Country:</label></td>\n <td><label> {$patient->country} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Address:</label></td>\n <td><label> {$patient->address} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Phone:</label></td>\n <td><label> {$patient->phone} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>CNIC:</label></td>\n <td><label> {$patient->cnic} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Additional Info:</label></td>\n <td><label> {$patient->note} </label></td>\n </tr>\n </table>"; // Appointment Details $doctor = $appointment->employee->name; $visit_date = date('j F, Y', strtotime($appointment->date)); if ($appointment->checkupfee) { $checkup_fee = $appointment->checkupfee->checkup_fee; } else { $checkup_fee = 0; } $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Appointment Details)</caption>\n <tr>\n <td height='20'><label>Visit Date:</label></td>\n <td><label> {$visit_date} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Visit Time:</label></td>\n <td><label> {$appointment->time} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Doctor Name:</label></td>\n <td><label> {$doctor} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Checkup Reason:</label></td>\n <td><label> {$appointment->checkup_reason} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Checkup Fee:</label></td>\n <td><label> {$checkup_fee}-/Rs </label></td>\n </tr>\n </table>"; // Prescription if ($appointment->prescription) { $medicines = []; foreach (explode(',', $appointment->prescription->medicines) as $id) { array_push($medicines, Medicine::find($id)); } $doctor = $appointment->employee->name; $code = $appointment->prescription->code; $note = $appointment->prescription->note; $proc = $appointment->prescription->procedure; $html .= "<br> <br> <br> <br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Prescription)</caption>\n <tr>\n <td height='20'><label>Patient Name:</label></td>\n <td><label> {$patient->name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Patient ID:</label></td>\n <td><label> {$patient->patient_id} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Visit Date:</label></td>\n <td><label> {$appointment->date} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Visit Time:</label></td>\n <td><label> {$appointment->time} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Doctor Name:</label></td>\n <td><label> {$doctor} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Prescription Code:</label></td>\n <td><label> {$code} </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Medicines:</label></td>\n <td><label>"; foreach ($medicines as $index => $medicine) { $html .= $index + 1 . ' - ' . $medicine->name . "<br />"; } $html .= "</label></td>\n </tr>\n <tr>\n <td height='20'><label>Note:</label></td>\n <td><label> {$note} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Diagnostic Procedure:</label></td>\n <td><label> {$proc} </label></td>\n </tr>\n </table>"; } // Vitalsigns if ($appointment->vitalsign) { $note = $appointment->vitalsign->note; $vitals = $appointment->vitalsign; $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Vital Signs)</caption>\n <tr>\n <td height='20'><label>Patient Height:</label></td>\n <td><label> {$vitals->height} - cm </label></td>\n </tr>\n <tr>\n <td height='20'><label>Patient Weight:</label></td>\n <td><label> {$vitals->weight} - kg </label></td>\n </tr>\n <tr>\n <td height='20'><label>Blood Pressure (Systolic):</label></td>\n <td><label> {$vitals->bp_systolic} - mmHg </label></td>\n </tr>\n <tr>\n <td height='20'><label>Blood Pressure (Diastolic):</label></td>\n <td><label> {$vitals->bp_diastolic} - mmHg </label></td>\n </tr>\n <tr>\n <td height='20'><label>Blood Group:</label></td>\n <td><label> {$vitals->blood_group} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Pulse Rate:</label></td>\n <td><label> {$vitals->pulse_rate} - per min </label></td>\n </tr>\n <tr>\n <td height='20'><label>Respiration Rate:</label></td>\n <td><label> {$vitals->respiration_rate} - per min </label></td>\n </tr>\n <tr>\n <td height='20'> <label>Temperature:</label></td>\n <td><label> {$vitals->temprature} - {$vitals->temprature_unit} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Note:</label></td>\n <td><label> {$vitals->note} </label></td>\n </tr>\n </table>"; } // Diagnostic Procedure if ($appointment->diagonosticprocedure) { $note = $appointment->diagonosticprocedure->procedure_note; $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Diagnostic Procedure)</caption>\n <tr>\n <td height='20'><label>Procedure Note:</label></td>\n <td><label> {$note} </label></td>\n </tr>\n </table>"; } // Lab Tests if ($appointment->labtests) { foreach ($appointment->labtests as $labtest) { $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Lab Test)</caption>\n <tr>\n <td height='20'><label>Test Name:</label></td>\n <td><label> {$labtest->test_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Test Description:</label></td>\n <td><label> {$labtest->test_description} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Test Results:</label></td>\n <td><label> {$labtest->test_results} </label></td>\n </tr>\n </table>"; } } // Family History if ($patient->familyhistories) { foreach ($patient->familyhistories as $familyhistory) { $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Family History)</caption>\n <tr>\n <td height='20'><label>Family Member Name:</label></td>\n <td><label> {$familyhistory->f_member_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Relation wtih Patient:</label></td>\n <td><label> {$familyhistory->patient_relation} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Gender:</label></td>\n <td><label> {$familyhistory->gender} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Age:</label></td>\n <td><label> {$familyhistory->age} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Disease Note:</label></td>\n <td><label> {$familyhistory->diesease_note} </label></td>\n </tr>\n </table>"; } } // Surgical History if ($patient->surgicalhistories) { foreach ($patient->surgicalhistories as $surgicalhistory) { $date = date('j F, Y', strtotime($surgicalhistory->surgery_date)); $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Surgical History)</caption>\n <tr>\n <td height='20'><label>Surgery Name:</label></td>\n <td><label> {$surgicalhistory->surgery_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Surgery Date:</label></td>\n <td><label> {$date} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Surgery Note:</label></td>\n <td><label> {$surgicalhistory->surgery_notes} </label></td>\n </tr>\n </table>"; } } // Previous Diseases if ($patient->previousdiseases) { foreach ($patient->previousdiseases as $disease) { $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Previous Disease)</caption>\n <tr>\n <td height='20'><label>Disease Name:</label></td>\n <td><label> {$disease->disease_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Disease Note:</label></td>\n <td><label> {$disease->disease_notes} </label></td>\n </tr>\n </table>"; } } // Drug Usage if ($patient->drugusages) { foreach ($patient->drugusages as $drug) { $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Drug Usage)</caption>\n <tr>\n <td height='20'><label>Drug Name:</label></td>\n <td><label> {$drug->drug_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Usage Note:</label></td>\n <td><label> {$drug->usage_note} </label></td>\n </tr>\n </table>"; } } // Allergy if ($patient->allergies) { foreach ($patient->allergies as $allergy) { $html .= "<br> <br>\n <table style='border-collapse: collapse; margin-left:auto; margin-right:auto' cellpadding='7' border='1'>\n <caption>(Allergy)</caption>\n <tr>\n <td height='20'><label>Allergy Name:</label></td>\n <td><label> {$allergy->allergy_name} </label></td>\n </tr>\n <tr>\n <td height='20'><label>Allergy Note:</label></td>\n <td><label> {$allergy->allergy_note} </label></td>\n </tr>\n </table>"; } } $html .= "</body></html>"; return PDF::load($html, 'A4', 'portrait')->show($patient->name . ' Medical Record'); }
/** * Update the specified prescription in storage. * * @param int $id * @return Response */ public function update($id) { $prescription = Prescription::findOrFail($id); $validator = Validator::make($data = Input::all(), Prescription::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['patient_id'] = $prescription->patient_id; foreach (Input::get('medicines') as $id) { if (!in_array($id, explode(',', $prescription->medicines))) { $medicine = Medicine::find($id); $medicine->quantity -= 1; $medicine->update(); } } foreach (explode(',', $prescription->medicines) as $old_id) { if (!in_array($old_id, Input::get('medicines'))) { $medicine = Medicine::find($old_id); $medicine->quantity += 1; $medicine->update(); } } $data['medicines'] = implode(",", Input::get('medicines')); $prescription->update($data); return Redirect::to('prescriptions?id=' . $prescription->patient_id); }
/** * Remove the specified medicine from storage. * * @param int $id * @return Response */ public function destroy($id) { Medicine::destroy($id); return Redirect::route('medicines.index'); }
// Prints Route::get('app_pres_print', function () { $appointments = Appointment::has('prescription')->get(); $flag = "pres_print"; return View::make('appointment_based_data.appointments', compact('appointments', 'flag')); }); Route::get('pres_print', function () { $id = Input::get('id'); $prescription = Prescription::findOrFail($id); $date = date('j F, Y', strtotime($prescription->appointment->date)); $time = date('H:i:s', strtotime($prescription->appointment->time)); $doctor_name = $prescription->appointment->employee->name; $patient = $prescription->appointment->patient; $medicines = []; foreach (explode(',', $prescription->medicines) as $id) { array_push($medicines, Medicine::find($id)); } return View::make('printables.prescription_print', compact('prescription', 'date', 'time', 'doctor_name', 'patient', 'medicines')); }); Route::get('app_test_print', function () { $appointments = Appointment::has('labtests')->get(); $flag = "test_print"; return View::make('appointment_based_data.appointments', compact('appointments', 'flag')); }); Route::get('test_print', function () { $id = Input::get('id'); $test = Labtest::findOrFail($id); $patient = $test->appointment->patient; $date = date('j F, Y', strtotime($test->appointment->date)); $time = date('H:i:s', strtotime($test->appointment->time)); $doctor_name = $test->appointment->employee->name;