public void TestIsAllergicToMedications02()
 {
     var allergyIntolerance = new AllergyIntolerance("http://fhirtest.uhn.ca/baseDstu2/");
     var patientID = 6116;
     var medications = new List<string>() { "NotARealMedicine" };
     var result = allergyIntolerance.IsAllergicToMedications(patientID, medications);
     Assert.False(result);
 }
 public void TestIsAllergicToMedications01()
 {
     var allergyIntolerance = new AllergyIntolerance("http://fhirtest.uhn.ca/baseDstu2/");
     var patientID = 6116;
     var medications = new List<string>() { "hYdRoCoDoNe" };
     var result = allergyIntolerance.IsAllergicToMedications(patientID, medications);
     Assert.True(result);
 }
示例#3
0
        public async Task<ActionResult> CheckVerification(Models.Medicine med)
        {
            using(var dbcontext = new ApplicationDbContext())
            {
                var allergyIntolerance = new AllergyIntolerance(Constants.HapiFhirServerBase, userManager, authManager);

                var user = dbcontext.Users.FirstOrDefault(a => a.FhirPatientId == med.UserFhirID);
                int patientID;
                if(user == null || !int.TryParse(user.FhirPatientId, out patientID))
                {
                    return new HttpStatusCodeResult(404, "Patient not found");
                }
                if(string.IsNullOrWhiteSpace(user.FhirPatientId))
                {
                    //todo: figure out what to show if the patient has no fhir data setup
                    return new HttpStatusCodeResult(404, "Patient does not have FHIR data");
                }
                var medications = new List<string>() { med.Name };
                med.Found = await allergyIntolerance.IsAllergicToMedications(patientID, medications);
            }
            return View(med);
        }