コード例 #1
0
ファイル: doctorsAdvice.cs プロジェクト: QcQcM/hospital
    }                                     //医生名字
    public static DoctorsAdvice CreateDoctorsAdvice(Dictionary <String, Object> dic)
    {
        DoctorsAdvice doctorsAdvice = new DoctorsAdvice();

        doctorsAdvice.DoctorNum  = (String)dic["d_num"];
        doctorsAdvice.PatientNum = (String)dic["p_num"];
        doctorsAdvice.Time       = dic["time"].ToString();
        doctorsAdvice.DoctorName = (String)dic["d_name"];
        try
        {
            doctorsAdvice.Content = (String)dic["content"];
        }
        catch (InvalidCastException)
        {
            doctorsAdvice.Content = "";
        }
        try
        {
            doctorsAdvice.Type = (int)dic["type"];
        }
        catch (InvalidCastException)
        {
            doctorsAdvice.Type = 0;
        }
        return(doctorsAdvice);
    }
コード例 #2
0
    //出院时查询医嘱
    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);
    }
コード例 #3
0
    // 将患者出院未出院字段改为已经出院,返回病人信息和费用
    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);
    }