public ActionResult Query()
        {
            string        patname         = Request["name"];
            string        patsex          = Request["sex"];
            string        date            = Request["date"];
            string        diagnosisresult = Request["diagnosis"];
            string        user            = HttpContext.Request.Cookies["username"].Value.ToString();
            List <string> query           = new List <string>();

            query.Add(patname);
            query.Add(patsex);
            query.Add(date);
            query.Add(diagnosisresult);
            query.Add(user);
            VisitDataOperation   visitop = new VisitDataOperation();
            List <PatBasicInfor> pts     = visitop.GetPat(query);

            return(PartialView("PatList", pts));
        }
Ejemplo n.º 2
0
        public ActionResult SendAdvice(string id, string strAdvice)
        {
            VisitDataOperation dataOperation = new VisitDataOperation();
            var correctPatient = from p in context.PatBasicInforSet.ToList() where p.Id == id select p;

            if (correctPatient != null)
            {
                string clientID = correctPatient.First().PushClientId;
                if (clientID != null)
                {
                    bool saveResult = dataOperation.SaveAdvice(id, strAdvice);
                    if (saveResult == true)
                    {
                        Push       pushAdvice     = new Push();
                        string     pushResult     = pushAdvice.PushAdvice(strAdvice, clientID);
                        PushReturn pushReturnInfo = JsonConvert.DeserializeObject <PushReturn>(pushResult);
                        if (pushReturnInfo.result == "ok")
                        {
                            return(this.Json(new { OK = true, Message = id }));
                        }
                        else
                        {
                            return(this.Json(new { OK = true, Message = pushReturnInfo.result }));
                        }
                    }
                    else
                    {
                        return(this.Json(new { OK = false, Message = "保存失败" }));
                    }
                }
                else
                {
                    return(this.Json(new { OK = false, Message = "该用户尚未使用移动端" }));
                }
            }
            else
            {
                return(this.Json(new { OK = false, Message = "没有找到对应的病人" }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Query(string name, string sex, string date, string diagnosis)
        {
            string user = HttpContext.Request.Cookies["username"].Value.ToString();
            //找到region账号对应的医生列表。
            UserOperation        uo             = new UserOperation();
            List <userInfo>      SelectedDocs   = uo.SelectedDocs(user);
            VisitDataOperation   visitop        = new VisitDataOperation();
            List <PatBasicInfor> Patlist        = new List <PatBasicInfor>();
            List <tableData>     patlistforre   = new List <tableData>();
            RegionViewData       regionViewData = new RegionViewData();

            var allpats        = from s in DataContainer.PatBasicInforSet.ToList() select s;
            var allvisitRecord = from s in DataContainer.VisitRecordSet.ToList() select s;
            var docnum         = SelectedDocs.Count;

            List <int> docIDS = new List <int> ();

            foreach (userInfo doc in SelectedDocs)
            {
                docIDS.Add(doc.id);
            }
            var patlist     = allpats.Where(p => docIDS.Contains(p.DoctorAccountId)).ToList();
            var patinfoList = (from ps in patlist.Where(p => (string.IsNullOrEmpty(name) ? true : p.Name == name) && (string.IsNullOrEmpty(sex) ? true : p.Sex == sex))
                               from r in allvisitRecord.Where(r => (r.PatBasicInforId == ps.Id) &&
                                                              (string.IsNullOrEmpty(diagnosis) ? true : (r.DiagnosisResult1.Contains(diagnosis) || r.DiagnosisResult2.Contains(diagnosis) || r.DiagnosisResult3.Contains(diagnosis))) &&
                                                              (string.IsNullOrEmpty(date) ? true : r.VisitDate.Date == DateTime.Parse(date)))
                               select new
            {
                Name = ps.Name,
                Sex = ps.Sex,
                Age = ps.Age,
                Date = r.VisitDate,
                DiagnosisResult1 = r.DiagnosisResult1,
                DiagnosisResult2 = r.DiagnosisResult2,
                DiagnosisResult3 = r.DiagnosisResult3,
                PatBasicInforId = ps.Id
            }).OrderByDescending(x => x.Date).DistinctBy(x => x.PatBasicInforId).ToList();
            int i = 1;

            foreach (var patient in patinfoList)
            {
                tableData td = new tableData();
                td.Name            = patient.Name;
                td.Sex             = patient.Sex;
                td.Age             = patient.Age;
                td.ListID          = i.ToString();
                td.Date            = patient.Date.ToString("yyyy-MM-dd");
                td.PatBasicInforId = patient.PatBasicInforId;
                if (patient.DiagnosisResult1 != null || patient.DiagnosisResult2 != null || patient.DiagnosisResult3 != null)
                {
                    if (patient.DiagnosisResult1.Contains("慢性每日头痛"))
                    {
                        var style = patient.DiagnosisResult1.Split(new Char[] { ':' });
                        if (style.Length > 1)
                        {
                            td.HeadacheStyle = style[1];
                        }
                        else
                        {
                            td.HeadacheStyle = patient.DiagnosisResult1 + patient.DiagnosisResult2 + patient.DiagnosisResult3;
                        }
                    }
                    else
                    {
                        td.HeadacheStyle = patient.DiagnosisResult1 + patient.DiagnosisResult2 + patient.DiagnosisResult3;
                    }
                }
                i++;
                patlistforre.Add(td);
            }

            /* int i,j;
             * List<string> query = new List<string>();
             * query.Add(name);
             * query.Add(sex);
             * query.Add(date);
             * query.Add(diagnosis);
             * for (i = 0; i < docnum; i++)
             * {
             *    string docname = SelectedDocs[i].userName;
             *    query.Add(docname);
             *    var pts= visitop.GetPatforDoc(query);
             *    query.Remove(docname);
             *    var patnum = pts.Count;
             *
             *    for (j = 0; j < patnum; j++)
             *    {
             *        var patID=pts[j].Id ;
             *        var selectedpat = allpats.Where(s => s.Id == patID).FirstOrDefault();
             *        List<string> patientIds = new List<string>();
             *        Patlist.Add(selectedpat);
             *    }
             * }
             * patlistforre = regionViewData.GetPatforView(Patlist);*/
            return(Json(patlistforre, JsonRequestBehavior.AllowGet));
            // return PartialView("PatlistForRe", patlistforre);
        }