/// <summary> /// 增加和保存 /// </summary> /// <param name="entity"></param> public void SaveInfo(AI_DeptInfo entity) { if (!string.IsNullOrWhiteSpace(entity.DeptID) && entity.DeptID != "null") { entity.UpdateM("DeptID"); } else { entity.DeptID = CommonService.GetPrimaryId(new GI_SerialInfo() { Name = "AI_DEPTINFO", ColumnName = "DeptID", OrganID = entity.OrganID }) + ""; entity.ParentID = (string.IsNullOrWhiteSpace(entity.ParentID) ? "0" : entity.ParentID); entity.SaveModelM(); } }
/// <summary> /// 获取会诊单信息 /// </summary> /// <returns></returns> public string GetConsultationInfoById() { return(base.ExecuteActionJsonResult("获取会诊单信息", () => { CD_Consultation entity = EntityOperate <CD_Consultation> .GetEntityById(Request["ConsultationId"], "ConsultationId"); if (!string.IsNullOrWhiteSpace(entity.RequesterCode)) { GI_UserInfo Requester = EntityOperate <GI_UserInfo> .GetEntityById(entity.RequesterCode, "UserID"); entity.RequesterName = Requester.UserName; } if (!string.IsNullOrWhiteSpace(entity.RequestDepartCode)) { AI_DeptInfo Dept = EntityOperate <AI_DeptInfo> .GetEntityById(entity.RequestDepartCode, "DeptID"); entity.RequestDepartName = Dept.DeptName; } return new WebApi_Result() { data = entity }; })); }
/// <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); }