/// <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> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { MethodSet.SaveStateData(SetEntityByPage(), "3"); MethodSet.App.CustomMessageBox.MessageShow("删除成功!"); RefreshData(); } catch (Exception) { MethodSet.App.CustomMessageBox.MessageShow("删除失败!"); } }
/// <summary> /// 删除操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.dateEdit.Text) || string.IsNullOrEmpty(this.lookUpState.CodeValue)) { MethodSet.App.CustomMessageBox.MessageShow("请选择要删除的状态"); return; } MethodSet.SaveStateData(SetEntityByPage(), "3"); MessageBox.Show("删除成功!"); RefreshData(); } catch (Exception) { MessageBox.Show("删除失败!"); } }
/// <summary> /// 保存 /// </summary> /// <returns></returns> private bool SaveData(PatStateEntity patStateEnt) { try { string edittype = ""; if (m_EditState == EditState.Add) { edittype = "1"; } else { edittype = "2"; } MethodSet.SaveStateData(patStateEnt, edittype); return(true); } catch (Exception e) { return(false); } }
/// <summary> /// 删除操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.dateEdit.Text) || string.IsNullOrEmpty(this.lookUpState.CodeValue)) { MethodSet.App.CustomMessageBox.MessageShow("请选择一条状态记录"); return; } //edit by cyq 2012-11-02 删除确认 if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定删除状态 " + this.lookUpState.Text.Trim() + " 吗?", "", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } MethodSet.SaveStateData(SetEntityByPage(), "3"); MethodSet.App.CustomMessageBox.MessageShow("删除成功"); RefreshData(); } catch (Exception) { MethodSet.App.CustomMessageBox.MessageShow("删除失败"); } }
/// <summary> /// 保存 /// </summary> /// <returns></returns> private bool SaveData(PatStateEntity patStateEnt) { try { string edittype = ""; if (m_EditState == EditState.Add) { edittype = "1"; } else { edittype = "2"; } #region "段位順移(更新数据库的时间-后移一个段位) - 已弃用" /// <summary> /// 新增(或者修改)病人状态记录时,如果同时存在'入院'和'出院'记录且为同一时间段位时, /// 则将出院状态改至下一个时间段位 /// </summary> //if (edittype == "1") //{ // if (patStateEnt.CCODE == "7003") // {//出院 // if (CheckPatiStateDiv(null)) // { // patStateEnt.DOTIME = GetNextPointDatetime(DateTime.Parse(patStateEnt.DOTIME)).ToString("yyyy-MM-dd HH:mm"); // } // } // else if (patStateEnt.CCODE == "7008") // {//入院 // if (CheckPatiStateDiv(null)) // { // UpdateToNextTimeDiv(null, patStateEnt.PATID, patStateEnt.DOTIME); // } // } //} //else //{ // if (patStateEnt.CCODE == "7003") // { // if (CheckPatiStateDiv(patStateEnt.ID)) // { // patStateEnt.DOTIME = GetNextPointDatetime(DateTime.Parse(patStateEnt.DOTIME)).ToString("yyyy-MM-dd HH:mm"); // } // } // else if (patStateEnt.CCODE == "7008") // { // if (CheckPatiStateDiv(patStateEnt.ID)) // { // UpdateToNextTimeDiv(patStateEnt.ID, patStateEnt.PATID, patStateEnt.DOTIME); // } // } //} #endregion MethodSet.SaveStateData(patStateEnt, edittype); return(true); } catch (Exception e) { return(false); } }