/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postStore(Request $request)
 {
     $record = new Record();
     $id = $request->input("patientID");
     $record->pt_id = $id;
     $record->diagnosis = $request->input("diagnosis");
     $record->treatment = $request->input("treatment");
     $presName = "";
     $presQty = "";
     $val = $request->input("xy");
     for ($count = 1; $count < $val + 1; $count++) {
         $presName .= $request->input("drug_" . $count);
         $presQty .= $request->input("drug_" . $count . "_qtt");
         $presName .= "#";
         $presQty .= "#";
     }
     $record->pres_med = $presName;
     $record->dispenseQuantity = $presQty;
     $record->save();
     $state = Queue::find($id);
     //retrieve whole row
     if (!is_null($state)) {
         $state->status = 'Payment';
         $state->save();
     }
     $todispense = new Dispensary();
     $todispense->case_ref = $record->id;
     $todispense->dispensed_drug_code = "{$presName}";
     $todispense->dispensed_quantity = "{$presQty}";
     $todispense->save();
     //other fields in this table is to be filled by nurse using DispensaryController
     return redirect()->action('DocController@index');
 }
Example #2
0
 public function stream(Record $record, Request $request)
 {
     if ($request->has('ts')) {
         $records = $record->where('date', '>=', $request->input('ts'))->orderBy('date', 'desc')->get();
     } else {
         $records = $record->take(15)->orderBy('date', 'desc')->get();
     }
     return response()->json($records);
 }
Example #3
0
 public function create(Request $req)
 {
     $record = new Record();
     $record->location_id = $req->get("location_id");
     $staff = Staff::where("staff_nr", "=", $req->get("staff_id"))->first();
     if ($staff == null) {
         return "oh fuk";
     }
     $record->staff_id = $staff->id;
     $record->particularities = $req->get("particularities");
     $record->save();
 }
 public function discharge(DischargeRequest $request, $id)
 {
     $visit = Visit::findOrFail($id)->toArray();
     $record = new Record($visit);
     Visit::findOrFail($id)->delete();
     $record->visit_date = $visit['created_at'];
     $record->discharge_date = \Carbon\Carbon::now();
     $record->findings = $request->findings;
     $record->save();
     flash()->overlay('patient discharged', 'notice');
     return redirect('visit');
 }
