public void getMedicationAndEncounterInfo() throws Exception { String sql = getParameter("sql"); if (sql == null || sql.trim().length() < 1) return; List<List<Object>> list = new MedicationDAO() .getMedicationAndEncounterInfo(sql); List<PatientOrder> medicationList = list != null && list.size() > 0 ? (List) list .get(0) : new ArrayList<PatientOrder>(); List<PatientInEncounter> encounterList = list != null && list.size() > 1 ? (List) list.get(1) : new ArrayList<PatientInEncounter>(); List<PatientDemographics> demoList = list != null && list.size() > 2 ? (List) list .get(2) : new ArrayList<PatientDemographics>(); resp.addParameter("medicationList", medicationList); resp.addParameter("encounterList", encounterList); resp.addParameter("demoList", demoList); }
public List<List<Object>> getMedicationAndEncounterInfo(String sql) throws Exception { DBOperator dbo = getDBOperator(); try { PatientOrderTableAdapter adapt = new PatientOrderTableAdapter(dbo); PatientInEncounterTableAdapter paAdapt = new PatientInEncounterTableAdapter( dbo); PatientDemographicsTableAdapter deAdapt = new PatientDemographicsTableAdapter( dbo); System.out.println("sql=" + sql); List<List<Object>> list = dbo.executeQuery(sql, new TableAdapter[] { adapt, paAdapt, deAdapt }); return list; } catch (Exception e) { dbo.rollback(); throw e; } finally { dbo.close(); } }
public void LoadPatientOrder() { ServiceRequest request = new MedicationAction().ServiceReqGetMedicationAndEncounterInfo; //string sql = "select a.*,b.*,c.* from gemr.patient_order a,gemr.patient_in_encounter b, patient_demographics c" // + " where (a.status=‘" + Constant.OrderStatus_Submited // + "‘ or a.status=‘" + Constant.OrderStatus_NurseConfirmed // + "‘ or (a.status=‘" + Constant.OrderStatus_NurseExecuted // + "‘and a.long_flag=‘Y‘ and a.date_stopped>‘" + DateTime.Today.ToString("yyyy-MM-dd") + "‘)) and a.record_flag = ‘" + App.RecordFlag + "‘ and b.ward_id = ‘" // + App.CurrentUserRoleWardepComb.Ward.WardId + "‘" // + " and a.encounter_id = b.encounter_id and b.demographics_id = c.demographics_id" // + " and (a.deleted_flag <> ‘Y‘ or a.deleted_flag is null) and (b.deleted_flag <> ‘Y‘ or b.deleted_flag is null) and (c.deleted_flag <> ‘Y‘ or c.deleted_flag is null)" // + " order by b.bed_num,a.encounter_id, a.date_started"; string sql = "select a.*,b.*,c.* from gemr.patient_order a,gemr.patient_in_encounter b, patient_demographics c" + " where a.status=" + "‘"+ Constant.OrderStatus_Submited+ "‘" + " and a.record_flag = " + "‘"+App.RecordFlag +"‘" +" and b.ward_id = "+"‘"+ App.CurrentUserRoleWardepComb.Ward.WardId + "‘" + " and a.encounter_id = b.encounter_id and b.demographics_id = c.demographics_id" + " and (a.deleted_flag <> ‘Y‘ or a.deleted_flag is null) and (b.deleted_flag <> ‘Y‘ or b.deleted_flag is null) and (c.deleted_flag <> ‘Y‘ or c.deleted_flag is null)" + " order by b.bed_num,a.encounter_id, a.date_started"; request.AddParameter("sql", sql); InvokeService(request, (e) => { if (e.Response == null) return; List<PatientOrder> medicationList = e.Response.GetParameterAsList<PatientOrder>("medicationList"); List<PatientInEncounter> encounterList = e.Response.GetParameterAsList<PatientInEncounter>("encounterList"); List<PatientDemographics> demoList = e.Response.GetParameterAsList<PatientDemographics>("demoList"); List<PatientMedicationCombo> comboList = new List<PatientMedicationCombo>(); for (int i = 0; i < medicationList.Count; i++) { PatientInEncounter encou = null; PatientDemographics demo = null; PatientOrder medi = medicationList[i]; if (OrderType.Medication.ToString() != medi.OrderType && Constant.OrderStatus_NurseExecuted.Equals(medi.Status)) { continue; } if (i < encounterList.Count) { encou = encounterList[i]; } if (i < demoList.Count) { demo = demoList[i]; } PatientMedicationCombo combo = new PatientMedicationCombo(medi, encou, demo); comboList.Add(combo); } //if (comboList != null && comboList.Count > 0) //{ // comboList = comboList.OrderByDescending(c => c.EncounterInfo).ToList(); //} gridControl1.ItemsSource = comboList; gridControl1.ExpandAllGroups(); }); }