Exemplo n.º 1
0
 function getAmputationPct($PatientID)
 {
     // error_log("Amputations for - $PatientID");
     $lookup = new LookUp();
     $amputations = $lookup->getLookupDescByNameAndType($PatientID, '30');
     if ($this->checkForErrors('Get Patient Amputations Failed. ', $amputations)) {
         $this->set('templatedata', null);
         // error_log("Error getting Amputations..." . $this->get('frameworkErr'));
         return;
     }
     $totalPctReduction = 0;
     // $BSACalcs = new BSACalcs;
     $controller = 'BSACalcController';
     $BSACalcs = new $controller('BSACalc', 'bsacalc', null);
     // error_log("Amputation Count = " . count($amputations));
     foreach ($amputations as $amputation) {
         $Ampu = $amputation['description'];
         // error_log("Ampu = $Ampu");
         $rslt = $BSACalcs->AmputationsPctLoss[$Ampu];
         // error_log("rslt = $rslt");
         $totalPctReduction += $rslt;
         // error_log("Pct BSA Reduction due to amputation of $Ampu = $rslt");
     }
     // error_log("TOTAL Pct BSA Reduction due to amputation = $totalPctReduction");
     return $totalPctReduction;
 }
Exemplo n.º 2
0
 function viewall($id = NULL)
 {
     // error_log("viewall Entry Point");
     if ($id == NULL) {
         $retVal = $this->Patient->selectAll();
     } else {
         $retVal = $this->Patient->selectAll($id);
     }
     if ($this->checkForErrors('Get Patients Failed. ', $retVal)) {
         $this->set('templatedata', null);
         return;
     }
     $patients = $retVal;
     $patientDetailMap = array();
     $measurements = array();
     $modPatients = array();
     // error_log("Patients Count - " . count($patients));
     foreach ($patients as $patient) {
         if (NULL === $id || NULL !== $id && $patient['ID'] == $id) {
             $lookup = new LookUp();
             $amputations = $lookup->getLookupDescByNameAndType($patient['ID'], '30');
             if ($this->checkForErrors('Get Patient Amputations Failed. ', $amputations)) {
                 $this->set('templatedata', null);
                 return;
             }
             $tmpAmputations = array();
             foreach ($amputations as $amputation) {
                 array_push($tmpAmputations, $amputation);
             }
             $patient['amputations'] = $tmpAmputations;
             array_push($modPatients, $patient);
             $retVal = $this->Patient->getPatientDetailInfo($patient['ID']);
             if ($this->checkForErrors('Get Patient Details Failed. ', $retVal)) {
                 $this->set('templatedata', null);
                 return;
             }
             $patientBSA = $this->_getBSA($patient['ID']);
             $details = $retVal;
             // error_log("Details Count - " . count($details));
             if (count($details) > 0) {
                 foreach ($details as $d) {
                     $detail = $this->TreatmentStatus($d);
                     if (isset($patientBSA) && count($patientBSA) > 0) {
                         $a = $patientBSA[0]["WeightFormula"];
                         $b = $patientBSA[0]["BSAFormula"];
                         $detail["WeightFormula"] = $a;
                         $detail["BSAFormula"] = $b;
                     }
                     if ($detail["TreatmentStatus"] != 'Ended') {
                         $patientDetailMap[$patient['ID']] = $detail;
                     }
                     // error_log("viewAll - The Details - " . json_encode($detail));
                 }
             } else {
                 // error_log("No Details, so build one");
                 $detail = array();
                 $detail["TemplateName"] = "";
                 $detail["TemplateDescription"] = "";
                 $detail["TemplateID"] = "";
                 $detail["TreatmentStart"] = "";
                 $detail["TreatmentEnd"] = "";
                 $detail["TreatmentStatus"] = "";
                 $detail["ConcurRadTherapy"] = "";
                 $detail["AssignedByUser"] = "";
                 $detail["ApprovedByUser"] = "";
                 $detail["Goal"] = "";
                 $detail["ClinicalTrial"] = "";
                 $detail["PAT_ID"] = "";
                 $detail["PerformanceStatus"] = "";
                 if (isset($patientBSA) && count($patientBSA) > 0) {
                     // error_log("Got BSA Data from BSA_Info Table");
                     $a = $patientBSA[0]["WeightFormula"];
                     $b = $patientBSA[0]["BSAFormula"];
                     $detail["WeightFormula"] = $a;
                     $detail["BSAFormula"] = $b;
                 }
                 $patientDetailMap[$patient['ID']] = $detail;
             }
         }
     }
     $this->set('patients', $modPatients);
     $this->set('templatedetails', $patientDetailMap);
 }