Example #5
0
 /**
  * 进行记录的保存
  */
 public static function AddRecord($create_verify, $void_verify, $user_id, $pic_original, $pic_background, $pic_button, $point_x, $point_y, $cookie_str)
 {
     $model = new Record();
     $model->create_verify = $create_verify;
     $model->void_verify = $void_verify;
     $model->user_id = $user_id;
     $model->pic_original = $pic_original;
     $model->pic_background = $pic_background;
     $model->pic_button = $pic_button;
     $model->point_x = $point_x;
     $model->point_y = $point_y;
     $model->cookie_str = $cookie_str;
     $model->save();
     return $model->id;
 }
 public static function storeHighRiskMeds($request, $record_id)
 {
     $high_risk_meds = HighRiskMeds::whereRecordId($record_id)->first();
     if (count($high_risk_meds) == 0) {
         $high_risk_meds = new HighRiskMeds();
         $high_risk_meds->record_id = $record_id;
         $high_risk_meds->user_id = Auth::user()->id;
         $high_risk_meds->q1 = $request->get('q1');
         $high_risk_meds->q1_a = $request->get('q1_a');
         $high_risk_meds->q2 = $request->get('q2');
         $high_risk_meds->q3 = $request->get('q3');
         $high_risk_meds->q4 = $request->get('q4');
         $high_risk_meds->q4_a = $request->get('q4_a');
         $high_risk_meds->q5 = $request->get('q5');
         if ($high_risk_meds->save()) {
             // Touch parent model
             $record = Record::find($record_id);
             $record->touch();
             return redirect()->back()->with('message', 'Answer sheet was successfully saved.')->with('msg_type', 'positive');
         } else {
             return redirect()->back()->with('message', 'Answer sheet was not saved. Please review the answers')->with('msg_type', 'negative');
         }
     } else {
         $high_risk_meds->update(['q1' => $request->get('q1'), 'q1_a' => $request->get('q1_a'), 'q2' => $request->get('q2'), 'q3' => $request->get('q3'), 'q4' => $request->get('q4'), 'q4_a' => $request->get('q4_a'), 'q5' => $request->get('q5')]);
         // Touch parent model
         $record = Record::find($record_id);
         $record->touch();
         return redirect()->back()->with('message', 'Answer sheet was successfully updated.')->with('msg_type', 'positive');
     }
 }
 public static function storeColonCancerScreening($request, $record_id)
 {
     $colon_cancer_screening = ColonCancerScreening::whereRecordId($record_id)->first();
     if (count($colon_cancer_screening) == 0) {
         $colon_cancer_screening = new ColonCancerScreening();
         $colon_cancer_screening->record_id = $record_id;
         $colon_cancer_screening->user_id = Auth::user()->id;
         $colon_cancer_screening->q1 = $request->get('q1');
         $colon_cancer_screening->q1_a = $request->get('q1_a');
         $colon_cancer_screening->q2 = $request->get('q2');
         $colon_cancer_screening->q2_a = $request->get('q2_a');
         $colon_cancer_screening->q3 = $request->get('q3');
         $colon_cancer_screening->q3_a = $request->get('q3_a');
         $colon_cancer_screening->q4 = $request->get('q4');
         $colon_cancer_screening->q4_a = $request->get('q4_a');
         $colon_cancer_screening->q5 = $request->get('q5');
         $colon_cancer_screening->q6 = $request->get('q6');
         $colon_cancer_screening->q7 = $request->get('q7');
         $colon_cancer_screening->q8 = $request->get('q8');
         if ($colon_cancer_screening->save()) {
             // Touch parent model
             $record = Record::find($record_id);
             $record->touch();
             return redirect()->back()->with('message', 'Answer sheet was successfully saved.')->with('msg_type', 'positive');
         } else {
             return redirect()->back()->with('message', 'Answer sheet was not saved. Please review the answers')->with('msg_type', 'negative');
         }
     } else {
         $colon_cancer_screening->update(['q1' => $request->get('q1'), 'q1_a' => $request->get('q1_a'), 'q2' => $request->get('q2'), 'q2_a' => $request->get('q2_a'), 'q3' => $request->get('q3'), 'q3_a' => $request->get('q3_a'), 'q4' => $request->get('q4'), 'q4_a' => $request->get('q4_a'), 'q5' => $request->get('q5'), 'q6' => $request->get('q6'), 'q7' => $request->get('q7'), 'q8' => $request->get('q8')]);
         // Touch parent model
         $record = Record::find($record_id);
         $record->touch();
         return redirect()->back()->with('message', 'Answer sheet was successfully updated.')->with('msg_type', 'positive');
     }
 }
 public static function storeBloodPressure($request, $record_id)
 {
     $blood_pressure = BloodPressure::whereRecordId($record_id)->first();
     if (count($blood_pressure) == 0) {
         $blood_pressure = new BloodPressure();
         $blood_pressure->record_id = $record_id;
         $blood_pressure->user_id = Auth::user()->id;
         $blood_pressure->q1 = $request->get('q1');
         $blood_pressure->q1_a = $request->get('q1_a');
         $blood_pressure->q2 = $request->get('q2');
         $blood_pressure->q3 = $request->get('q3');
         $blood_pressure->q3_a = $request->get('q3_a');
         $blood_pressure->q4 = $request->get('q4');
         $blood_pressure->q4_a = $request->get('q4_a');
         $blood_pressure->q5 = $request->get('q5');
         $blood_pressure->q5_a = $request->get('q5_a');
         $blood_pressure->q6 = $request->get('q6');
         $blood_pressure->q7 = $request->get('q7');
         $blood_pressure->q7_a = $request->get('q7_a');
         if ($blood_pressure->save()) {
             // Touch parent model
             $record = Record::find($record_id);
             $record->touch();
             return redirect()->back()->with('message', 'Answer sheet was successfully saved.')->with('msg_type', 'positive');
         } else {
             return redirect()->back()->with('message', 'Answer sheet was not saved. Please review the answers')->with('msg_type', 'negative');
         }
     } else {
         $blood_pressure->update(['q1' => $request->get('q1'), 'q1_a' => $request->get('q1_a'), 'q2' => $request->get('q2'), 'q3' => $request->get('q3'), 'q3_a' => $request->get('q3_a'), 'q4' => $request->get('q4'), 'q4_a' => $request->get('q4_a'), 'q5' => $request->get('q5'), 'q5_a' => $request->get('q5_a'), 'q6' => $request->get('q6'), 'q7' => $request->get('q7'), 'q7_a' => $request->get('q7_a')]);
         // Touch parent model
         $record = Record::find($record_id);
         $record->touch();
         return redirect()->back()->with('message', 'Answer sheet was successfully updated.')->with('msg_type', 'positive');
     }
 }
 public function destroy($id)
 {
     $record = Record::findOrFail($id);
     $record->delete($id);
     Session::flash('message', 'fue eliminado de nuestros registros.');
     return redirect()->route('registros.index');
 }
 public function update(Request $request, $id)
 {
     $temp = Record::find($id);
     if ($temp != null) {
         $temp->status = $request->get('stat1');
         $temp->save();
     }
     return redirect('/log');
 }
