|  | @ -1,6 +1,7 @@
 | 
												
													
														
															|  | package com.yihu.jw.hospital.prescription.service;
 |  | package com.yihu.jw.hospital.prescription.service;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSON;
 |  | import com.alibaba.fastjson.JSON;
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSONPObject;
 | 
												
													
														
															|  | import com.fasterxml.jackson.databind.ObjectMapper;
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | import com.yihu.jw.dict.dao.DictDeptDescDao;
 |  | import com.yihu.jw.dict.dao.DictDeptDescDao;
 | 
												
													
														
															|  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 |  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
												
											
												
													
														
															|  | @ -9328,6 +9329,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, object);
 |  |         return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, object);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public MixEnvelop selectByUrlHsjc(Integer id,String wxId,String channel) throws Exception {
 | 
												
													
														
															|  | 
 |  |         WxWechatDO wxWechatDO = wechatDao.findById(wxId);
 | 
												
													
														
															|  | 
 |  |         if (wxWechatDO == null) {
 | 
												
													
														
															|  | 
 |  |             throw new Exception("微信配置不存在!");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         BaseNatAppointmentDO natAppointmentDO = baseNatAppointmentDao.findOne(id);
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId());
 | 
												
													
														
															|  | 
 |  |         List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, natAppointmentDO.getPatientId());
 | 
												
													
														
															|  | 
 |  |         if (patientWechatDos == null || patientWechatDos.size() == 0) {
 | 
												
													
														
															|  | 
 |  |             throw new Exception("openid不存在!");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String idcard = null;
 | 
												
													
														
															|  | 
 |  |         if (natAppointmentDO != null) {
 | 
												
													
														
															|  | 
 |  |             idcard = natAppointmentDO.getMedicare();
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isNoneBlank(idcard)) {
 | 
												
													
														
															|  | 
 |  |             throw new Exception("就诊卡不存在!");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         String url = null;
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNoneBlank(channel)&&channel.equalsIgnoreCase("ALI")){
 | 
												
													
														
															|  | 
 |  |             url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(), patientDO.getAlipayId(), idcard, "ALI");
 | 
												
													
														
															|  | 
 |  |         }else {
 | 
												
													
														
															|  | 
 |  |             url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(), patientWechatDo.getOpenid(), idcard, "WX");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
 | 
												
													
														
															|  | 
 |  |         return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, object);
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取居民openId
 |  |      * 获取居民openId
 | 
												
													
														
															|  |      *
 |  |      *
 | 
												
											
												
													
														
															|  | @ -10426,6 +10459,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
 |  |     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) throws Exception {
 |  |                                    String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
 | 
												
													
														
															|  |         BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
 |  |         BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setMedicare(mediaCard);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setName(name);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setCardNo(cardNo);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setCardType(cardType);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setAddress(address);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setCityName(cityName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setFirstJobCode(firstJobCode);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setFirstJobName(firstJobName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setSecondJobCode(secondJobCode);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setSecondJobName(secondJobName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setProvinceName(provinceName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setTownName(townName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setStreetName(streetName);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setPatientId(patientId);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setIsSuccess("0");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setPayStatus("0");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setMobile(mobile);
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setIcdCode("Z00.000");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setChargeCode("361322");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setWinNo("6");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setDept("3150000");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO.setDeptName("感染疾病科");
 | 
												
													
														
															|  | 
 |  |         baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
												
													
														
															|  |         Map returnMap = new HashMap();
 |  |         Map returnMap = new HashMap();
 | 
												
													
														
															|  |         net.sf.json.JSONObject jsondate = new JSONObject();
 |  |         net.sf.json.JSONObject jsondate = new JSONObject();
 | 
												
													
														
															|  |         jsondate.put("checkPart","鼻/咽拭子");
 |  |         jsondate.put("checkPart","鼻/咽拭子");
 | 
												
											
												
													
														
															|  | @ -10441,12 +10501,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         jsondate.put("address4",streetName);
 |  |         jsondate.put("address4",streetName);
 | 
												
													
														
															|  |         jsondate.put("address5",2);
 |  |         jsondate.put("address5",2);
 | 
												
													
														
															|  |         jsondate.put("area",address);
 |  |         jsondate.put("area",address);
 | 
												
													
														
															|  | 
 |  |         jsondate.put("winNo",6);
 | 
												
													
														
															|  |         jsondate.put("target",2);
 |  |         jsondate.put("target",2);
 | 
												
													
														
															|  | 
 |  |         jsondate.put("quantity",1);
 | 
												
													
														
															|  |         Map<String,Object> map = findRandomDoctor();
 |  |         Map<String,Object> map = findRandomDoctor();
 | 
												
													
														
															|  |         net.sf.json.JSONObject rs = new JSONObject();
 |  |         net.sf.json.JSONObject rs = new JSONObject();
 | 
												
													
														
															|  |         if (map!=null){
 |  |         if (map!=null){
 | 
												
													
														
															|  |             //先进行核算检测预约
 |  |             //先进行核算检测预约
 | 
												
													
														
															|  |             String result = entranceService.BS10144(map.get("deptCode").toString(),map.get("doctorMappingCode").toString(),natTime,mediaCard,name,patientId,mobile,demoFlag);
 |  | 
 | 
												
													
														
															|  | 
 |  |             String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,demoFlag);
 | 
												
													
														
															|  |             com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 |  |             com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
												
													
														
															|  |             logger.info("核酸检测预约结束"+result);
 |  |             logger.info("核酸检测预约结束"+result);
 | 
												
													
														
															|  |             Boolean flag = false;
 |  |             Boolean flag = false;
 | 
												
											
												
													
														
															|  | @ -10474,14 +10536,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                             jsondate.put("serialNo",registerDO.getRegisterNo());
 |  |                             jsondate.put("serialNo",registerDO.getRegisterNo());
 | 
												
													
														
															|  |                             jsondate.put("dept",map.get("deptCode").toString());
 |  |                             jsondate.put("dept",map.get("deptCode").toString());
 | 
												
													
														
															|  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 |  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
												
													
														
															|  | 
 |  |                             baseNatAppointmentDO.setRegisterNo(registerDO.getRegisterNo());
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
 |  |                             baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
 | 
												
													
														
															|  | 
 |  |                             baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
 | 
												
													
														
															|  |                         }else {
 |  |                         }else {
 | 
												
													
														
															|  |                             returnMap.put("msg","已经挂号的数据有误");
 |  |                             returnMap.put("msg","已经挂号的数据有误");
 | 
												
													
														
															|  |                             returnMap.put("status","-1");
 |  |                             returnMap.put("status","-1");
 | 
												
													
														
															|  |                             return map;
 |  | 
 | 
												
													
														
															|  | 
 |  |                             returnMap.put("id",baseNatAppointmentDO.getId());
 | 
												
													
														
															|  | 
 |  |                             return returnMap;
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                     }else {
 |  |                     }else {
 | 
												
													
														
															|  |                         rs = entranceService.BS10111(cardNo, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
 | 
												
													
														
															|  |                         net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 |  |                         net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 | 
												
													
														
															|  |                         logger.info("挂号结果 res: " + res.toString());
 |  |                         logger.info("挂号结果 res: " + res.toString());
 | 
												
													
														
															|  |                         String rsCode = res.getString("@RESULT");
 |  |                         String rsCode = res.getString("@RESULT");
 | 
												
											
												
													
														
															|  | @ -10496,6 +10561,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                             jsondate.put("serialNo",serialNo);
 |  |                             jsondate.put("serialNo",serialNo);
 | 
												
													
														
															|  |                             jsondate.put("dept",map.get("deptCode").toString());
 |  |                             jsondate.put("dept",map.get("deptCode").toString());
 | 
												
													
														
															|  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 |  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
												
													
														
															|  | 
 |  |                             baseNatAppointmentDO.setRegisterNo(serialNo);
 | 
												
													
														
															|  |                             //存储就诊记录
 |  |                             //存储就诊记录
 | 
												
													
														
															|  |                             WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 |  |                             WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 | 
												
													
														
															|  |                             // 存储挂号医生与挂号科室
 |  |                             // 存储挂号医生与挂号科室
 | 
												
											
												
													
														
															|  | @ -10563,9 +10629,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                         }else {
 |  |                         }else {
 | 
												
													
														
															|  |                             returnMap.put("msg","请求挂号失败");
 |  |                             returnMap.put("msg","请求挂号失败");
 | 
												
													
														
															|  |                             returnMap.put("status","-1");
 |  |                             returnMap.put("status","-1");
 | 
												
													
														
															|  |                             return map;
 |  | 
 | 
												
													
														
															|  | 
 |  |                             returnMap.put("id",baseNatAppointmentDO.getId());
 | 
												
													
														
															|  | 
 |  |                             return returnMap;
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
 |  |                         baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
 | 
												
													
														
															|  | 
 |  |                         baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 } catch (Exception e) {
 |  |                 } catch (Exception e) {
 | 
												
											
												
													
														
															|  | @ -10573,8 +10641,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 logger.info("开单开始");
 |  |                 logger.info("开单开始");
 | 
												
													
														
															|  |                 logger.info("saveNatAppointment params:"+jsondate.toString());
 |  |                 logger.info("saveNatAppointment params:"+jsondate.toString());
 | 
												
													
														
															|  | 
 |  |                 com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
 | 
												
													
														
															|  | 
 |  |                 array.add(jsondate);
 | 
												
													
														
															|  |                 try {
 |  |                 try {
 | 
												
													
														
															|  |                     JSONObject jsonObject  = entranceService.BS10112(jsondate.toString(),flag);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     JSONObject jsonObject  = entranceService.BS10112(array.toString(),demoFlag);
 | 
												
													
														
															|  |                     //判断返回结果
 |  |                     //判断返回结果
 | 
												
													
														
															|  |                     String prers = jsonObject.getString("@RESULT");
 |  |                     String prers = jsonObject.getString("@RESULT");
 | 
												
													
														
															|  |                     //保存日志
 |  |                     //保存日志
 | 
												
											
												
													
														
															|  | @ -10589,11 +10659,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                     wlyyHttpLogDao.save(log);
 |  |                     wlyyHttpLogDao.save(log);
 | 
												
													
														
															|  |                     if ("0".equals(prers)) {
 |  |                     if ("0".equals(prers)) {
 | 
												
													
														
															|  |                         String realOrder = jsonObject.getString("@real_order");
 |  |                         String realOrder = jsonObject.getString("@real_order");
 | 
												
													
														
															|  | 
 |  |                         String voucherNo = jsonObject.getString("@xtgzh0");
 | 
												
													
														
															|  |                         baseNatAppointmentDO.setRealOrder(realOrder);
 |  |                         baseNatAppointmentDO.setRealOrder(realOrder);
 | 
												
													
														
															|  | 
 |  |                         baseNatAppointmentDO.setIsSuccess("1");
 | 
												
													
														
															|  | 
 |  |                         baseNatAppointmentDO.setVoucherNo(voucherNo);
 | 
												
													
														
															|  | 
 |  |                         baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
												
													
														
															|  |                         String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
 |  |                         String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
 | 
												
													
														
															|  |                         String applyDepaName = map.get("deptCode").toString();
 |  | 
 | 
												
													
														
															|  | 
 |  |                         String applyDepaName = map.get("deptName").toString();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                         String voucherNo = jsonObject.getString("@xtgzh0") ;
 |  | 
 | 
												
													
														
															|  |                         String applyDoctorName = map.get("doctorName").toString();
 |  |                         String applyDoctorName = map.get("doctorName").toString();
 | 
												
													
														
															|  |                         BasePatientDO patientDO = basePatientDao.findById(patientId);
 |  |                         BasePatientDO patientDO = basePatientDao.findById(patientId);
 | 
												
													
														
															|  |                         String userName = null;
 |  |                         String userName = null;
 | 
												
											
												
													
														
															|  | @ -10617,45 +10691,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                         if ("0".equals(rsCode)) {
 |  |                         if ("0".equals(rsCode)) {
 | 
												
													
														
															|  |                             free = res.getString("@total_charge");
 |  |                             free = res.getString("@total_charge");
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
 |  | 
 | 
												
													
														
															|  | 
 |  |                         ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                         /*//成功后发送模板消息
 |  |                         /*//成功后发送模板消息
 | 
												
													
														
															|  |                         sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
 |  |                         sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
 | 
												
													
														
															|  |                     }else{
 |  |                     }else{
 | 
												
													
														
															|  |                         returnMap.put("msg","核酸检测开方失败");
 |  |                         returnMap.put("msg","核酸检测开方失败");
 | 
												
													
														
															|  |                         returnMap.put("status","-1");
 |  |                         returnMap.put("status","-1");
 | 
												
													
														
															|  |                         return map;
 |  | 
 | 
												
													
														
															|  | 
 |  |                         returnMap.put("id",baseNatAppointmentDO.getId());
 | 
												
													
														
															|  | 
 |  |                         return returnMap;
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 } catch (Exception e) {
 |  |                 } catch (Exception e) {
 | 
												
													
														
															|  |                     e.printStackTrace();
 |  |                     e.printStackTrace();
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             baseNatAppointmentDO.setMedicare(mediaCard);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setName(name);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setCardNo(cardNo);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setCardType(cardType);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setAddress(address);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setCityName(cityName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setFirstJobCode(firstJobCode);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setFirstJobName(firstJobName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setSecondJobCode(secondJobCode);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setSecondJobName(secondJobName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setProvinceName(provinceName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setTownName(townName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setStreetName(streetName);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setPatientId(patientId);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setIsSuccess("1");
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setPayStatus("0");
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setCreateTime(new Date());
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDO.setMobile(mobile);
 |  | 
 | 
												
													
														
															|  |             baseNatAppointmentDao.save(baseNatAppointmentDO);
 |  | 
 | 
												
													
														
															|  |             returnMap.put("msg","预约成功");
 |  |             returnMap.put("msg","预约成功");
 | 
												
													
														
															|  |             returnMap.put("status","200");
 |  |             returnMap.put("status","200");
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  | 
 |  |             returnMap.put("id",baseNatAppointmentDO.getId());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return map;
 |  | 
 | 
												
													
														
															|  | 
 |  |         return returnMap;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  |     public MixEnvelop getNatRecords(String patientId,Integer page ,Integer pageSize){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public MixEnvelop getNatRecords(String patientId,String id,Integer page ,Integer pageSize){
 | 
												
													
														
															|  |         String sql = "select t.name as \"name\"," +
 |  |         String sql = "select t.name as \"name\"," +
 | 
												
													
														
															|  |                 "t.card_no as \"cardNo\"," +
 |  |                 "t.card_no as \"cardNo\"," +
 | 
												
													
														
															|  |                 "t.card_type as \"cardType\"," +
 |  |                 "t.card_type as \"cardType\"," +
 | 
												
											
												
													
														
															|  | @ -10665,12 +10723,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 "t.is_success as \"isSuccess\"," +
 |  |                 "t.is_success as \"isSuccess\"," +
 | 
												
													
														
															|  |                 "t.create_time as \"createTime\"," +
 |  |                 "t.create_time as \"createTime\"," +
 | 
												
													
														
															|  |                 "t.pay_status as \"payStatus\"," +
 |  |                 "t.pay_status as \"payStatus\"," +
 | 
												
													
														
															|  | 
 |  |                 "t.medicare as \"medicare\","+
 | 
												
													
														
															|  | 
 |  |                 "t.voucher_no as \"voucherNo\","+
 | 
												
													
														
															|  |                 "t.id as \"id\"," +
 |  |                 "t.id as \"id\"," +
 | 
												
													
														
															|  |                 "t.appointment_time as \"appointmentTime\" " +
 |  |                 "t.appointment_time as \"appointmentTime\" " +
 | 
												
													
														
															|  |                 " from base_nat_appointment t where 1=1 ";
 |  |                 " from base_nat_appointment t where 1=1 ";
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(patientId)){
 |  |         if (StringUtils.isNoneBlank(patientId)){
 | 
												
													
														
															|  |             sql+=" and t.patient_id ='"+patientId+"'";
 |  |             sql+=" and t.patient_id ='"+patientId+"'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNoneBlank(id)){
 | 
												
													
														
															|  | 
 |  |             sql+=" and t.id ='"+id+"'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
 |  |         List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
 | 
												
													
														
															|  |         List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
 |  |         List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  |         MixEnvelop mixnvelop = new MixEnvelop();
 |  |         MixEnvelop mixnvelop = new MixEnvelop();
 | 
												
											
												
													
														
															|  | @ -10710,12 +10773,51 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 patientCode = patientMappingService.findHisPatNoByIdCard(patientDO.getIdcard());
 |  |                 patientCode = patientMappingService.findHisPatNoByIdCard(patientDO.getIdcard());
 | 
												
													
														
															|  |                 BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
 |  |                 BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
 | 
												
													
														
															|  |                 if (null!=baseNatAppointmentDO){
 |  |                 if (null!=baseNatAppointmentDO){
 | 
												
													
														
															|  |                     res = entranceService.BS10145(baseNatAppointmentDO.getDept(),baseNatAppointmentDO.getDoctorId(),DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),patientCode,baseNatAppointmentDO.getMobile(),demoFlag);
 |  | 
 | 
												
													
														
															|  |                     baseNatAppointmentDO.setIsSuccess("-1");
 |  | 
 | 
												
													
														
															|  |                     baseNatAppointmentDO.setCancelReson("患者本人取消");
 |  | 
 | 
												
													
														
															|  |                     baseNatAppointmentDO.setCancelTime(new Date());
 |  | 
 | 
												
													
														
															|  |                     baseNatAppointmentDO.setCancelBy(patientId);
 |  | 
 | 
												
													
														
															|  |                     baseNatAppointmentDao.save(baseNatAppointmentDO);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     res = entranceService.BS10145("3150000","0001",DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),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);
 | 
												
													
														
															|  | 
 |  |                             //删除处方
 | 
												
													
														
															|  | 
 |  |                             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("删除处方结束");
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             } catch (Exception e) {
 |  |             } catch (Exception e) {
 |