//判断是否允许延期,不超过延期限制次数,查询审核通过的管理记录数 public static int IsCanDelay(WriteUpObject applyObject, int times) { try { //获取被延期记录是否也是延期记录,是获取记录的申请ID string delayid = WriteUpObject.GetApplyDelayId(applyObject.m_sApply); if (delayid == null || delayid.Equals("")) { return(1); } else { string sql = " select id from EMR_RECORDWRITEUP where yanqiflag = '" + delayid + "'" + " and status in(2,5) " + " and applydocid = '" + applyObject.m_sApplyDocId + "'"; DataSet data = DrectSoft.DSSqlHelper.DS_SqlHelper.ExecuteDataSet(sql); if (data.Tables[0].Rows.Count < times) { return(1); } else { return(0); } } } catch (Exception) { throw; } }
//延期操作:创建新的申请记录,并保存延期的原有申请ID public static int Delay(WriteUpObject applyObject) { try { //将原有补写申请剩余的期限加上 int i = WriteUpObject.GetDelayedApplyTimesResidue(applyObject.m_sApply); applyObject.m_iApplyTimes = applyObject.m_iApplyTimes + i; //原有记录存在延期申请, string delayid = WriteUpObject.GetApplyDelayId(applyObject.m_sApply); if (delayid == null || delayid.Equals("")) { delayid = applyObject.m_sApply; } string sql = @"insert into EMR_RECORDWRITEUP(noofinpat,applydocid,applycontent,applytimes, status,yanqiflag) values(@nOofinpat,@applydocid, @applycontent,@applytimes,@applystatus,@yanqiflag)"; SqlParameter[] sps = { new SqlParameter("@nOofinpat", applyObject == null | applyObject.m_sNoOfInpat == null?"":applyObject.m_sNoOfInpat), new SqlParameter("@applydocid", applyObject == null | applyObject.m_sApplyDocId == null?"":applyObject.m_sApplyDocId), new SqlParameter("@applycontent", applyObject == null | applyObject.m_sApplyContent == null?"":applyObject.m_sApplyContent), new SqlParameter("@applytimes", applyObject == null?0:applyObject.m_iApplyTimes), new SqlParameter("@applystatus", applyObject.m_iStatus.ToString()), new SqlParameter("@yanqiflag", delayid) }; DrectSoft.DSSqlHelper.DS_SqlHelper.ExecuteNonQuery(sql, sps, CommandType.Text); //原有补写申请状态设置/ return(1); } catch (Exception) { throw; } }