Example #11
0
 public function getRecordArray(Request $request)
 {
     $id = $request->id;
     $rid = RecordPreset::where('id', '=', $id)->first()->rid;
     $record = Record::where('rid', '=', $rid)->first();
     $form = Form::where('fid', '=', $record->fid)->first();
     $field_collect = $form->fields()->get();
     $field_array = array();
     foreach ($field_collect as $field) {
         $data = array();
         $data['flid'] = $field->flid;
         $data['type'] = $field->type;
         if ($field->type == 'Text') {
             $textfield = TextField::where('rid', '=', $record->rid)->first();
             $data['text'] = $textfield->text;
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Rich Text') {
             $rtfield = RichTextField::where('rid', '=', $record->rid)->first();
             $data['rawtext'] = $rtfield->rawtext;
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Number') {
             $numberfield = NumberField::where('rid', '=', $record->rid)->first();
             $data['number'] = $numberfield->number;
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'List') {
             $listfield = ListField::where('rid', '=', $record->rid)->first();
             $data['option'] = $listfield->option;
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Multi-Select List') {
             $mslfield = MultiSelectListField::where('rid', '=', $record->rid)->first();
             $data['options'] = explode('[!]', $mslfield->options);
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Generated List') {
             $gnlfield = GeneratedListField::where('rid', '=', $record->rid)->first();
             $data['options'] = explode('[!]', $gnlfield->options);
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Date') {
             $datefield = DateField::where('rid', '=', $record->rid)->first();
             $date_array['circa'] = $datefield->circa;
             $date_array['era'] = $datefield->era;
             $date_array['day'] = $datefield->day;
             $date_array['month'] = $datefield->month;
             $date_array['year'] = $datefield->year;
             $data['data'] = $date_array;
             $flid_array[] = $field->flid;
         } elseif ($field->type == 'Schedule') {
             $schedfield = ScheduleField::where('rid', '=', $record->rid)->first();
             $data['events'] = explode('[!]', $schedfield->events);
             $flid_array[] = $field->flid;
         }
         $field_array[$field->flid] = $data;
     }
     $response['data'] = $field_array;
     $response['flids'] = $flid_array;
     return $response;
 }
 public function showHighRiskMeds($record_id)
 {
     $record = Record::find($record_id);
     $dispositions = Disposition::all();
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     return view('admin.high_risk_meds', compact('record', 'dispositions'));
 }
 public function showBreastCancerScreening($record_id)
 {
     $record = Record::find($record_id);
     $dispositions = Disposition::all();
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     return view('admin.breast_cancer_screening', compact('record', 'dispositions'));
 }
 public function showBloodPressure($record_id)
 {
     $record = Record::find($record_id);
     $dispositions = Disposition::all();
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     return view('admin.blood_pressure', compact('record', 'dispositions'));
 }
 public function showDiabetesEyeExam($record_id)
 {
     $record = Record::find($record_id);
     $dispositions = Disposition::all();
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     return view('admin.diabetes_eye_exam', compact('record', 'dispositions'));
 }
 public function showPneumoniaVaccination($record_id)
 {
     $record = Record::find($record_id);
     $dispositions = Disposition::all();
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     return view('admin.pneumonia_vaccination', compact('record', 'dispositions'));
 }
