/// <summary> /// 将数据表中与此对象同一段位的'出院'状态更新至下一个段位 /// </summary> /// <param name="id">排除项</param> /// <param name="patID">首页序号</param> /// <param name="dtime">时间:yyyy-MM-dd HH:mm</param> public void UpdateToNextTimeDiv(string id, string patID, string dtime) { DataTable dtState = MethodSet.GetStatesByNoPatID(patID); string sqlWhere = " 1=1 "; if (!string.IsNullOrEmpty(id)) { sqlWhere += " and id not in(" + id + ") "; } DataRow[] drows = dtState.Select(sqlWhere + " and ccode = '7003' and dotime like '%" + DateTime.Parse(dtime).ToString("yyyy-MM-dd") + "%'"); if (drows.Length > 0) { PatientInfo pinfo = new PatientInfo(); foreach (DataRow dr in drows) { PatStateEntity entity = new PatStateEntity(); entity.ID = dr["id"].ToString(); entity.NOOFINPAT = dr["noofinpat"].ToString(); entity.CCODE = dr["ccode"].ToString(); entity.PATID = dr["patid"].ToString(); //判断是否在同一段位 DataTable timePoints = PublicSet.MethodSet.GetTimePoint(); if (pinfo.CompareTimePoint(timePoints, DateTime.Parse(dr["dotime"].ToString()), DateTime.Parse(dtime))) { entity.DOTIME = GetNextPointDatetime(DateTime.Parse(dr["dotime"].ToString())).ToString("yyyy-MM-dd HH:mm"); MethodSet.SaveStateData(entity, "2"); } } } }
/// <summary> /// 判断是否存在同一时间段位的'入院'和'出院'记录 /// </summary> /// author:cyq /// date:2012-08-16 /// <param name="id">id:null-新增;不为null:修改</param> /// <returns></returns> public bool CheckPatiStateDiv(string id) { bool boo = false; DataTable dtState = MethodSet.GetStatesByNoPatID(NoOfinPat); //DataTable dtState = MethodSet.GetStatesByNoPatID(m_currInpatient.Code.ToString()); DateTime dtime = DateTime.Parse(this.dateEdit.DateTime.ToString("yyyy-MM-dd ") + this.txtTime.Text); DataTable timePoints = PublicSet.MethodSet.GetTimePoint(); PatientInfo pinfo = new PatientInfo(); string sqlWhere = " 1=1 "; if (!string.IsNullOrEmpty(id)) { sqlWhere += " and id not in(" + id + ") "; } if (this.lookUpState.CodeValue == "7003") { DataRow[] drState1 = dtState.Select(sqlWhere + " and ccode=7008 "); if (drState1.Length > 0) { foreach (DataRow dr in drState1) { if (pinfo.CompareTimePoint(timePoints, DateTime.Parse(dr["dotime"].ToString()), dtime) == true) { boo = true; break; } } } } else if (this.lookUpState.CodeValue == "7008") { DataRow[] drState2 = dtState.Select(sqlWhere + " and ccode=7003 "); if (drState2.Length > 0) { foreach (DataRow dr in drState2) { if (pinfo.CompareTimePoint(timePoints, DateTime.Parse(dr["dotime"].ToString()), dtime) == true) { boo = true; break; } } } } return(boo); }