Beispiel #1
0
        public List <Reportlab> getLabRpts4TreatView(string idpat, DateTime dt, CiRptLabItmDO[] itms)
        {
            // todo 修改成 检查的 id
            //return service.findById(id_lab);
            if (itms == null || itms.Length == 0)
            {
                return(null);
            }
            string[] srvs   = itms.Select(p => p.Id_srv).ToArray();
            string[] rptids = itms.Select(p => p.Id_rptlab).ToArray();
            //        var dtn = this.NowTime();
            LabDTO[] labs = qryservice.getLabItms8DateBP(idpat, new FDateTime(dt.ToString()),
                                                         new FDateTime((dt.AddDays(-200)).ToString()), srvs);
            if (labs.Count() == 0)
            {
                this.ShowAlert("没有符合要求的数据");
                return(null);
            }
            if (itms.Count() > 5)
            {
                this.ShowAlert("勾选的数据不能超过5条");
                return(null);
            }
            var lablist = new List <Reportlab>();
            int i       = 0;

            foreach (CiRptLabItmDO s2 in itms)
            {
                if (s2.Sd_restrptlabtp != "0")
                {
                    continue;
                }
                var lab = new Reportlab();
                lab.Name  = s2.Name_srv;
                lab.YUnit = s2.Unit_name;
                i++;

                foreach (LabDTO ldo in labs)
                {
                    if (ldo.Val_rstrptlab == null)
                    {
                        continue;
                    }
                    if (s2.Id_srv.Equals(ldo.Id_srv))
                    {
                        var p = new LabPoint();
                        p.Xvalue        = ldo.Dt_rptlab;
                        p.Yvalue        = Double.Parse(ldo.Val_rstrptlab);
                        p.FlagException = false;
                        lab.AddPoint(p);
                    }
                }

                lablist.Add(lab);
                if (i == 5)
                {
                    break;
                }
            }
            if (lablist.Count == 0 || lablist.Count < itms.Count())
            {
                this.ShowAlert("结果值的类型不是数值");
                return(null);
            }

            return(lablist);
        }