| 
					
				 | 
			
			
				@ -2,12 +2,15 @@ package com.yihu.jw.hospital.prescription.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.dict.dao.BaseDictJobTitleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.dict.dao.BaseJobCategoryDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.dict.dao.DictDeptDescDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.dict.dao.DictHospitalDeptDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.service.BaseDoctorInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.area.BaseDrugStoreDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.BaseJobCategoryDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.DictDeptDescDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.DictHospitalDeptDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -127,6 +130,8 @@ import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import static javafx.scene.input.KeyCode.L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by Trick on 2019/5/17. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -274,6 +279,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseNatAppointmentDao baseNatAppointmentDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PayInfoNoticeService payInfoNoticeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseJobCategoryDao jobCategoryDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10458,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(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10473,10 +10480,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("address2",cityName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("address3",townName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("address4",streetName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("address5",2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("area",address); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("address5",address); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("area",townName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("winNo",6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("target",2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(secondJobName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsondate.put("target",secondJobName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsondate.put("target",firstJobName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsondate.put("quantity",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> map = findRandomDoctor(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject rs = new JSONObject(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10690,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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10708,9 +10722,20 @@ 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(cardNo,name,mobile,mediaCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("建档结束"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("更新建档信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseJobCategoryDO jobCategoryDO =jobCategoryDao.findByName(firstJobName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Float zy= 0f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (jobCategoryDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                zy=Float.parseFloat(jobCategoryDO.getId()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ykyyEntranceService.updatePatientJd(patientId,address,mobile,zy,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //同步眼科医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("开始同步眼科医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ykyyEntranceService.saveKsjc(baseNatAppointmentDO,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //预约成功后发送支付模板消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sendYktemplateMessage(baseNatAppointmentDO.getId(),false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("结束同步眼科医院"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10814,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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10832,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())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10857,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()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10895,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+"'"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -11004,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) { 
			 |