Exemple #1
0
        public HttpResponseMessage GetAllCost(string treatmentId)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            ArrayList list = new ArrayList();

            try
            {
                list = PatientHelper.GetAllConsumption(treatmentId);
            }
            catch (Exception e)
            {
                response.Content    = new StringContent(e.Message);
                response.StatusCode = HttpStatusCode.BadRequest;
                return(response);
            }
            ArrayList returnList = new ArrayList();

            if (list == null)
            {
                response.Content    = new StringContent("查询失败");
                response.StatusCode = HttpStatusCode.NotFound;
            }
            else if (list.Count == 0)
            {
                response.Content    = new StringContent("查询列表空");
                response.StatusCode = HttpStatusCode.OK;
            }
            else
            {
                try
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        ArrayList costList = (ArrayList)list[i];
                        ArrayList payList;
                        switch (i)
                        {
                        case 0:
                            payList = new ArrayList();
                            for (int j = 0; j < costList.Count; j++)
                            {
                                Treatment      examination    = (Treatment)costList[j];
                                DetailCostInfo detailCostInfo = new DetailCostInfo();
                                detailCostInfo.cost      = examination.pay;
                                detailCostInfo.costId    = examination.treat_id;
                                detailCostInfo.docName   = PatientHelper.GetDoctorNameById(examination.doc_id);
                                detailCostInfo.startTime = examination.start_time.ToString();
                                if (examination.pay_time.Year == 1)
                                {
                                    detailCostInfo.isPay = false;
                                }
                                else
                                {
                                    detailCostInfo.isPay = true;
                                }
                                payList.Add(detailCostInfo);
                            }
                            returnList.Add(payList);
                            break;

                        case 1:
                            payList = new ArrayList();
                            for (int j = 0; j < costList.Count; j++)
                            {
                                Examination    examination    = (Examination)costList[j];
                                DetailCostInfo detailCostInfo = new DetailCostInfo();
                                detailCostInfo.cost      = examination.pay;
                                detailCostInfo.costId    = examination.exam_id;
                                detailCostInfo.docName   = PatientHelper.GetDoctorNameById(examination.employee_id);
                                detailCostInfo.startTime = examination.exam_time.ToString();
                                if (examination.pay_time.Year == 1)
                                {
                                    detailCostInfo.isPay = false;
                                }
                                else
                                {
                                    detailCostInfo.isPay = true;
                                }
                                payList.Add(detailCostInfo);
                            }
                            returnList.Add(payList);
                            break;

                        case 2:
                            payList = new ArrayList();
                            for (int j = 0; j < costList.Count; j++)
                            {
                                Prescription   examination    = (Prescription)costList[j];
                                DetailCostInfo detailCostInfo = new DetailCostInfo();
                                detailCostInfo.cost      = examination.pay;
                                detailCostInfo.costId    = examination.pres_id;
                                detailCostInfo.docName   = PatientHelper.GetDoctorNameById(examination.employee_id);
                                detailCostInfo.startTime = examination.make_time.ToString();
                                if (examination.pay_time.Year == 1)
                                {
                                    detailCostInfo.isPay = false;
                                }
                                else
                                {
                                    detailCostInfo.isPay = true;
                                }
                                payList.Add(detailCostInfo);
                            }
                            returnList.Add(payList);
                            break;

                        case 3:
                            payList = new ArrayList();
                            for (int j = 0; j < costList.Count; j++)
                            {
                                Surgery        examination    = (Surgery)costList[j];
                                DetailCostInfo detailCostInfo = new DetailCostInfo();
                                detailCostInfo.cost   = examination.pay;
                                detailCostInfo.costId = examination.surg_id;
                                //detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.);
                                detailCostInfo.docName   = examination.surgery_name;
                                detailCostInfo.startTime = examination.start_time.ToString();
                                if (examination.pay_time.Year == 1)
                                {
                                    detailCostInfo.isPay = false;
                                }
                                else
                                {
                                    detailCostInfo.isPay = true;
                                }
                                payList.Add(detailCostInfo);
                            }
                            returnList.Add(payList);
                            break;

                        case 4:
                            payList = new ArrayList();
                            for (int j = 0; j < costList.Count; j++)
                            {
                                Hospitalization examination    = (Hospitalization)costList[j];
                                DetailCostInfo  detailCostInfo = new DetailCostInfo();
                                detailCostInfo.cost      = examination.pay;
                                detailCostInfo.costId    = examination.hos_id;
                                detailCostInfo.docName   = PatientHelper.GetDoctorNameById(examination.nurse_id);
                                detailCostInfo.startTime = examination.in_time.ToString();
                                if (examination.pay_time.Year == 1)
                                {
                                    detailCostInfo.isPay = false;
                                }
                                else
                                {
                                    detailCostInfo.isPay = true;
                                }
                                payList.Add(detailCostInfo);
                            }
                            returnList.Add(payList);
                            break;

                        default:
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    response.Content    = new StringContent(e.Message);
                    response.StatusCode = HttpStatusCode.BadRequest;
                    return(response);
                }
                response.Content    = new StringContent(JsonObjectConverter.ObjectToJson(returnList));
                response.StatusCode = HttpStatusCode.OK;
            }


            return(response);
        }
Exemple #2
0
        public HttpResponseMessage GetTreatmentID()
        {
            HttpResponseMessage response = new HttpResponseMessage();

            string patient_id = HttpContext.Current.User.Identity.Name;

            // treatment表调取数据
            ArrayList list = null;

            try
            {
                list = PatientHelper.GetTreatmentInfo(patient_id);
            }
            catch (Exception e)
            {
                response.Content    = new StringContent(e.Message);
                response.StatusCode = HttpStatusCode.NotFound;
                return(response);
            }

            ArrayList returnList = new ArrayList();

            if (list == null)
            {
                response.Content    = new StringContent("查询失败");
                response.StatusCode = HttpStatusCode.NotFound;
            }
            else if (list.Count == 0)
            {
                response.Content    = new StringContent(JsonObjectConverter.ObjectToJson(returnList));
                response.StatusCode = HttpStatusCode.OK;
            }
            else
            {
                for (int i = 0; i < list.Count; i++)
                {
                    Treatment treatment = (Treatment)list[i];

                    TreatPayInfo treatPayInfo = new TreatPayInfo();

                    treatPayInfo.docName = PatientHelper.GetDoctorNameById(treatment.doc_id);

                    treatPayInfo.pay        = treatment.pay;
                    treatPayInfo.clinicName = treatment.clinic;
                    treatPayInfo.treatId    = treatment.treat_id;
                    treatPayInfo.treatTime  = treatment.start_time.ToString();
                    if (treatment.pay_time.Year == 1)
                    {
                        treatPayInfo.isPay = false;
                    }
                    else
                    {
                        treatPayInfo.isPay = true;
                    }

                    returnList.Add(treatPayInfo);
                }

                response.Content    = new StringContent(JsonObjectConverter.ObjectToJson(returnList));
                response.StatusCode = HttpStatusCode.OK;
            }
            return(response);
        }