public int GetConsulationCountByUser(string userID) { string filter = "1=1"; if (!string.IsNullOrWhiteSpace(userID)) { GI_UserInfo user = EntityOperate <GI_UserInfo> .GetEntityById(userID, "USERID"); if (user != null) { filter += string.Format(" and ( ApplyDoctorCode = '{0}'", userID); filter += string.Format(" or ( ApplyDepartCode = '{0}' and ApplyDoctorCode is null ))", user.DpetID); // filter += string.Format(" and ApplyWardCode = '{0}'", user.InpatientID); } } DataTable dt = dataProvider.GetDataSet("select count(consultationid) as cnt from CD_Consultation a where del=0 and consultationstate = 1 and " + filter).Tables[0]; if (dt.Rows.Count > 0) { return(Extend.HandleNull(dt.Rows[0]["cnt"], 0)); } else { return(0); } }
/// <summary> /// 根据ID获得用户实体类 /// </summary> /// <param name="userid"></param> /// <returns></returns> public GI_UserInfo GetInfoById(string userid) { GI_UserInfo info = EntityOperate <GI_UserInfo> .GetEntityById(userid, "USERID"); //职位 GI_CodeDict job = new CodeDictService().GetCodeDictByDictCodeAndEName(info.Job, "Job"); info.JobName = job == null ? "" : job.DictName; //职称 GI_CodeDict userPosition = new CodeDictService().GetCodeDictByDictCodeAndEName(info.UserPosition, "Position"); info.UserPositionName = userPosition == null ? "" : userPosition.DictName; //职务级别 GI_CodeDict joblevel = new CodeDictService().GetCodeDictByDictCodeAndEName(info.JobLevel, "JobLevel"); info.JobLevelName = joblevel == null ? "" : joblevel.DictName; #region 科室和病区组 List <AI_DeptInfo> userDepts = deptinfoservice.GetDeptInfoByUserId(info.UserID); //科室 info.DpetList = (from u in userDepts where u.IsInpatient == 0 select u).ToList(); //病区 info.InpatientList = (from u in userDepts where u.IsInpatient == 1 select u).ToList(); #endregion //用户医疗组 info.MedicalList = new DoctorGroupService().GetDoctorGroupByUserId(info.UserID); return(info); }
/// <summary> /// 根据筛选条件查询病人诊断数据列表 /// </summary> /// <param name="iFilter"></param> /// <returns></returns> public List <CD_PatientDiagnosis> GetAll(PatientDiagnosisFilter iFilter) { string filter = "1=1"; if (!string.IsNullOrWhiteSpace(iFilter.keyword)) { filter += string.Format(" and DiagnosisName like '%{0}%'", iFilter.keyword); } filter += iFilter.GetQueryString(); List <CD_PatientDiagnosis> list = EntityOperate <CD_PatientDiagnosis> .GetEntityList(filter, "SortOrder,OrganID"); if (list == null || list.Count <= 0) { return(new List <CD_PatientDiagnosis>()); } list.ForEach((f) => { var Inpatient = new InpatientService().GetInfoByInpatientId(f.InpatientId); f.InpatientName = Inpatient != null ? Inpatient.Name : "";//病人名字 if (f.DiagnosisFlag != null) { f.DiagnosisFlagName = codedictService.GetCodeDictByDictCodeAndEName(f.DiagnosisFlag.ToString(), "DiagnosisFlag").DictName; } //确诊标志中文 GI_UserInfo RecordUser = EntityOperate <GI_UserInfo> .GetEntityById(f.RecordUserId, "USERID"); //记录医生实体类 f.RecordUserESign = RecordUser?.ESign; //电子签名 }); return(list); }
public string SaveConsultationInfo() { return(base.ExecuteActionJsonResult("会诊单信息保存", () => { CD_Consultation entity = base.GetPageData <CD_Consultation>(0); if (!string.IsNullOrWhiteSpace(entity.InpatientId)) { CD_Inpatient inpatient = EntityOperate <CD_Inpatient> .GetEntityById(Request["InpatientId"], "InpatientId"); if (string.IsNullOrWhiteSpace(entity.ConsultationId) || entity.ConsultationId == "null") { entity.ConsultationState = "1"; entity.DeptId = inpatient.CurrentDeptID; entity.WardId = inpatient.CurrentWardID; entity.RequesterCode = UserTokenManager.GetUserToken(Request["token"]).UserId; GI_UserInfo user = EntityOperate <GI_UserInfo> .GetEntityById(entity.RequesterCode, "USERID"); entity.RequestDepartCode = user.DpetID; entity.OrganID = UserTokenManager.GetUserToken(Request["token"]).ORGANID; } entity.Del = 0; service.SaveInfo(entity); msgHub hub = new msgHub(); // hub.SendGroup(entity.ApplyDepartCode, "Con", "", ""); } return new WebApi_Result(); })); }
public string GetUserById(string userid) { var aa = Request.QueryString.Keys; return(base.ExecuteActionJsonResult("获取用户信息", () => { GI_UserInfo list = userService.GetInfoById(Request["userid"]); return new WebApi_Result() { data = list }; })); }
public List <CD_Consultation> GetConsultationByUser(string userID, string consultationType = null) { string filter = "1=1"; if (!string.IsNullOrWhiteSpace(userID)) { GI_UserInfo user = EntityOperate <GI_UserInfo> .GetEntityById(userID, "USERID"); if (user != null) { if (consultationType == "1") { filter += string.Format(" and ( ApplyDoctorCode = '{0}'", userID); filter += string.Format(" or ( ApplyDepartCode = '{0}' and ApplyDoctorCode is null ))", user.DpetID); // filter += string.Format(" and ApplyWardCode = '{0}'", user.InpatientID); } else { filter += string.Format(" and ( RequesterCode = '{0}'", userID); filter += string.Format(" or RequestDepartCode = '{0}')", user.DpetID); } } } filter += " order by a.consultationtype desc,a.applytime"; List <CD_Consultation> list = EntityOperate <CD_Consultation> .GetEntityListBySQL(@"select a.consultationid,a.organid,a.inpatientid,a.deptid, a.wardid,a.bednum,a.consultationstate,a.consultationtype,a.hospitaltype,a.hospitalname,a.applytime,a.diseasesummary,a.applydepartcode, a.applydepartname,a.applywardcode,a.applywardname,a.applydoctorcode,a.applydoctorname,a.requestdepartcode,a.requestercode,a.verifiertime, a.verifiercode,a.replytime,a.replycontent,a.replydepartcode,a.replydepartname,a.replywardcode,a.replywardname,a.replydoctorcode, a.replydoctorname,a.del,a.creator,a.createtime,a.updater,a.updatetime, b.name as inpatientname,b.HEALTHCARD as InpatientCode, dept.DeptName as requestdepartName,ward.DeptName as InpatientWardName from CD_Consultation a ,cd_inpatient b,ai_deptinfo dept,ai_deptinfo ward where a.inpatientid=b.inpatientid and dept.isinpatient=0 and ward.isinpatient=1 and a.requestdepartcode=dept.DeptID and a.wardID=ward.DeptID and " + filter); if (list == null || list.Count <= 0) { return(new List <CD_Consultation>()); } list.ForEach((f) => { f.ConsultationStateName = f.ConsultationState == "2" ? "已回复" : "新开"; f.ConsultationTypeName = f.ConsultationType == "2" ? "<label style='color:red'>紧急</label>" : "普通"; f.HospitalName = f.HospitalType == "2" ? f.HospitalName : "本院"; if (!string.IsNullOrWhiteSpace(f.RequesterCode)) { GI_UserInfo Requester = EntityOperate <GI_UserInfo> .GetEntityById(f.RequesterCode, "UserID"); f.RequesterName = Requester.UserName; } }); return(list); }
/// <summary> /// 保存用户信息 /// </summary> /// <param name="entity">用户实体</param> public void SaveUserInfo(GI_UserInfo entity) { if (!string.IsNullOrWhiteSpace(entity.UserID) && entity.UserID != "null") { entity.ModifyTime = DateTime.Now; entity.PassWord = null; //user.PASSWORD = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(user.PASSWORD, "md5"); entity.UpdateM("USERID"); } else { entity.UserID = this.GetPrimaryId(entity.OrganID) + ""; entity.LoginTime = entity.ModifyTime = DateTime.Now; entity.SaveModelM(); } }
public string SaveUserInfo() { return(base.ExecuteActionJsonResult("保存用户信息", () => { GI_UserInfo _user = base.GetPageData <GI_UserInfo>(0); if (!string.IsNullOrWhiteSpace(_user.PassWord)) { _user.PassWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(_user.PassWord, "md5"); } if (Request["myaction"] != "UserEdit") { _user.UserCode = null; } userService.SaveUserInfo(_user); return new WebApi_Result(); })); }
/// <summary> /// 根据住院病人id获得病案首页 /// </summary> /// <returns></returns> public CD_MedicalRecordHomePage GetInfoByInpatientId(string InpatientId) { CD_MedicalRecordHomePage info = EntityOperate <CD_MedicalRecordHomePage> .GetEntityById(InpatientId, "InpatientId"); if (info != null) { if (!string.IsNullOrWhiteSpace(info.Creator)) { GI_UserInfo Creator = EntityOperate <GI_UserInfo> .GetEntityById(info.Creator, "UserID"); info.CreatorName = Creator?.UserName; } if (!string.IsNullOrWhiteSpace(info.Updater)) { GI_UserInfo Updater = EntityOperate <GI_UserInfo> .GetEntityById(info.Updater, "UserID"); info.UpdaterName = Updater?.UserName; } } return(info); }
/// <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> /// <returns></returns> public string GetAll() { return(base.ExecuteActionJsonResult("获取病程记录列表", () => { ProgressNoteFilter filter = GetPageData <ProgressNoteFilter>(0); List <CD_ProgressNote> list = progressNoteService.GetAll(filter); list.ForEach(e => { e.ProgressTypeName = CommonService.GetDictNameByID("824", e.ProgressTypeId + ""); GI_UserInfo Creator = EntityOperate <GI_UserInfo> .GetEntityById(e.Creator, "USERID"); e.CreatorName = Creator?.UserName; //创建人姓名 e.CreatorESign = Creator?.ESign; //创建人电子签名 }); int curpage = 0, limit = 3; int.TryParse(Request["page"], out curpage); int.TryParse(Request["limit"], out limit); var myskip = curpage > 0 ? limit * (curpage - 1) : 0; return new WebApi_Result() { data = list.Skip(myskip).Take(limit), count = list.Count }; })); }
/// <summary> /// 增加和保存 /// </summary> /// <param name="entity"></param> public void SaveInfo(GI_UserInfo entity) { string[] dpetlist = new string[] { }; //科室 string[] inpatientlist = new string[] { }; //病区 string[] medicallist = new string[] { }; //医疗组 //科室 if (!string.IsNullOrWhiteSpace(entity.DpetID)) { dpetlist = entity.DpetID.Split(','); entity.DpetID = dpetlist[0];//默认科室 } //病区 if (!string.IsNullOrWhiteSpace(entity.InpatientID)) { inpatientlist = entity.InpatientID.Split(','); entity.InpatientID = inpatientlist[0];//默认病区 } //医疗组 if (!string.IsNullOrWhiteSpace(entity.MedicalID)) { medicallist = entity.MedicalID.Split(','); entity.MedicalID = medicallist[0];//默认医疗组 } //状态为正常 entity.IsCance = 0; //保存或修改 if (!string.IsNullOrWhiteSpace(entity.UserID) && entity.UserID != "null") { entity.UpdateM("UserID"); } else { entity.UserID = CommonService.GetPrimaryId(new GI_SerialInfo() { Name = "GI_UserInfo", ColumnName = "UserID", OrganID = entity.OrganID }) + ""; entity.SaveModelM(); } #region 科室,病区关联 //删除用户关联科室,重新关联 EntityOperate <AI_UserDept> .DeleteByFilter(" UserID='" + entity.UserID + "' "); //添加科室关联 for (int i = 0; i < dpetlist.Length; i++) { AI_UserDept userdept = new AI_UserDept() { UserID = entity.UserID, DeptID = dpetlist[i], TypeCode = 1, DisplaySort = i }; userdept.SaveModelM(); } //添加病区关联 for (int i = 0; i < inpatientlist.Length; i++) { AI_UserDept userdept = new AI_UserDept() { UserID = entity.UserID, DeptID = inpatientlist[i], TypeCode = 2, DisplaySort = i }; userdept.SaveModelM(); } #endregion #region 医疗组 //获得该用户的医疗组 DoctorGroupService doctorgroupService = new DoctorGroupService(); List <AI_DoctorGroup> userDoctorGroupList = doctorgroupService.GetDoctorGroupByUserId(entity.UserID); string[] userDoctorGroup = (from u in userDoctorGroupList select u.DoctorGroupId).ToArray(); foreach (var item in userDoctorGroup) { if (!((IList <string>)medicallist).Contains(item)) { //保存的医疗组中不包含该医疗组对照表中-删除对照表中的信息 EntityOperate <AI_GroupMember> .DeleteByFilter(" DoctorGroupId='" + item + "' and Member='" + entity.UserID + "' "); } } foreach (var item in medicallist) { if (!((IList <string>)userDoctorGroup).Contains(item)) { //数据库中的医疗组对照表不包含该医疗组id-添加对照 AI_GroupMember groupMember = new AI_GroupMember() { DoctorGroupId = item, Member = entity.UserID, MemberNum = entity.UserCode, MemberName = entity.UserName, Creator = entity.ModifyUserID, CreateTime = entity.ModifyTime, Updater = entity.ModifyUserID, UpdateTime = entity.ModifyTime }; groupMember.MemberId = CommonService.GetPrimaryId(new GI_SerialInfo() { Name = "AI_GroupMember", ColumnName = "MemberId", OrganID = entity.OrganID }) + ""; groupMember.SaveModelM(); } } #endregion }