You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					468 lines
				
				20 KiB
			
		
		
			
		
	
	
					468 lines
				
				20 KiB
			| 
											2 years ago
										 | package com.ynxbd.common.action;
 | ||
|  | 
 | ||
|  | import com.alibaba.fastjson.JSONArray;
 | ||
|  | import com.alibaba.fastjson.JSONObject;
 | ||
|  | import com.ynxbd.common.action.base.BaseAction;
 | ||
|  | import com.ynxbd.common.bean.Patient;
 | ||
|  | import com.ynxbd.common.bean.User;
 | ||
|  | import com.ynxbd.common.bean.enums.HCardTypeEnum;
 | ||
|  | import com.ynxbd.common.bean.enums.HealthCardEnum;
 | ||
|  | import com.ynxbd.common.bean.enums.HealthCardRespCodeEnum;
 | ||
|  | import com.ynxbd.common.dao.PatientDao;
 | ||
|  | import com.ynxbd.common.helper.common.DateHelper;
 | ||
|  | import com.ynxbd.common.helper.common.IDNumberHelper;
 | ||
|  | import com.ynxbd.common.helper.common.ValidHelper;
 | ||
|  | import com.ynxbd.common.result.Result;
 | ||
|  | import com.ynxbd.common.result.ResultEnum;
 | ||
|  | import com.ynxbd.common.service.HCodeService;
 | ||
|  | import com.ynxbd.common.service.PatientService;
 | ||
|  | import com.ynxbd.wx.wxfactory.WxCacheHelper;
 | ||
|  | import lombok.extern.slf4j.Slf4j;
 | ||
|  | import org.apache.commons.lang3.ObjectUtils;
 | ||
|  | import org.apache.struts2.convention.annotation.Action;
 | ||
|  | import org.apache.struts2.convention.annotation.Namespace;
 | ||
|  | import org.ehcache.Cache;
 | ||
|  | 
 | ||
|  | import java.util.List;
 | ||
|  | import java.util.Timer;
 | ||
|  | import java.util.TimerTask;
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @Author wsq
 | ||
|  |  * @Date 2020/9/24 18:00
 | ||
|  |  * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
 | ||
|  |  */
 | ||
|  | @Slf4j
 | ||
|  | @Namespace("/healthCode")
 | ||
