internal Medication[] toMeds(IDataReader reader) { IList <Medication> results = new List <Medication>(); while (reader.Read()) { string facility = DbReaderUtil.getValue(reader, reader.GetOrdinal("Facility")); string sta3n = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")); string id = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("RxOutpatSID")); string status = DbReaderUtil.getValue(reader, reader.GetOrdinal("RxStatus")); string drugNameWithDose = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocalDrugNameWithDose")); string issueDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("IssueDate")); string rxNumber = DbReaderUtil.getValue(reader, reader.GetOrdinal("RxNumber")); string refills = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("MaxRefills")); string patientIcn = DbReaderUtil.getValue(reader, reader.GetOrdinal("PatientICN")); string sig = DbReaderUtil.getValue(reader, reader.GetOrdinal("Sig")); string daysSupply = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("DaysSupply")); string quantity = DbReaderUtil.getValue(reader, reader.GetOrdinal("Qty")); string lastFilledDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("LastFillDate")); string expriationDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("ExpirationDate")); SiteId site = new SiteId() { Name = facility, Id = sta3n }; Medication med = new Medication() { Facility = site, Id = id, Drug = new KeyValuePair <string, string>(id, drugNameWithDose), Name = drugNameWithDose, RxNumber = rxNumber, IssueDate = issueDate, LastFillDate = lastFilledDate, Refills = refills, Status = status, Sig = sig, ExpirationDate = expriationDate, Quantity = quantity, DaysSupply = daysSupply }; results.Add(med); } return(results.ToArray <Medication>()); }
internal Problem[] toProblemList(IDataReader reader) { IList <Problem> problemResults = new List <Problem>(); try { while (reader.Read()) { string sta3n = DbReaderUtil.getValue(reader, reader.GetOrdinal("Facility")); SiteId siteId = new SiteId(sta3n); string status = DbReaderUtil.getValue(reader, reader.GetOrdinal("ActiveFlag")); string enteredDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("EnteredDate")); string onsetDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("OnsetDate")); string modifiedDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("LastModifiedDate")); string resolvedDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("ResolvedDate")); string priority = DbReaderUtil.getValue(reader, reader.GetOrdinal("Priority")); string icd = DbReaderUtil.getValue(reader, reader.GetOrdinal("ICDDescription")); string icdCode = DbReaderUtil.getValue(reader, reader.GetOrdinal("ICDCode")); string providerNarrative = DbReaderUtil.getValue(reader, reader.GetOrdinal("ProviderNarrative")); string id = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("ProblemListSID")); string majorDiagnosticCategory = DbReaderUtil.getValue(reader, reader.GetOrdinal("MDC")); Problem problem = new Problem() { Facility = siteId, Status = status, OnsetDate = enteredDate, ModifiedDate = modifiedDate, ResolvedDate = resolvedDate, Priority = priority, NoteNarrative = icd, Id = id, ProviderNarrative = providerNarrative }; problemResults.Add(problem); } } catch (Exception) { } finally { reader.Close(); } return(problemResults.ToArray <Problem>()); }
internal MentalHealthInstrumentResultSet toMentalHealthInstrumentResultSet(IDataReader reader) { MentalHealthInstrumentResultSet result = new MentalHealthInstrumentResultSet() { Scale = new KeyValuePair <string, string>("Scale", DbReaderUtil.getValue(reader, reader.GetOrdinal("SurveyScale"))), RawScore = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("RawScore")), Id = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("SurveyResultSID")), Instrument = new KeyValuePair <string, string>("Instrument", DbReaderUtil.getValue(reader, reader.GetOrdinal("SurveyName"))), AdministrationId = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("SurveyAdministrationSID")), SurveyGivenDateTime = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("SurveyGivenDateTime")), SurveySavedDateTime = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("SurveySavedDateTime")) }; result.TransformedScores.Add("1", DbReaderUtil.getValue(reader, reader.GetOrdinal("TransformedScore1"))); result.TransformedScores.Add("2", DbReaderUtil.getValue(reader, reader.GetOrdinal("TransformedScore2"))); result.TransformedScores.Add("3", DbReaderUtil.getValue(reader, reader.GetOrdinal("TransformedScore3"))); return(result); }
internal MentalHealthInstrumentAdministration toMentalHealthInstrumentAdministration(IDataReader reader) { MentalHealthInstrumentAdministration instrumentAdministration = new MentalHealthInstrumentAdministration() { Id = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("SurveyAdministrationSID")), Patient = new KeyValuePair <string, string>("", DbReaderUtil.getValue(reader, reader.GetOrdinal("PatientICN"))), Instrument = new KeyValuePair <string, string>("", DbReaderUtil.getValue(reader, reader.GetOrdinal("SurveyName"))), DateAdministered = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("SurveyGivenDateTime")), DateSaved = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("SurveySavedDateTime")), OrderedBy = new KeyValuePair <string, string>("", DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("OrderedBySID"))), AdministeredBy = new KeyValuePair <string, string>("", DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("AdministeredBySID"))), IsSigned = DbReaderUtil.getBooleanFromYNValue(reader, reader.GetOrdinal("IsSignedFlag")), IsComplete = DbReaderUtil.getBooleanFromYNValue(reader, reader.GetOrdinal("IsCompleteFlag")), NumberOfQuestionsAnswered = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("NumberOfQuestionsAnswered")), TransmissionStatus = DbReaderUtil.getValue(reader, reader.GetOrdinal("TransmissionStatus")), TransmissionTime = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("TransmisionTime")), HospitalLocation = new KeyValuePair <string, string>("", DbReaderUtil.getValue(reader, reader.GetOrdinal("Facility"))) }; return(instrumentAdministration); }
internal ChemHemReport buildChemHemReport(IDataReader reader) { string patientIcn = DbReaderUtil.getValue(reader, reader.GetOrdinal("PatientICN")); string testName = DbReaderUtil.getValue(reader, reader.GetOrdinal("LabChemTestName")); // LabResult.LabTest.ShortName string resultValue = DbReaderUtil.getValue(reader, reader.GetOrdinal("LabChemResultValue")); // LabResult.Value string refHigh = DbReaderUtil.getValue(reader, reader.GetOrdinal("RefHigh")); // LabResult.LabTest.hiRef string refLow = DbReaderUtil.getValue(reader, reader.GetOrdinal("RefLow")); // LabResult.LabTest.lowRef string abnormal = DbReaderUtil.getValue(reader, reader.GetOrdinal("Abnormal")); // LabResult.BoundaryStatus string loinc = DbReaderUtil.getValue(reader, reader.GetOrdinal("LOINC")); // LabResult.LabTest.Loinc string component = DbReaderUtil.getValue(reader, reader.GetOrdinal("Component")); // LabResult.LabTest.Name string labTestType = DbReaderUtil.getValue(reader, reader.GetOrdinal("LabTestType")); //LabResult.LabTest.Category string labChemTestSid = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("LabChemTestSID")); string labChemTestIen = DbReaderUtil.getValue(reader, reader.GetOrdinal("LabChemTestIEN")); string labChemIen = DbReaderUtil.getValue(reader, reader.GetOrdinal("LabChemIEN")); // LabTest.Id string labChemSid = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("LabChemSID")); string siteCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")); string labChemCompleteDate = DbReaderUtil.getDateValue(reader, reader.GetOrdinal("LabChemCompleteDateTime")); SiteId facility = new SiteId() { Id = siteCode }; LabTest labTest = new LabTest() { Id = labChemTestIen, Name = testName, ShortName = labTestType, DataId = labChemTestSid, HiRef = refHigh, LowRef = refLow, Loinc = loinc }; LabResult labResult = new LabResult() { Value = resultValue, BoundaryStatus = abnormal, Test = labTest }; LabResult[] labResults = new LabResult[1]; labResults[0] = labResult; LabSpecimen labSpecimen = new LabSpecimen() { Id = labChemIen, Name = DbReaderUtil.getValue(reader, reader.GetOrdinal("Specimen")), CollectionDate = labChemCompleteDate, Site = siteCode }; ChemHemReport report = new ChemHemReport() { Id = labChemSid, Specimen = labSpecimen, Facility = facility, Results = labResults, Timestamp = labChemCompleteDate }; return(report); }