/// <summary> /// 加载时间项目 /// </summary> public void loadTree() { DateTime inDatetime = Convert.ToDateTime(Convert.ToDateTime(this.in_date).ToString("yyyy-MM-dd")); DateTime today = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); DataTable dt = null; if (this.isChild) { dt = App.GetDataSet(string.Format("SELECT to_char(MEASURE_TIME,'yyyy-MM-dd') as MEASURE_TIME FROM t_child_vital_signs T WHERE T.DESCRIBE like '%出院%' AND patient_id = '{0}' ORDER BY MEASURE_TIME DESC", this.id)).Tables[0]; } else { dt = App.GetDataSet(string.Format("SELECT to_char(MEASURE_TIME,'yyyy-MM-dd') as MEASURE_TIME FROM T_VITAL_SIGNS T WHERE (T.DESCRIBE like '%出院%' OR T.DESCRIBE like '%死亡%') AND patient_id = '{0}' ORDER BY MEASURE_TIME", this.id)).Tables[0]; } if (dt.Rows.Count > 0) { today = Convert.ToDateTime(dt.Rows[0]["MEASURE_TIME"].ToString()); ph.out_time = today; } TimeSpan ts1 = new TimeSpan(inDatetime.Ticks); TimeSpan ts2 = new TimeSpan(today.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); int weekCount = 0; if ((ts.Days + 1) % 7 == 0) { weekCount = (ts.Days + 1) / 7; } else { weekCount = (ts.Days + 1) / 7 + 1; } string temper = ""; for (int i = 0; i < weekCount; i++) { temper = "第" + (i + 1).ToString() + "页(" + inDatetime.AddDays(i * 7).ToString("yyyy-MM-dd") + '~' + inDatetime.AddDays(i * 7 + 6).ToString("yyyy-MM-dd") + ")"; Node tn = new Node(); tn.Text = temper; this.tvTimes.Nodes.Add(tn); temper = ""; } string tempString = tvTimes.Nodes[tvTimes.Nodes.Count - 1].Text.ToString(); StarToEndTime(tempString); ph.PageIndex = tvTimes.Nodes.Count; ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["病房:"] = TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["床号:"] = TemperatureMethod.GetBedNo(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); Node de = new Node(); de.Text = "显示全部"; this.tvTimes.Nodes.Add(de); }
private bool isAll = false; //是否全部打印 /// <summary> /// 打印函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pdDocument_PrintPage(object sender, PrintPageEventArgs e) { try { if (id != "") { e.Graphics.ScaleTransform(1f, 0.97f); Graphics g = e.Graphics; if (isAll) { StarToEndTime(this.tvTimes.Nodes[index].Text); if (isChild) { phChild.PageIndex = index + 1; phChild.User["科室:"] = TemperatureMethod.GetSection(phChild.User["编号:"], phChild.PageIndex.ToString()); //phChild.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, phChild.PageIndex.ToString(), this.bedNo); phChild.printMain(e.Graphics, startTime, endTime); } else { ph.PageIndex = index + 1; //ph.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, ph.PageIndex.ToString(), this.bedNo); //ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.pid); ph.User["科室:"] = TemperatureMethod.GetSection(ph.User["编号:"], ph.PageIndex.ToString()); ph.User["病区:"] = App.UserAccount.CurrentSelectRole.Role_type == "N" ? ph.User["病区:"] : TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString()); ph.printMain(e.Graphics, startTime, endTime); } index++; if (index == this.tvTimes.Nodes.Count - 1) { e.HasMorePages = false; index = 0; } else { e.HasMorePages = true; } } else { if (isChild) { phChild.printMain(e.Graphics, startTime, endTime); } else { ph.printMain(e.Graphics, startTime, endTime); } } } } catch { MessageBoxEx.Show("数据异常或没有安装打印机"); // this.Close(); } }
private bool isAll = false; //是否全部打印 /// <summary> /// 打印函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pdDocument_PrintPage(object sender, PrintPageEventArgs e) { try { if (id != "") { e.Graphics.ScaleTransform(1f, 0.97f); if (isAll) {//显示全部 ph.PageIndex = index + 1; ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["病房:"] = TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["床号:"] = TemperatureMethod.GetBedNo(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); StarToEndTime(this.tvTimes.Nodes[index].Text); ph.printMain(startTime, endTime); index++; if (index == this.tvTimes.Nodes.Count - 1) { e.HasMorePages = false; index = 0; } else { e.HasMorePages = true; } } else { ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["病房:"] = TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.User["床号:"] = TemperatureMethod.GetBedNo(this.id, ph.PageIndex.ToString(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); ph.printMain(startTime, endTime); } } if (ph.currentpage.Objs.Count == 0) { pt.TemperturePaintInterface(e.Graphics, null); } else { pt.TemperturePaintInterface(e.Graphics, ph.currentpage); } } catch { MessageBoxEx.Show("数据异常或没有安装打印机"); } }
/// <summary> /// 树节点 选择打印日期 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvTimes_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) { Node selectNode = this.tvTimes.SelectedNode; if (selectNode != null && this.tvTimes.Nodes.Count > 1) { if (selectNode.Text == "显示全部") { this.isAll = true; this.ppcPreview.Rows = this.tvTimes.Nodes.Count - 1; this.pdDocument.DocumentName = (this.tvTimes.Nodes.Count - 1).ToString(); } else { this.isAll = false; string tempString = selectNode.Text; string temp = tempString.Split('(')[1].ToString(); string howWeek = tempString.Split('(')[0].ToString(); string weeks = howWeek.Substring(1, howWeek.Length - 2); string[] startEndDate = temp.Substring(0, temp.Length - 1).Split('~'); this.startTime = startEndDate[0]; this.endTime = startEndDate[1]; if (isChild) { phChild.PageIndex = selectNode.Index + 1; phChild.User["科室:"] = TemperatureMethod.GetSection(phChild.User["编号:"], phChild.PageIndex.ToString()); //phChild.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, phChild.PageIndex.ToString(), this.bedNo); //ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.pid); } else { ph.PageIndex = selectNode.Index + 1; //ph.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, ph.PageIndex.ToString(), this.bedNo); //ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.pid); ph.User["科室:"] = TemperatureMethod.GetSection(ph.User["编号:"], ph.PageIndex.ToString()); ph.User["病区:"] = App.UserAccount.CurrentSelectRole.Role_type == "N" ? ph.User["病区:"] : TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString()); } this.ppcPreview.Rows = 1; this.pdDocument.DocumentName = "1"; } this.ppcPreview.InvalidatePreview(); } }
/// <summary> /// 普通体温单打印构造函数 新方法 /// </summary> /// <param name="name">姓名</param> /// <param name="bedNo">床号</param> /// <param name="sex">性别</param> /// <param name="in_time">出生时间</param> /// <param name="pid">住院号</param> public ucTemperPrint(InPatientInfo info)//string pid, string medicare_no, string id, string bedNo, string name, string sex, string age, string section, string ward, string in_time, string out_time) { InitializeComponent(); string age = info.Age; string sex = info.Gender_Code; this.id = info.Id.ToString();//App.ReadSqlVal("select id from t_in_patient where pid='" + pid + "'", 0, "id"); this.in_date = info.In_Time.ToString("yyyy-MM-dd HH:mm"); this.pid = info.PId; this.bedNo = info.Sick_Bed_Name; this.medicareNo = info.Medicare_no; string Age_Child = DataInit.GetAge(info.Id.ToString()); if (string.IsNullOrEmpty(age) || age.Equals("0岁")) { age = Age_Child; } if (pid.Contains("_")) { this.isChild = true; } else { if (Age_Child.Contains("天")) { Age_Child = Age_Child.Replace("天", ""); } if (Age_Child.Contains("小时") || Age_Child.Contains("分") || (App.IsNumeric(Age_Child) && Convert.ToInt32(Age_Child) < 28)) { this.isChild = true; } else { this.isChild = false; } } if (isChild) { if (sex == "0" || sex == "男") { sex = "男"; } else { sex = "女"; } phChild.Hospital = App.HospitalTittle; phChild.Bingqu = info.Sick_Area_Name; phChild.TextName = "体 温 记 录 单"; phChild.User.Add("姓名:", info.Patient_Name); phChild.User.Add("性别:", sex); phChild.User.Add("病区:", info.Sick_Area_Name); phChild.User.Add("年龄:", age); phChild.User.Add("床号:", bedNo); phChild.User.Add("入院日期:", in_date); phChild.User.Add("登记号:", medicareNo); phChild.User.Add("住院号:", pid); phChild.User.Add("转入日期:", ""); string diagnose = "新生儿"; phChild.User.Add("诊断:", ""); phChild.User.Add("编号:", id);// App.ReadSqlVal("select id from t_in_patient where pid='" + pid + "' and to_char(in_time,'yyyy-MM-dd HH24:mi')='" + phChild.User["入院日期:"] + "' ", 0, "id")); phChild.User.Add("科室:", TemperatureMethod.GetSection(phChild.User["编号:"], phChild.PageIndex.ToString())); //if (out_time.Trim()!="") // ph.User.Add("出院日期:", Convert.ToDateTime(out_time).ToString("yyyy-MM-dd HH:mm")); //else // ph.User.Add("出院日期:",""); //DataSet ds = App.GetDataSet("select t.happen_time from t_inhospital_action t where t.next_id=0 and t.action_type='出区' and t.patient_id=" + id + ""); //DataSet ds = App.GetDataSet("select t.happen_time from t_inhospital_action t inner join t_in_patient a on t.pid=a.id where t.next_id=0 and t.action_type='出区' and t.patient_id=" + id + " and a.die_flag<>1"); //if (ds.Tables[0].Rows.Count > 0) // phChild.User.Add("出院日期:", Convert.ToDateTime(ds.Tables[0].Rows[0][0]).ToString("yyyy-MM-dd HH:mm")); //else // phChild.User.Add("出院日期:", ""); phChild.Init(id, in_date); } else { if (sex == "0" || sex == "男") { sex = "男"; } else { sex = "女"; } ph.Hospital = App.HospitalTittle; ph.Bingqu = info.Sick_Area_Name; ph.TextName = "体 温 记 录 单"; ph.User.Add("姓名:", info.Patient_Name); ph.User.Add("性别:", sex); ph.User.Add("病区:", info.Sick_Area_Name); ph.User.Add("年龄:", age); ph.User.Add("床号:", bedNo); ph.User.Add("入院日期:", in_date); ph.User.Add("登记号:", medicareNo); ph.User.Add("住院号:", pid); ph.User.Add("转入日期:", ""); ph.User.Add("编号:", id);//App.ReadSqlVal("select id from t_in_patient where pid='" + pid + "' and to_char(in_time,'yyyy-MM-dd HH24:mi')='" + ph.User["入院日期:"] + "'", 0, "id")); ph.User.Add("科室:", TemperatureMethod.GetSection(ph.User["编号:"], ph.PageIndex.ToString())); string diagnose = ""; string sql_diagnose = "select a.diagnose_name from t_diagnose_item a where a.patient_id=" + id + " order by a.diagnose_sort asc "; sql_diagnose = "select distinct a.diagnose_name,a.diagnose_sort from t_diagnose_item a where a.patient_id = " + id + " and a.diagnose_type = '403' order by a.diagnose_sort"; DataTable dtdiagnose = App.GetDataSet(sql_diagnose).Tables[0]; if (dtdiagnose != null) { for (int i = 0; i < dtdiagnose.Rows.Count; i++) { if (i == 0) { diagnose = Convert.ToString(i + 1) + "." + dtdiagnose.Rows[i][0].ToString(); } else if (i >= 3) { break; } else { diagnose += "," + Convert.ToString(i + 1) + "." + dtdiagnose.Rows[i][0].ToString(); } } } ph.User.Add("诊断:", diagnose); //if (out_time.Trim()!="") // ph.User.Add("出院日期:", Convert.ToDateTime(out_time).ToString("yyyy-MM-dd HH:mm")); //else // ph.User.Add("出院日期:",""); //DataSet ds = App.GetDataSet("select t.happen_time from t_inhospital_action t where t.next_id=0 and t.action_type='出区' and t.patient_id=" + id + ""); DataSet ds = App.GetDataSet("select t.happen_time from t_inhospital_action t inner join t_in_patient a on t.pid=a.id where t.next_id=0 and t.action_type='出区' and t.patient_id=" + id + " and a.die_flag<>1"); if (ds.Tables[0].Rows.Count > 0) { ph.User.Add("出院日期:", Convert.ToDateTime(ds.Tables[0].Rows[0][0]).ToString("yyyy-MM-dd HH:mm")); } else { ph.User.Add("出院日期:", ""); } ph.Init(id, in_date); } temperInit(); }
/// <summary> /// 加载时间项目 /// </summary> public void loadTree() { DateTime inDatetime = Convert.ToDateTime(Convert.ToDateTime(this.in_date).ToString("yyyy-MM-dd")); DateTime today = Convert.ToDateTime(App.GetSystemTime().ToString("yyyy-MM-dd")); DataTable dt = null; if (this.isChild) { dt = App.GetDataSet(string.Format("SELECT to_char(MEASURE_TIME,'yyyy-MM-dd') as MEASURE_TIME FROM T_VITAL_SIGNS T WHERE (T.DESCRIBE like '%出院%' OR T.DESCRIBE like '%死亡%') AND patient_id = '{0}' ORDER BY MEASURE_TIME", this.id)).Tables[0]; } else { dt = App.GetDataSet(string.Format("SELECT to_char(MEASURE_TIME,'yyyy-MM-dd') as MEASURE_TIME FROM T_VITAL_SIGNS T WHERE (T.DESCRIBE like '%出院%' OR T.DESCRIBE like '%死亡%') AND patient_id = '{0}' ORDER BY MEASURE_TIME", this.id)).Tables[0]; } if (dt.Rows.Count > 0) { today = Convert.ToDateTime(dt.Rows[0]["MEASURE_TIME"].ToString()); if (isChild) { phChild.out_time = today; } else { ph.out_time = today; } } if (pid.Contains("_")) { inDatetime = Convert.ToDateTime(App.ReadSqlVal(" select to_char(birthday,'yyyy-MM-dd') birthday from t_in_patient where id=" + this.id, 0, "birthday")); } TimeSpan ts1 = new TimeSpan(inDatetime.Ticks); TimeSpan ts2 = new TimeSpan(today.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); int weekCount = 0; if ((ts.Days + 1) % 7 == 0) { weekCount = (ts.Days + 1) / 7; } else { weekCount = (ts.Days + 1) / 7 + 1; } string temper = ""; for (int i = 0; i < weekCount; i++) { temper = "第" + (i + 1).ToString() + "周(" + inDatetime.AddDays(i * 7).ToString("yyyy-MM-dd") + '~' + inDatetime.AddDays(i * 7 + 6).ToString("yyyy-MM-dd") + ")"; Node tn = new Node(); tn.Text = temper; this.tvTimes.Nodes.Add(tn); temper = ""; } string tempString = tvTimes.Nodes[tvTimes.Nodes.Count - 1].Text.ToString(); StarToEndTime(tempString); if (isChild) { phChild.PageIndex = tvTimes.Nodes.Count; phChild.User["科室:"] = TemperatureMethod.GetSection(phChild.User["编号:"], phChild.PageIndex.ToString()); //phChild.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, phChild.PageIndex.ToString(), this.bedNo); //ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.pid, ph.PageIndex.ToString()); } else { ph.PageIndex = tvTimes.Nodes.Count; ph.User["科室:"] = TemperatureMethod.GetSection(ph.User["编号:"], ph.PageIndex.ToString()); //ph.User["床号:"] = TemperatureMethod.GetTransferBed(this.pid, ph.PageIndex.ToString(), this.bedNo); //ph.User["诊断:"] = TemperatureMethod.GetDiagnose(this.pid); ph.User["病区:"] = App.UserAccount.CurrentSelectRole.Role_type == "N" ? ph.User["病区:"] : TemperatureMethod.GetSection(this.id, ph.PageIndex.ToString()); } Node de = new Node(); de.Text = "显示全部"; this.tvTimes.Nodes.Add(de); }
public static void RefreshHeader(string PatientID, string PageIndex, DateTime startTime, DateTime endTime) { Diagnose = TemperatureMethod.GetDiagnose(PatientID, PageIndex, startTime, endTime); Section = TemperatureMethod.GetSection(PatientID, PageIndex, startTime, endTime); BedNo = TemperatureMethod.GetBedNo(PatientID, PageIndex, startTime, endTime); }