public static string getModel()
        {
            DeviceQueryBLL bll    = new DeviceQueryBLL();
            var            result = bll.getBioModel();

            var retvalue = JsonConvert.SerializeObject(result).Replace("null", "\"\"");

            return(retvalue);
        }
        public static string getProductType()
        {
            DeviceQueryBLL bll    = new DeviceQueryBLL();
            var            result = bll.getProductType();

            var retvalue = JsonConvert.SerializeObject(result);

            return(retvalue);
        }
        public static string getNumDetail(string sn, string num)
        {
            try
            {
                DeviceQueryBLL bll    = new DeviceQueryBLL();
                var            result = bll.getNumDetail(sn, num);

                var retvalue = JsonConvert.SerializeObject(result).Replace("null", "\"\"");;
                return(retvalue);
            }
            catch (Exception ex)
            {
            }
            return("{}");
        }
        public static string GetBioDeviceFault(string sn, string dtstart, string dtend)
        {
            try
            {
                DeviceQueryBLL bll    = new DeviceQueryBLL();
                var            result = bll.GetBioDeviceFaultBLL(sn, dtstart, dtend);

                var retvalue = JsonConvert.SerializeObject(result).Replace("null", "\"\"");;
                return(retvalue);
            }
            catch (Exception ex)
            {
            }
            return(sn);
        }
        public static string getBioDeviceDetial(string sn)
        {
            try
            {
                DeviceQueryBLL bll    = new DeviceQueryBLL();
                var            result = bll.GetBioDeviceDetialBLL(sn);

                var retvalue = JsonConvert.SerializeObject(result).Replace("null", "\"\"");;
                return(retvalue);
            }
            catch (Exception ex)
            {
            }
            return(sn);
        }
        public static string GetDeviceFault(string sn)
        {
            try
            {
                DeviceQueryBLL bll    = new DeviceQueryBLL();
                var            result = bll.GetDeviceFaultBLL(sn);

                var retvalue = JsonConvert.SerializeObject(result);
                return(retvalue);
            }
            catch (Exception ex)
            {
            }
            return(sn);
        }
        public static string getDeviceSampleList(string conditions)
        {
            if (string.IsNullOrEmpty(conditions))
            {
                return("{\"total\":0,\"rows\":[]}");
            }
            DeviceQueryBLL bll = new DeviceQueryBLL();

            List <BioStatistics> list = new List <BioStatistics>();

            list = bll.GetDeviceInfoBLL(conditions);

            var result = new { total = list.Count, rows = list };

            return(JsonConvert.SerializeObject(result).Replace("null", "\"\""));
        }
