|  | @ -47,7 +47,7 @@ public class QLCController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 院方_挂号事件推送
 | 
	
		
			
				|  |  |      * http://localhost:8081/gateway/transfer?api=17¶m={EventType:"1",EventNo:"1",CardType:"1",CardNo:"1",PatientId:"1004295",HospitalId:"1026333"}&requestId="目前没用随便写"
 | 
	
		
			
				|  |  |      *http://localhost:8081/gateway/transfer?api=17¶m={EventType:"1",EventNo:"1",CardType:"1",CardNo:"6001",PatientId:"10001",HospitalId:"1026333"}&requestId="目前没用随便写"
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/queryUserInfo", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "挂号事件推送", response = Object.class, produces = "application/json", notes = "院方挂号事件推送")
 | 
	
	
		
			
				|  | @ -59,7 +59,6 @@ public class QLCController {
 | 
	
		
			
				|  |  |                                          @ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
 | 
	
		
			
				|  |  |                                          HttpServletRequest request) {
 | 
	
		
			
				|  |  |         SQLResponResult restResponseResult = new SQLResponResult();
 | 
	
		
			
				|  |  |         Object s = null;
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             //判断参数是否为空
 | 
	
		
			
				|  |  |             isEmpty(EventType, "EventType is null");
 | 
	
	
		
			
				|  | @ -68,83 +67,94 @@ public class QLCController {
 | 
	
		
			
				|  |  |             isEmpty(CardNo, "CardNo is null");
 | 
	
		
			
				|  |  |             isEmpty(PatientId, "PatientId is null");
 | 
	
		
			
				|  |  |             isEmpty(HospitalId, "HospitalId is null");
 | 
	
		
			
				|  |  |             //-----------------------------得到挂号信息--start
 | 
	
		
			
				|  |  |             //拼凑RPC参数
 | 
	
		
			
				|  |  |             String param = "<Req><TransactionCode>5003</TransactionCode><Data><CardType>"+CardType+"</CardType><CardNo>"+CardNo+"</CardNo><IdCardNo></IdCardNo><OrderId></OrderId><ClinicCard></ClinicCard><TimeSlice></TimeSlice><StartTime></StartTime><EndTime></EndTime><RegFlag>2</RegFlag></Data></Req>";
 | 
	
		
			
				|  |  |             String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
 | 
	
		
			
				|  |  |                     "\"ParamType\"=1," +
 | 
	
		
			
				|  |  |                     "\"Params\"=\"" + param + "\"," +
 | 
	
		
			
				|  |  |                     "\"Guid\"=\"00000001111111\"," +
 | 
	
		
			
				|  |  |                     "\"V\"=\"3.0.0\"," +
 | 
	
		
			
				|  |  |                     "\"OutType\"=1," +
 | 
	
		
			
				|  |  |                     "\"HospitalId\"=\"" + HospitalId + "\"}";
 | 
	
		
			
				|  |  |             s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryRegInfo", apiparam);
 | 
	
		
			
				|  |  |             //解析xml
 | 
	
		
			
				|  |  |             SAXReader saxReader = new SAXReader();
 | 
	
		
			
				|  |  |             Document document = DocumentHelper.parseText(s.toString());
 | 
	
		
			
				|  |  |             Element root = document.getRootElement();
 | 
	
		
			
				|  |  |             String respCode=root.element("RespCode").getText();
 | 
	
		
			
				|  |  |             if ("10000".equals(respCode)) {
 | 
	
		
			
				|  |  |                 //調用接口存入mongo--挂号信息
 | 
	
		
			
				|  |  |                 Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |                 params.put("dataset", "HDSC01_02");
 | 
	
		
			
				|  |  |                 params.put("data", XML2JsonData(root.asXML()));
 | 
	
		
			
				|  |  |                 params.put("orgCode", HospitalId);
 | 
	
		
			
				|  |  |                 String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
 | 
	
		
			
				|  |  |                 monogoUrlValid(monogoUrl,"挂号信息mongo入库失败");
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 throw new Exception(s.toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //-----------------------------得到挂号信息--end
 | 
	
		
			
				|  |  |             //-----------------------------得到人口学信息--start
 | 
	
		
			
				|  |  |             //拼凑RPC参数
 | 
	
		
			
				|  |  |              param = "<Req><TransactionCode>5003</TransactionCode><Data><CardType>"+CardType+"</CardType><CardNo>"+CardNo+"</CardNo><Mobile>123</Mobile><PatientId>"+PatientId+"</PatientId></Data></Req>";
 | 
	
		
			
				|  |  |              apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
 | 
	
		
			
				|  |  |                     "\"ParamType\"=1," +
 | 
	
		
			
				|  |  |                     "\"Params\"=\"" + param + "\"," +
 | 
	
		
			
				|  |  |                     "\"Guid\"=\"00000001111111\"," +
 | 
	
		
			
				|  |  |                     "\"V\"=\"3.0.0\"," +
 | 
	
		
			
				|  |  |                     "\"OutType\"=1," +
 | 
	
		
			
				|  |  |                     "\"HospitalId\"=\"" + HospitalId + "\"}";
 | 
	
		
			
				|  |  |             s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryUserInfo", apiparam);
 | 
	
		
			
				|  |  |             //解析xml
 | 
	
		
			
				|  |  |             saxReader = new SAXReader();
 | 
	
		
			
				|  |  |             document = DocumentHelper.parseText(s.toString());
 | 
	
		
			
				|  |  |             root = document.getRootElement();
 | 
	
		
			
				|  |  |             respCode=root.element("RespCode").getText();
 | 
	
		
			
				|  |  |             if ("10000".equals(respCode)) {
 | 
	
		
			
				|  |  |                 //調用接口存入mongo--人口学信息
 | 
	
		
			
				|  |  |                 Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |                 params.put("dataset", "HDSA00_01");
 | 
	
		
			
				|  |  |                 params.put("data", XML2JsonData(root.asXML()));
 | 
	
		
			
				|  |  |                 params.put("orgCode", HospitalId);
 | 
	
		
			
				|  |  |                 String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
 | 
	
		
			
				|  |  |                 monogoUrlValid(monogoUrl,"人口学信息mongo入库失败");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //触发採集上傳
 | 
	
		
			
				|  |  |                 params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |                 String jsonObject="{\"orgCode\":\""+HospitalId+"\",\"eventNo\":\""+EventNo+"\",\"patientId\":\""+PatientId+"\"}";
 | 
	
		
			
				|  |  |                 params.put("patient", jsonObject);
 | 
	
		
			
				|  |  |                 String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
 | 
	
		
			
				|  |  |                 monogoUrlValid(startCollect,"数据上传失败");
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 throw new Exception(s.toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //得到挂号信息和病人基本信息
 | 
	
		
			
				|  |  |             getRegAndUserInfo(CardType, CardNo, PatientId, HospitalId);
 | 
	
		
			
				|  |  |             Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //触发採集上傳
 | 
	
		
			
				|  |  |             String jsonObject="{\"orgCode\":\""+HospitalId+"\",\"eventNo\":\""+EventNo+"\",\"patientId\":\""+PatientId+"\"}";
 | 
	
		
			
				|  |  |             params.put("patient", jsonObject);
 | 
	
		
			
				|  |  |             String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
 | 
	
		
			
				|  |  |             monogoUrlValid(startCollect,"数据上传失败");
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             restResponseResult.setStatus("1");
 | 
	
		
			
				|  |  |             restResponseResult.setStatusInfo(e.getMessage() + "       RPC:返回" + s);
 | 
	
		
			
				|  |  |             restResponseResult.setStatusInfo(e.getMessage());
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             return restResponseResult;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return restResponseResult;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 得到挂号信息的病人基本信息入mongo
 | 
	
		
			
				|  |  |      * @param CardType
 | 
	
		
			
				|  |  |      * @param CardNo
 | 
	
		
			
				|  |  |      * @param PatientId
 | 
	
		
			
				|  |  |      * @param HospitalId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     private void getRegAndUserInfo(String CardType,String CardNo,String PatientId,  String HospitalId) throws Exception {
 | 
	
		
			
				|  |  |         //-----------------------------得到挂号信息--start
 | 
	
		
			
				|  |  |         //拼凑RPC参数
 | 
	
		
			
				|  |  |         String param = "<Req><TransactionCode>5003</TransactionCode><Data><CardType>"+CardType+"</CardType><CardNo>"+CardNo+"</CardNo><IdCardNo></IdCardNo><OrderId></OrderId><ClinicCard></ClinicCard><TimeSlice></TimeSlice><StartTime></StartTime><EndTime></EndTime><RegFlag>2</RegFlag></Data></Req>";
 | 
	
		
			
				|  |  |         String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
 | 
	
		
			
				|  |  |                 "\"ParamType\"=1," +
 | 
	
		
			
				|  |  |                 "\"Params\"=\"" + param + "\"," +
 | 
	
		
			
				|  |  |                 "\"Guid\"=\"00000001111111\"," +
 | 
	
		
			
				|  |  |                 "\"V\"=\"3.0.0\"," +
 | 
	
		
			
				|  |  |                 "\"OutType\"=1," +
 | 
	
		
			
				|  |  |                 "\"HospitalId\"=\"" + HospitalId + "\"}";
 | 
	
		
			
				|  |  |         Object s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryRegInfo", apiparam);
 | 
	
		
			
				|  |  |         //解析xml
 | 
	
		
			
				|  |  |         Document document = DocumentHelper.parseText(s.toString());
 | 
	
		
			
				|  |  |         Element root = document.getRootElement();
 | 
	
		
			
				|  |  |         String respCode=root.element("RespCode").getText();
 | 
	
		
			
				|  |  |         if ("10000".equals(respCode)) {
 | 
	
		
			
				|  |  |             //調用接口存入mongo--挂号信息
 | 
	
		
			
				|  |  |             Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |             params.put("dataset", "HDSC01_02");
 | 
	
		
			
				|  |  |             params.put("data", XML2JsonData(root.asXML()));
 | 
	
		
			
				|  |  |             params.put("orgCode", HospitalId);
 | 
	
		
			
				|  |  |             String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
 | 
	
		
			
				|  |  |             monogoUrlValid(monogoUrl,"挂号信息mongo入库失败");
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             throw new Exception(s.toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //-----------------------------得到挂号信息--end
 | 
	
		
			
				|  |  |         //-----------------------------得到人口学信息--start
 | 
	
		
			
				|  |  |         //拼凑RPC参数
 | 
	
		
			
				|  |  |         param = "<Req><TransactionCode>5003</TransactionCode><Data><CardType>"+CardType+"</CardType><CardNo>"+CardNo+"</CardNo><Mobile>123</Mobile><PatientId></PatientId></Data></Req>";
 | 
	
		
			
				|  |  |         apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
 | 
	
		
			
				|  |  |                "\"ParamType\"=1," +
 | 
	
		
			
				|  |  |                "\"Params\"=\"" + param + "\"," +
 | 
	
		
			
				|  |  |                "\"Guid\"=\"00000001111111\"," +
 | 
	
		
			
				|  |  |                "\"V\"=\"3.0.0\"," +
 | 
	
		
			
				|  |  |                "\"OutType\"=1," +
 | 
	
		
			
				|  |  |                "\"HospitalId\"=\"" + HospitalId + "\"}";
 | 
	
		
			
				|  |  |         s = RPCUtil.getRPCData("ZEUS.HosHOPWs.QueryUserInfo", apiparam);
 | 
	
		
			
				|  |  |         //解析xml
 | 
	
		
			
				|  |  |         document = DocumentHelper.parseText(s.toString());
 | 
	
		
			
				|  |  |         root = document.getRootElement();
 | 
	
		
			
				|  |  |         respCode=root.element("RespCode").getText();
 | 
	
		
			
				|  |  |         Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |         if ("10000".equals(respCode)) {
 | 
	
		
			
				|  |  |             //調用接口存入mongo--人口学信息
 | 
	
		
			
				|  |  |             params.put("dataset", "HDSA00_01");
 | 
	
		
			
				|  |  |             params.put("data", XML2JsonData(root.asXML()));
 | 
	
		
			
				|  |  |             params.put("orgCode", HospitalId);
 | 
	
		
			
				|  |  |             String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
 | 
	
		
			
				|  |  |             monogoUrlValid(monogoUrl,"人口学信息mongo入库失败");
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             throw new Exception(s.toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //-----------------------------得到人口学信息--end
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 院方_检查/检验报告单推送---数据说明
 | 
	
		
			
				|  |  |      * localhost:8081/gateway/transfer?api=18¶m={CardType:"",CardNo:"000021341249",ReportType:"0",ReportId:"201405228-A-110B",State:"2",HospitalId:"1026333"}&requestId="目前没用随便写"
 | 
	
		
			
				|  |  |      * localhost:8081/gateway/transfer?api=18¶m={CardType:"1",CardNo:"10003",ReportType:"2",ReportId:"123",State:"2",HospitalId:"1026333"}&requestId="目前没用随便写"
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/patientInformation", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "检查/检验报告单推送-", response = Object.class, produces = "application/json", notes = "检查/检验报告单推送-")
 | 
	
	
		
			
				|  | @ -168,9 +178,12 @@ public class QLCController {
 | 
	
		
			
				|  |  |             if ("1".equals(State)) {
 | 
	
		
			
				|  |  |                 throw new Exception("报告未出,结束");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
 | 
	
		
			
				|  |  |             String data =
 | 
	
		
			
				|  |  |                     "<Req><TransactionCode>5001</TransactionCode><Data><CardNo>" + CardNo + "</CardNo><ReportId>" + ReportId + "</ReportId><ReportType>" + ReportType + "</ReportType></Data></Req>";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //得到挂号信息和病人基本信息
 | 
	
		
			
				|  |  |             getRegAndUserInfo(CardType, CardNo, null, HospitalId);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String data ="<Req><TransactionCode>5001</TransactionCode><Data><CardNo>" + CardNo + "</CardNo><ReportId>" + ReportId + "</ReportId><ReportType>" + ReportType + "</ReportType></Data></Req>";
 | 
	
		
			
				|  |  |             String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
 | 
	
		
			
				|  |  |                     "\"ParamType\"=1," +
 | 
	
		
			
				|  |  |                     "\"Params\"=\"" + data + "\"," +
 | 
	
	
		
			
				|  | @ -208,12 +221,24 @@ public class QLCController {
 | 
	
		
			
				|  |  |                             jsonArray1.add(jo1);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     String evenNo=jo.get("EVENT_NO").toString();
 | 
	
		
			
				|  |  |                     jsonArray.add(jo);
 | 
	
		
			
				|  |  |                     //上傳主表
 | 
	
		
			
				|  |  |                     addMongoAndUpload("HDSD02_01",  jo.get("EVENT_NO").toString(),CardNo, HospitalId, jsonArray);
 | 
	
		
			
				|  |  |                     //上傳細表
 | 
	
		
			
				|  |  |                     addMongoAndUpload("HDSD02_02",  jo.get("EVENT_NO").toString(),CardNo, HospitalId, jsonArray1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if(ReportType.equals("1")){
 | 
	
		
			
				|  |  |                         //检验报告
 | 
	
		
			
				|  |  |                         //上傳主表
 | 
	
		
			
				|  |  |                         addMongo("HDSD02_01", evenNo,CardNo, HospitalId, jsonArray);
 | 
	
		
			
				|  |  |                         //上傳細表
 | 
	
		
			
				|  |  |                         addMongo("HDSD02_03", evenNo,CardNo, HospitalId, jsonArray1);
 | 
	
		
			
				|  |  |                     }else{
 | 
	
		
			
				|  |  |                         //检查报告
 | 
	
		
			
				|  |  |                         addMongo("HDSD01_01", evenNo,CardNo, HospitalId, jsonArray);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     //出發採集上傳
 | 
	
		
			
				|  |  |                     Map<String,Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |                     String jsonObject="{\"orgCode\":\""+HospitalId+"\",\"eventNo\":\""+evenNo+"\",\"patientId\":\""+CardNo+"\"}";
 | 
	
		
			
				|  |  |                     params.put("patient", jsonObject);
 | 
	
		
			
				|  |  |                     String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
 | 
	
		
			
				|  |  |                     monogoUrlValid(startCollect,"数据上传失败");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
	
		
			
				|  | @ -227,19 +252,13 @@ public class QLCController {
 | 
	
		
			
				|  |  |         return restResponseResult;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private void addMongoAndUpload(String tableName,String evenNo,String CardNo,String HospitalId, JSONArray jsonArray) throws Exception {
 | 
	
		
			
				|  |  |     private void addMongo(String tableName,String evenNo,String CardNo,String HospitalId, JSONArray jsonArray) throws Exception {
 | 
	
		
			
				|  |  |         Map<String, Object> params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |         params.put("dataset", tableName);
 | 
	
		
			
				|  |  |         params.put("data", jsonArray.toString());
 | 
	
		
			
				|  |  |         params.put("orgCode", HospitalId);
 | 
	
		
			
				|  |  |         String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
 | 
	
		
			
				|  |  |         monogoUrlValid(monogoUrl,"mongo入库失败");
 | 
	
		
			
				|  |  |         //出發採集上傳
 | 
	
		
			
				|  |  |         params = new HashMap<String, Object>();
 | 
	
		
			
				|  |  |         String jsonObject="{\"orgCode\":\""+HospitalId+"\",\"eventNo\":\""+evenNo+"\",\"patientId\":\""+CardNo+"\"}";
 | 
	
		
			
				|  |  |         params.put("patient", jsonObject);
 | 
	
		
			
				|  |  |         String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
 | 
	
		
			
				|  |  |         monogoUrlValid(startCollect,"数据上传失败");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private String getOrgCodeBy(String orgCode) {
 |