public static LeaveInformation CreateLeavelInformation(List <DoctorsAdvice> advices, String lengthStay, List <Order> orders, Decimal totalPrice, PatientPartInformation partInformation) { LeaveInformation information = new LeaveInformation(); information.Advices = advices; information.LengthStay = lengthStay; information.Orders = orders; information.TotalPrice = totalPrice; information.Information = partInformation; return(information); }
// 将患者出院未出院字段改为已经出院,返回病人信息和费用 public static LeaveInformation LeaveHospital(String ID) { DatabaseTool.ExecSql(String.Format(UPDATE_PATIENT_CONDITION, ID)); //更新患者状态为已出院 DatabaseTool.ExecSql(String.Format(UPDATE_DISCHARGE_TIME, System.DateTime.Now.ToString(), ID)); //插入病人出院时间 //全部订单存放至orders List <Dictionary <String, Object> > sqlResult1 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ALL_ORDERS_BY_ID, ID)); List <Order> orders = new List <Order>(); foreach (Dictionary <String, Object> dic in sqlResult1) //遍历结果集,每一条都加入list { orders.Add(Order.CreateOrder(dic)); } //获取入院时间与出院时间,计算时间差 DateTime admissionTime = Convert.ToDateTime(DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_PATIENT_BY_ID, ID), "admission_time")); DateTime dischargeTime = Convert.ToDateTime(DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_PATIENT_BY_ID, ID), "discharge_time")); TimeSpan ts = dischargeTime.Subtract(admissionTime).Duration(); String dateDiff = ts.Days.ToString() + "天"; //获取全部医嘱存放至advices List <DoctorsAdvice> advices = new List <DoctorsAdvice>(); List <Dictionary <String, Object> > sqlResult2 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ALL_ADVICES_BY_ID, ID)); foreach (Dictionary <String, Object> dic in sqlResult2) //遍历结果集,每一条都加入list { advices.Add(DoctorsAdvice.CreateDoctorsAdvice(dic)); } //计算最终费用存放至totalPrice Decimal totalPrice = DatabaseTool.ExeclSqlDecimal(String.Format(SELECT_ALL_PRICE, ID)); //获取用户部分信息 PatientPartInformation partInformation = new PatientPartInformation(); List <Dictionary <String, Object> > sqlResult3 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PATIENT_BY_ID, ID)); foreach (Dictionary <String, Object> dic in sqlResult3) //遍历结果集,每一条都加入list { partInformation = PatientPartInformation.CreatePatientInformation(dic); } //新建信息对象,返回 LeaveInformation information = LeaveInformation.CreateLeavelInformation(advices, dateDiff, orders, totalPrice, partInformation); return(information); }
protected void Button1_Click(object sender, EventArgs e) { admissionDay.Visible = true; dischargeDay.Visible = true; lengthStay.Visible = true; diagnose.Visible = true; admissionDay1.Visible = true; dischargeDay1.Visible = true; lengthStay1.Visible = true; diagnose1.Visible = true; Table1.Visible = true; doctorAdvices.Visible = true; //打印出出院信息 //获得其余出院信息 LeaveInformation all_messages = new LeaveInformation(); all_messages = PatientService.LeaveHospital(Request["patientId"].ToString()); //补充其他个人信息 admissionDay.Text = all_messages.Information.AdmissionTime.ToString(); dischargeDay.Text = all_messages.Information.DischargeTime.ToString(); diagnose.Text = all_messages.Information.Diagnose.ToString(); //获得医生编号、建议、类型、治疗时间 addAdvices(all_messages.Advices); //获得住院时长 lengthStay.Text = all_messages.LengthStay.ToString(); //全部订单信息 addOrders(all_messages.Orders); //总费用 totalprice.Text = all_messages.TotalPrice.ToString(); }