private List <Patient> GetPatientsInFixedDay(List <Patient> srcList, long areaid) { List <Patient> patients = new List <Patient>(); using (var scheduleTemplateDao = new ScheduleTemplateDao()) { var condition = new Dictionary <string, object>(); condition["DATE"] = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd"); var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition); foreach (var type in list22) { if (type.BedId == -1) { continue; } bool bExist = true; foreach (var patient in patients) { if (patient.PatientId != type.PatientId.ToString()) { bExist = false; break; } } if (!bExist) { long areaid1 = GetAreaIdByBedId(type.BedId); if (areaid == areaid1) { using (PatientDao patientDao1 = new PatientDao()) { var condition2 = new Dictionary <string, object>(); condition2["ID"] = type.PatientId; var list2 = patientDao1.SelectPatient(condition2); patients.Add(list2[0]); } } } } } foreach (var patient in srcList) { if (!patients.Contains(patient)) { patients.Add(patient); } } return(patients); }
private void QueryPatients() { try { int index = PatientGroupComboBox.SelectedIndex; if (index == -1) { return; } using (var patientGroupDao = new PatientGroupDao()) { var condition = new Dictionary <string, object>(); condition["NAME"] = PatientGroupComboBoxItems[index]; var list = patientGroupDao.SelectPatientGroup(condition); if (list.Count > 0) { using (var patientGroupParaDao = new PatientGroupParaDao()) { var conditionpara = new Dictionary <string, object>(); conditionpara["GROUPID"] = list[0].Id; var listpara = patientGroupParaDao.SelectPatientGroupPara(conditionpara); if (listpara.Count > 0) { using (var patientDao = new PatientDao()) { var patientlist = patientDao.SelectPatientSpecial(listpara); string areaid = GetPatientArea(listpara); if (!areaid.Equals("")) { Datalist.Clear(); QueryPatientsByArea(areaid); return; } Datalist.Clear(); foreach (var patient in patientlist) { using (var scheduleTemplateDao = new ScheduleTemplateDao()) { condition.Clear(); condition = new Dictionary <string, object>(); condition["PatientId"] = patient.Id; condition["DATE"] = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd"); var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition); foreach (var type in list22) { if (type.BedId == -1) { continue; } var rReportData = new ReportData(); rReportData.Id = type.Id; using (PatientDao patientDao1 = new PatientDao()) { var condition2 = new Dictionary <string, object>(); condition2["ID"] = type.PatientId; var list2 = patientDao1.SelectPatient(condition2); if ((list2 != null) && (list.Count > 0)) { rReportData.PatientName = list2[0].Name; rReportData.Description = list2[0].Description; } } rReportData.ShiftWork = type.AmPmE; rReportData.Method = type.Method; /*if (type.BedId == -1) * rReportData.BedId = ""; * else * { * rReportData.BedId = type.BedId.ToString(); * }*/ using (var bedDao = new BedDao()) { condition.Clear(); condition["Id"] = type.BedId; var bedlist = bedDao.SelectBed(condition); if (bedlist.Count == 1) { long areaId = bedlist[0].PatientAreaId; rReportData.BedId = bedlist[0].Name; using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["Id"] = areaId; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { rReportData.Area = arealist[0].Name; } } } } //rReportData.Description = patient.Description; Datalist.Add(rReportData); } } } } } } } } UpdateGroupCount(); } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded select patient exception messsage: " + ex.Message); } }
private void QueryPatientsByArea(string areaName) { string areaid = ""; using (var patientAreaDao = new PatientAreaDao()) { var condition = new Dictionary <string, object>(); condition["Name"] = areaName; var arealist = patientAreaDao.SelectPatientArea(condition); areaid = arealist[0].Id.ToString(); } using (BedDao bedDao = new BedDao()) { Dictionary <string, object> condition = new Dictionary <string, object>(); condition["PatientAreaId"] = areaid; var list = bedDao.SelectBed(condition); foreach (DAOModule.Bed bed in list) { using (var scheduleTemplateDao = new ScheduleTemplateDao()) { condition.Clear(); condition = new Dictionary <string, object>(); condition["BedId"] = bed.Id; condition["DATE"] = DatePicker1.SelectedDate.Value.ToString("yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd"); var list22 = scheduleTemplateDao.SelectScheduleTemplate(condition); foreach (var type in list22) { if (type.BedId == -1) { continue; } var rReportData = new ReportData(); rReportData.Id = type.Id; using (PatientDao patientDao1 = new PatientDao()) { var condition2 = new Dictionary <string, object>(); condition2["ID"] = type.PatientId; var list2 = patientDao1.SelectPatient(condition2); if ((list2 != null) && (list.Count > 0)) { rReportData.PatientName = list2[0].Name; rReportData.Description = list2[0].Description; } } rReportData.ShiftWork = type.AmPmE; rReportData.Method = type.Method; /*if (type.BedId == -1) * rReportData.BedId = ""; * else * { * rReportData.BedId = type.BedId.ToString(); * }*/ using (var bedDao1 = new BedDao()) { condition.Clear(); condition["Id"] = type.BedId; var bedlist = bedDao1.SelectBed(condition); if (bedlist.Count == 1) { long areaId = bedlist[0].PatientAreaId; rReportData.BedId = bedlist[0].Name; using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["Id"] = areaId; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { rReportData.Area = arealist[0].Name; } } } } Datalist.Add(rReportData); } } } } UpdateGroupCount(); }