예제 #1
0
        /// <summary>
        /// 开启报告
        /// </summary>
        /// <param name="postDataStr"></param>
        private static void  CreateReport(string postDataStr)
        {
            string postUrl = "http://hk-server.bisahealth.com/l/create_report_public";

            //post方法返回json格式返回值
            string jsonResult = HttpUtils.HttpPost(postUrl, postDataStr);

            ReportDto reportDto = new ReportDto();

            //将json返回值转换成ReportDto对象
            reportDto = JsonToObjectUtils.JSONStringToList(jsonResult.ToString());

            Console.WriteLine(jsonResult);

            //当返回状态码为205和402时,才会有报告返回
            if (reportDto.code == 205)
            {
                Console.WriteLine("Code:" + reportDto.code + "|Msg:" + reportDto.message + "\r\n");
                Console.WriteLine("开启报告成功!");
            }
            else if (reportDto.code == 402)
            {
                Console.WriteLine(reportDto.code + ":" + reportDto.message + "\r\n" + reportDto.appReport.report_number);


                int    user_guid     = 729;
                string report_number = reportDto.appReport.report_number;
                int    report_status = 6;

                /*
                 * 以防万一,我增加了一个手动修改报告状态的接口,设置报告状态status=6,即为失效状态。
                 * 如果开启报告一直报402,并返回了未上传数据的报告,此时你可以进行两种操作:
                 * 如需要使用该方法,请去掉注释,再启动。
                 */

                //1、补充上传这个报告的心电数据


                //2、设置这个报告的状态为失效report_status=6(用下面这个ChangeReportStatus方法)
                //ChangeReportStatus(user_guid, report_number, report_status);
            }
            else
            {
                Console.WriteLine("Code:" + reportDto.code + "|Msg:" + reportDto.message + "\r\n");
            }


            Console.ReadKey();

            /*
             * }catch(Exception e)
             * {
             * Console.WriteLine(e.StackTrace);
             * }
             * finally
             * {
             * Console.ReadKey();
             * }
             */
        }
예제 #2
0
        public static void ChangeReportStatus(int user_guid, string report_number, int report_status)
        {
            string httpGetUrl = "http://hk-server.bisahealth.com/l/change_report_status";
            string getDataStr = "user_guid=" + user_guid + "&report_number=" + report_number + "&report_status=" + report_status;
            string jsonResult = HttpUtils.HttpGet(httpGetUrl, getDataStr);

            ReportDto reportDto = new ReportDto();

            reportDto = JsonToObjectUtils.JSONStringToList(jsonResult.ToString());

            if (reportDto.code == 200)
            {
                Console.WriteLine("修改状态成功!修改状态为" + report_status);
            }
            else
            {
                Console.WriteLine(jsonResult);
            }
            Console.ReadKey();
        }