/// <summary> /// 检查病人当前科室与医生科室(包含权限科室)是否一致 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-01</date> /// <param name="noofinpat">首页序号</param> /// <returns></returns> private string CheckIfCurrentDept(int noofinpat) { try { DataTable inpDt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (null == inpDt || inpDt.Rows.Count == 0) { return("该病人不存在,请刷新数据重试。"); } string dept = null == inpDt.Rows[0]["outhosdept"] ? "" : inpDt.Rows[0]["outhosdept"].ToString().Trim(); if (dept != DS_Common.currentUser.CurrentDeptId) {//该病人已转科 if (string.IsNullOrEmpty(dept.Trim())) { return("该病人所属科室异常,请联系管理员。"); } string deptName = DS_BaseService.GetDeptNameByID(dept); List <string[]> list = DS_BaseService.GetDeptAndWardInRight(DS_Common.currentUser.Id); if (null != list && list.Count > 0 && list.Any(p => p[0] == dept)) {//转科后科室在医生权限范围内 return("该病人已转至 " + deptName + "(" + dept + ")" + ",请切换科室。"); } else { return("该病人已转至 " + deptName + "(" + dept + ")" + ",您无权操作。"); } } return(string.Empty); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 根据登陆人科室权限查询未归档病人 /// </summary> /// <param name="userid"></param> /// <returns></returns> public static string GetAllUnRebackRecordsByDeptRights(string userid) { try { if (string.IsNullOrEmpty(userid)) { return(""); } string deptStr = string.Empty; if (userid != "00") { List <string[]> list = DS_BaseService.GetDeptAndWardInRight(userid); if (null != list && list.Count() > 0) { deptStr = DS_Common.CombineSQLStringByList(list.Select(p => p[0]).ToList()); } } //修改语句 更据病人表查询未归档病人 无需更据病历表 string sqlStr = @"select distinct a.patid, a.noofinpat, a.NAME patname, a.PY, a.WB, a.sexid sex,a.agestr, b.NAME sexname, a.outbed bedid, trim(c.Name) admitdeptname, trim(d.name) outdeptname, substr(a.admitdate, 1, 16) as admitdate,substr(a.inwarddate, 1, 16) as inwarddate from inpatient a LEFT JOIN inpatientchangeinfo i on i.noofinpat = a.noofinpat LEFT JOIN dictionary_detail b ON b.detailid = a.sexid and b.categoryid = '3' LEFT JOIN department c ON a.admitdept = c.id LEFT JOIN department d ON a.outhosdept = d.id where (a.islock=4700 or a.islock=4702 or a.islock is null) "; deptStr = string.IsNullOrEmpty(deptStr) ? ("'" + DS_Common.currentUser.CurrentDeptId + "'") : deptStr; List <string> jobList = DS_BaseService.GetRolesByUserID(userid); if (null == jobList || jobList.Count() == 0 || (!jobList.Contains("66") && !jobList.Contains("111"))) { sqlStr += " and (i.newdeptid in(" + deptStr + ") or a.outhosdept in(" + deptStr + ")) ";// " and a.outhosdept in(" + (string.IsNullOrEmpty(deptStr) ? YD_Common.currentUser.CurrentDeptId : deptStr) + ") "; } sqlStr += " order by admitdeptname asc,admitdate desc,inwarddate desc "; return(sqlStr); } catch (Exception ex) { throw new Exception("GetAllUnRebackRecordsByDeptRights" + ex.Message); } }