/// <summary> /// 根据删除的样本创建回发对象集合 /// </summary> /// <returns>WebService.SpecimenRt 集合</returns> private List<WebService.SpecimenRt> CreateSpecimenRtWithSamples_Trashbin() { List<WebService.SpecimenRt> specimenRtList = new List<WebService.SpecimenRt>(); List<Model.Samples_Trashbin> sample_by_dateList = sample.GetSamples_Trashbin("5000");//所有删除的样本 if (sample_by_dateList.Count > 0) { foreach (Model.Samples_Trashbin item in sample_by_dateList) { Dictionary<string, string> dic = new Dictionary<string, string>(); Model.Sample_Info sampleinfo = sample.GetSample_Info(item.obj_id); dic = CreatOtherInfoBySampleInfo(sampleinfo); dic.Add("created_at", item.created_at); dic.Add("in_vials", ""); dic.Add("out_vials", ""); string source_id = sampleinfo.source_id; specimen.Id = item.id.ToString();//添加样本id specimen.Name = item.name;//添加样本名称 specimen.OtherInfo = Common.FpJsonHelper.DictionaryToJsonString(dic);//添加其他信息(样本类型、总管数、样本创建时间、样本保存时间、样本可用管数、样本出库在外的管数) specimenRt = Get_SpecimenRt(source_id);//创建specimenRt specimenRt.Specimens = new WebService.Specimen[] { specimen }; specimenRtList.Add(specimenRt); } } return specimenRtList; }
/// <summary> /// 创建回发数据中患者信息部分 /// </summary> /// <param name="source_id">样本源id</param> /// <returns>WebService.SpecimenRt 对象</returns> private WebService.SpecimenRt Get_SpecimenRt(string source_id) { WebService.SpecimenRt SpecimenRt = new WebService.SpecimenRt(); Dictionary<string, string> dic = new Dictionary<string, string>(); dic = samplesource.Get_Sample_Source_Userfields(source_id);//根据id获取样本源信息 if (dic.Count > 0) { if (dic.Keys.Contains("唯一标识号")) { specimenRt.PatientId = dic["唯一标识号"]; } if (dic.Keys.Contains("姓名")) { specimenRt.PatientName = dic["姓名"]; } if (dic.Keys.Contains("就诊号")) { specimenRt.VisitId = dic["就诊号"]; } } return SpecimenRt; }
/// <summary> /// 根据日期创建回发信息集合,返回是specimenRtList /// </summary> /// <param name="date">日期"tadoy","yesterday","2015.02.18,2015.02.19"</param> /// <returns>WebService.SpecimenRt回发信息集合</returns> private List<WebService.SpecimenRt> CreateSpecimenRtWithSamples_By_Date(string date) { List<WebService.SpecimenRt> specimenRtList = new List<WebService.SpecimenRt>(); //sample_by_date,根据日期获取“前一天(yesterday)”的样本,如果是调用当天的样本数据就是“today"或者是"2015.02.18,2015.02.19" //***此处应该是根据保存的日志文件中的日期然后根据保存的日期取数据 //http://192.168.1.104/api?username=admin;password=admin;method=samples_by_date&date=2014.03.15,2015.03.16 List<Model.Sample> sample_by_dateList = sample.GetSamples_By_Date(date,"5000"); if (sample_by_dateList.Count > 0) { foreach (Model.Sample item in sample_by_dateList) { Dictionary<string, string> dic = new Dictionary<string, string>(); //根据日期获取样本再根据id获取样本详细信息 Model.Sample_Info sampleinfo = sample.GetSample_Info(item.id); dic = CreatOtherInfoBySampleInfo(sampleinfo);//根据Sample_Info获取:样本类型、总管数、样本更新时间、样本源id字典 dic.Add("created_at", item.created_at);//添加创建时间 dic.Add("in_vials", ""); dic.Add("out_vials", ""); string source_id = sampleinfo.source_id;//获取样本源id specimen.Id = item.id.ToString();//添加样本id specimen.Name = item.name;//添加样本名称 specimen.OtherInfo = Common.FpJsonHelper.DictionaryToJsonString(dic);//添加其他信息(样本类型、总管数、样本创建时间、样本保存时间、样本可用管数、样本出库在外的管数) specimenRt = Get_SpecimenRt(source_id);//创建specimenRt specimenRt.Specimens = new WebService.Specimen[] { specimen };//将specimen添加到specimenRt中 specimenRtList.Add(specimenRt); } } return specimenRtList; }