예제 #1
0
        public HttpResponseMessage GetHospitalization()
        {
            string nurseId = HttpContext.Current.User.Identity.Name;

            if (nurseId.Equals(""))
            {
                nurseId = "14001";
            }
            HttpResponseMessage response = new HttpResponseMessage();
            // Retuen ALL Hospitalization natural join Bed
            // hospitalization表查找nurse_id相关的记录 找到床 返回
            ArrayList list     = new ArrayList();
            JArray    resArray = new JArray();

            try
            {
                list = NurseHelper.GetHospitalizationInfo(nurseId);
                if (list == null)
                {
                    response.Content    = new StringContent("查询出现错误!");
                    response.StatusCode = HttpStatusCode.NotFound;
                }
                else
                {
                    foreach (HospitalInfo item in list)
                    {
                        JObject obj = new JObject();
                        obj.Add("hosp_id", item.hos_id);
                        string      patient_id = UserHelper.GetPatientIdByTreatmentId(item.treat_id);
                        PatientInfo user_info  = UserHelper.GetPatientInfo(patient_id);
                        if (user_info != null)
                        {
                            obj.Add("patient_name", user_info.name);
                        }
                        obj.Add("bed_num", item.bed_num);
                        obj.Add("nursing_rank", item.rank);
                        obj.Add("in_hosp_time", item.in_time);
                        resArray.Add(obj);
                    }

                    response.Content    = new StringContent(JsonObjectConverter.ObjectToJson(resArray));
                    response.StatusCode = HttpStatusCode.OK;
                }
            }
            catch (Exception e)
            {
                response.Content    = new StringContent(e.Message);
                response.StatusCode = HttpStatusCode.BadRequest;
            }

            return(response);
        }
예제 #2
0
        public HttpResponseMessage OutHospital(string hospitalId)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            if (NurseHelper.OutHospital(hospitalId))
            {
                response.Content    = new StringContent("出院成功");
                response.StatusCode = HttpStatusCode.OK;
            }
            else
            {
                response.Content    = new StringContent("更新失败");
                response.StatusCode = HttpStatusCode.BadRequest;
            }

            return(response);
        }