internal VitalSign buildVitalSign(IDataReader reader) { SiteId facility = new SiteId() { Id = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")), Name = DbReaderUtil.getValue(reader, reader.GetOrdinal("Location")) }; string id = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VitalSignSID")); string dateTaken = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("VitalSignTakenDateTime")); string vitalType = DbReaderUtil.getValue(reader, reader.GetOrdinal("VitalType")); string typeId = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("VitalTypeSID")); ObservationType type = new ObservationType(typeId, VitalSign.VITAL_SIGN, vitalType); VitalSign vitalSign = new VitalSign() { Id = id, Facility = facility, Type = type, Value1 = DbReaderUtil.getValue(reader, reader.GetOrdinal("Result")), Timestamp = dateTaken }; return(vitalSign); }
internal Appointment[] toAppointmentsFromDataReader(IDataReader reader) { IList <Appointment> appointments = new List <Appointment>(); try { while (reader.Read()) { string id = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("AppointmentSID")); string sta3n = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")); string appointmentDateTime = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("AppointmentDateTime")); string purposeOfVisit = DbReaderUtil.getValue(reader, reader.GetOrdinal("PurposeOfVisit")); string locationName = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationName")); string primaryStopCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("PrimaryStopCode")); string secondaryStopCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("SecondaryStopCode")); string institutionName = DbReaderUtil.getValue(reader, reader.GetOrdinal("InstitutionName")); string locationType = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationType")); string medicalService = DbReaderUtil.getValue(reader, reader.GetOrdinal("MedicalService")); string visitId = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VisitSID")); string providerName = providerNameIfAvailable(reader); SiteId facility = new SiteId(sta3n, institutionName); HospitalLocation hospitalLocation = new HospitalLocation(); hospitalLocation.Name = locationName; hospitalLocation.StopCode = new KeyValuePair <string, string>("Primary", primaryStopCode); hospitalLocation.Type = medicalService; Appointment appointment = new Appointment() { Id = id, VisitId = visitId, Clinic = hospitalLocation, Timestamp = appointmentDateTime, Purpose = purposeOfVisit, Facility = facility, ProviderName = providerName }; appointments.Add(appointment); } } catch (Exception) { } finally { reader.Close(); } return(appointments.ToArray <Appointment>()); }
internal RadiologyReport buildRadiologyReport(IDataReader reader) { SiteId facility = new SiteId() { Id = DbReaderUtil.getValue(reader, reader.GetOrdinal("station__no")) }; RadiologyReport report = new RadiologyReport() { Facility = facility, Id = DbReaderUtil.getValue(reader, reader.GetOrdinal("id")), Impression = DbReaderUtil.getValue(reader, reader.GetOrdinal("impressiontextwp")), Status = DbReaderUtil.getValue(reader, reader.GetOrdinal("report_status")), Text = DbReaderUtil.getValue(reader, reader.GetOrdinal("reporttextwp")), Title = DbReaderUtil.getValue(reader, reader.GetOrdinal("procedure102")), Timestamp = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("dt")), CaseNumber = DbReaderUtil.getValue(reader, reader.GetOrdinal("caseNumber")) }; return(report); }
internal string toNoteText(IDataReader reader) { string report = ""; try { while (reader.Read()) { string text = DbReaderUtil.getValue(reader, reader.GetOrdinal("ReportText")); string title = DbReaderUtil.getValue(reader, reader.GetOrdinal("TIUStandardTitle")); string date = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("EntryDateTime")); report = concatenateNote(report, text, title, date); } } catch (Exception) { } finally { reader.Close(); } return(report); }
internal Visit[] toVisitsFromDataReader(IDataReader reader) { IList <Visit> visits = new List <Visit>(); try { while (reader.Read()) { string providerSid = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("ProviderSID")); //ignore record if we don't have valid provider if (!String.IsNullOrEmpty(providerSid)) { string id = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VisitSID")); string sta3n = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")); string visitDateTime = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("VisitDateTime")); string locationName = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationName")); string primaryStopCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("PrimaryStopCode")); string secondaryStopCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("SecondaryStopCode")); string institutionName = DbReaderUtil.getValue(reader, reader.GetOrdinal("InstitutionName")); string locationType = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationType")); string medicalService = DbReaderUtil.getValue(reader, reader.GetOrdinal("MedicalService")); string firstName = getStringValue(reader, "FirstName"); string lastName = getStringValue(reader, "LastName"); string prefix = getStringValue(reader, "StaffNamePrefix"); string suffix = getStringValue(reader, "StaffNameSuffix"); string providerClass = getStringValue(reader, "ProviderClass"); SiteId facility = new SiteId(sta3n, institutionName); HospitalLocation hospitalLocation = new HospitalLocation() { Name = locationName, StopCode = new KeyValuePair <string, string>("Primary", primaryStopCode), Type = locationType }; PersonName name = new PersonName() { Firstname = firstName, Lastname = lastName, Prefix = prefix, Suffix = suffix }; User provider = new User() { Name = name, ProviderClass = providerClass, UserClass = providerClass }; Visit visit = new Visit() { Id = id, Location = hospitalLocation, Timestamp = visitDateTime, Facility = facility, Provider = provider, Service = medicalService }; visits.Add(visit); } } } catch (Exception) { } finally { reader.Close(); } return(visits.ToArray <Visit>()); }