예제 #1
0
 public function processDistrict($patientquery, $visitquery, $value, $title = "")
 {
     if ($value != "all") {
         $title .= District::find($value)->district . " District ";
         $patientquery->whereIn('id', PatientReport::where('district', $value)->get()->lists('patient_id') + array('0'));
         $visitquery->whereIn('id', PatientInfo::where('district', $value)->get()->lists('visit_id') + array('0'));
     }
     return array($patientquery, $visitquery, $title);
 }
예제 #2
0
 public function store_followup($id)
 {
     $patient = Patient::find($id);
     $patient->first_name = Input::get("firstname");
     $patient->middle_name = Input::get("middlename");
     $patient->last_name = Input::get("lastname");
     $patient->birth_date = Input::get("dob");
     $patient->hospital_id = Input::get("hosp_no");
     $patient->phone = Input::get("phone");
     $patient->facility_id = Input::get("facility");
     $patient->save();
     //adding patient visit info
     $visit = Visit::create(array("patient_id" => $patient->id, "visit_date" => date('Y-m-d'), "server_status" => 'not', "user" => Auth::user()->firstname . " " . Auth::user()->middlename . " " . Auth::user()->lastname));
     //adding address information
     PatientInfo::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "hospital_id" => "somenumber", "region" => Input::get("region"), "district" => Input::get("district"), "ward" => Input::get("ward"), "ten_cell_leader" => Input::get("t_cell_leadr")));
     //adding gynecological history inforamtion for a visit
     GynecologicalHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "parity" => Input::get("parity"), "number_of_pregnancy" => Input::get("number_of_preg"), "menarche" => Input::get("menarche"), "age_at_sexual_debut" => Input::get("start_sex_age"), "marital_status" => Input::get("marital"), "age_at_first_marriage" => Input::get("first_marriage"), "sexual_partner" => Input::get("sexual_partner"), "partner_sexual_partner" => Input::get("partner_sexual_partner")));
     //adding contraceptive history
     ContraceptiveHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "current_status" => Input::get("current_on_contra"), "current_contraceptive_id" => Input::has("current_contra") ? Input::get("current_contra") : ""));
     //adding HIV status
     HivStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::has("hiv_status") ? Input::get("hiv_status") : "", "test_status" => Input::has("hiv_test_status") ? Input::get("hiv_test_status") : "", "unknown_reason" => Input::has("unknown_reason") ? Input::get("unknown_reason") : "", "years_since_first_diagnosis" => Input::has("year_since_diagnosis") ? Input::get("year_since_diagnosis") : "", "year_of_last_test" => Input::has("last_test") ? Input::get("last_test") : "", "art_status" => Input::has("art_status") ? Input::get("art_status") : "", "current_art_status" => Input::has("current_art_status") ? Input::get("current_art_status") : "", "pitc_offered" => Input::get("test_again") == "yes" ? "yes" : "no", "pitc_agreed" => Input::has("test_again") ? Input::get("test_again") : "", "pitc_result" => Input::has("current_test_result") ? Input::get("current_test_result") : "", "pitc_cd4_count" => Input::has("current_cd4") ? Input::get("current_cd4") : "", "prev_cd4_count" => Input::has("prev_cd4") ? Input::get("prev_cd4") : ""));
     //adding VIA Status
     ViaStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "via_counselling_status" => Input::get("via_counceling"), "via_test_status" => Input::get("via_test"), "reject_reason" => Input::has("via_reason") ? Input::get("via_reason") : "", "via_result" => Input::has("via_results") ? Input::get("via_results") : ""));
     //adding colposcopy
     ColposcopyStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("colposcopy_status"), "result_id" => Input::has("colpo_result") ? Input::get("colpo_result") : ""));
     //adding Pap smear result
     PapsmearStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("pap_status"), "result_id" => Input::has("pap_result") ? Input::get("pap_result") : ""));
     //adding intervetion status
     Intervention::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "type_id" => Input::has("intervention") ? Input::get("intervention") : "", "indicator_id" => Input::has("indicator") ? Input::get("indicator") : "", "histology_id" => Input::has("histology") ? Input::get("histology") : "", "cancer_id" => Input::has("cancer") ? Input::get("cancer") : "", "grade" => Input::has("hist_grade") ? Input::get("hist_grade") : "", "stages" => Input::has("stages") ? Input::get("stages") : "", "differentiation" => Input::has("differentiation") ? Input::get("differentiation") : ""));
     $report = PatientReport::where('patient_id', $patient->id)->first();
     $report->region = Input::get("region");
     $report->district = Input::get("district");
     $report->number_of_pregnancy = Input::get("number_of_preg");
     $report->marital_status = Input::get("marital");
     $report->first_marriage = Input::get("first_marriage");
     $report->partners = Input::get("sexual_partner");
     $report->partners_partner = Input::get("partner_sexual_partner");
     $report->contraceptive_status = Input::get("current_on_contra");
     $report->facility_id = Input::get("facility");
     if (Input::has("current_contra")) {
         $report->contraceptive_type = Input::get("current_contra");
     }
     if (Input::has("hiv_status")) {
         $report->HIV_status = Input::get("hiv_status");
     }
     if (Input::has("current_cd4")) {
         $report->cd4_count = Input::get("current_cd4");
     } elseif (Input::has("prev_cd4")) {
         $report->cd4_count = Input::has("prev_cd4");
     }
     $report->save();
     if (Input::get("next_visit") != "") {
         Notification::create(array("patient_id" => $patient->id, "message" => "Kumbuka Kwenda katika kituo ulichopimwa mara ya mwisho saratani ya shingo ya kizazi. Tafadhali fika bila kukosa tarehe  " . Input::get('next_visit'), "status" => "pending", "phone_number" => $patient->phone, "next_visit" => Input::get('next_visit')));
     }
     Logs::create(array("user_id" => Auth::user()->id, "action" => "Patient followup for " . $patient->first_name . " " . $patient->last_name));
     $msg = "Patient followup stored successfull";
     return View::make('visit.index', compact('patient', "msg"));
 }
 function test_paramsSize()
 {
     $patient = new PatientInfo();
     $queryParams = $patient->getQueryParams(null, null);
     $this->assertEquals(count($queryParams), 22);
 }
<?php

include_once '../AutoLoader.php';
AutoLoader::registerDirectory('../src/classes');
require "config.php";
if (empty($_SESSION['user'])) {
    header("Location: ../index.php");
    die("Redirecting to index.php");
}
if (!empty($_POST)) {
    $patient = new PatientInfo();
    // Update session variables to reflect post values.
    $postParams = array('first_name', 'last_name', 'sex', 'dob', 'age', 'marital_status', 'years_of_experience', 'availability', 'shift_id', 'address', 'city', 'state', 'zip', 'phone', 'insurance_id', 'insurance_begin', 'insurance_end', 'allergies', 'diseases', 'previous_surgeries', 'other_medical_history', 'challenge_question_id', 'challenge_question_answer');
    foreach ($postParams as $param) {
        $_SESSION['user'][$param] = htmlspecialchars($_POST[$param]);
    }
    if ($patient->validate($_POST)) {
        $patient->saveInfo($_POST, $_SESSION, $db);
    }
}
?>

<!doctype html>
<html lang="en">
<head>
    <style>.error {color: #FF0000;}</style>
    <meta charset="utf-8">
    <title>Hospital Management</title>
    <meta name="description" content="Hospital management system for Intro to Software Engineering">
    <meta name="author" content="WAL Consulting">
 function test_nullPost()
 {
     $info = new PatientInfo();
     $info->saveInfo(null, null, null);
     $this->assertEquals($info->status, "failed");
 }