Ejemplo n.º 1
0
        public void Execute(IJobExecutionContext context)
        {
            IHospitalBLL    hospitalBll  = new HospitalBLL();
            List <Hospital> hospitalList = null;
            DateTime        dateTimeM    = DateTime.Now;

            FlashLogger.Error(string.Format("下载医疗机构信息【{0}】", System.Threading.Thread.CurrentThread.ManagedThreadId));
            while (dateTimeM > Convert.ToDateTime("2016-03-01"))
            {
                var listEntity = hospitalBll.GetHospitals("", dateTimeM.ToString("yyyy-MM"), "1");
                if (listEntity == null)
                {
                    break;
                }
                hospitalList = listEntity.DataList;
                if (hospitalList != null && hospitalList.Count > 0)
                {
                    for (int i = 1; i <= listEntity.TotalPageCount; i++)
                    {
                        hospitalBll.AddHospitals(hospitalList);
                        var log = string.Format("{0} : 第{1}页/共{2}页 成功下载 {3} 条医疗机构信息.【{4}】", dateTimeM.ToString("yyyy-MM"),
                                                i, listEntity.TotalPageCount, hospitalList.Count, System.Threading.Thread.CurrentThread.ManagedThreadId);
                        FlashLogger.Warn(log);
                        hospitalList = hospitalBll.GetHospitals("", dateTimeM.ToString("yyyy-MM"), (i + 1).ToString()).DataList;
                    }
                }
                dateTimeM = dateTimeM.AddMonths(-1);
            }
            FlashLogger.Error(string.Format("下载完毕【{0}】", System.Threading.Thread.CurrentThread.ManagedThreadId));
            //测试
            var hospitalIdList = new List <object>
            {
                new { hospitalId = "12319" },
                new { hospitalId = "2" },
                new { hospitalId = "10679" }
            };
            var hospitalIds = JsonConvert.SerializeObject(new { list = hospitalIdList });
            var checkList   = hospitalBll.CheckExist(hospitalIds);
        }
Ejemplo n.º 2
0
        public int AddOrder(Order entity)
        {
            entity.SubmitTime = TimeHelper.GetTime(entity.SubmitTime.ToString());
            IHospitalBLL hospitalBLL = new HospitalBLL();

            if (hospitalBLL.GetHospitalById(entity.HospitalId, Convert.ToInt32(entity.HospitalDepartmentId)) == null)
            {
                var objList = new List <object>
                {
                    new { hospitalId = entity.HospitalId.ToString() }
                };
                var hospitalIds = JsonConvert.SerializeObject(new { list = objList });
                var listEntity  = hospitalBLL.GetHospitals(hospitalIds, "", "1");
                if (listEntity != null)
                {
                    var hospitalList = listEntity.DataList;
                    if (hospitalList != null && hospitalList.Count > 0)
                    {
                        hospitalBLL.AddHospitals(hospitalList);
                    }
                }
            }

            IProcurecatalogBLL procurecatalogBLL = new ProcurecatalogBLL();

            if (procurecatalogBLL.GetProcurecatalogById(entity.ProcurecatalogId) == null)
            {
                var objList = new List <object>
                {
                    new { procurecatalogId = entity.ProcurecatalogId.ToString() }
                };
                var procurecatalogIds = JsonConvert.SerializeObject(new { list = objList });
                var listEntity        = procurecatalogBLL.GetProcurecatalogs(procurecatalogIds, "", "1");
                if (listEntity != null)
                {
                    var procurecatalogList = listEntity.DataList;
                    if (procurecatalogList != null && procurecatalogList.Count > 0)
                    {
                        procurecatalogBLL.AddProcurecatalogs(procurecatalogList);
                    }
                }
            }
            return(dal.AddEntity(entity));
        }