Example #17
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $count = 0;
     $rawdata = OldData::where('Transfered', '0');
     $data = $rawdata->get();
     $rawdata->update(['Transfered' => 1]);
     foreach ($data as $check) {
         $count++;
         Record::create(['nid' => $check->USERID, 'datetime' => strftime('%Y-%m-%d %X', strtotime($check->CHECKTIME))]);
     }
     //DB::connection('sqlsrv')->update('update CHECKINOUT set Transfered = 0');
 }
Example #18
0
 /**
  * Execute the console command.
  *
  * @param Schedule $schedule
  * @param Event $event
  * @param Record $record
  */
 public function handle(Schedule $schedule, Event $event, Record $record)
 {
     $uptimeRobot = new UptimeRobot(env('UPTIMEROBOT_API'));
     $getMonitors = simplexml_load_string($uptimeRobot->getMonitors());
     foreach ($getMonitors->monitor as $monitor) {
         // Check for the restart signal.
         $check = $event->where('event', 'restart');
         if ($monitor['status'] == 9) {
             // Record the restart
             $event->create(['machine_name' => 'ubuntu-512mb-sgp1-01', 'event' => 'restart']);
             // Check for the record of recent restart
             $recentRestart = $record->where('event', 'restart');
             // If there is a recent record but no signal found
             if ($recentRestart->count() > 0 && $check->count() < 6) {
                 \Mail::send('Email.Down', [], function ($message) {
                     $message->to('*****@*****.**', 'Hashim Ibrahim')->subject('About your server');
                 });
             } else {
                 // 4 hours have been passed.
                 $hoursPassed = $check->where('created_at', '<', 'DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 HOUR)');
                 if ($hoursPassed->count() > 0) {
                     if ($schedule->exec('envoy run monitorStatus')) {
                         \Log::info('Envoy ran @ ' . \Carbon\Carbon::now());
                         \Mail::send('Email.Server', ['time' => \Carbon\Carbon::now()], function ($message) {
                             $message->to('*****@*****.**', 'Hashim Ibrahim')->subject('About your server');
                         });
                         // Save this restart to db
                         $record->create(['event' => 'restart']);
                     } else {
                         \Log::info('Envoy is not working @ ' . \Carbon\Carbon::now());
                     }
                 }
                 $check->delete();
             }
         } else {
             $check->delete();
             \Log::info('Monitor status is good @ ' . \Carbon\Carbon::now());
         }
     }
 }
Example #19
0
 public function edit(Request $request)
 {
     $me = \Session::get('user');
     if (!$me->can('项目外出记录管理')) {
         abort(401);
     }
     $record = Record::find($request->input('id'));
     $project = $record->project;
     $user = User::find($request->input('user_id'));
     $record->user()->associate($user);
     $old_attributes = $record->attributesToArray();
     $time = $request->input('time');
     if (!$time) {
         $time = null;
     } else {
         $time = \Carbon\Carbon::createFromFormat('Y/m/d', $time)->format('Y-m-d H:i:s');
     }
     $record->time = $time;
     $record->content = $request->input('content');
     $record->contact = $request->input('contact');
     $record->phone = $request->input('phone');
     $record->software_count = $request->input('software_count');
     $record->hardware_name = $request->input('hardware_name');
     $record->hardware_count = $request->input('hardware_count');
     $record->save();
     $new_attributes = $record->attributesToArray();
     foreach (array_diff_assoc($old_attributes, $new_attributes) as $key => $value) {
         $changed = false;
         $old_value = $old_attributes[$key];
         if ($old_value == null) {
             $old_value = '空';
         }
         $new_value = $new_attributes[$key];
         if ($new_value == null) {
             $new_value = '空';
         }
         switch ($key) {
             case 'time':
                 if ($old_value->format('Y/m/d') != $new_value->format('Y/m/d')) {
                     $changed = true;
                 }
                 break;
             default:
                 $changed = true;
         }
         if ($changed) {
             \Log::notice(strtr('外出记录修改: 用户(%name[%id]) 修改了项目 %project[%project_id] 的外出记录 %record_id: %key : %old --> %new', ['%name' => $me->name, '%id' => $me->id, '%project' => $project->name, '%project_id' => $project->id, '%record_id' => $record->id, '%key' => $key, '%old' => $old_value, '%new' => $new_value]));
         }
     }
     return redirect()->back()->with('message_content', '外出记录修改成功!')->with('message_type', 'info')->with('tab', 'records');
 }
