public TaggedLabTestArrays(IndexedHashtable labTests) { if (labTests == null || labTests.Count == 0) { return; } arrays = new TaggedLabTestArray[labTests.Count]; for (int i = 0; i < labTests.Count; i++) { string tag = (string)labTests.GetKey(i); if (labTests.GetValue(i) == null) { arrays[i] = new TaggedLabTestArray(tag); } if (labTests.GetValue(i) is IList<LabTest>) { arrays[i] = new TaggedLabTestArray(tag, (IList<LabTest>)labTests.GetValue(i)); } else if (labTests.GetValue(i) is LabTest[]) { arrays[i] = new TaggedLabTestArray(tag); } else if (labTests.GetValue(i) is LabTest) { arrays[i] = new TaggedLabTestArray(tag); } else { return; } } }
public TaggedOrderArrays(IndexedHashtable t) { this.count = 0; if(t == null || t.Count == 0) { return; } this.count = t.Count; arrays = new TaggedOrderArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedOrderArray(); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedOrderArray(); arrays[i].fault = new FaultTO((Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType() != typeof(Order[])) { arrays[i] = new TaggedOrderArray((string)t.GetKey(i), null); } else { arrays[i] = new TaggedOrderArray((string)t.GetKey(i), (Order[])t.GetValue(i)); } } }
public PatientMedicalRecordTO(IndexedHashtable ihs) { initCollections(); if (ihs == null || ihs.Count == 0) { return; } for (int i = 0; i < ihs.Count; i++) { object key = ihs.GetKey(i); if (!(key is string)) { continue; } string sitecode = key as string; if (!(ihs.GetValue(i) is Hashtable)) { continue; } Hashtable domains = ihs.GetValue(i) as Hashtable; Meds.add(sitecode, domains["meds"] as IList<Medication>); Patient = new PatientTO(domains["demographics"] as Patient); Allergies.add(sitecode, domains["reactions"] as IList<Allergy>); Notes.add(sitecode, domains["documents"] as IList<Note>); Problems.add(sitecode, domains["problems"] as IList<Problem>); Appointments.add(sitecode, domains["appointments"] as IList<Appointment>); ChemHemReports.add(sitecode, domains["labs"] as IList<LabReport>); IList<HealthSummary> healthSummaries = domains["healthFactors"] as IList<HealthSummary>; // TODO - implement the remaining hashtable keys //results.Add("healthFactors", healthSummaries); //results.Add("flags", flags); //results.Add("consults", consults); //results.Add("procedures", null); //results.Add("visits", visits); //results.Add("appointments", appointments); //results.Add("problems", problems); //results.Add("vitals", vitals); //results.Add("labs", labs); //results.Add("immunizations", null); } }
public TaggedPatientArrays(IndexedHashtable t) { if (t.Count == 0) { return; } if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0))) { fault = new FaultTO((Exception)t.GetValue(0)); return; } arrays = new TaggedPatientArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient[])t.GetValue(i)); } else { arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient)t.GetValue(i)); } } count = t.Count; }
public PersonArray(IndexedHashtable t) { if (t == null || t.Count == 0) { count = 0; return; } persons = new PersonTO[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) != null) { persons[i] = new PersonTO((Person)t.GetValue(i)); } } count = t.Count; }
public TaggedSurgeryReportArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedSurgeryReportArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedSurgeryReportArray((string)t.GetKey(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedSurgeryReportArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedSurgeryReportArray((string)t.GetKey(i), (SurgeryReport[])t.GetValue(i)); } else { arrays[i] = new TaggedSurgeryReportArray((string)t.GetKey(i), (SurgeryReport)t.GetValue(i)); } } count = t.Count; }
public TaggedClaimArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedClaimArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim[])t.GetValue(i)); } else { arrays[i] = new TaggedClaimArray((string)t.GetKey(i), (Claim)t.GetValue(i)); } } count = t.Count; }
public TaggedMentalHealthInstrumentAdministrationArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedMentalHealthInstrumentAdministrationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i), (MentalHealthInstrumentAdministration[])t.GetValue(i)); } else if (MdwsUtils.isException(t.GetValue(i))) { fault = new FaultTO((Exception)t.GetValue(i)); } else { arrays[i] = new TaggedMentalHealthInstrumentAdministrationArray((string)t.GetKey(i), (List<MentalHealthInstrumentAdministration>)t.GetValue(i)); } } count = t.Count; }
public void Init(IndexedHashtable mdo) { if (mdo == null) { return; } healthSummaries = new HealthSummaryTO[mdo.Count]; for (int i = 0; i < mdo.Count; i++) { healthSummaries[i] = new HealthSummaryTO((HealthSummary)mdo.GetValue(i),(string)mdo.GetKey(i)); } count = mdo.Count; }
public TaggedPersonArrays(IndexedHashtable t) { if (t.Count == 0) { return; } if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0))) { fault = new FaultTO((Exception)t.GetValue(0)); return; } arrays = new TaggedPersonArray[t.Count]; for (int i = 0; i < t.Count; i++) { string ky = (string)t.GetKey(i); if (t.GetValue(i) == null) { arrays[i] = new TaggedPersonArray(ky); } else if (MdwsUtils.isException(t.GetValue(i))) { arrays[i] = new TaggedPersonArray(ky, (Exception)t.GetValue(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedPersonArray(ky, (Person[])t.GetValue(i)); } else if (t.GetValue(i).GetType().IsInstanceOfType(new List<Person>())) { arrays[i] = new TaggedPersonArray(ky, (List<Person>)t.GetValue(i)); } else { arrays[i] = new TaggedPersonArray(ky, (Person)t.GetValue(i)); } } count = t.Count; }
public TaggedHospitalLocationArrays(IndexedHashtable t) { if (t.Count == 0) { return; } arrays = new TaggedHospitalLocationArray[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i) == null) { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i)); } else if (t.GetValue(i).GetType().IsArray) { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i), (HospitalLocation[])t.GetValue(i)); } else { arrays[i] = new TaggedHospitalLocationArray((string)t.GetKey(i), (HospitalLocation)t.GetValue(i)); } } count = t.Count; }
public DataSourceArray(IndexedHashtable t) { if (t.Count == 0) { return; } items = new DataSourceTO[t.Count]; for (int i = 0; i < t.Count; i++) { if (t.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { fault = new FaultTO((Exception)t.GetValue(i)); } //else if (t.GetValue(i) == null) //{ // items[i] = new TaggedAdtArray((string)t.GetKey(i)); //} else { items[i] = new DataSourceTO((DataSource)t.GetValue(i)); } } count = items.Length; }
public ZipcodeTO[] getCitiesInState(string stateAbbr) { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); ZipcodeTO[] result = new ZipcodeTO[1]; result[0] = new ZipcodeTO(); if (String.IsNullOrEmpty(stateAbbr)) { result[0].fault = new FaultTO("Missing state abbreviation"); } else if (stateAbbr.Length != 2) { result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation"); } if (result[0].fault != null) { return result; } try { Zipcode[] zips = dao.getCitiesInState(stateAbbr); IndexedHashtable t = new IndexedHashtable(); for (int i = 0; i < zips.Length; i++) { if (!t.ContainsKey(zips[i].City)) { t.Add(zips[i].City, zips[i]); } } result = new ZipcodeTO[t.Count]; for (int i = 0; i < t.Count; i++) { result[i] = new ZipcodeTO((Zipcode)t.GetValue(i)); } } catch (Exception exc) { result[0].fault = new FaultTO(exc); } return result; }
public void testGetValueWithKey() { Assert.AreEqual("Value0", tbl.GetValue("Key0")); }
private void setProps(IndexedHashtable t) { this.results = new TaggedText[t.Count]; for (int i = 0; i < t.Count; i++) { this.results[i] = new TaggedText(); this.results[i].tag = (string)t.GetKey(i); if (t.GetValue(i) == null) { continue; } Type vType = t.GetValue(i).GetType(); if (vType == typeof(string)) { this.results[i].text = (string)t.GetValue(i); } else if (vType == typeof(string[])) { string[] a = (string[])t.GetValue(i); this.results[i].taggedResults = new TaggedText[a.Length]; for (int j = 0; j < a.Length; j++) { if (textOnly) { this.results[i].taggedResults[j] = new TaggedText("", a[j]); } else { this.results[i].taggedResults[j] = new TaggedText(a[j]); } } } else if (vType == typeof(Dictionary<string, ArrayList>)) { Dictionary<string, ArrayList> d = (Dictionary<string, ArrayList>)t.GetValue(i); this.results[i].taggedResults = new TaggedText[d.Count]; int j = 0; foreach (KeyValuePair<string, ArrayList> kvp in d) { this.results[i].taggedResults[j++] = new TaggedText(kvp); } } else if (vType == typeof(IndexedHashtable)) { IndexedHashtable tbl = (IndexedHashtable)t.GetValue(i); this.results[i].taggedResults = new TaggedText[tbl.Count]; for (int j = 0; j < tbl.Count; j++) { this.results[i].taggedResults[j] = new TaggedText((string)tbl.GetKey(j),(string)tbl.GetValue(j)); } } else if (vType == typeof(DictionaryHashList)) { DictionaryHashList d = (DictionaryHashList)t.GetValue(i); this.results[i].taggedResults = new TaggedText[d.Count]; for (int j = 0; j < d.Count; j++) { this.results[i].taggedResults[j] = new TaggedText(d[j]); } } else if (vType == typeof(KeyValuePair<int, string>)) { if (t.Count == 1) { this.results = new TaggedText[] { new TaggedText((KeyValuePair<int, string>)t.GetValue(i)) }; } else { this.results[i].taggedResults = new TaggedText[] { new TaggedText((KeyValuePair<int, string>)t.GetValue(i)) }; } } else if (vType == typeof(DateTime)) { string s = ((DateTime)t.GetValue(i)).ToString("yyyyMMdd.HHmmss"); if (t.Count == 1) { this.results = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) }; } else { this.results[i].taggedResults = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) }; } } else if (vType == typeof(StringDictionary)) { StringDictionary sd = (StringDictionary)t.GetValue(i); this.results[i] = new TaggedText(this.results[i].tag, sd); } else if (vType == typeof(OrderedDictionary)) { OrderedDictionary d = (OrderedDictionary)t.GetValue(i); this.results[i] = new TaggedText(this.results[i].tag, d); } else if (vType == typeof(User)) { string s = ((User)t.GetValue(i)).Uid; this.results[i].text = s; } else if (MdwsUtils.isException(t.GetValue(i))) { this.results[i].fault = new FaultTO((Exception)t.GetValue(i)); } else if (vType == typeof(gov.va.medora.mdo.domain.ccd.ContinuityOfCareRecord)) { // serialize CCR as XML MemoryStream memStream = new MemoryStream(); XmlSerializer serializer = new XmlSerializer(typeof(ContinuityOfCareRecord)); serializer.Serialize(memStream, new ContinuityOfCareRecord()); this.results[i] = new TaggedText(this.results[i].tag, "<![CDATA[" + System.Text.Encoding.UTF8.GetString(memStream.ToArray()) + "]]>"); } } this.count = t.Count; }
internal IndexedHashtable removeDups(IndexedHashtable t) { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < t.Count; i++) { string source = (string)t.GetKey(i); if (t.GetValue(i) == null) { result.Add(source, null); continue; } if (t.GetValue(i).GetType().Name.EndsWith("Exception")) { gov.va.medora.mdo.exceptions.MdoException e = new gov.va.medora.mdo.exceptions.MdoException( gov.va.medora.mdo.exceptions.MdoExceptionCode.DATA_INVALID, (Exception)t.GetValue(i)); result.Add(source,e); continue; } List<Person> persons = (List<Person>)t.GetValue(i); List<DemographicsRecord> rex = new List<DemographicsRecord>(persons.Count); Hashtable ht = new Hashtable(persons.Count); foreach (Person p in persons) { PersonTO pto = new PersonTO(p); DemographicsRecord rec = new DemographicsRecord(pto, source); long hashcode = new TOReflection.TOEqualizer(rec).HashCode; if (!ht.ContainsKey(hashcode)) { ht.Add(hashcode, rec); rex.Add(rec); } } result.Add(source, rex); } return result; }
private IndexedHashtable mergeNotesAndDischargeSummaries(IndexedHashtable tNotes, IndexedHashtable tSummaries) { if (tNotes == null) { return tSummaries; } if (tSummaries == null) { return tNotes; } IndexedHashtable result = new IndexedHashtable(tNotes.Count + tSummaries.Count); for (int i = 0; i < tNotes.Count; i++) { Note[] notes = (Note[])tNotes.GetValue(i); int notesLength = (notes == null ? 0 : notes.Length); string key = (string)tNotes.GetKey(i); Note[] summaries = (Note[])tSummaries.GetValue(key); int summariesLength = (summaries == null ? 0 : summaries.Length); ArrayList lst = new ArrayList(notesLength + summariesLength); for (int j = 0; j < notesLength; j++) { lst.Add(notes[j]); } for (int j = 0; j < summariesLength; j++) { lst.Add(summaries[j]); } result.Add(key, (Note[])lst.ToArray(typeof(Note))); } return result; }
internal PatientAssociateArray processContacts(IndexedHashtable t) { ArrayList lst = new ArrayList(); for (int siteIdx = 0; siteIdx < t.Count; siteIdx++) { PatientAssociate[] pas = (PatientAssociate[])t.GetValue(siteIdx); for (int i = 0; i < pas.Length; i++) { lst.Add(pas[i]); } } return new PatientAssociateArray(lst); }