Beispiel #8
0
        public static string getDeviceList(string conditions, int rows, int page, string sort, string sortOrder)
        {
            if (rows == 0)
            {
                return("{\"total\":0,\"rows\":[]}");
            }
            DeviceQueryBLL bll = new DeviceQueryBLL();

            PagerInfo pagerInfo = new PagerInfo();

            pagerInfo.CurrenetPageIndex = page;
            pagerInfo.PageSize          = rows;

            SortInfo            sortInfo       = new SortInfo(sort, sortOrder);
            QueryConditionModel conditionModel = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));

            if (conditionModel.QueryRange == "1")
            {
                conditionModel.DeviceState = MachineState.已连接仪器;
            }
            else if (conditionModel.QueryRange == "2")
            {
                conditionModel.DeviceState = MachineState.未连接仪器;
            }

            List <QueryList> list = new List <QueryList>();

            list = bll.GetDeviceInfoBLL(conditionModel, pagerInfo, sortInfo);
            pagerInfo.RecordCount = bll.getDeviceCount(conditionModel);

            //Json格式的要求{total:22,rows:{}}
            //构造成Json的格式传递
            var result = new { total = pagerInfo.RecordCount, rows = list };

            return(JsonConvert.SerializeObject(result).Replace("null", "\"\""));
        }
        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            string message = "";
            string Action  = context.Request["Action"];
            //params
            string sn    = context.Request["sn"] ?? "";
            string model = context.Request["model"] ?? "";

            if (model.Trim() == "0")
            {
                model = "";
            }

            string conditions = context.Request["conditions"] ?? "";

            DeviceQueryBLL      bll           = new DeviceQueryBLL();
            StatisticsBLL       staticBll     = new StatisticsBLL();
            PoctStatisticsBLL   poctStaticBll = new PoctStatisticsBLL();
            QueryConditionModel condition;
            DataTable           dt = new DataTable();
            string fileName        = "";

            string[] headers = new string[] { };
            switch (Action)
            {
            case "fault":
                dt       = bll.GetDeviceFaultForExportBLL(sn);//获取导出数据源
                fileName = "错误信息";
                headers  = new string[] { "错误码", "时间" };
                break;

            case "yangben":
                dt       = bll.GetDeviceSampleForExportBLL();//获取导出数据源
                fileName = "样本信息";
                headers  = new string[] { "system_seq", "仪器序列号", "计数值", "计数类型", "时间" };
                break;

            case "cuowu":
                dt       = bll.GetDeviceFaultForExportBLL();//获取导出数据源
                fileName = "错误信息";
                headers  = new string[] { "id", "仪器序列号", "错误码", "时间" };
                break;

            case "bio_fault":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = bll.GetBioDeviceFaultBLL(condition.SN, condition.dtStart, condition.dtEnd);
                fileName  = "生化仪统计_故障信息";
                headers   = new string[] { "错误码", "时间" };
                break;

            case "bio_all":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = staticBll.StatisticsAllBioDevicesForExportBLL(condition);
                fileName  = "生化仪统计_所有机器";
                headers   = new string[] { "仪器名称", "上报时间", "SIM卡号", "仪器序列号", "样本数", "R1试剂使用量(mL)", "R2试剂使用量(mL)" };
                break;

            case "bio_area":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = staticBll.BioStatisticsByAreaForExportBLL(condition);
                fileName  = "生化仪统计_按区域";
                headers   = new string[] { "装机区域", "仪器总数", "样本数", "R1试剂使用量(mL)", "R2试剂使用量(mL)" };
                break;

            case "bio_type":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = staticBll.BioStatisticsByTypeForExportBLL(condition);
                fileName  = "生化仪统计_按机型";
                headers   = new string[] { "机型", "仪器总数", "样本数", "R1试剂使用量(mL)", "R2试剂使用量(mL)" };
                break;

            case "poct_fault":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = bll.GetPoctDeviceFaultBLL(condition.SN, condition.dtStart, condition.dtEnd);
                fileName  = "POCT统计_故障信息";
                headers   = new string[] { "错误码", "时间" };
                break;

            case "poct_all":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = poctStaticBll.StatisticsAllPoctDevicesForExportBLL(condition);
                fileName  = "POCT统计_所有机器";
                headers   = new string[] { "仪器名称", "上报时间", "SIM卡号", "仪器序列号", "样本数", "测试卡消耗数" };
                break;

            case "poct_area":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = poctStaticBll.PoctStatisticsByAreaForExportBLL(condition);
                fileName  = "POCT统计_按区域";
                headers   = new string[] { "装机区域", "仪器总数", "样本数", "测试卡消耗数" };
                break;

            case "poct_type":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = poctStaticBll.PoctStatisticsByTypeForExportBLL(condition);
                fileName  = "POCT统计_按机型";
                headers   = new string[] { "机型", "仪器总数", "样本数", "测试卡消耗数" };
                break;

            case "poct_all_num":
                condition = JsonConvert.DeserializeObject <QueryConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt        = poctStaticBll.StatisticsAllPoctNumForExportBLL(condition);
                fileName  = "POCT统计_总量统计";
                headers   = new string[] { "仪器型号", "测试项目", "样本数", "测试卡消耗数" };
                break;

            case "bio_log":
                LogConditionModel conditionModel = JsonConvert.DeserializeObject <LogConditionModel>(conditions.Replace("\"0\"", "\"\""));
                dt       = staticBll.StatisticsLogsForExportBLL(conditionModel);
                fileName = "日志查询";
                headers  = new string[] { "仪器名称", "SIM卡号", "仪器序列号", "发生时间", "日志内容" };
                break;
            }
            ExportExcel(context, dt, headers, fileName + sn + "_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
            context.Response.Write(message);
        }