/// <summary> /// 随访记录-保存 /// </summary> /// <param name="tnbRecord"></param> /// <param name="tnbSf"></param> /// <param name="sfData"></param> /// <param name="sfId"></param> /// <returns></returns> public int SaveTnbSfRecord(EntityTnbRecord tnbRecord, EntityTnbSf tnbSf, EntityTnbSfData sfData, out decimal sfId) { using (Biz205 biz = new Biz205()) { return(biz.SaveTnbSfRecord(tnbRecord, tnbSf, sfData, out sfId)); } }
/// <summary> /// ctor /// </summary> public frmPopup2050201(EntityTnbSf _sfVo) { InitializeComponent(); this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; if (!DesignMode) { this.lueSfOper.LookAndFeel.UseDefaultLookAndFeel = false; this.lueSfOper.LookAndFeel.SkinName = "Black"; this.lueSfRecorder.LookAndFeel.UseDefaultLookAndFeel = false; this.lueSfRecorder.LookAndFeel.SkinName = "Black"; this.tnbSf = _sfVo; } }
/// <summary> /// 随访记录-保存 /// </summary> /// <param name="sfData"></param> /// <param name="sfId"></param> /// <returns></returns> public int SaveTnbSfRecord(EntityTnbRecord tnbRecord, EntityTnbSf tnbSf, EntityTnbSfData sfData, out decimal sfId) { int affectRows = 0; sfId = 0; string Sql = string.Empty; SqlHelper svc = null; decimal id = 0; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); if (tnbSf.sfId <= 0) { id = svc.GetNextID("tnbSf", "sfId"); tnbSf.sfId = id; tnbSf.sfStatus = 1; tnbSf.recordDate = DateTime.Now; tnbRecord.sfId = id; tnbRecord.sfTimes += 1; sfData.sfId = id; lstParm.Add(svc.GetInsertParm(tnbSf)); } else { id = tnbSf.sfId; lstParm.Add(svc.GetUpdateParm(tnbSf, new List <string> { EntityTnbSf.Columns.sfMethod, EntityTnbSf.Columns.sfClass, EntityTnbSf.Columns.sfDate }, new List <string> { EntityTnbSf.Columns.sfId })); } //随访数据 lstParm.Add(svc.GetDelParm(sfData, EntityTnbSfData.Columns.sfId)); lstParm.Add(svc.GetInsertParm(sfData)); if (tnbRecord.sfTimes > 0) { //高血压下次随访数据 string sql = @"update tnbRecord set manageLevel = ?, nextSfDate = ?, sfId = ?,sfTimes = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(5); param[0].Value = tnbRecord.manageLevel; param[1].Value = tnbRecord.nextSfDate; param[2].Value = tnbRecord.sfId; param[3].Value = tnbRecord.sfTimes; param[4].Value = tnbRecord.recId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } else { //高血压下次随访数据 string sql = @"update tnbRecord set manageLevel = ?, nextSfDate = ?, sfId = ? where recId = ?"; IDataParameter[] param = svc.CreateParm(4); param[0].Value = tnbRecord.manageLevel; param[1].Value = tnbRecord.nextSfDate; param[2].Value = tnbRecord.sfId; param[3].Value = tnbRecord.recId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param)); } if (lstParm.Count > 0) { affectRows = svc.Commit(lstParm); } sfId = id; } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <summary> /// 随访记录-获取 /// </summary> /// <param name="parms"></param> /// <returns></returns> public List <EntityTnbSf> GetTnbSfRecords(List <EntityParm> parms) { List <EntityTnbSf> data = null; SqlHelper svc = new SqlHelper(EnumBiz.onlineDB); string Sql = string.Empty; Sql = @" select a.recId, b.clientNo, b.clientName, b.gender, b.birthday, b.gradeName, a.sfId, a.sfDate, a.sfMethod, a.sfClass, e.xmlData, d.oper_name as sfRecorder from tnbSf a left join tnbRecord c on a.recId = c.recId inner join V_ClientInfo b on c.clientNo = b.clientNo and c.regTimes = b.regTimes left join tnbSfData e on a.sfId = e.sfId left join code_operator d on a.sfRecorder = d.oper_code where a.sfStatus = 1"; DataTable dt = svc.GetDataTable(Sql); if (dt != null && dt.Rows.Count > 0) { data = new List <EntityTnbSf>(); EntityTnbSf vo = null; foreach (DataRow dr in dt.Rows) { vo = new EntityTnbSf(); vo.recId = Function.Dec(dr["recId"]); vo.sfId = Function.Int(dr["sfId"]); vo.sfDateStr = dr["sfDate"] == DBNull.Value ? "" : Function.Datetime(dr["sfDate"]).ToString("yyyy-MM-dd HH:mm"); Function.SetClientInfo(ref vo, dr); int sfMethod = Function.Int(dr["sfMethod"]); if (sfMethod == 1) { vo.sfMethod = "上门"; } if (sfMethod == 2) { vo.sfMethod = "电话"; } if (sfMethod == 3) { vo.sfMethod = "门诊"; } vo.sfClass = (dr["sfClass"].ToString() == "01" ? "普通" : "其他"); vo.sfData = dr["xmlData"].ToString(); vo.sfRecorder = dr["sfRecorder"].ToString(); data.Add(vo); } } return(data); }
/// <summary> /// SaveData /// </summary> /// <returns></returns> void SaveData() { if (tnbSf == null) { tnbSf = new EntityTnbSf(); tnbSf.recId = tnbRecord.recId; } if (tnbRecord == null) { tnbRecord = new EntityTnbRecord(); tnbRecord.recId = tnbSf.recId; } tnbSf.sfDate = Function.Datetime(dteSfDate.Text); tnbSf.sfMethod = string.Empty; tnbSf.sfClass = string.Empty; tnbRecord.manageLevel = string.Empty; if (chkSffs01.Checked == true) { tnbSf.sfMethod = "1"; } if (chkSffs02.Checked == true) { tnbSf.sfMethod = "2"; } if (chkSffs03.Checked == true) { tnbSf.sfClass = "3"; } if (chkSfClass01.Checked == true) { tnbSf.sfClass = "1"; } if (chkSfClass02.Checked == true) { tnbSf.sfClass = "2"; } if (chkSfClass03.Checked == true) { tnbSf.sfClass = "3"; } if (chkSfClass04.Checked == true) { tnbSf.sfClass = "4"; } if (chkManageLevel01.Checked == true) { tnbRecord.manageLevel = "1"; } if (chkManageLevel02.Checked == true) { tnbRecord.manageLevel = "2"; } if (chkManageLevel03.Checked == true) { tnbRecord.manageLevel = "3"; } if (string.IsNullOrEmpty(tnbSf.sfMethod)) { DialogBox.Msg("随访形式必选 !"); return; } if (string.IsNullOrEmpty(tnbSf.sfClass)) { DialogBox.Msg("随访分类必选 !"); return; } if (string.IsNullOrEmpty(tnbRecord.manageLevel)) { DialogBox.Msg("管理等级必选 !"); return; } tnbSf.sfRecorder = this.lueSfRecorder.EditValue.ToString(); tnbSf.sfStatus = 1; if (this.sfData == null) { this.sfData = new EntityTnbSfData(); } this.sfData.sfId = tnbSf.sfId; this.sfData.xmlData = this.GetData(); if (!string.IsNullOrEmpty(dteNextSfDate.Text)) { tnbRecord.nextSfDate = Function.Datetime(dteNextSfDate.Text); } decimal sfId = 0; bool isNew = this.sfData.sfId <= 0 ? true : false; using (ProxyHms proxy = new ProxyHms()) { if (proxy.Service.SaveTnbSfRecord(this.tnbRecord, this.tnbSf, this.sfData, out sfId) > 0) { this.IsRequireRefresh = true; if (isNew) { this.tnbSf.sfId = sfId; this.sfData.sfId = sfId; this.tnbRecord.sfId = sfId; } DialogBox.Msg("保存成功!"); } else { DialogBox.Msg("保存失败。"); } } }