Exemplo n.º 3
0
 private function MatchGetInfo4OnePatient($lastFour, $comspatientModel)
 {
     error_log("MyMDWS Controller - MatchGetInfo4OnePatient() - Entry Point, DFN = " . $this->_dfn);
     $patient = $comspatientModel->getPatientIdByDFN($this->_dfn);
     if ($this->checkForErrors('Get Patient Record by DFN Failed. ', $patient)) {
         $jsonRecord['success'] = false;
         $jsonRecord['message'] = $this->get('frameworkErr');
         $this->set('jsonRecord', $jsonRecord);
         error_log("MyMDWS Controller - MatchGetInfo4OnePatient() - call to Patient Model -> getPatientIdByDFN() FAILED - " . $this->get('frameworkErr'));
         return $jsonRecord;
     }
     if (count($patient) > 0) {
         error_log("Have one or more Patient Records");
     } else {
         error_log("NO Patient Records");
     }
     error_log("MyMDWS Controller - MatchGetInfo4OnePatient() - Got Patient By DFN (" . $this->_dfn . "), No Errors - " . json_encode($patient));
     $patient = $comspatientModel->selectByPatientId($patient[0]['id']);
     if ($this->checkForErrors('Get Patient Info Failed. ', $patient)) {
         $jsonRecord['success'] = false;
         $jsonRecord['message'] = $this->get('frameworkErr');
         $this->set('jsonRecord', $jsonRecord);
         // return;	<-- MWB - 5/4/2012 Can't return null, need to return the jsonRecord
         return $jsonRecord;
     }
     error_log("Got Patient Info, No Errors (look for id in element 0) - " . json_encode($patient));
     $patientTemplate = $comspatientModel->getTemplateIdByPatientID($patient[0]['id']);
     if ($this->checkForErrors('Get Patient Template Failed. ', $patientTemplate)) {
         $jsonRecord['success'] = false;
         $jsonRecord['message'] = $this->get('frameworkErr');
         $this->set('jsonRecord', $jsonRecord);
         return $jsonRecord;
     } elseif (!empty($patientTemplate)) {
         $details = $comspatientModel->getPatientDetailInfo($patient[0]['id']);
         if ($this->checkForErrors('Get Patient Details Failed. ', $details)) {
             $jsonRecord['success'] = false;
             $jsonRecord['message'] = $this->get('frameworkErr');
             $this->set('jsonRecord', $jsonRecord);
             return $jsonRecord;
         }
     } else {
         $details = $this->createEmptyTemplateArray();
     }
     error_log("Got Patient Details " . json_encode($details));
     if ('' === $details[0]['TemplateID']) {
         $detail = $details[0];
     } else {
         $detail = $this->TreatmentStatus($details[0]);
         if ($detail['TreatmentStatus'] == "Ended") {
             $detail = array();
             $detail['TemplateID'] = '';
             $detail['TemplateName'] = '';
             $detail['TemplateDescription'] = '';
             $detail['TreatmentStart'] = '';
             $detail['TreatmentEnd'] = '';
             $detail['TreatmentStatus'] = '';
             $detail['Goal'] = '';
             $detail['ClinicalTrial'] = '';
             $detail['WeightFormula'] = '';
             $detail['BSAFormula'] = '';
             $detail['PerformanceStatus'] = '';
         }
     }
     $patient[0] = array_merge($patient[0], $detail);
     $lookup = new LookUp();
     $amputations = $lookup->getLookupDescByNameAndType($patient[0]['id'], '30');
     if ($this->checkForErrors('Get Patient Amputations Failed. ', $amputations)) {
         $jsonRecord['success'] = false;
         $jsonRecord['message'] = $this->get('frameworkErr');
         $this->set('jsonRecord', $jsonRecord);
         return;
     }
     $tmpAmputations = array();
     foreach ($amputations as $amputation) {
         array_push($tmpAmputations, $amputation);
     }
     $patient[0]['Amputations'] = $tmpAmputations;
     $VPR = $this->getVitalsFromVistA($this->_dfn);
     $VPR_New = array();
     $VPR_Data = array();
     $VPR_Data_Items = array();
     $NameInfo = array();
     $NameInfo["Name"] = $this->_Name;
     $NameInfo["pName"] = $this->_pName;
     $NameInfo["fullName"] = $this->_fullName;
     $NameInfo["briefId"] = $lastFour;
     $NameInfo["dateOfBirth"] = $this->_dob;
     $NameInfo["genderCode"] = "urn:va:pat-gender:M";
     $NameInfo["gender"] = $this->_gender;
     $NameInfo["age"] = $this->_age;
     $NameInfo["dfn"] = $this->_dfn;
     $NameInfo["ssn"] = $this->_ssn;
     $fullname = array();
     $fullname[] = $NameInfo;
     // $VPR_Data_Items = array_merge( $VPR_Data_Items, json_decode($VPR), $NameInfo, json_encode($VPR1) );
     $VPR_Data_Items = array_merge($VPR_Data_Items, $fullname, $VPR);
     $VPR_Data["items"] = $VPR_Data_Items;
     $VPR_New["data"] = $VPR_Data;
     $patient[0]["VPR"] = $VPR_New;
     $this->patient = $patient[0];
     error_log("MyMDWS Controller - MatchGetInfo4OnePatient() - EXIT Point, patient = " . json_encode($patient[0]));
     return null;
 }