java高并发

业务场景:一般在项目完成时,为了项目的稳定性,安全性,我们一般都会做一个测试工具,就比如高并发测试:在一个时间点同时访问莫一个服务

需要知道的几个知识点:

  1)AtomicInteger

    AtomicInteger提供原子操作来进行Integer的使用,因此十分适合高并发情况下的使用,在a线程中+1,此时在b线程中在看这个值就是+1后的值了

    参考:https://www.cnblogs.com/zhaoyan001/p/8885360.html

  2)ExecutorService

    线程池

  3)CountDownLatch

    正如每个Java文档所描述的那样,CountDownLatch是一个同步工具类,它允许一个或多个线程一直等待,直到其他线程的操作执行完后再执行

               http://www.importnew.com/15731.html

  4)例子:

public Result highlyConcurrentTest1(Integer count,String classes) {
        Date data = new Date();
        Map<Thread,HttpURLConnection> threadData = new HashMap<Thread,HttpURLConnection>();
        final AtomicInteger number = new AtomicInteger(); //计数执行失败的线程
        ExecutorService pool = Executors.newCachedThreadPool(); //创建一个线程池  
        final CountDownLatch cdOrder = new CountDownLatch(1);//指挥官的命令,设置为1,指挥官一下达命令,则cutDown,变为0,战士们执行任务  
        final CountDownLatch cdAnswer = new CountDownLatch(count-1);//因为有三个战士,所以初始值为count,每一个战士执行任务完毕则cutDown一次,当三个都执行完毕,变为0,则指挥官停止等待。 
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                try {
                    log.info("子线程"+Thread.currentThread().getName()+"正准备执行");
                    cdOrder.await();//战士们都处于等待命令状态  
                    synchronized (this) {
                        switch (classes) {
                        case "8881":
                            String endPoint1 = "http://"+testIp+":8881/WebSiteSouthRJ/CSWebService.asmx";
                            HttpURLConnection connection1 = SoapUtil.invokeSrvGet(endPoint1);
                            threadData.put(Thread.currentThread(), connection1);
                            break;
                        case "8882":
                            String soapXML17 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><ESP_Input xmlns=\"http://tempuri.org/\"><user>RuiKe</user><password>eea79c4e7f1c453d866bcb0bbd22138e</password><methodCode>EMR-ET-S10</methodCode><methodName>SynchRisReport</methodName><parameter>&lt;CallInfo&gt;&lt;Reportcomment&gt;&lt;ETONo&gt;8185856&lt;/ETONo&gt;&lt;ETODetailNo&gt;9305395&lt;/ETODetailNo&gt;&lt;ReportNo&gt;c8293bac-03bb-4879-9b9c-0d3fa10ddd74&lt;/ReportNo&gt;&lt;ExamDateTime&gt;&lt;/ExamDateTime&gt;&lt;ReportDateTime&gt;2018-08-21 16:32:59&lt;/ReportDateTime&gt;&lt;ExamPart&gt;胸部平扫&lt;/ExamPart&gt;&lt;DeptCode&gt;33620562&lt;/DeptCode&gt;&lt;DeptName&gt;33620562&lt;/DeptName&gt;&lt;DoctorId&gt;1135&lt;/DoctorId&gt;&lt;DoctorName&gt;1135&lt;/DoctorName&gt;&lt;CriticalFlag&gt;0&lt;/CriticalFlag&gt;&lt;CriticalContent&gt;&lt;/CriticalContent&gt;&lt;ExamDescript&gt;行aaaa1\r\n行aaaa2\r\n行aaaa3\r\n行4aaaa&lt;/ExamDescript&gt;&lt;DiagDescript&gt;&lt;/DiagDescript&gt;&lt;ExamVerdict&gt;结果1\r\n结果2\r\n结果3\r\n&lt;/ExamVerdict&gt;&lt;ExamDiag&gt;&lt;/ExamDiag&gt;&lt;Reporter&gt;zww&lt;/Reporter&gt;&lt;ReporterName&gt;zww&lt;/ReporterName&gt;&lt;DateTime&gt;&lt;/DateTime&gt;&lt;ReportTypeFlag&gt;1&lt;/ReportTypeFlag&gt;&lt;Noter&gt;&lt;/Noter&gt;&lt;ReportURL&gt;&lt;/ReportURL&gt;&lt;ImageURL&gt;&lt;![CDATA[http://172.26.12.37/masterview/mv.jsp?server_name=pacsrjnFIR&amp;user_name=clinic&amp;close_on_exit=true&amp;key_images=false&amp;password=clinic&amp;accession_number=CT9008185856]]&gt;&lt;/ImageURL&gt;&lt;/Reportcomment&gt;&lt;/CallInfo&gt;</parameter></ESP_Input></soap:Body></soap:Envelope>";
                            String endPoint17 = "http://"+testIp+":8882/MedicalServiceESB.asmx";
                            String soapAction17 = "http://tempuri.org/ESP_Input";
                            HttpURLConnection connection2 = SoapUtil.invokeSrvSoap(endPoint17,soapAction17, soapXML17);
                            threadData.put(Thread.currentThread(), connection2);
                            break;
                        case "8883":
                            String endPoint3 = "http://"+testIp+":8883/WebSiteSouthRJ/CSWebService.asmx?WSDL";
                            HttpURLConnection connection3 = SoapUtil.invokeSrvGet(endPoint3);
                            threadData.put(Thread.currentThread(), connection3);
                            break;
                        case "8884":
                            String soapXML4 = "<?xml version=\"1.0\"?>\r\n"+
                                    "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><SOAP-ENV:Body><ESP_Input xmlns=\"http://tempuri.org/\"><user></user><password></password><methodCode>EMR-ET-S10</methodCode><methodName>SynchRisReport</methodName><parameter>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;CallInfo&gt;&lt;Reportcomment&gt;&lt;ETONo&gt;12400537&lt;/ETONo&gt;&lt;ETODetailNo&gt;12400537&lt;/ETODetailNo&gt;&lt;ReportNo&gt;1&lt;/ReportNo&gt;&lt;ExamDateTime&gt;2018-10-24 13:45:46&lt;/ExamDateTime&gt;&lt;ReportDateTime&gt;2018-10-24 13:45:46&lt;/ReportDateTime&gt;&lt;ExamPart&gt;颈动脉&lt;/ExamPart&gt;&lt;DeptCode&gt;33670262&lt;/DeptCode&gt;&lt;DeptName&gt;超声医学科&lt;/DeptName&gt;&lt;DoctorId&gt;&lt;/DoctorId&gt;&lt;DoctorName&gt;蒋会&lt;/DoctorName&gt;&lt;CriticalFlag&gt;1&lt;/CriticalFlag&gt;&lt;CriticalContent&gt;&lt;/CriticalContent&gt;&lt;ExamDescript&gt;右侧颈总��脉内径5.3mm,内膜中层厚度1.3mm,最大流速87cm/s,舒张末期流速21cm/s,阻力指数0.78。&amp;#13;&amp;#10;左侧颈总动脉内径5.2mm,内膜中层厚度1.2mm,最大流速89cm/s,舒张末期流速20cm/s,阻力指数0.78。&amp;#13;&amp;#10;右侧颈动脉分叉处内膜中层厚度:0.9-1.5mm。&amp;#13;&amp;#10;左侧颈动脉分叉处内膜中层厚度:0.9-1.4mm。&amp;#13;&amp;#10;\r\n"+
                                    "右侧颈内动脉内径4.8mm,内膜中层厚度0.5mm,最大流速78cm/s,舒张末期流速21cm/s,阻力指数0.65。&amp;#13;&amp;#10;右侧颈外动脉内径3.9mm,内膜中层厚度0.5mm,最大流速60cm/s,舒张末期流速14cm/s,阻力指数0.78。&amp;#13;&amp;#10;左侧颈内动脉内径4.6mm,内膜中层厚度0.5mm,最大流速77cm/s,舒张末期流速20cm/s,阻力指数0.66。&amp;#13;&amp;#10;左侧颈外动脉内径3.5mm,内膜中层厚度0.5mm,最大流速65cm/s,舒张末期流速12cm/s,阻力指数0.79。&amp;#13;&amp;#10;双侧颈动脉内膜面毛糙,双侧颈动脉分叉处内膜中层不规则增厚伴强回声斑块,左侧大小约3.7*0.9mm。&amp;#13;&amp;#10;&lt;/ExamDescript&gt;&lt;DiagDescript&gt;&lt;/DiagDescript&gt;&lt;ExamVerdict&gt;双侧颈动脉内膜面毛糙,双侧颈动脉分叉处内膜中层不规则增厚伴钙化灶形成&amp;#13;&amp;#10;&lt;/ExamVerdict&gt;&lt;ExamDiag&gt;&lt;/ExamDiag&gt;&lt;Reporter&gt;&lt;/Reporter&gt;&lt;ReporterName&gt;蒋会&lt;/ReporterName&gt;&lt;DateTime&gt;2018-10-24 13:45:46&lt;/DateTime&gt;&lt;ReportTypeFlag&gt;1&lt;/ReportTypeFlag&gt;&lt;Noter&gt;"+
                                    "&lt;/Noter&gt;&lt;ReportURL&gt;http://172.26.12.39:81/HCRISOtherReport.aspx?Patient_ID=377579&lt;/ReportURL&gt;&lt;ImageURL&gt;377579&lt;/ImageURL&gt;&lt;/Reportcomment&gt;&lt;/CallInfo&gt;</parameter></ESP_Input></SOAP-ENV:Body></SOAP-ENV:Envelope>";
                            String soapXML14 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><ESP_Input xmlns=\"http://tempuri.org/\"><user>RuiKe</user><password>eea79c4e7f1c453d866bcb0bbd22138e</password><methodCode>EMR-ET-S02</methodCode><methodName>SynchReceiveInfo</methodName><parameter>&lt;CallInfo&gt;&lt;ETONo&gt;9690890&lt;/ETONo&gt;&lt;ETODetailNo&gt;10898322&lt;/ETODetailNo&gt;&lt;PerformedBy&gt;33620362&lt;/PerformedBy&gt;&lt;Technician&gt;RIS&lt;/Technician&gt;&lt;StatusFlag&gt;1&lt;/StatusFlag&gt;&lt;SysFlag&gt;1&lt;/SysFlag&gt;&lt;/CallInfo&gt; </parameter></ESP_Input></soap:Body></soap:Envelope>";
                            String endPoint4 = "http://"+testIp+":8884/MedicalServiceESB.asmx";
                            String soapAction4 = "http://tempuri.org/ESP_Input";
                            HttpURLConnection connection4 = SoapUtil.invokeSrvSoap(endPoint4,soapAction4, soapXML4);
                            threadData.put(Thread.currentThread(), connection4);
                            break;
                        case "8885":
                            String endPoint5 = "http://"+testIp+":8885/WebSiteSouthRJ/CSWebService.asmx?WSDL";
                            HttpURLConnection connection5 = SoapUtil.invokeSrvGet(endPoint5);
                            threadData.put(Thread.currentThread(), connection5);
                            break;
                        case "8886":
                            java.util.Random random=new java.util.Random();
                            int result=random.nextInt(4);
                            String soapXML6="";
                            String endPoint6 = "";
                            String soapAction6 = "";
                            switch(result){
                            case 0:
                                soapXML6="<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:zs1=\"http://tempuri.org/\">  <s:Body>    <zs1:SynchLisReportStatusByReportNo>      <zs1:ReportNo><![CDATA[5404720]]></zs1:ReportNo>      <zs1:ETONo><![CDATA[11235151]]></zs1:ETONo>      <zs1:PerformedBy><![CDATA[33600262]]></zs1:PerformedBy>      <zs1:Technician><![CDATA[017040]]></zs1:Technician>      <zs1:StatusFlag><![CDATA[1]]></zs1:StatusFlag>      <zs1:SysFlag><![CDATA[1]]></zs1:SysFlag>    </zs1:SynchLisReportStatusByReportNo >  </s:Body></s:Envelope>";
                                endPoint6="http://"+testIp+":8886/InspectService.asmx";
                                soapAction6="http://tempuri.org/SynchLisReportStatusByReportNo";
                                break;
                            case 1:
                                soapXML6="<E:Envelope    xmlns:E=\"http://schemas.xmlsoap.org/soap/envelope/\"    xmlns:A=\"http://schemas.xmlsoap.org/soap/encoding/\"    xmlns:s=\"http://www.w3.org/2001/XMLSchema-instance\"    xmlns:y=\"http://www.w3.org/2001/XMLSchema\"    E:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><E:Body><m:SynchBloodFeeInfo    xmlns:m=\"http://tempuri.org/LIS/\"><m:Barcode    s:type=\"y:string\">BX1000041165</m:Barcode><m:FeeInfo    s:type=\"y:string\">&lt;FeeInfo&gt;&#xd;  &lt;Record&gt;&#xd;    &lt;OrderId&gt;14978220&lt;/OrderId&gt;&#xd;    &lt;DetailXh&gt;0&lt;/DetailXh&gt;&#xd;    &lt;ChargeItemId&gt;X0000-2&lt;/ChargeItemId&gt;&#xd;    &lt;ItemFlag&gt;1&lt;/ItemFlag&gt;&#xd;    &lt;Count&gt;2.00&lt;/Count&gt;&#xd;    &lt;ModifyDate&gt;2018-06-25 18:14:28&lt;/ModifyDate&gt;&#xd;    &lt;ModifyStaffId&gt;012610&lt;/ModifyStaffId&gt;&#xd;    &lt;ModifyDeptId&gt;33780012&lt;/ModifyDeptId&gt;&#xd;  &lt;/Record&gt;&#xd;&lt;/FeeInfo&gt;</m:FeeInfo></m:SynchBloodFeeInfo></E:Body></E:Envelope>";
                                endPoint6="http://"+testIp+":8886/InspectServiceESB.asmx";
                                soapAction6="http://tempuri.org/LIS/SynchBloodFeeInfo";
                                break;
                            case 2:
                                soapXML6="<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><CreateLisReport xmlns=\"http://tempuri.org/\"><REPORTCOMMENT> &lt;Report&gt;  &lt;ReportHead&gt;   &lt;ETO_NO&gt;S018062508543&lt;/ETO_NO&gt;   &lt;ETO_DETAIL_NO&gt;12472213&lt;/ETO_DETAIL_NO&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;EXAM_DATE_TIME&gt;2018062518:11:02&lt;/EXAM_DATE_TIME&gt;   &lt;REPORT_DATE_TIME&gt;2018062518:20:35&lt;/REPORT_DATE_TIME&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;DOCTOR_ID&gt;7040&lt;/DOCTOR_ID&gt;   &lt;DOCTOR_NAME&gt;蔡回波&lt;/DOCTOR_NAME&gt;   &lt;CRITICAL&gt;0&lt;/CRITICAL&gt;   &lt;DESCRIPTION&gt;&lt;/DESCRIPTION&gt;   &lt;REPORTER&gt;2401&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;袁挺&lt;/REPORTER_NAME&gt;   &lt;DESCRIPTION_DATE_TIME&gt;2018062518:11:02&lt;/DESCRIPTION_DATE_TIME&gt;   &lt;DETAIL&gt;&lt;/DETAIL&gt;   &lt;REPORT_TYPE&gt;0&lt;/REPORT_TYPE&gt;   &lt;SAMPLEKIND&gt;静脉血&lt;/SAMPLEKIND&gt;  &lt;/ReportHead&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;4589010&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;pH&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;PH值&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;7.37&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;7040&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;蔡回波&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;2018062518:11:02&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;7.35--7.45&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;pCO2&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;二氧化碳分压&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;46&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmHg&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;pO2&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;氧分压&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;25&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmHg&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;SO2c&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;氧饱和度&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;43&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;%&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;TCO2&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;二氧化碳总量&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;28.0&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;24--32&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;Na+&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;钠&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;141&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;135--145&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;K+&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;钾&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;3.8&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;3.5--5.5&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;Ca++&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;离子钙&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;1.13&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;L&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;1.15--1.27&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;Lac&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;乳酸&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;1.2&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;0.5--2.2&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;Hct&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;红细胞压积&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;53&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;%&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;H&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;33--51&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;HCO3-&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;碳酸氢根&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;26.6&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;22--29&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;HCO3std&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;标准碳酸氢根&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;23.7&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;22--29&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;BE(B)&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;全血剩余碱&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;0.7&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;-3--3&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt;  &lt;ReportDetail&gt;   &lt;REPORT_NO&gt;LIS5404720&lt;/REPORT_NO&gt;   &lt;VISIT_ID&gt;&lt;/VISIT_ID&gt;   &lt;REPORT_TYPE&gt;LIS&lt;/REPORT_TYPE&gt;   &lt;REPORT_TYPE_NAME&gt;&lt;/REPORT_TYPE_NAME&gt;   &lt;ITEM_CODE&gt;BE(ecf)&lt;/ITEM_CODE&gt;   &lt;ITEM_NAME&gt;红细胞外液剩余碱&lt;/ITEM_NAME&gt;   &lt;RELEVANT_LAB_TEST&gt;1.3&lt;/RELEVANT_LAB_TEST&gt;   &lt;ITEM_EXTRAVALUE&gt;&lt;/ITEM_EXTRAVALUE&gt;   &lt;DEPT_CODE&gt;&lt;/DEPT_CODE&gt;   &lt;DEPT_NAME&gt;&lt;/DEPT_NAME&gt;   &lt;REPORTER&gt;&lt;/REPORTER&gt;   &lt;REPORTER_NAME&gt;&lt;/REPORTER_NAME&gt;   &lt;DATE_TIME&gt;&lt;/DATE_TIME&gt;   &lt;ITEM_UP&gt;&lt;/ITEM_UP&gt;   &lt;ITEM_DOWN&gt;&lt;/ITEM_DOWN&gt;   &lt;ITEM_UNIT&gt;mmol/L&lt;/ITEM_UNIT&gt;   &lt;ITEM_STATUS&gt;M&lt;/ITEM_STATUS&gt;   &lt;CRITICALMINBAND&gt;&lt;/CRITICALMINBAND&gt;   &lt;CRITICALMAXBAND&gt;&lt;/CRITICALMAXBAND&gt;   &lt;CRITICALFLAG&gt;0&lt;/CRITICALFLAG&gt;   &lt;CRITICALREPLYFLAG&gt;&lt;/CRITICALREPLYFLAG&gt;   &lt;ITEM_EXAMMETHOD&gt;&lt;/ITEM_EXAMMETHOD&gt;   &lt;RELATED_ITEM_CODE&gt;&lt;/RELATED_ITEM_CODE&gt;   &lt;BANDRANGE&gt;-3--3&lt;/BANDRANGE&gt;  &lt;/ReportDetail&gt; &lt;/Report&gt;</REPORTCOMMENT></CreateLisReport></soap:Body></soap:Envelope>";
                                endPoint6="http://"+testIp+":8886/InspectService.asmx";
                                soapAction6="http://tempuri.org/CreateLisReport";
                                break;
                            case 3:
                                soapAction6="http://tempuri.org/SynchReceiveBarcode";
                                soapXML6="<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><SynchReceiveBarcode xmlns=\"http://tempuri.org/\"><BARCODE>S018062508584</BARCODE><PERFORMED_BY>33600262</PERFORMED_BY><TECHNICIAN>012709</TECHNICIAN><STATUS>1</STATUS><SYSTEM_INDICATE>1</SYSTEM_INDICATE></SynchReceiveBarcode></soap:Body></soap:Envelope>";
                                endPoint6="http://"+testIp+":8886/InspectService.asmx";
                                break;
                            default:
                                break;
                            }
                            HttpURLConnection connection6 = SoapUtil.invokeSrvSoap(endPoint6,soapAction6, soapXML6);
                            threadData.put(Thread.currentThread(), connection6);
                            break;
                        default:
                            break;
                        }
                    }
                    int responseCode = threadData.get(Thread.currentThread()).getResponseCode();
                    synchronized (this) {
                        if(responseCode==200){
                            log.info(Thread.currentThread().getName()+"获得返回值");
                            String result = "";
                            InputStream is = threadData.get(Thread.currentThread()).getInputStream();  
                            InputStreamReader isr = new InputStreamReader(is);  
                            BufferedReader br = new BufferedReader(isr);  
                            StringBuilder sb = new StringBuilder();  
                            String temp = null;  
                            while(null != (temp = br.readLine())){
                                sb.append(temp);  
                            }  
                            result = sb.toString();
                            log.info(Thread.currentThread().getName()+":"+result);
                            is.close();  
                            isr.close();  
                            br.close();
                        }
                    }
                } catch (Exception e) {
                    number.incrementAndGet();
                    e.printStackTrace();
                }finally {
                    cdAnswer.countDown(); //任务执行完毕,返回给指挥官,cdAnswer减1
                    log.info(Long.toString(cdAnswer.getCount()));
                }
            }
        };
        try {
            for(int i=0;i<count;i++){
                pool.execute(runnable);
            }
            Thread.sleep((long)(count*10));
            synchronized (this) {
                log.info("线程" + Thread.currentThread().getName() + "即将发布命令");
                data = new Date();//这里就是所有线程并发时间点
                log.info("线程" + Thread.currentThread().getName() + "已发送命令,正在等待结果");
                cdOrder.countDown(); //发送命令,cdOrder减1,处于等待的战士们停止等待转去执行任务
            }
            cdAnswer.await(); //命令发送后指挥官处于等待状态,一旦cdAnswer为0时停止等待继续往下执行
            log.info("线程" + Thread.currentThread().getName() +  "已收到所有响应结果");  
        } catch (Exception e) {
            e.printStackTrace();
        }
        long interval = new Date().getTime()-data.getTime();
        String sql = "select sum(a.WSInterval)as sum,max(a.WSInterval) as max ,AVG(a.WSInterval) as avg from ("
                + "select top("+count+")* from wsm.dbo.CallLogs order by SerialNo desc)a";
        Map<String,Object> map = esbsitMapper.commsql(sql);
        String max = map.get("max").toString();
        String sum = map.get("sum").toString();
        String avg = map.get("avg").toString();
        JSONObject result = new JSONObject();
        result.put("failSum", number);
        result.put("interval", interval);
        result.put("sum", sum);
        result.put("max", max);
        result.put("avg", avg);
        
        return ResultUtil.success(result);
    }

 

posted @ 2019-04-18 22:25  王吉平  阅读(311)  评论(0编辑  收藏  举报