public static List <Device> QueryDeviceByNum(String deviceNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DEVICE_SQL, deviceNum)); List <Device> device = new List <Device>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(device); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { device.Add(Device.CreateDevice(dic)); } } return(device); }
public static List <Room> QueryRoomByNum(String roomNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_ROOM_SQL, roomNum)); List <Room> room = new List <Room>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(room); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { room.Add(Room.CreateRoom(dic)); } } return(room); }
//出院时查询医嘱 public List <DoctorsAdvice> QueryAdvicesByNum(String patientNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DOCTORSADVICE_SQL, patientNum)); List <DoctorsAdvice> advices = new List <DoctorsAdvice>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(advices); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { advices.Add(DoctorsAdvice.CreateDoctorsAdvice(dic)); } } return(advices); }
//查询取药记录 public static List <FetchRecords> QueryFetchByNum(String patientNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_FETCHRECORDS_SQL, patientNum)); List <FetchRecords> fetchRecords = new List <FetchRecords>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(fetchRecords); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { fetchRecords.Add(FetchRecords.CreateFetchRecords(dic)); } } return(fetchRecords); }
private const String SELECT_DEVICE_PRICE_BYID = "select single_price from device where d_num=\"{0}\" "; //在设备表查价格 //重载函数 //函数一用于插入检查订单或者手术订单 //函数一需要传入 患者编号、手术或者检查的编号、医生的编号、订单编号、类型(用于区分三类操作:药品是1 手术是2 检查是3)、使用的时间 public static List <Order> QueryOrderByNum(String orderNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ORDER_SQL, orderNum)); List <Order> order = new List <Order>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(order); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { order.Add(Order.CreateOrder(dic)); } } return(order); }
public static List <Department> QueryDepartmentByNum(String departmentNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DEPARTMENT_SQL, departmentNum)); List <Department> department = new List <Department>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(department); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { department.Add(Department.CreateDepartment(dic)); } } return(department); }
//返回患者部分信息用于确认 public static List <PatientPart> SearchPartInformation(String ID) { List <Dictionary <String, object> > partInformation = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PART_INFORMATION, ID)); List <PatientPart> patientParts = new List <PatientPart>(); if (partInformation == null || partInformation.Count < 1) { return(patientParts); } else { foreach (Dictionary <String, Object> dic in partInformation) //遍历结果集,每一条都加入list { patientParts.Add(PatientPart.CreatePatientPart(dic)); } return(patientParts); } }
public static List <Medicine> QueryMedicineByNum(String medicineNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_MEDICINE_SQL, medicineNum)); List <Medicine> medicine = new List <Medicine>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(medicine); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { medicine.Add(Medicine.createMedicine(dic)); } } return(medicine); }
//根据用户号查找用户 public static List <Users> QueryUsersByNum(String UserNum) { List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_USERS_SQL, UserNum)); List <Users> users = new List <Users>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(users); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { users.Add(Users.CreateUsers(dic)); } } return(users); }
// 将患者出院未出院字段改为已经出院,返回病人信息和费用 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); }
//按病人ID查找病人的操作 public static List <Patient> GetPatientsById(String ID) { //查询返回的是一个结果集,每一个结果集是一个主键为ID的多组对应关系 List <Dictionary <String, object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PATIENT_BY_ID, ID)); List <Patient> patient = new List <Patient>(); if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象 { return(patient); } else { foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list { patient.Add(Patient.CreatePatient(dic)); } } return(patient); }