//Populates a fake patient values for us FraminghamCalculatorPatient PhillFCM(int iWhichOne) { FraminghamCalculatorPatient myFCMP = new FraminghamCalculatorPatient(); switch (iWhichOne) { //case 1: // Console.WriteLine(1); // break; //case 5: // Console.WriteLine(5); // break; default: iWhichOne = 999999999; myFCMP.Age = 65; myFCMP.Diabetic = true; myFCMP.FirstName = "Kevin"; myFCMP.GenderAsInt = 1; myFCMP.HDL = 98; myFCMP.LastName = "GonnaDie"; myFCMP.OnAntihypertensiveMedication = false; myFCMP.PatientId = iWhichOne.ToString(); myFCMP.Smoker = true; myFCMP.SystolicBP = 156; myFCMP.TotalCholesterol = 425; break; } return(myFCMP); }
// Let's request the conformance statement from the SMART on FHIR API server and // find out the endpoint URLs for the authorization server //public ActionResult FraminghamCalculator(CernerFullConnectionInformationViewModel cfcivm) //Models.ViewModels.Patient viewPatient) public FraminghamCalculatorViewModel FraminghamCalculator(CernerFullConnectionInformationViewModel cfcivm) //Models.ViewModels.Patient viewPatient) { ViewBag.Message = "Framingham Calculator"; var client = new FhirClient(cfcivm.ServiceUrl) { PreferredFormat = ResourceFormat.Json };; client.OnBeforeRequest += (object sender, BeforeRequestEventArgs e) => { e.RawRequest.Headers.Add("Authorization", "Bearer " + cfcivm.AccessToken); }; var identity = ResourceIdentity.Build("Patient", cfcivm.PatientId); Hl7.Fhir.Model.Patient viewPatient = client.Read <Hl7.Fhir.Model.Patient>(identity); //Get those values we don't know how to retrive yet. FraminghamCalculatorPatient Fcp = PhillFCM(0); Fcp.LastName = viewPatient.Name[viewPatient.Name.Count - 1].FamilyElement[0].ToString(); Fcp.FirstName = viewPatient.Name[viewPatient.Name.Count - 1].GivenElement[0].ToString(); Fcp.Gender = viewPatient.Gender.ToString(); Fcp.Age = Convert.ToDateTime(viewPatient.BirthDate).Age(); #region Get HDL //Now we get some real data like the HDL FraminghamCalculator fc = new FraminghamCalculator(Fcp); fc.FhirClient = client; string loinc_hdl = "2085-9"; string loinc_ldl = "13457-7"; string loinc_Cholesterol_Total = "9830-1"; string loinc_cholesterol = "2093-3"; string loinc_Triglycerides = "2571-8"; string loinc_SystolicBP = "8480-6"; string loinc_DiastolicBP = "8462-4"; BloodPressureValue bpv = fc.GetLatestBloodPressureValue(cfcivm.PatientId, loinc_SystolicBP); CholesterolValue cv_hdl = fc.GetLatestCholesterolValue(cfcivm.PatientId, loinc_hdl); CholesterolValue cv_total = fc.GetLatestCholesterolValue(cfcivm.PatientId, loinc_cholesterol); #endregion Get HDL Fcp.SystolicBP = (int)bpv.Value; Fcp.HDL = (int)cv_hdl.Value; Fcp.TotalCholesterol = (int)cv_total.Value; FraminghamCalculatorViewModel vm = new FraminghamCalculatorViewModel(); vm.FraminghamScore = fc.DoCalculation(); vm.FCM = Fcp; return(vm); }
public FraminghamCalculator(FraminghamCalculatorPatient fcp) { this.FCP = fcp; }