|  | public class HealthCodeAction extends BaseAction {
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 查询患者集合
 | ||
|  |      */
 | ||
|  |     @Action("getHealthCardList")
 | ||
|  |     public Result getHealthCardList(String openid) {
 | ||
|  |         log.info("[电子健康卡]获取用户数据 openid={}", openid);
 | ||
|  |         if (openid == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         List<Patient> patients = new PatientDao().selectHealthCardListByOpenid(openid);
 | ||
|  |         return Result.success(patients);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 根据身份证和openid取二维码
 | ||
|  |      */
 | ||
|  |     @Action("getPatientByIdCardNo")
 | ||
|  |     public Result getPatientByIdCardNo(String openid, String idCardNo) {
 | ||
|  |         log.info("[电子健康卡]根据身份证和openid取二维码 openid={}, idCardNo={}", openid, idCardNo);
 | ||
|  |         if (openid == null || idCardNo == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         Patient patient = new PatientDao().selectByIdCardNo(openid, idCardNo);
 | ||
|  |         return Result.success(patient);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 获取token,用于绑卡
 | ||
|  |      */
 | ||
|  |     @Action("getAppToken")
 | ||
|  |     public Result getAppToken() {
 | ||
|  |         String appToken = HCodeService.getAppToken();
 | ||
|  |         return appToken == null ? Result.error() : Result.success();
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     @Action("appBindHealthCard")
 | ||
|  |     public Result appBindHealthCard(String openid,String healthCode){
 | ||
|  |         log.info("[新版电子健康卡]H5嵌入链接绑卡-通过healthCode获取健康卡数据 healthCode={}, openid={}", healthCode, openid);
 | ||
|  |         if (healthCode == null || openid == null) return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数为空
 | ||
|  | 
 | ||
|  |         Patient patient = HCodeService.appBindHealthCard(healthCode); // 通过健康卡授权码获取健康卡的用户信息
 | ||
|  |         if (patient == null) {
 | ||
|  |             log.info("[新版电子健康卡]H5嵌入链接绑卡 获取用户信息失败");
 | ||
|  |             return Result.error("[新版电子健康卡]H5嵌入链接绑卡 获取用户信息失败");
 | ||
|  |         }
 | ||
|  |         return Result.success(patient);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * [电子健康卡]通过二维码获取健康卡数据
 | ||
|  |      *
 | ||
|  |      * @param qrCode 二维码
 | ||
|  |      */
 | ||
|  |     @Action("getHealthCardByQrCode")
 | ||
|  |     public Result getHealthCardByQrCode(String qrCode) {
 | ||
|  |         log.info("[电子健康卡]通过二维码获取健康卡数据 qrCode={}", qrCode);
 | ||
|  |         if (qrCode == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数为空
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         Patient patient = HCodeService.getHealthCardByQrCode(qrCode);
 | ||
|  |         return patient == null ? Result.error() : Result.success(patient);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 获取健康卡二维码
 | ||
|  |      * * @param appToken     appToken
 | ||
|  |      * * @param healthCardId 健康卡ID
 | ||
|  |      * * @param idCardNo     证件号码
 | ||
|  |      * * @param codeType     传0或者1,0返回动态码,1返回静态码
 | ||
|  |      */
 | ||
|  |     @Action("getDynamicQRCode")
 | ||
|  |     public Result getDynamicQRCode(String idCardNo, String healthCardId) {
 | ||
|  |         log.info("[电子健康卡]获取二维码 healthCardId={}, idCardNo={}", healthCardId, idCardNo);
 | ||
|  |         if (healthCardId == null || idCardNo == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数缺失
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         JSONObject result = HCodeService.getDynamicQRCode(healthCardId, idCardNo, "0");
 | ||
|  |         return result == null ? Result.error() : Result.success(result);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 获取卡包订单ID
 | ||
|  |      */
 | ||
|  |     @Action("getCardOrderId")
 | ||
|  |     public Result getCardOrderId(String idCardNo, String healthCardId) {
 | ||
|  |         log.info("[电子健康卡]获取卡包订单ID healthCardId={}, idCardNo={}", healthCardId, idCardNo);
 | ||
|  |         if (healthCardId == null || idCardNo == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数缺失
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         String qrCodeText = HCodeService.getQRCodeText(healthCardId, idCardNo);
 | ||
|  |         if (qrCodeText == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // qrCodeText参数缺失
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         JSONObject result = HCodeService.getCardOrderId(qrCodeText);
 | ||
|  | 
 | ||
|  |         return result == null ? Result.error() : Result.success(result);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 健康卡[上报数据]
 | ||
|  |      *
 | ||
|  |      * @param scene        上报类型编码
 | ||
|  |      * @param openid       openid -->1.前端可以利用openid来操作是否上报, 2.防止非法调用
 | ||
|  |      * @param idCardNo     身份证
 | ||
|  |      * @param healthCardId 健康卡id
 | ||
|  |      */
 | ||
|  |     @Action("reportHISData")
 | ||
|  |     public Result reportHISData(String scene, String openid, String idCardNo, String healthCardId) {
 | ||
|  |         idCardNo = getDecodeString(idCardNo);
 | ||
|  |         if (scene == null || openid == null || healthCardId == null || idCardNo == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         String qrCodeText = HCodeService.getQRCodeText(healthCardId, idCardNo);
 | ||
|  |         if (qrCodeText == null) {
 | ||
|  |             return Result.error(ResultEnum.INTERFACE_OUTER_INVOKE_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         JSONObject jsonObject = HCodeService.reportHISData(qrCodeText, null, scene, HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS, null);
 | ||
|  |         if (jsonObject == null) {
 | ||
|  |             return Result.error();
 | ||
|  |         }
 | ||
|  |         return Result.success();
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * [电子健康卡]患者绑定(成人)
 | ||
|  |      */
 | ||
|  |     @Action("bind")
 | ||
|  |     public Result bind(boolean isCounty, String county, String address, String openid, String tel, String sex, String name, String nation, String birthday, String idCardNo, String cardType, Boolean isHealthCard, String healthCardId, String weChatCode) {
 | ||
|  |         log.info("[电子健康卡]身份绑定 name={}, address={}, nation={}, sex={}, birthday={}, tel={}, healthCardId={}, cardType={}", name, address, nation, sex, birthday, tel, healthCardId, cardType);
 | ||
|  |         if (isHealthCard == null || openid == null || tel == null || sex == null || birthday == null || name == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (cardType == null) cardType = HCardTypeEnum._01.WX_CODE;
 | ||
|  |         HCardTypeEnum cardTypeEnum = HCardTypeEnum.toTypeByWxCode(cardType);
 | ||
|  |         if (cardTypeEnum == null) {
 | ||
|  |             return Result.error(ResultEnum.CARD_TYPE_NOT_FOUNT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (!ValidHelper.isValidTel(tel)) {
 | ||
|  |             log.info("[电子健康卡]电话号码错误 name={}, tel={}, idCardNo={}", name, tel, idCardNo);
 | ||
|  |             return Result.error(ResultEnum.TEL_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (!ValidHelper.isValidIdCard(idCardNo)) {
 | ||
|  |             log.info("[电子健康卡]身份证错误 name={}, tel={}, idCardNo={}", name, tel, idCardNo);
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_INVALID);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (!ValidHelper.isValidNation(nation)) {
 | ||
|  |             return Result.error(ResultEnum.NATION_ERROR);
 | ||
|  |         }
 | ||
|  |         if(nation.equals("未知")) {
 | ||
|  |             nation = "";
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (!DateHelper.isValidDate(birthday)) { // 生日异常
 | ||
|  |             return Result.error(ResultEnum.PARAM_DATE_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (address == null || county == null) {
 | ||
|  |             log.info("[电子健康卡]地址错误 county={}, address={}", county, address);
 | ||
|  |             return Result.error(ResultEnum.PARAM_ADDRESS_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |         String uuid = null;
 | ||
|  |         if (HCodeService.isEnableHealthCard() && isHealthCard && healthCardId == null) { // 没有禁用电子健康卡
 | ||
|  |             log.info("[电子健康卡]绑定 weChatCode={}", weChatCode);
 | ||
|  |             if (weChatCode == null) {
 | ||
|  |                 return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |             }
 | ||
|  | 
 | ||
|  |             // 先注册,后修改-->先获取健康卡ID
 | ||
|  |             JSONObject respObj = HCodeService.registerHealthCard(null, weChatCode, birthday, cardTypeEnum, address, sex, nation, name, idCardNo, tel);
 | ||
|  |             if (respObj == null) {
 | ||
|  |                 log.info("[电子健康卡]注册健康卡失败,响应内容为空");
 | ||
|  | 
 | ||
|  |             } else {
 | ||
|  |                 healthCardId = respObj.getString("healthCardId");
 | ||
|  |                 if (ObjectUtils.isEmpty(healthCardId)) {
 | ||
|  |                     healthCardId = null; // 防止后续绑定院内关系失败
 | ||
|  |                     log.info("[电子健康卡]注册失败 healthCardId为空");
 | ||
|  |                     // 响应处理
 | ||
|  |                     String errMsg = respObj.getString("errMsg");
 | ||
|  |                     String resultCode = respObj.getString("resultCode");
 | ||
|  |                     HealthCardRespCodeEnum healthCardRespCodeEnum = HCodeService.resultCodeHandle(resultCode);
 | ||
|  |                     log.info("[电子健康卡] 绑定失败原因 resultCode={}, errMsg={}, statusMsg={}", resultCode, errMsg, healthCardRespCodeEnum.MESSAGE);
 | ||
|  | //
 | ||
|  |                     if (!healthCardRespCodeEnum.IS_CONTINUE) { // 不继续执行
 | ||
|  |                         if (!healthCardRespCodeEnum.equals(HealthCardRespCodeEnum._10060)) { // 姓名和身份证不一致
 | ||
|  |                             return Result.error(healthCardRespCodeEnum.MESSAGE);
 | ||
|  |                         }
 | ||
|  | 
 | ||
|  |                         // 判断出生日期是否大于半年前-->婴儿
 | ||
|  |                         Boolean isOverDateByToday = DateHelper.isTodayMoveDateOverDate(birthday, -180);
 | ||
|  |                         if (isOverDateByToday == null || isOverDateByToday) {
 | ||
|  |                             return Result.error(healthCardRespCodeEnum.MESSAGE);
 | ||
|  |                         }
 | ||
|  |                         uuid = HCardTypeEnum.BABY.WX_CODE;
 | ||
|  |                     }
 | ||
|  |                 }
 | ||
|  |             }
 | ||
|  |         }
 | ||
|  |         return new PatientService().bindCard(false, isCounty, healthCardId, openid, name, sex, idCardNo, cardTypeEnum, tel, address, birthday, nation, county, uuid);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * [一键绑定]-->获取健康卡用户信息
 | ||
|  |      *
 | ||
|  |      * @param openid     openid
 | ||
|  |      * @param healthCode 健康卡授权码-->用来获取健康卡用户信息
 | ||
|  |      */
 | ||
|  |     @Action("getHealthCardInfo")
 | ||
|  |     public Result getHealthCardInfo(String openid, String healthCode) {
 | ||
|  |         log.info("[电子健康卡]一键绑定 获取健康卡用户信息 healthCode={}, openid={}", healthCode, openid);
 | ||
|  |         if (healthCode == null || openid == null) return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数为空
 | ||
|  | 
 | ||
|  |         Patient patient = HCodeService.getInfoByHealthCode(healthCode); // 通过健康卡授权码获取健康卡的用户信息
 | ||
|  |         if (patient == null) {
 | ||
|  |             log.info("[电子健康卡]一键绑定 获取用户信息失败");
 | ||
|  |             return Result.error("[电子健康卡]一键绑定 获取用户信息失败");
 | ||
|  |         }
 | ||
|  |         return Result.success(patient);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * [升级绑定]-->已在HIS绑定-->注册健康卡
 | ||
|  |      *
 | ||
|  |      * @param weChatCode
 | ||
|  |      * @param idCardNo
 | ||
|  |      * @param cardType
 | ||
|  |      * @param openid
 | ||
|  |      * @param tel
 | ||
|  |      * @param name
 | ||
|  |      * @param nation
 | ||
|  |      * @param patientId
 | ||
|  |      * @param address
 | ||
|  |      * @return
 | ||
|  |      */
 | ||
|  |     @Action("upBind")
 | ||
|  |     public Result upBind(String weChatCode, String idCardNo, String cardType, String openid, String tel, String name, String nation, String patientId, String address) {
 | ||
|  |         log.info("[电子健康卡]升级绑定 name={}, address={}, nation={}, patientId={}, tel={}, idType={}, weChatCode={}", name, address, nation, patientId, tel, cardType, weChatCode);
 | ||
|  |         if (weChatCode == null || openid == null || patientId == null || name == null || idCardNo == null || tel == null || address == null || nation == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (cardType == null) cardType = HCardTypeEnum._01.WX_CODE;
 | ||
|  |         HCardTypeEnum cardTypeEnum = HCardTypeEnum.toTypeByWxCode(cardType);
 | ||
|  |         if (cardTypeEnum == null) {
 | ||
|  |             return Result.error(ResultEnum.CARD_TYPE_NOT_FOUNT);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         if (!ValidHelper.isValidNation(nation)) {
 | ||
|  |             return Result.error(ResultEnum.NATION_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         String sex = IDNumberHelper.getSex(idCardNo);
 | ||
|  |         String birthday = IDNumberHelper.getBirthday(idCardNo);
 | ||
|  |         if (sex == null || birthday == null) { // 身份证解析数据错误
 | ||
|  |             log.info("[电子健康卡]升级绑失败,身份证解析数据错误 sex={} birthday={}", sex, birthday);
 | ||
|  |             return Result.error(ResultEnum.PARAM_TYPE_ERROR);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         // 先注册,后修改-->先获取健康卡ID
 | ||
|  |         JSONObject rspObj = HCodeService.registerHealthCard(patientId, weChatCode, birthday, cardTypeEnum, address, sex, nation, name, idCardNo, tel);
 | ||
|  |         if (rspObj == null) {
 | ||
|  |             log.info("[电子健康卡]升级绑定失败, 响应内容为空");
 | ||
|  |             return Result.error("[电子健康卡]升级绑定失败, 响应内容为空");
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         String healthCardId = rspObj.getString("healthCardId");
 | ||
|  |         if (healthCardId == null) {
 | ||
|  |             // 响应处理
 | ||
|  |             String errMsg = rspObj.getString("errMsg");
 | ||
|  |             String resultCode = rspObj.getString("resultCode");
 | ||
|  |             HealthCardRespCodeEnum healthCardRespCodeEnum = HCodeService.resultCodeHandle(resultCode);
 | ||
|  | 
 | ||
|  |             log.info("[电子健康卡]升级绑定失败原因 resultCode={}, errMsg={}, statusMsg={}", resultCode, errMsg, healthCardRespCodeEnum.MESSAGE);
 | ||
|  |             return Result.error(healthCardRespCodeEnum.MESSAGE);
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         boolean isUpdate = new PatientDao().updateInfo(openid, patientId, idCardNo, healthCardId, name, nation, tel, address, null, null);
 | ||
|  |         if (isUpdate) {
 | ||
|  |             Cache<String, User> cache = WxCacheHelper.getUserCache();
 | ||
|  |             cache.remove(openid);
 | ||
|  |             return Result.success();
 | ||
|  |         }
 | ||
|  |         return Result.error();
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 身份证识别
 | ||
|  |      */
 | ||
|  |     @Action("orcInfo")
 | ||
|  |     public Result orcInfo(String image) {
 | ||
|  |         log.info("身份证识别");
 | ||
|  |         if (image == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | ||
|  |         }
 | ||
|  |         Patient patient = HCodeService.orcInfo(image);
 | ||
|  |         return Result.success(patient);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 实人认证生成orderId
 | ||
|  |      * * @param qrCodeText 二维码编码
 | ||
|  |      */
 | ||
|  |     @Action("registerUniformVerifyOrder")
 | ||
|  |     public Result registerUniformVerifyOrder(String idCardNo, String name, String wechatCode) {
 | ||
|  |         log.info("[电子健康卡]实人认证生成orderId idCardNo={}, name={}", idCardNo, name);
 | ||
|  |         if (idCardNo == null || name == null || wechatCode == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数为空
 | ||
|  |         }
 | ||
|  | 
 | ||
|  |         String orderId = HCodeService.registerUniformVerifyOrder(idCardNo, name, wechatCode);
 | ||
|  |         return ObjectUtils.isEmpty(orderId) ? Result.error() : Result.success(orderId);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     /**
 | ||
|  |      * 实人认证结果查询接口
 | ||
|  |      * * @param qrCodeText 二维码编码
 | ||
|  |      */
 | ||
|  |     @Action("checkUniformVerifyResult")
 | ||
|  |     public Result checkUniformVerifyResult(String orderId, String registerOrderId) {
 | ||
|  |         log.info("[电子健康卡]实人认证结果查询 orderId={}, registerOrderId={}", orderId, registerOrderId);
 | ||
|  |         if (orderId == null || registerOrderId == null) {
 | ||
|  |             return Result.error(ResultEnum.PARAM_IS_DEFECT); // 参数为空
 | ||
|  |         }
 | ||
|  |         return Result.change(HCodeService.checkUniformVerifyResult(orderId, registerOrderId));
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     @Action("batchUpdate")
 | ||
|  |     public void batchUpdate() {
 | ||
|  |         Timer timer = new Timer();
 | ||
|  |         timer.schedule(new TimerTask() {
 | ||
|  |             public void run() {
 | ||
|  |                 log.info("开始执行批量领卡定时任务");
 | ||
|  |                 List<Patient> lstPatient = new PatientDao().selectPatient4BatchUpdateHealthCard();
 | ||
|  |                 JSONArray jsonArray = null;
 | ||
|  |                 try {
 | ||
|  |                     jsonArray = HCodeService.batchUpdate(lstPatient);
 | ||
|  |                 } catch (Exception e) {
 | ||
|  |                     e.printStackTrace();
 | ||
|  |                 }
 | ||
|  | 
 | ||
|  |                 if (jsonArray == null) return;
 | ||
|  | 
 | ||
|  |                 for (int i = 0; i < jsonArray.size(); i++) {
 | ||
|  |                     new PatientDao().updateCallFlag(jsonArray.getJSONObject(i).get("idNumber").toString());
 | ||
|  |                     if (!"".equals(jsonArray.getJSONObject(i).get("healthCardId").toString()) && !"".equals(jsonArray.getJSONObject(i).get("idNumber").toString()))
 | ||
|  |                         new PatientDao().updateHealthCard(jsonArray.getJSONObject(i).get("healthCardId").toString(),
 | ||
|  |                                 jsonArray.getJSONObject(i).get("idNumber").toString());
 | ||
|  |                 }
 | ||
|  |             }
 | ||
|  |         }, 2 * 1000, 30 * 1000);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     public static void main(String[] args) {
 | ||
|  |         String qrCodeText = HCodeService.getQRCodeText("F43F5B90877116A61D3B960EDAECBCDDDDE7F452605C23DD425CC79BF4644F61", "530127199711211059");
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, "口腔科", "0101011", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, "口腔科", "0101012", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101013", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101014", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  |         // 门诊缴费
 | ||
|  |         HCodeService.reportHISData(qrCodeText, "口腔科", "0101051", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 "0100");
 | ||
|  | 
 | ||
|  |         // 门诊缴费记录
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101052", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101081", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101082", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  |         HCodeService.reportHISData(qrCodeText, null, "0101083", HealthCardEnum.CARD_TYPE_HEALTH_CARD.STATUS,
 | ||
|  |                 null);
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | //
 | ||
|  | //    public static void main(String[] args){
 | ||
|  | //        String resultCode = "-10044";
 | ||
|  | //        HealthCardRespCodeEnum healthCardRespCodeEnum = HCodeService.resultCodeHandle(resultCode);
 | ||
|  | //        logger.info("resultCode=[" + resultCode + "],健康卡绑定失败原因,statusMsg=" + healthCardRespCodeEnum.getMessage() );
 | ||
|  | //        System.out.println(healthCardRespCodeEnum);
 | ||
|  | //        if (!healthCardRespCodeEnum.isContinue()) { // 不继续执行
 | ||
|  | //            System.out.println("停止");
 | ||
|  | //            Integer age = IDNumberHelper.getAge("532331202010054010");
 | ||
|  | //            if (age != null && age > 10) {
 | ||
|  | //                System.out.println(age);
 | ||
|  | //            }
 | ||
|  | //        }else{
 | ||
|  | //            System.out.println("继续");
 | ||
|  | //        }
 | ||
|  | //    }
 | ||
|  | }
 |