Example #20
0
 /**
  * Show the application welcome screen to the user.
  *
  *
  *
  * @return Response
  */
 public function index()
 {
     $languages_available = Config::get('app.locales_supported');
     $user = Auth::user();
     if ($user->admin) {
         $admin = 1;
         $records = Record::where('owner', '=', $user->id)->orderBy('updated_at', 'desc')->get();
         return view('user/profile', compact('languages_available', 'admin', 'records'));
     } else {
         $admin = 0;
         $projects = UserController::buildProjectsArray($user);
         $forms = UserController::buildFormsArray($user);
         $records = Record::where('owner', '=', $user->id)->orderBy('updated_at', 'desc')->get();
         return view('user/profile', compact('languages_available', 'admin', 'projects', 'forms', 'records'));
     }
 }
 public static function storeDiabetesEyeExam($request, $record_id)
 {
     $diabetes_eye_exam = DiabetesEyeExam::whereRecordId($record_id)->first();
     if (count($diabetes_eye_exam) == 0) {
         $diabetes_eye_exam = new DiabetesEyeExam();
         $diabetes_eye_exam->record_id = $record_id;
         $diabetes_eye_exam->user_id = Auth::user()->id;
         $diabetes_eye_exam->q1 = $request->get('q1');
         $diabetes_eye_exam->q2 = $request->get('q2');
         $diabetes_eye_exam->q3 = $request->get('q3');
         $diabetes_eye_exam->q4 = $request->get('q4');
         $diabetes_eye_exam->q5 = $request->get('q5');
         $diabetes_eye_exam->q6 = $request->get('q6');
         $diabetes_eye_exam->q7 = $request->get('q7');
         $diabetes_eye_exam->q8 = $request->get('q8');
         $diabetes_eye_exam->q9 = $request->get('q9');
         $diabetes_eye_exam->q10 = $request->get('q10');
         $diabetes_eye_exam->q11 = $request->get('q11');
         $diabetes_eye_exam->q12 = $request->get('q12');
         $diabetes_eye_exam->q12_a = $request->get('q12_a');
         $diabetes_eye_exam->q13 = $request->get('q13');
         $diabetes_eye_exam->q14 = $request->get('q14');
         $diabetes_eye_exam->q15 = $request->get('q15');
         $diabetes_eye_exam->q15_a = $request->get('q15_a');
         $diabetes_eye_exam->q16 = $request->get('q16');
         $diabetes_eye_exam->q16_a = $request->get('q16_a');
         $diabetes_eye_exam->q17 = $request->get('q17');
         $diabetes_eye_exam->q17_a = $request->get('q17_a');
         $diabetes_eye_exam->q18 = $request->get('q18');
         if ($diabetes_eye_exam->save()) {
             // Touch parent model
             $record = Record::find($record_id);
             $record->touch();
             return redirect()->back()->with('message', 'Answer sheet was successfully saved.')->with('msg_type', 'positive');
         } else {
             return redirect()->back()->with('message', 'Answer sheet was not saved. Please review the answers')->with('msg_type', 'negative');
         }
     } else {
         $diabetes_eye_exam->update(['q1' => $request->get('q1'), 'q1' => $request->get('q1'), 'q2' => $request->get('q2'), 'q3' => $request->get('q3'), 'q4' => $request->get('q4'), 'q5' => $request->get('q5'), 'q6' => $request->get('q6'), 'q7' => $request->get('q7'), 'q8' => $request->get('q8'), 'q9' => $request->get('q9'), 'q10' => $request->get('q10'), 'q11' => $request->get('q11'), 'q12' => $request->get('q12'), 'q12_a' => $request->get('q12_a'), 'q13' => $request->get('q13'), 'q14' => $request->get('q14'), 'q15' => $request->get('q15'), 'q15_a' => $request->get('q15_a'), 'q16' => $request->get('q16'), 'q16_a' => $request->get('q16_a'), 'q17' => $request->get('q17'), 'q17_a' => $request->get('q17_a'), 'q18' => $request->get('q18')]);
         // Touch parent model
         $record = Record::find($record_id);
         $record->touch();
         return redirect()->back()->with('message', 'Answer sheet was successfully updated.')->with('msg_type', 'positive');
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($records_2nd_list_id)
 {
     $record = Record::find($records_2nd_list_id);
     // Update user status if user status was IDLE
     if (Auth::user()->status == 'IDLE') {
         Auth::user()->addStatus('BCW', $record->id);
     }
     // Check if there are checklist entries for this record
     if (count($record->checklist) != count($record->getList())) {
         // Delete first all related checklist
         Checklist::where('record_id', $record->id)->delete();
         // Generate list for this record
         foreach ($record->getList() as $list) {
             $record->checklist()->save(new Checklist($list));
         }
     }
     return view('questionnaires.demographics_2', compact('record'));
 }
Example #23
0
 public static function showAdminDashboard()
 {
     $ctr = 0;
     $all_records = Record::with(['user' => function ($query) {
         $query->where('type', '=', 'agent');
     }]);
     if (!empty(request('gender'))) {
         $all_records = $all_records->where('gender', request('gender'));
     }
     if (!empty(request('age_from'))) {
         $all_records = $all_records->where('age', '>=', request('age_from'));
     }
     if (!empty(request('age_to'))) {
         $all_records = $all_records->where('age', '<=', request('age_to'));
     }
     $all_records = $all_records->orderBy('updated_at')->orderBy('gender')->orderBy('age', 'DESC')->paginate(20);
     $all_records->setPath("?gender=" . request('gender') . "&age_from=" . request('age_from') . "&age_to=" . request('age_to'));
     $callbacks = Callback::where('schedule', '>', date('Y-m-d', strtotime('-2 day', time())))->get();
     return view('auth.dashboard', compact('ctr', 'all_records', 'callbacks'));
 }
Example #24
0
 public function update(ListRequest $request, $referen)
 {
     $empresa = Session::get('empresa');
     $input = Input::all();
     $pedimento = \DB::connection('users')->table('optr01')->select('ref_transport1', 'ref_tipo')->where('pk_referencia', $referen)->first();
     $result = Checklist::where('chk_opera', $pedimento->ref_tipo)->where('chk_transport', $pedimento->ref_transport1)->get();
     foreach ($result as $res) {
         $doc = $input['id_' . $res->id];
         $digital = 0;
         $fisico = 0;
         if (isset($input['exp_digital_' . $res->id])) {
             $digital = $input['exp_digital_' . $res->id];
         }
         if (isset($input['exp_material_' . $res->id])) {
             $fisico = $input['exp_material_' . $res->id];
         }
         Record::updateOrCreate(['exp_referen' => $referen, 'exp_document' => $doc], ['exp_material' => $fisico, 'exp_company' => $empresa, 'exp_digital' => $digital]);
         //$id = 'chk'.$request->chk_id;
     }
     return redirect()->back();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $count = 20;
     //访问一次,更新20条记录
     $res = Record::select('id', 'phone')->whereNull('phone_province')->whereNotNull('phone')->limit($count)->get();
     $res = $res->toArray();
     $ko = 2;
     foreach ($res as $v) {
         $mobile = $v['phone'];
         if ($mobile) {
             if ($ko == 1) {
                 $data = $this->taobao($mobile);
             } else {
                 $data = $this->tenpay($mobile);
             }
             if ($data) {
                 Record::where('id', $v['id'])->update(['phone_province' => $data['province'], 'phone_city' => $data['city'], 'phone_supplier' => $data['supplier']]);
             }
         }
     }
     exit;
 }
Example #26
0
 public function dispense($ic, $name)
 {
     $getID = Patient::where('pt_ic', $ic)->first();
     //whole row
     $deID = $getID->id;
     //get the id from the ic
     $getcaseID = Record::where('pt_id', $deID)->first();
     $caseID = $getcaseID->id;
     $disData = Dispensary::where('case_ref', $caseID)->first();
     //xpe pakai first() sbb setiap case unik, case lain xpakai id ni
     $arrQty = explode("#", $disData->dispensed_quantity);
     $arrDrug = explode("#", $disData->dispensed_drug_code);
     //need declare $prices array x?
     $prices = array();
     for ($x = 0; $x < count($arrDrug) - 1; $x++) {
         //get price of each drug into an array
         $hehe = Inventory::where('drug_name', $arrDrug[$x])->first();
         $prices[$x] = $hehe->spu;
     }
     // $arrOne = count($arrDrug);
     // arr1 = druglist , arr2= respective qty of drug, arr3= respective price of drug
     $panel = Panel::all();
     return view('staff.dispensary')->with('name', $name)->with('arr2', $arrQty)->with('arr1', $arrDrug)->with('arr3', $prices)->with('panel', $panel)->with('ptid', $deID);
 }
 public static function storePneumoniaVaccination($request, $record_id)
 {
     $pneumonia_vaccination = PneumoniaVaccination::whereRecordId($record_id)->first();
     if (count($pneumonia_vaccination) == 0) {
         $pneumonia_vaccination = new PneumoniaVaccination();
         $pneumonia_vaccination->record_id = $record_id;
         $pneumonia_vaccination->user_id = Auth::user()->id;
         $pneumonia_vaccination->q1 = $request->get('q1');
         $pneumonia_vaccination->q1_a = $request->get('q1_a');
         $pneumonia_vaccination->q2 = $request->get('q2');
         $pneumonia_vaccination->q3 = $request->get('q3');
         $pneumonia_vaccination->q4 = $request->get('q4');
         $pneumonia_vaccination->q4_a = $request->get('q4_a');
         $pneumonia_vaccination->q5 = $request->get('q5');
         $pneumonia_vaccination->q5_a = $request->get('q5_a');
         $pneumonia_vaccination->q6 = $request->get('q6');
         $pneumonia_vaccination->q7 = $request->get('q7');
         $pneumonia_vaccination->q8 = $request->get('q8');
         $pneumonia_vaccination->q8_a = $request->get('q8_a');
         $pneumonia_vaccination->q9 = $request->get('q9');
         if ($pneumonia_vaccination->save()) {
             // Touch parent model
             $record = Record::find($record_id);
             $record->touch();
             return redirect()->back()->with('message', 'Answer sheet was successfully saved.')->with('msg_type', 'positive');
         } else {
             return redirect()->back()->with('message', 'Answer sheet was not saved. Please review the answers')->with('msg_type', 'negative');
         }
     } else {
         $pneumonia_vaccination->update(['q1' => $request->get('q1'), 'q1_a' => $request->get('q1_a'), 'q2' => $request->get('q2'), 'q3' => $request->get('q3'), 'q4' => $request->get('q4'), 'q4_a' => $request->get('q4_a'), 'q5' => $request->get('q5'), 'q5_a' => $request->get('q5_a'), 'q6' => $request->get('q6'), 'q7' => $request->get('q7'), 'q8' => $request->get('q8'), 'q8_a' => $request->get('q8_a'), 'q9' => $request->get('q9')]);
         // Touch parent model
         $record = Record::find($record_id);
         $record->touch();
         return redirect()->back()->with('message', 'Answer sheet was successfully updated.')->with('msg_type', 'positive');
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $records = Record::select('*')->where('patient_id', '=', $id)->get();
     $patient = Patient::findOrFail($id);
     return view('pages.patient.patientdetails', compact('patient', 'records'));
 }
 public function showRecordDemographics($record_id)
 {
     $showRecordDemographics = Record::showDemographics($record_id);
     return $showRecordDemographics;
 }
 private function syncTags(Record $record, array $tags)
 {
     $listTags = Tag::lists('id')->toArray();
     foreach ($tags as $tag) {
         if (!in_array($tag, $listTags)) {
             Tag::create(['name' => $tag]);
         }
     }
     $record->tags()->sync($tags);
 }