|  | @ -10465,7 +10465,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
 | 
	
		
			
				|  |  |                                    String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType) throws Exception {
 | 
	
		
			
				|  |  |                                    String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType,String consumer) throws Exception {
 | 
	
		
			
				|  |  |         Map returnMap = new HashMap();
 | 
	
		
			
				|  |  |         if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject jsondate = new JSONObject();
 | 
	
	
		
			
				|  | @ -10701,11 +10701,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setDeptName("感染疾病科");
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setAmpm(pm);
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setHospitalFlag(pushFlag);
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setConsumer(consumer);
 | 
	
		
			
				|  |  |             BasePatientDO basePatientDO = basePatientDao.findById(consumer);
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setConsumerName(basePatientDO.getName());
 | 
	
		
			
				|  |  |             baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |             //添加订单
 | 
	
		
			
				|  |  |             BusinessOrderDO businessDO = new BusinessOrderDO();
 | 
	
		
			
				|  |  |             businessDO.setPatient(patientId);
 | 
	
		
			
				|  |  |             businessDO.setPatientName(name);
 | 
	
		
			
				|  |  |             businessDO.setPatient(consumer);
 | 
	
		
			
				|  |  |             businessDO.setPatientName(basePatientDO.getName());
 | 
	
		
			
				|  |  |             businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
 | 
	
		
			
				|  |  |             businessDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             businessDO.setStatus(0);
 | 
	
	
		
			
				|  | @ -10719,6 +10722,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             businessDO.setPayType(1);
 | 
	
		
			
				|  |  |             businessDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |             businessOrderDao.save(businessDO);
 | 
	
		
			
				|  |  |             logger.info("建档开始");
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject jdObject = ykyyEntranceService.patientJDKH(patientId, cardNo,name,mobile,mediaCard);
 | 
	
		
			
				|  |  |             logger.info("建档结束");
 | 
	
		
			
				|  |  |             logger.info("更新建档信息");
 | 
	
		
			
				|  |  |             BaseJobCategoryDO jobCategoryDO =jobCategoryDao.findByName(firstJobName);
 | 
	
		
			
				|  |  |             Float zy= 0f;
 | 
	
	
		
			
				|  | @ -10833,11 +10839,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (patientDO != null) {
 | 
	
		
			
				|  |  |             userName = patientDO.getName();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(baseNatAppointmentDO.getPatientId())){
 | 
	
		
			
				|  |  |             ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, baseNatAppointmentDO.getPatientId());
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(baseNatAppointmentDO.getConsumer())){
 | 
	
		
			
				|  |  |             ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, baseNatAppointmentDO.getConsumer());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (ps.isEmpty()) {
 | 
	
		
			
				|  |  |             logger.info("该用户没有openid,无法推送模版消息,用户ID:" + baseNatAppointmentDO.getPatientId() + "wechatId:" + wechatId);
 | 
	
		
			
				|  |  |             logger.info("该用户没有openid,无法推送模版消息,用户ID:" + baseNatAppointmentDO.getConsumer() + "wechatId:" + wechatId);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Map<String,Object> map = ykyyEntranceService.findYkDoctor(baseNatAppointmentDO.getHospitalFlag());
 | 
	
		
			
				|  |  |         WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
 | 
	
	
		
			
				|  | @ -10851,6 +10857,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                     newConfig.setFirst(config.getFirst().replace("key1",userName));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1("核酸检测预约单支付");
 | 
	
		
			
				|  |  |                     if ("3".equalsIgnoreCase(baseNatAppointmentDO.getHospitalFlag())){
 | 
	
		
			
				|  |  |                         newConfig.setKeyword2("厦门大学附属厦门眼科中心思北院区");
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         newConfig.setKeyword2("厦门大学附属厦门眼科中心五缘院区");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     newConfig.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword4(userName);
 | 
	
		
			
				|  |  |                     newConfig.setKeyword5(DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()));
 | 
	
	
		
			
				|  | @ -10876,6 +10887,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     BeanUtils.copyProperties(configPayNotice, newPayNotice);
 | 
	
		
			
				|  |  |                     newPayNotice.setFirst(configPayNotice.getFirst().replace("key1",userName));
 | 
	
		
			
				|  |  |                     newPayNotice.setKeyword1("核酸检测预约单支付");
 | 
	
		
			
				|  |  |                     if ("3".equalsIgnoreCase(baseNatAppointmentDO.getHospitalFlag())){
 | 
	
		
			
				|  |  |                         newPayNotice.setKeyword2("厦门大学附属厦门眼科中心思北院区");
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         newPayNotice.setKeyword2("厦门大学附属厦门眼科中心五缘院区");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     newPayNotice.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                     newPayNotice.setRemark(configPayNotice.getRemark());
 | 
	
		
			
				|  |  |                     newPayNotice.setUrl(configPayNotice.getUrl()+baseNatAppointmentDO.getId());
 | 
	
	
		
			
				|  | @ -10914,12 +10930,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "t.pay_status as \"payStatus\"," +
 | 
	
		
			
				|  |  |                 "t.medicare as \"medicare\","+
 | 
	
		
			
				|  |  |                 "t.voucher_no as \"voucherNo\","+
 | 
	
		
			
				|  |  |                 "t.dept as \"dept\","+
 | 
	
		
			
				|  |  |                 "t.dept_name as \"deptName\","+
 | 
	
		
			
				|  |  |                 "t.id as \"id\"," +
 | 
	
		
			
				|  |  |                 "t.card_no_type as \"cardNoType\"," +
 | 
	
		
			
				|  |  |                 "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
 | 
	
		
			
				|  |  |                 "t.appointment_time as \"appointmentTime\" " +
 | 
	
		
			
				|  |  |                 " from base_nat_appointment t where 1=1 ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(patientId)){
 | 
	
		
			
				|  |  |             sql+=" and t.patient_id ='"+patientId+"'";
 | 
	
		
			
				|  |  |             sql+=" and t.consumer ='"+patientId+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(id)){
 | 
	
		
			
				|  |  |             sql+=" and t.id ='"+id+"'";
 | 
	
	
		
			
				|  | @ -11023,54 +11042,71 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
 | 
	
		
			
				|  |  |                 if (null!=baseNatAppointmentDO){
 | 
	
		
			
				|  |  |                     res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
 | 
	
		
			
				|  |  |                     logger.info("核酸检测预约取消"+res);
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
 | 
	
		
			
				|  |  |                     Boolean flag = false;
 | 
	
		
			
				|  |  |                     if (jsonObject!=null){
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
 | 
	
		
			
				|  |  |                         String Msg = object.getString("Msg");
 | 
	
		
			
				|  |  |                         if (Msg.contains("Error")){
 | 
	
		
			
				|  |  |                             throw new Exception(Msg);
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             baseNatAppointmentDO.setIsSuccess("-1");
 | 
	
		
			
				|  |  |                             baseNatAppointmentDO.setCancelReson("患者本人取消");
 | 
	
		
			
				|  |  |                             baseNatAppointmentDO.setCancelTime(new Date());
 | 
	
		
			
				|  |  |                             baseNatAppointmentDO.setCancelBy(patientId);
 | 
	
		
			
				|  |  |                             baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                             if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
 | 
	
		
			
				|  |  |                                 //删除处方
 | 
	
		
			
				|  |  |                                 logger.info("删除处方开始");
 | 
	
		
			
				|  |  |                                 net.sf.json.JSONObject jsondate = new JSONObject();
 | 
	
		
			
				|  |  |                                 jsondate.put("checkPart","鼻/咽拭子");
 | 
	
		
			
				|  |  |                                 jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
 | 
	
		
			
				|  |  |                                 jsondate.put("chargeFlag","2");
 | 
	
		
			
				|  |  |                                 jsondate.put("chargeCode","361322");
 | 
	
		
			
				|  |  |                                 jsondate.put("icdCode","Z00.000");
 | 
	
		
			
				|  |  |                                 jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
 | 
	
		
			
				|  |  |                                 jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
 | 
	
		
			
				|  |  |                                 jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
 | 
	
		
			
				|  |  |                                 jsondate.put("address2",baseNatAppointmentDO.getCityName());
 | 
	
		
			
				|  |  |                                 jsondate.put("address3",baseNatAppointmentDO.getTownName());
 | 
	
		
			
				|  |  |                                 jsondate.put("address4",baseNatAppointmentDO.getStreetName());
 | 
	
		
			
				|  |  |                                 jsondate.put("address5",2);
 | 
	
		
			
				|  |  |                                 jsondate.put("area",baseNatAppointmentDO.getAddress());
 | 
	
		
			
				|  |  |                                 jsondate.put("winNo",6);
 | 
	
		
			
				|  |  |                                 jsondate.put("target",2);
 | 
	
		
			
				|  |  |                                 jsondate.put("quantity",1);
 | 
	
		
			
				|  |  |                                 jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
 | 
	
		
			
				|  |  |                                 jsondate.put("dept",baseNatAppointmentDO.getDept());
 | 
	
		
			
				|  |  |                                 jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
 | 
	
		
			
				|  |  |                                 jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |                                 JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |                                 array.add(jsondate);
 | 
	
		
			
				|  |  |                                 JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
 | 
	
		
			
				|  |  |                                 logger.info("删除处方结束");
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                     if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                         res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
 | 
	
		
			
				|  |  |                         logger.info("核酸检测预约取消"+res);
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
 | 
	
		
			
				|  |  |                         Boolean flag = false;
 | 
	
		
			
				|  |  |                         if (jsonObject!=null){
 | 
	
		
			
				|  |  |                             com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
 | 
	
		
			
				|  |  |                             String Msg = object.getString("Msg");
 | 
	
		
			
				|  |  |                             if (Msg.contains("Error")){
 | 
	
		
			
				|  |  |                                 throw new Exception(Msg);
 | 
	
		
			
				|  |  |                             }else {
 | 
	
		
			
				|  |  |                                 baseNatAppointmentDO.setIsSuccess("-1");
 | 
	
		
			
				|  |  |                                 baseNatAppointmentDO.setCancelReson("患者本人取消");
 | 
	
		
			
				|  |  |                                 baseNatAppointmentDO.setCancelTime(new Date());
 | 
	
		
			
				|  |  |                                 baseNatAppointmentDO.setCancelBy(patientId);
 | 
	
		
			
				|  |  |                                 baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                                 if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
 | 
	
		
			
				|  |  |                                     //删除处方
 | 
	
		
			
				|  |  |                                     logger.info("删除处方开始");
 | 
	
		
			
				|  |  |                                     net.sf.json.JSONObject jsondate = new JSONObject();
 | 
	
		
			
				|  |  |                                     jsondate.put("checkPart","鼻/咽拭子");
 | 
	
		
			
				|  |  |                                     jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
 | 
	
		
			
				|  |  |                                     jsondate.put("chargeFlag","2");
 | 
	
		
			
				|  |  |                                     jsondate.put("chargeCode","361322");
 | 
	
		
			
				|  |  |                                     jsondate.put("icdCode","Z00.000");
 | 
	
		
			
				|  |  |                                     jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
 | 
	
		
			
				|  |  |                                     jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
 | 
	
		
			
				|  |  |                                     jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
 | 
	
		
			
				|  |  |                                     jsondate.put("address2",baseNatAppointmentDO.getCityName());
 | 
	
		
			
				|  |  |                                     jsondate.put("address3",baseNatAppointmentDO.getTownName());
 | 
	
		
			
				|  |  |                                     jsondate.put("address4",baseNatAppointmentDO.getStreetName());
 | 
	
		
			
				|  |  |                                     jsondate.put("address5",2);
 | 
	
		
			
				|  |  |                                     jsondate.put("area",baseNatAppointmentDO.getAddress());
 | 
	
		
			
				|  |  |                                     jsondate.put("winNo",6);
 | 
	
		
			
				|  |  |                                     jsondate.put("target",2);
 | 
	
		
			
				|  |  |                                     jsondate.put("quantity",1);
 | 
	
		
			
				|  |  |                                     jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
 | 
	
		
			
				|  |  |                                     jsondate.put("dept",baseNatAppointmentDO.getDept());
 | 
	
		
			
				|  |  |                                     jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
 | 
	
		
			
				|  |  |                                     jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |                                     JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |                                     array.add(jsondate);
 | 
	
		
			
				|  |  |                                     JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
 | 
	
		
			
				|  |  |                                     logger.info("删除处方结束");
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                         baseNatAppointmentDO.setIsSuccess("-1");
 | 
	
		
			
				|  |  |                         baseNatAppointmentDO.setCancelReson("患者本人取消");
 | 
	
		
			
				|  |  |                         baseNatAppointmentDO.setCancelTime(new Date());
 | 
	
		
			
				|  |  |                         baseNatAppointmentDO.setCancelBy(patientId);
 | 
	
		
			
				|  |  |                         baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                         if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
 | 
	
		
			
				|  |  |                             logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |                             String updateJcsq = "update V_EMR_JCSQ set ZFBZ = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
 | 
	
		
			
				|  |  |                             ykyyEntranceService.updateHisStatus(updateJcsq);
 | 
	
		
			
				|  |  |                             String update01sq = "update V_MS_YJ01 set ZFPB = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
 | 
	
		
			
				|  |  |                             ykyyEntranceService.updateHisStatus(update01sq);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } catch (Exception e) {
 |