| 
					
				 | 
			
			
				@ -3,13 +3,17 @@ package com.yihu.jw.hospital.service.MultipleCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.BasePatientWechatDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.WxWechatDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.BasePatientWechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.WechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.ylzinfo.ehc.EhcHandler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.ylzinfo.ehc.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.ylzinfo.ehc.trans.TransRequest; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -30,7 +34,7 @@ import java.util.UUID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OauthYlzConfigDao oauthYlzConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private  OauthYlzConfigDao oauthYlzConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientDao basePatientDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -38,11 +42,20 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientWechatDao basePatientWechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${wx.id}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String wxId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WechatDao wechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHttpLogDao wlyyHttpLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop mcfRegister(BasePatientDO patientDO, String wechatId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientWechatDo patientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientDO.getId()).get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WxWechatDO wechatDO = wechatDao.findById(wxId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        TransResponse re= new TransResponse(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            TransRequest request = new TransRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setMethod("ehc.ehealthcard.register"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -56,7 +69,7 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("out_register_time", DateUtils.getOutTradeTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("out_register_no", DateUtils.getOutTradeTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("open_id", patientWechatDo.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("account_id", "gh_a09552a72c9b"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("account_id", wechatDO.getAppOriginId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("certificate_mode", "01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("id_type", "01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("id_no", patientDO.getIdcard()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -74,9 +87,7 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("code_url",JSONObject.parseObject(re.getBiz_content()).getString("code_url")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String result = jsonObject.toJSONString().replaceAll("\\|888", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(result!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setRegister("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                basePatientDao.save(patientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return MixEnvelop.getSuccess("注册成功",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return MixEnvelop.getSuccess("注册URL获取成功",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError(JSONObject.parseObject(re.getRet_msg()).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -85,32 +96,85 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     根据openId、 accountId查询三码融合码信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop mcfOpenquery(String openId,String accountId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            TransRequest request = new TransRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setMethod("ehc.ehealthcard.openquery"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setApp_id(oauthYlzConfigDO.getAppId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setTerm_id(oauthYlzConfigDO.getTermId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setVersion("X.M.0.1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setTimestamp(DateUtils.getOutTradeTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setSign_type("MD5"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setEnc_type("Plain"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject bizContent = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("open_id", openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            bizContent.put("account_id", accountId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            request.setBiz_content(JSONObject.toJSONString(bizContent)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl()+"ehcService/gateway.do", oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            TransResponse re = ehcHandler.execute(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("0000".equals(JSONObject.parseObject(re.getRet_code()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String ehealth_card_id = JSONObject.parseObject(re.getBiz_content()).getString("ehealth_card_id").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (ehealth_card_id!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return MixEnvelop.getSuccess("查询用户信息成功",ehealth_card_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop mcfOpenquery(String patientId,String wechatId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WxWechatDO wechatDO = wechatDao.findByAppId(wxId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientWechatDo patientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientDO.getId()).get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patientWechatDo!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                TransRequest request = new TransRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setMethod("ehc.ehealthcard.openquery"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setApp_id(oauthYlzConfigDO.getAppId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setTerm_id(oauthYlzConfigDO.getTermId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setVersion("X.M.0.1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setTimestamp(DateUtils.getOutTradeTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setSign_type("MD5"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setEnc_type("Plain"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject bizContent = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                bizContent.put("open_id", patientWechatDo.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                bizContent.put("account_id",wechatDO.getAppOriginId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                request.setBiz_content(JSONObject.toJSONString(bizContent)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl()+"ehcService/gateway.do", oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                TransResponse re = ehcHandler.execute(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ((JSONObject.parseObject(re.getRet_code()).toJSONString()).equalsIgnoreCase("0000")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patientDO.setRegister("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String idCard = JSONObject.parseObject(re.getBiz_content()).getString("id_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (idCard!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setIdcard(idCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String userName = JSONObject.parseObject(re.getBiz_content()).getString("user_name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (userName!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setName(userName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String userSex = JSONObject.parseObject(re.getBiz_content()).getString("user_sex"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (userSex!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setSex(Integer.valueOf(userName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String mobilePhone = JSONObject.parseObject(re.getBiz_content()).getString("mobile_phone"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (mobilePhone!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setMobile(mobilePhone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String birthday = JSONObject.parseObject(re.getBiz_content()).getString("birthday"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (birthday!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setBirthday(DateUtil.strToDate(birthday)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String telephone = JSONObject.parseObject(re.getBiz_content()).getString("telephone"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (telephone!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setPhone(telephone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String address = JSONObject.parseObject(re.getBiz_content()).getString("address"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (address!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientDO.setAddress(address); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    basePatientDao.save(patientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   jsonObject.put("register","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String ehealthCardId = JSONObject.parseObject(re.getBiz_content()).getString("ehealth_card_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyHttpLogDO logDO = new WlyyHttpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logDO.setCode("ehc.ehealthcard.register"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logDO.setName("获取多码融合展示码"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logDO.setPatient(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logDO.setRequest("ehealthCardId="+ehealthCardId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String codeUrl = mcfGetCodeUrl(ehealthCardId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (codeUrl!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logDO.setResponse(codeUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logDO.setCreateTime(DateUtil.getNowDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        wlyyHttpLogDao.save(logDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        jsonObject.put("codeUrl",codeUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return MixEnvelop.getSuccess("注册成功",jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getError(JSONObject.parseObject(re.getRet_msg()).toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     获取展码地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop mcfGetCodeUrl(String ehealth_card_id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  String mcfGetCodeUrl(String ehealth_card_id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        TransRequest request = new TransRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        request.setMethod("ehc.ehealthcard.getCodeUrl"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -134,13 +198,13 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("code_url",JSONObject.parseObject(re.getBiz_content()).getString("code_url")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String code_url = jsonObject.toJSONString().replaceAll("\\|888", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (code_url!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return MixEnvelop.getSuccess("获取展码成功",code_url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return code_url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getError("获取展码失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //通过身边证查询用户信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  TransResponse  mcfQueryInfo(String idType,String ID) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  String  mcfQueryInfo(BasePatientDO patientDO) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("mcf_config"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        TransRequest request = new TransRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        request.setMethod("ehc.ehealthcard.queryInfo"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -152,12 +216,65 @@ public class MultipleCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        request.setEnc_type("Plain"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject bizContent = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String no = UUID.randomUUID().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        bizContent.put("id_type", idType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        bizContent.put("id_no", ID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        bizContent.put("id_type", "01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        bizContent.put("id_no", patientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        request.setBiz_content(JSONObject.toJSONString(bizContent)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl()+"ehcService/gateway.do", oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        TransResponse re = ehcHandler.execute(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ((JSONObject.parseObject(re.getRet_code()).toJSONString()).equalsIgnoreCase("0000")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientDO.setRegister("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idCard = JSONObject.parseObject(re.getBiz_content()).getString("id_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (idCard!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setIdcard(idCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String userName = JSONObject.parseObject(re.getBiz_content()).getString("user_name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (userName!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setName(userName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String userSex = JSONObject.parseObject(re.getBiz_content()).getString("user_sex"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (userSex!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setSex(Integer.valueOf(userName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String mobilePhone = JSONObject.parseObject(re.getBiz_content()).getString("mobile_phone"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (mobilePhone!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setMobile(mobilePhone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String birthday = JSONObject.parseObject(re.getBiz_content()).getString("birthday"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (birthday!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setBirthday(DateUtil.strToDate(birthday)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String telephone = JSONObject.parseObject(re.getBiz_content()).getString("telephone"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (telephone!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setPhone(telephone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String address = JSONObject.parseObject(re.getBiz_content()).getString("address"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (address!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDO.setAddress(address); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDao.save(patientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("register","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String ehealthCardId = JSONObject.parseObject(re.getBiz_content()).getString("ehealth_card_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyHttpLogDO logDO = new WlyyHttpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logDO.setCode("ehc.ehealthcard.getCodeUr"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logDO.setName("获取多码融合展示码"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logDO.setPatient(patientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logDO.setRequest("ehealthCardId="+ehealthCardId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String codeUrl = mcfGetCodeUrl(ehealthCardId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (codeUrl!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logDO.setResponse(codeUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logDO.setCreateTime(DateUtil.getNowDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDao.save(logDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("codeUrl",codeUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return codeUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop mcfQueryInfo(String ehealth_card_id ) throws Exception { 
			 |