/// <summary> /// 根据筛选条件查询病案首页数据列表 /// </summary> /// <param name="iFilter"></param> /// <returns></returns> public List <CD_MedicalRecordHomePage> GetAll(InpatientFilter iFilter) { string filter = "1=1"; if (!string.IsNullOrWhiteSpace(iFilter.keyword)) { filter += string.Format(" and {1} like '%{0}%'", iFilter.keyword, iFilter.KeywordType); } filter += iFilter.GetQueryString(); List <CD_MedicalRecordHomePage> list = EntityOperate <CD_MedicalRecordHomePage> .GetEntityList(filter, "OrganID"); if (list == null || list.Count <= 0) { return(new List <CD_MedicalRecordHomePage>()); } return(list); }
/// <summary> /// 根据筛选条件查询住院病人数据列表 /// </summary> /// <param name="iFilter"></param> /// <param name="where">其他条件</param> /// <returns></returns> public List <CD_Inpatient> GetAll(InpatientFilter iFilter, string where = "") { string filter = "1=1"; //关键词 if (!string.IsNullOrWhiteSpace(iFilter.keyword)) { filter += string.Format(" and {1} like '%{0}%'", iFilter.keyword, iFilter.KeywordType); } //档案状态,1:在院,2:已出院,3:待归档,4:已归档 if (!string.IsNullOrWhiteSpace(iFilter.Status)) { switch (iFilter.Status) { case "1": filter += string.Format(" and LeaveTime is null "); break; //在院 case "2": filter += string.Format(" and LeaveTime is not null and MedicalRecordState<>1 "); break; //已出院 不包括已归档 case "3": filter += string.Format(" and MedicalRecordState=0 "); break; //待归档 case "4": filter += string.Format(" and MedicalRecordState=1 "); break; //已归档 default: break; } } //病历所属 if (!string.IsNullOrWhiteSpace(iFilter.Group) && !string.IsNullOrWhiteSpace(iFilter.UserID)) { switch (iFilter.Group) { case "1": filter += string.Format(" and AttendingDoctorId='{0}' ", iFilter.UserID); break; //主诊医生过滤 case "4": filter += string.Format(" and INPATIENTID in (select INPATIENTID from CD_InpatientAuthorized where AUTHORIZEDPERSONID='{0}' and sysdate+numtodsinterval(-" + inpatientauthorizedservice.AuthorizedHours + ",'hour')<= AUTHORIZEDPERSONTIME) ", iFilter.UserID); break; //授权病人 case "5": filter += string.Format(" and CurrentDeptID in (select DPETID from GI_USERINFO where USERID='{0}') ", iFilter.UserID);; break; //本科室 default: break; } } filter += iFilter.GetQueryString() + where; List <CD_Inpatient> list = EntityOperate <CD_Inpatient> .GetEntityList(filter, "OrganID"); if (list == null || list.Count <= 0) { return(new List <CD_Inpatient>()); } list.ForEach((f) => { #region 科室和病区组 //科室 AI_DeptInfo deptInfo = EntityOperate <AI_DeptInfo> .GetEntityById(f.CurrentDeptID, "DeptID"); f.CurrentDeptName = deptInfo == null ? "" : deptInfo?.DeptName; //病区 AI_DeptInfo Ward = EntityOperate <AI_DeptInfo> .GetEntityById(f.CurrentWardID, "DeptID"); f.CurrentWardName = Ward == null ? "" : Ward?.DeptName; #endregion }); return(list); }