private void PopulateWithDefaultData() { NewPatient(); Name = "Doe"; GivenName = "John"; BirthDate = new DateTime(1925, 8, 27); MultipleBirth = false; Gender = AdministrativeGender.Male; Active = true; Deceased = false; MaritalState = MaritalStatusList.FirstOrDefault(x => x.Equals("married")); Nationality = NationalityList.First(x => x.Equals("US")); Photo = "unknown-male.jpg"; Address1 = "Nørre Alle"; Address2 = "12"; Triage = "TriageRed"; Specialty = "Unknown"; HospitalName = "AUH"; CPR = "1212121212"; FromDestination = "Grenåvej"; AgeOfPatient = "40"; Zip = "8000"; City = "Aarhus"; State = "Midtjylland"; Country = "Denmark"; Phone = "12345678"; Mobile = ""; Email = "*****@*****.**"; }
private void NewPatient() { PatientId = "NEW PATIENT"; Active = true; Deceased = false; Name = ""; GivenName = ""; BirthDate = DateTime.Now; //added: ETA = DateTime.Now; MultipleBirth = false; Gender = AdministrativeGender.Unknown; MaritalState = MaritalStatusList.FirstOrDefault(x => x.Equals("unknown")); Nationality = NationalityList.First(x => x.Equals("Other")); Address1 = ""; Address2 = ""; Zip = ""; City = ""; State = ""; Country = ""; CPR = ""; FromDestination = ""; AgeOfPatient = ""; Phone = ""; Mobile = ""; Email = ""; Photo = "unknown-male.jpg"; }
private void ExecuteReadData(object obj) { String id = PatientId; NewPatient(); PatientId = "UNKNOWN"; var uri = new Uri(_url); var client = new FhirClient(uri); var location = String.Format("{0}/Patient/{1}", _url, id); Patient entry = null; try { entry = client.Read <Patient>(new Uri(location)); //entry = client.Read(location); if (entry == null) { return; } _entry = entry; //var identity = new ResourceIdentity(_entry.Id); //PatientId = identity.Id; var identity = _entry.Id; PatientId = identity; var patient = _entry; Active = patient.Active ?? true; var d = patient.Deceased as Hl7.Fhir.Model.FhirBoolean; if (d != null) { Deceased = d.Value ?? false; } else { Deceased = false; } Name = patient.Name[0].Family.ToString(); GivenName = patient.Name[0].GivenElement[0].ToString(); if (patient.BirthDate != null) { BirthDate = DateTime.Parse(patient.BirthDate); } var m = patient.MultipleBirth as FhirBoolean; if (m != null) { MultipleBirth = m.Value ?? false; } else { MultipleBirth = false; } // The following properties are not yet updated, simply set them to default values // // TODO // Gender = patient.Gender ?? AdministrativeGender.Unknown; CPR = patient.Identifier[0].Value.ToString(); Triage = patient.GetStringExtension("http://www.example.com/triagetest") ?? "Unknown"; Specialty = patient.GetStringExtension("http://www.example.com/SpecialtyTest") ?? "Unknown"; HospitalName = patient.Identifier[1].Value ?? "Unknown"; //patient.GetStringExtension("http://www.example.com/hospitalTest") ?? "To hospital went wrong"; FromDestination = patient.Identifier[2].Value ?? "Unknown"; //AgeOfPatient = patient. //Tjek op på at den er i Identity ETA = Convert.ToDateTime(patient.GetExtension("http://www.example.com/datetimeTest").Value.ToString()); MaritalState = MaritalStatusList.FirstOrDefault(x => x.Equals("unknown")); Nationality = NationalityList.First(x => x.Equals("Other")); //if(patient.Address[0] != null) Address1 = patient.Address[0].LineElement[0].ToString(); // if (patient.Address[0].LineElement[1] != null) Address2 = patient.Address[0].LineElement[1].ToString(); // if (patient.Address[0].PostalCode != null) Zip = patient.Address[0].PostalCode; // if (patient.Address[0].City != null) City = patient.Address[0].City; // if (patient.Address[0].State != null) State = patient.Address[0].State; // if (patient.Address[0].Country != null) Country = patient.Address[0].Country; // if (patient.Telecom[0] != null) Phone = patient.Telecom[0].Value; // if (patient.Telecom[1] != null) Mobile = patient.Telecom[1].Value; // if (patient.Telecom[2] != null) Email = patient.Telecom[2].Value; // Photo = null; } catch (Exception) { NewPatient(); } }