/// <summary> /// 获取方案实例 /// </summary> /// <param name="FollowId"></param> private void IniData(string FollowId) { /* * 加载出当前,所选择方案的所有信息 */ DataSet dsTempInfo = App.GetDataSet("select * from t_follow_info where id=" + FollowId + ""); Class_FollowInfo info = new Class_FollowInfo(); info.Id = dsTempInfo.Tables[0].Rows[0]["id"].ToString(); info.Follow_name = dsTempInfo.Tables[0].Rows[0]["Follow_name"].ToString(); info.Section_ids = dsTempInfo.Tables[0].Rows[0]["Section_ids"].ToString(); info.Section_names = dsTempInfo.Tables[0].Rows[0]["Section_names"].ToString(); info.Icd9codes = dsTempInfo.Tables[0].Rows[0]["Icd9codes"].ToString(); info.Icd10codes = dsTempInfo.Tables[0].Rows[0]["Icd10codes"].ToString(); info.Ismaindiag = dsTempInfo.Tables[0].Rows[0]["Ismaindiag"].ToString(); info.Followtype = dsTempInfo.Tables[0].Rows[0]["Followtype"].ToString(); info.Defaultdays = dsTempInfo.Tables[0].Rows[0]["Defaultdays"].ToString(); info.Definefollows = dsTempInfo.Tables[0].Rows[0]["Definefollows"].ToString(); info.Createtime = dsTempInfo.Tables[0].Rows[0]["Createtime"].ToString(); info.Exec_sections = dsTempInfo.Tables[0].Rows[0]["Exec_sections"].ToString(); info.Exec_secnames = dsTempInfo.Tables[0].Rows[0]["Exec_secnames"].ToString(); info.Exec_sickarea = dsTempInfo.Tables[0].Rows[0]["Exec_sickarea"].ToString(); info.Exec_sickareanames = dsTempInfo.Tables[0].Rows[0]["Exec_sickareanames"].ToString(); info.FinishType = dsTempInfo.Tables[0].Rows[0]["FinishType"].ToString(); info.Isenable = dsTempInfo.Tables[0].Rows[0]["Isenable"].ToString(); info.Startingtime = dsTempInfo.Tables[0].Rows[0]["Startingtime"].ToString(); info.Followtextid = dsTempInfo.Tables[0].Rows[0]["followtextid"].ToString(); IniControls(info); }
/// <summary> /// 实例化方案 /// </summary> /// <param name="temp"></param> /// <returns></returns> public Class_FollowInfo[] GetInfo(DataSet temp) { if (temp != null) { if (temp.Tables[0].Rows.Count != 0) { DataTable dt = temp.Tables[0]; Class_FollowInfo[] info = new Class_FollowInfo[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { info[i] = new Class_FollowInfo(); info[i].Id = dt.Rows[i]["id"].ToString(); info[i].Follow_name = dt.Rows[i]["follow_name"].ToString(); info[i].Section_ids = dt.Rows[i]["section_ids"].ToString(); info[i].Icd9codes = dt.Rows[i]["icd9codes"].ToString(); info[i].Icd10codes = dt.Rows[i]["icd10codes"].ToString(); info[i].Ismaindiag = dt.Rows[i]["ismaindiag"].ToString(); info[i].Startingtime = dt.Rows[i]["startingtime"].ToString(); info[i].Defaultdays = dt.Rows[i]["defaultdays"].ToString(); info[i].Followtype = dt.Rows[i]["followtype"].ToString(); info[i].Definefollows = dt.Rows[i]["definefollows"].ToString(); info[i].Followtextid = dt.Rows[i]["followtextid"].ToString(); info[i].Createtime = dt.Rows[i]["createtime"].ToString(); info[i].Isenable = dt.Rows[i]["isenable"].ToString(); info[i].Maintain_section = dt.Rows[i]["maintain_section"].ToString(); info[i].FinishType = dt.Rows[i]["finishType"].ToString(); } return(info); } } return(null); }
/// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, EventArgs e) { DateTime myTime = App.GetSystemTime(); string stateTime = myTime.ToShortDateString(); myTime = myTime.AddDays(1); string endTime = myTime.ToShortDateString(); string temp = "select '' 序号,c.follow_name 随访方案,a.pid 住院号,a.id 病人号,a.patient_name 病人姓名,a.age||a.age_unit 年龄,a.sick_doctor_id 管床医生号,a.sick_doctor_name 管床医生,section_id 科室号,section_name 科室,(select name from COVER_DIAGNOSE c where c.patient_id=a.id and rownum=1 and c.type='M') 诊断,(select count(*) from T_FOLLOW_RECORD where patient_id=b.patient_id and solution_id=b.solution_id and isfinished=1) 随访次数 ,d.des 随访状态,a.now_addres_phone 电话,a.now_address 地址 ,c.id 方案号 from T_FOLLOW_RECORD b join T_IN_PATIENT a on a.id=b.patient_id join T_FOLLOW_INFO c on b.solution_id=c.id join T_FOLLOW_STATE d on b.state_id=d.id join T_FOLLOW_DOC_ATTACH da on b.id=da.record_id where da.finish_time between to_date('" + stateTime + "','yyyy-MM-dd') and to_date('" + endTime + "','yyyy-MM-dd') "; if (cmbFollowInfo.Text != "") { Class_FollowInfo info = cmbFollowInfo.SelectedItem as Class_FollowInfo; temp += " and b.solution_id=" + info.Id + ""; } if (txtPatientName.Text.Trim() != "") { temp += " and a.patient_name='" + txtPatientName.Text.Trim() + "'"; } if (txtHospital.Text.Trim() != "") { temp += " and a.pid like '%" + txtHospital.Text.Trim() + "%'"; } if (DoctorId != "") { temp += " and a.sick_doctor_id=" + DoctorId + ""; } if (cmbSection.Text != "") { temp += " and a.section_id =" + cmbSection.SelectedValue.ToString() + ""; } DataSet dsTemp = App.GetDataSet(temp); if (dsTemp != null) { if (dsTemp.Tables[0].Rows.Count != 0) { dgvPatients.DataSource = dsTemp.Tables[0].DefaultView; dgvPatients.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; dgvPatients.Columns["管床医生号"].Visible = false; dgvPatients.Columns["科室号"].Visible = false; dgvPatients.Columns["方案号"].Visible = false; for (int i = 0; i < dgvPatients.Rows.Count; i++) { dgvPatients.Rows[i].Cells["序号"].Value = i + 1; } dgvPatients.ReadOnly = true; } else { dgvPatients.DataSource = null; } } else { dgvPatients.DataSource = null; } }
public frmFollowDelete(string param1, Class_FollowInfo param2, ucFollowVisite param3) { InitializeComponent(); Sid = param2.Id; info = param2; Pid = param1; parent2 = param3; IniState(); }
/// <summary> /// 控件初始化 /// </summary> public void IniControls() { Info = new Class_FollowInfo(); PreVisit = App.ReadSqlVal("select count(*) times from T_FOLLOW_RECORD where patient_id=(select patient_id from T_FOLLOW_RECORD where id=" + recordId + ") and solution_id =(select solution_id from T_FOLLOW_RECORD where id=" + recordId + ") and id<" + recordId + "", 0, "times"); string RelatedSchema = "select * from T_FOLLOW_INFO where id =(select solution_id from T_FOLLOW_RECORD where id=" + recordId + ")"; DataSet temp = App.GetDataSet(RelatedSchema); if (temp.Tables[0].Rows.Count != 0) { Info.Id = temp.Tables[0].Rows[0]["ID"].ToString(); Info.Defaultdays = temp.Tables[0].Rows[0]["Defaultdays"].ToString(); Info.Definefollows = temp.Tables[0].Rows[0]["Definefollows"].ToString(); Info.Followtype = temp.Tables[0].Rows[0]["Followtype"].ToString(); Info.FinishType = temp.Tables[0].Rows[0]["FinishType"].ToString(); } string isfinished = App.ReadSqlVal("select id from T_FOLLOW_RECORD where id=" + recordId + " and isfinished=1", 0, "id"); if (isfinished != null && isfinished != "") { btnAdd.Enabled = false; } else { btnAdd.Enabled = true; } string isLast = App.ReadSqlVal("select id from t_follow_record where id >" + recordId + " and patient_id=" + pId + " and solution_id =" + sId + "", 0, "id"); if (isLast != null && isLast != "") { grpNextTimeSet.Enabled = false; } else { grpNextTimeSet.Enabled = true; } if (Info.FinishType != "") { if (Info.FinishType.IndexOf("次") != -1) { if (Convert.ToInt32(PreVisit) == (Convert.ToInt32(Info.FinishType.Substring(0, Info.FinishType.IndexOf("次"))) - 1)) { App.Msg("已是最后一次,无法指定"); grpNextTimeSet.Enabled = false; } } else { DateTime Now = DateTime.Today; int TimeSpan = 0; if (Info.FinishType.IndexOf("年") != -1) { TimeSpan = Convert.ToInt32(Info.FinishType.Substring(0, Info.FinishType.IndexOf("年"))) * 365; } if (Info.FinishType.IndexOf("月") != -1) { TimeSpan = Convert.ToInt32(Info.FinishType.Substring(0, Info.FinishType.IndexOf("月"))) * 30; } if (Info.FinishType.IndexOf("天") != -1) { TimeSpan = Convert.ToInt32(Info.FinishType.Substring(0, Info.FinishType.IndexOf("天"))); } if ((int)(Now - Convert.ToDateTime(lTime)).TotalDays > TimeSpan) { App.Msg("已是最后一次,无法指定"); grpNextTimeSet.Enabled = false; } } } txtUser.Text = App.UserAccount.UserInfo.User_name; txtRemark.Text = ""; rbtnOrigin.Checked = true; btnSave.Enabled = false; btnCancel.Enabled = false; btnUpdate.Enabled = false; }
/// <summary> /// 根据方案管理者ID,生成记录包括完成与未完成的(按循环条件) /// </summary> public void Procedure() { if (myRow != null) { string quryRec = "select * from T_FOLLOW_RECORD where patient_id=" + pid + " and solution_id=" + sid + " order by id"; DataTable recTb = App.GetDataSet(quryRec).Tables[0]; myRec = GetRecords(recTb); } string uid = App.UserAccount.UserInfo.User_id; string tempSql; if (sid != "") { tempSql = "select * from T_FOLLOW_INFO where id =" + sid + ""; DataSet dsTemp = App.GetDataSet(tempSql); myInfo = GetInfo(dsTemp); } //全部插入,然后遍历现有Record表去除已有的记录 ArrayList Batch = new ArrayList(); Batch.Clear(); Class_FollowInfo info = myInfo[0]; //参考时间默认为出院时间 DateTime myTime = Convert.ToDateTime(myRow.Cells["参考时间"].Value.ToString()); string sql = ""; try { //先考虑是否为手动控制启用病人 string Manual = App.ReadSqlVal("select * from T_FOLLOW_MANUALPATIENT where patient_id=" + pid + " and solution_id=" + info.Id + " and isadd=1 ", 0, "definefollows"); #region Manual if (Manual != "" && Manual != null) { string ExistRecord = App.ReadSqlVal("select max(requested_time) 完成时间 from T_FOLLOW_RECORD where patient_id=" + pid + " and solution_id=" + info.Id + " ", 0, "完成时间"); DateTime NowTime = App.GetSystemTime().Date; DateTime RefTime = Convert.ToDateTime(myRow.Cells["参考时间"].Value.ToString()); DateTime RecordTime; if (ExistRecord != "") { RecordTime = Convert.ToDateTime(ExistRecord); } else { RecordTime = RefTime; } TimeSpan tSpan1 = RecordTime - RefTime; TimeSpan tSpan2 = NowTime - RecordTime; int MinusTime1 = (int)tSpan1.TotalDays; int MinusTime2 = (int)tSpan2.TotalDays; if (Manual.IndexOf(",") != -1) { string[] Items = Manual.Split(','); for (int i = 0; i < Items.Length; i++) { string Span = Items[i]; if (MinusTime2 < 0) { break; } if (Span.IndexOf("年") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("年"))) * 365; } else { MinusTime2 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("年"))) * 365; RecordTime = RecordTime.AddYears(Convert.ToInt32(Span.Substring(0, Span.IndexOf("年")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",'" + RecordTime.ToShortDateString() + "')"; Batch.Add(sql); } } } if (Span.IndexOf("月") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("月"))) * 30; } else { MinusTime2 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("月"))) * 30; RecordTime = RecordTime.AddMonths(Convert.ToInt32(Span.Substring(0, Span.IndexOf("月")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",'" + RecordTime.ToShortDateString() + "')"; Batch.Add(sql); } } } if (Span.IndexOf("天") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("天"))); } else { MinusTime2 -= Convert.ToInt32(Span.Substring(0, Span.IndexOf("天"))); RecordTime = RecordTime.AddDays(Convert.ToInt32(Span.Substring(0, Span.IndexOf("天")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",'" + RecordTime.ToShortDateString() + "')"; Batch.Add(sql); } } } if (i == Items.Length - 1) { i--; } } } else { while (true) { if (MinusTime2 < 0) { break; } if (Manual.IndexOf("年") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("年"))) * 365; } else { MinusTime2 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("年"))) * 365; RecordTime = RecordTime.AddYears(Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("年")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); } } } if (Manual.IndexOf("月") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("月"))) * 30; } else { MinusTime2 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("月"))) * 30; RecordTime = RecordTime.AddMonths(Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("月")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); } } } if (Manual.IndexOf("天") != -1) { if (MinusTime1 > 0) { MinusTime1 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("天"))); } else { MinusTime2 -= Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("天"))); RecordTime = RecordTime.AddDays(Convert.ToInt32(Manual.Substring(0, Manual.IndexOf("天")))); if (MinusTime2 >= 0) { sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); } } } } } } #endregion /**************************************************************************************************************************************************************************************/ /***************************************************************************************完成手动添加病人的记录插入***********************************************************************************************/ #region Auto else { string ExistRecord = ""; int ExistTimes = 0; //计数用来查看是否超过方案规定次数 int TimesCount = 0; //计数当前已生成记录 DateTime NowTime = DateTime.Today; DateTime RefTime = Convert.ToDateTime(myRow.Cells["参考时间"].Value.ToString()); DateTime RecordTime; //判断是否已存在记录,若已存在则时间点以当前最大应随访时间开始计算 if (myRec != null) { ExistRecord = myRec[myRec.Length - 1].Requested_time; ExistTimes = TimesCount = myRec.Length; RecordTime = Convert.ToDateTime(ExistRecord); } else { RecordTime = RefTime; if (info.Defaultdays != "0") { RecordTime = RecordTime.AddDays(Convert.ToInt32(info.Defaultdays)); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; } } int MinusTime2 = (int)(NowTime - RecordTime).TotalDays; if (info.Definefollows != "") { string[] Items = info.Definefollows.Split(','); for (int i = 0; i < Items.Length; i++) { if (MinusTime2 < 0) { break; } if (TimesCount != 0) { //若最后一条记录设置了下次随访时间 if (TimesCount == 1) { if (myRec[myRec.Length - 1].Next_time != "") { if (myRec[myRec.Length - 1].Is_timeset == "1") { RecordTime = Convert.ToDateTime(myRec[myRec.Length - 1].Next_time); sql = "insert into t_follow_record(patient_id,solution_id,creator_id,requested_time) values(" + pid + "," + sid + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; } if (myRec[myRec.Length - 1].Is_timeset == "0") { RecordTime = Convert.ToDateTime(myRec[myRec.Length - 1].Next_time); } } MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (i >= Items.Length - 1) { i--; } TimesCount--; continue; } //判断是否符合方案的结束条件 if (info.FinishType != "") { if (info.FinishType.IndexOf("次") != -1) { if (ExistTimes >= Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("次")))) { break; } } else { int span2 = 0; TimeSpan tempSpan = RecordTime - RefTime; span2 = (int)tempSpan.TotalDays + Convert.ToInt32(info.Defaultdays); int span1 = 0; if (info.FinishType.IndexOf("年") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("年"))) * 365; } if (info.FinishType.IndexOf("月") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("月"))) * 30; } if (info.FinishType.IndexOf("天") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("天"))); } if (span1 <= span2) { break; } } } string Span = ""; if (i >= Items.Length) { i = Items.Length - 1; } Span = Items[i]; if (Span.IndexOf("年") != -1) { RecordTime = RecordTime.AddYears(Convert.ToInt32(Span.Substring(0, Span.IndexOf("年")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (Span.IndexOf("月") != -1) { RecordTime = RecordTime.AddMonths(Convert.ToInt32(Span.Substring(0, Span.IndexOf("月")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (Span.IndexOf("天") != -1) { RecordTime = RecordTime.AddDays(Convert.ToInt32(Span.Substring(0, Span.IndexOf("天")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (i >= Items.Length - 1) { i--; } } } else { while (true) { string Span = info.Followtype; if (MinusTime2 < 0) { break; } if (TimesCount != 0) { //若最后一条记录设置了下次随访时间 if (TimesCount == 1) { if (myRec[myRec.Length - 1].Next_time != "") { RecordTime = Convert.ToDateTime(myRec[myRec.Length - 1].Next_time); sql = "insert into t_follow_record(patient_id,solution_id,creator_id,requested_time) values(" + pid + "," + sid + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; } MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } TimesCount--; continue; } if (info.FinishType != "") { if (info.FinishType.IndexOf("次") != -1) { if (ExistTimes >= Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("次")))) { break; } } else { int span2 = 0; TimeSpan tempSpan = RecordTime - RefTime; span2 = (int)tempSpan.TotalDays + Convert.ToInt32(info.Defaultdays); int span1 = 0; if (info.FinishType.IndexOf("年") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("年"))) * 365; } if (info.FinishType.IndexOf("月") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("月"))) * 30; } if (info.FinishType.IndexOf("天") != -1) { span1 = Convert.ToInt32(info.FinishType.Substring(0, info.FinishType.IndexOf("天"))); } if (span1 <= span2) { break; } } } if (info.Followtype.IndexOf("年") != -1) { RecordTime = RecordTime.AddYears(Convert.ToInt32(info.Followtype.Substring(0, info.Followtype.IndexOf("年")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (info.Followtype.IndexOf("月") != -1) { RecordTime = RecordTime.AddMonths(Convert.ToInt32(info.Followtype.Substring(0, info.Followtype.IndexOf("月")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } if (info.Followtype.IndexOf("天") != -1) { RecordTime = RecordTime.AddDays(Convert.ToInt32(info.Followtype.Substring(0, info.Followtype.IndexOf("天")))); sql = "insert into T_FOLLOW_RECORD(PATIENT_ID,SOLUTION_ID,CREATOR_ID,REQUESTED_TIME) VALUES(" + pid + "," + info.Id + "," + App.UserAccount.UserInfo.User_id + ",to_date('" + RecordTime.ToShortDateString() + "','yyyy-MM-dd'))"; Batch.Add(sql); ExistTimes++; MinusTime2 = (int)(NowTime - RecordTime).TotalDays; } } } } #endregion string[] final = new string[Batch.Count]; for (int j = 0; j < Batch.Count; j++) { final[j] = Batch[j].ToString(); } App.ExecuteBatch(final); } catch (Exception ex) { App.MsgErr(ex.Message); } }
/// <summary> /// 加载控件信息 /// </summary> public void IniControls(Class_FollowInfo info) { if (info != null) { txtFollowName.Text = info.Follow_name; //加载相关科室 txtExecSecs.Text = info.Exec_secnames; txtExecSecs.Tag = info.Exec_sections; //加载相关病区 txtExecSickAeras.Text = info.Exec_sickareanames; txtExecSickAeras.Tag = info.Exec_sickarea; //加载病人相关科室 txtSection.Text = info.Section_names; txtSection.Tag = info.Section_ids; //手术 if (icd9codes != "") { DataSet ds_icd9 = App.GetDataSet("select code ,name from oper_def_icd9"); string[] opred = info.Icd9codes.Split(','); string opredname = ""; for (int i = 0; i < opred.Length; i++) { for (int j = 0; j < ds_icd9.Tables[0].Rows.Count; j++) { if (opred[i] == ds_icd9.Tables[0].Rows[j][0].ToString()) { opredname = ds_icd9.Tables[0].Rows[j][1].ToString(); ucICD9.setWidth(ucICD9.Width); ucElement element = new ucElement(opredname, opred[i]); ucICD9.createUser(element); break; } } } } if (info.Icd10codes != "") { DataSet dsIcd10 = App.GetDataSet("select code ,name from diag_def_icd10"); string[] diag = info.Icd10codes.Split(','); string diagName = ""; for (int i = 0; i < diag.Length; i++) { for (int j = 0; j < dsIcd10.Tables[0].Rows.Count; j++) { if (diag[i] == dsIcd10.Tables[0].Rows[j][0].ToString()) { diagName = dsIcd10.Tables[0].Rows[j][1].ToString(); ucICD10.setWidth(ucICD10.Width); ucElement element = new ucElement(diagName, diag[i]); ucICD10.createUser(element); break; } } } } //是否主诊断 if (info.Ismaindiag == "Y") { checkMain.Checked = true; } else { checkMain.Checked = false; } //默认参考时间 cmbStartTime.Text = info.Startingtime; //首次默认时间 txtDefaultDay.Text = info.Defaultdays; //随访方式 if (info.Followtype != "") { grpBoxDefineTime.Enabled = false; int i = 0; foreach (Object ob in cmbFollowTimeType.Items) { DataRowView drv = ob as DataRowView; string value = drv["typename"].ToString(); if (value == info.Followtype) { cmbFollowTimeType.SelectedIndex = i; break; } i++; } } //添加循环方式 else { string times; string[] days = info.Definefollows.Split(','); for (int i = 0; i < days.Length; i++) { int temp = i + 1; times = "第" + temp + "次"; dgvDefineTime.Rows.Add(false, times, days[i]); } } // if (info.FinishType != "") { ckbEnd.Checked = true; panel3.Enabled = true; if (info.FinishType.IndexOf("年") != -1) { rbtnTime.Checked = true; rbtnTimes.Checked = false; txtTime.Text = info.FinishType.Substring(0, info.FinishType.IndexOf("年")); cmbYMD2.Text = "年"; } else if (info.FinishType.IndexOf("月") != -1) { rbtnTime.Checked = true; rbtnTimes.Checked = false; txtTime.Text = info.FinishType.Substring(0, info.FinishType.IndexOf("月")); cmbYMD2.Text = "月"; } else if (info.FinishType.IndexOf("日") != -1) { rbtnTime.Checked = true; rbtnTimes.Checked = false; txtTime.Text = info.FinishType.Substring(0, info.FinishType.IndexOf("日")); cmbYMD2.Text = "日"; } else if (info.FinishType.IndexOf("次") != -1) { rbtnTime.Checked = false; rbtnTimes.Checked = true; txtTimes.Text = info.FinishType.Substring(0, info.FinishType.IndexOf("次")); } } else { panel3.Enabled = false; ckbEnd.Checked = false; } // DataSet ds_texttype = App.GetDataSet("select id,textname from t_follow_text where enable_flag='Y'"); string[] texttypes = info.Followtextid.Split(','); txtFollowType.Tag = info.Followtextid; ///加载文书类型 if (info.Followtextid != "") { for (int i = 0; i < texttypes.Length; i++) { if (texttypes[i] == "") { break; } else { for (int j = 0; j < ds_texttype.Tables[0].Rows.Count; j++) { if (texttypes[i] == ds_texttype.Tables[0].Rows[j][0].ToString()) { if (txtFollowType.Text == "") { txtFollowType.Text = ds_texttype.Tables[0].Rows[j]["textname"].ToString(); } else { txtFollowType.Text += "," + ds_texttype.Tables[0].Rows[j]["textname"].ToString(); } break; } } } } } //是否有效复选框 if (info.Isenable == "Y") { rbtnValid.Checked = true; } else { rbtnVain.Checked = true; } //创建时间 dataTimeCreate.Value = Convert.ToDateTime(info.Createtime); } }