|  | @ -11695,133 +11695,124 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 natFee= Double.parseDouble(chargeAmount)*100;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             BasePatientDO  basePatientDO = basePatientDao.findById(patientId);
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject jsondate = new JSONObject();
 | 
	
		
			
				|  |  |             jsondate.put("checkPart",checkPart);
 | 
	
		
			
				|  |  |             jsondate.put("cardNo",mediaCard);
 | 
	
		
			
				|  |  |             jsondate.put("chargeFlag",chargeFlag);
 | 
	
		
			
				|  |  |             jsondate.put("chargeCode",chargeCode);
 | 
	
		
			
				|  |  |             jsondate.put("icdCode",icdCode);
 | 
	
		
			
				|  |  |             jsondate.put("socialNo",cardNo);
 | 
	
		
			
				|  |  |             jsondate.put("tellPhone",mobile);
 | 
	
		
			
				|  |  |             jsondate.put("address1",provinceName);
 | 
	
		
			
				|  |  |             jsondate.put("address2",cityName);
 | 
	
		
			
				|  |  |             jsondate.put("address3",townName);
 | 
	
		
			
				|  |  |             jsondate.put("address4",streetName);
 | 
	
		
			
				|  |  |             jsondate.put("address5",address);
 | 
	
		
			
				|  |  |             jsondate.put("area",townName);
 | 
	
		
			
				|  |  |             jsondate.put("winNo",winNo);
 | 
	
		
			
				|  |  |             jsondate.put("targetChild",secondJobName);
 | 
	
		
			
				|  |  |             jsondate.put("target",firstJobName);
 | 
	
		
			
				|  |  |             jsondate.put("quantity",1);
 | 
	
		
			
				|  |  |             Map<String,Object> map = findRandomDoctor();
 | 
	
		
			
				|  |  |             if (map!=null){
 | 
	
		
			
				|  |  |                 //先进行核算检测预约
 | 
	
		
			
				|  |  |                 String realOrder="";
 | 
	
		
			
				|  |  |                 String result = tasyNatService.initNatParams(preNo,name,cardNo);
 | 
	
		
			
				|  |  |                 Boolean flag = false;
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(result)){
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                     logger.info("核酸检测预约结束"+result);
 | 
	
		
			
				|  |  |                     if (object!=null){
 | 
	
		
			
				|  |  |                         String returnCode = object.getString("returnCode");
 | 
	
		
			
				|  |  |                         if ("0".equalsIgnoreCase(returnCode)){
 | 
	
		
			
				|  |  |                             returnMap.put("msg",object.getString("returnMsg"));
 | 
	
		
			
				|  |  |                             returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                             return  returnMap;
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             flag = true;
 | 
	
		
			
				|  |  |                             realOrder=object.getString("hisTradeNo");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |             List<WlyyHospitalSysDictDO> tasyList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
 | 
	
		
			
				|  |  |             String deptCode = "0001";
 | 
	
		
			
				|  |  |             String staffNo = "0001";
 | 
	
		
			
				|  |  |             for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:tasyList){
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"deptCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
 | 
	
		
			
				|  |  |                     deptCode = wlyyHospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"staffNo".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
 | 
	
		
			
				|  |  |                     staffNo = wlyyHospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //先进行核算检测预约
 | 
	
		
			
				|  |  |             String realOrder="";
 | 
	
		
			
				|  |  |             String result = tasyNatService.initNatParams(preNo,name,cardNo);
 | 
	
		
			
				|  |  |             Boolean flag = false;
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(result)){
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                 logger.info("核酸检测预约结束"+result);
 | 
	
		
			
				|  |  |                 if (object!=null){
 | 
	
		
			
				|  |  |                     String returnCode = object.getString("returnCode");
 | 
	
		
			
				|  |  |                     if ("0".equalsIgnoreCase(returnCode)){
 | 
	
		
			
				|  |  |                         returnMap.put("msg",object.getString("returnMsg"));
 | 
	
		
			
				|  |  |                         returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                         return  returnMap;
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         flag = true;
 | 
	
		
			
				|  |  |                         realOrder=object.getString("hisTradeNo");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setChargeAmount(chargeAmount);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setMedicare(mediaCard);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setName(name);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setCardNo(cardNo);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setCardType(cardType);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setAddress(address);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
 | 
	
		
			
				|  |  |                     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.setCardNoType(cardNoType);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setPayStatus("0");
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setMobile(mobile);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setInspectionCode(chargeCode);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setInspectionName(inspectionName);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setIcdCode(icdCode);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setChargeCode(chargeCode);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setDept("3150000");
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setDeptName("感染疾病科");
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setAmpm(pm);
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                     //添加订单
 | 
	
		
			
				|  |  |                     BusinessOrderDO businessDO = new BusinessOrderDO();
 | 
	
		
			
				|  |  |                     businessDO.setPatient(consumer);
 | 
	
		
			
				|  |  |                     businessDO.setPatientName(basePatientDO.getName());
 | 
	
		
			
				|  |  |                     businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
 | 
	
		
			
				|  |  |                     businessDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     businessDO.setStatus(0);
 | 
	
		
			
				|  |  |                     businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
 | 
	
		
			
				|  |  |                     businessDO.setRelationName("核酸检测订单");
 | 
	
		
			
				|  |  |                     businessDO.setOrderCategory("6");
 | 
	
		
			
				|  |  |                     businessDO.setOrderType(12);
 | 
	
		
			
				|  |  |                     businessDO.setPayPrice(natFee);
 | 
	
		
			
				|  |  |                     businessDO.setRematk("核酸检测订单");
 | 
	
		
			
				|  |  |                     businessDO.setDescription("核酸检测订单");
 | 
	
		
			
				|  |  |                     businessDO.setPayType(1);
 | 
	
		
			
				|  |  |                     businessDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |                     businessDO=businessOrderDao.save(businessDO);
 | 
	
		
			
				|  |  |                     String openId="";
 | 
	
		
			
				|  |  |                     List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patientId);
 | 
	
		
			
				|  |  |                     if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
 | 
	
		
			
				|  |  |                         openId=basePatientWechatDo.get(0).getOpenid();
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     //亿同支付创建订单
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                     orderObj.put("payType",1);
 | 
	
		
			
				|  |  |                     orderObj.put("tradeNo",businessDO.getOrderNo());
 | 
	
		
			
				|  |  |                     orderObj.put("openId",openId);
 | 
	
		
			
				|  |  |                     orderObj.put("name",name);
 | 
	
		
			
				|  |  |                     orderObj.put("idNo",cardNo);
 | 
	
		
			
				|  |  |                     orderObj.put("amount",chargeAmount);
 | 
	
		
			
				|  |  |                     String orderRes=tasyNatService.placeOrder(orderObj);
 | 
	
		
			
				|  |  |                     if (StringUtils.isNoneBlank(orderRes)){
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
 | 
	
		
			
				|  |  |                         if (jsonObject!=null){
 | 
	
		
			
				|  |  |                             if("0".equalsIgnoreCase(jsonObject.getString("code"))){
 | 
	
		
			
				|  |  |                                 com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
 | 
	
		
			
				|  |  |                                 businessDO.setTraceNo(dataObj.getString("orderNo"));
 | 
	
		
			
				|  |  |                                 businessDO=businessOrderDao.save(businessDO);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setChargeAmount(chargeAmount);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setMedicare(mediaCard);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setName(name);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setCardNo(cardNo);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setCardType(cardType);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setAddress(address);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
 | 
	
		
			
				|  |  |                 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.setCardNoType(cardNoType);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setPayStatus("0");
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setMobile(mobile);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setInspectionCode(chargeCode);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setInspectionName(inspectionName);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setIcdCode(icdCode);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setChargeCode(chargeCode);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setDept(deptCode);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setDeptName("感染疾病科");
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setAmpm(pm);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setDoctorId(staffNo);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setConsumer(consumer);
 | 
	
		
			
				|  |  |                 //baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                 //添加订单
 | 
	
		
			
				|  |  |                 BusinessOrderDO businessDO = new BusinessOrderDO();
 | 
	
		
			
				|  |  |                 businessDO.setPatient(consumer);
 | 
	
		
			
				|  |  |                 businessDO.setPatientName(basePatientDO.getName());
 | 
	
		
			
				|  |  |                 businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
 | 
	
		
			
				|  |  |                 businessDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 businessDO.setStatus(0);
 | 
	
		
			
				|  |  |                 businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
 | 
	
		
			
				|  |  |                 businessDO.setRelationName("核酸检测订单");
 | 
	
		
			
				|  |  |                 businessDO.setOrderCategory("6");
 | 
	
		
			
				|  |  |                 businessDO.setOrderType(12);
 | 
	
		
			
				|  |  |                 businessDO.setPayPrice(natFee);
 | 
	
		
			
				|  |  |                 businessDO.setRematk("核酸检测订单");
 | 
	
		
			
				|  |  |                 businessDO.setDescription("核酸检测订单");
 | 
	
		
			
				|  |  |                 businessDO.setPayType(1);
 | 
	
		
			
				|  |  |                 businessDO.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |                 businessDO=businessOrderDao.save(businessDO);
 | 
	
		
			
				|  |  |                 String openId="";
 | 
	
		
			
				|  |  |                 List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
 | 
	
		
			
				|  |  |                 if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
 | 
	
		
			
				|  |  |                     openId=basePatientWechatDo.get(0).getOpenid();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //亿同支付创建订单
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                 orderObj.put("payType",1);
 | 
	
		
			
				|  |  |                 orderObj.put("tradeNo",businessDO.getOrderNo());
 | 
	
		
			
				|  |  |                 orderObj.put("openId",openId);
 | 
	
		
			
				|  |  |                 orderObj.put("name",name);
 | 
	
		
			
				|  |  |                 orderObj.put("idNo",cardNo);
 | 
	
		
			
				|  |  |                 orderObj.put("amount",chargeAmount);
 | 
	
		
			
				|  |  |                 String orderRes=tasyNatService.placeOrder(orderObj);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(orderRes)){
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
 | 
	
		
			
				|  |  |                     if (jsonObject!=null){
 | 
	
		
			
				|  |  |                         if("0".equalsIgnoreCase(jsonObject.getString("code"))){
 | 
	
		
			
				|  |  |                             com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
 | 
	
		
			
				|  |  |                             businessDO.setTraceNo(dataObj.getString("orderNo"));
 | 
	
		
			
				|  |  |                             businessDO=businessOrderDao.save(businessDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     logger.info("开单结束");
 | 
	
		
			
				|  |  |                     logger.info("saveNatAppointment params:"+jsondate.toString());
 | 
	
		
			
				|  |  |                     returnMap.put("msg","预约成功");
 | 
	
		
			
				|  |  |                     returnMap.put("status","200");
 | 
	
		
			
				|  |  |                     returnMap.put("id",baseNatAppointmentDO.getId());
 | 
	
		
			
				|  |  |                     returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     returnMap.put("msg","核酸开方失败");
 | 
	
		
			
				|  |  |                     returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                     return returnMap;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),"hszftx",baseNatAppointmentDO.getName());
 | 
	
		
			
				|  |  |                 logger.info("开单结束");
 | 
	
		
			
				|  |  |                 returnMap.put("msg","预约成功");
 | 
	
		
			
				|  |  |                 returnMap.put("status","200");
 | 
	
		
			
				|  |  |                 returnMap.put("id",baseNatAppointmentDO.getId());
 | 
	
		
			
				|  |  |                 returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 returnMap.put("msg","核酸开方失败");
 | 
	
		
			
				|  |  |                 returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                 return returnMap;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return returnMap;
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -12019,7 +12010,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(patientId)){
 | 
	
		
			
				|  |  |             if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
 | 
	
		
			
				|  |  |                 sql+=" and t.consumer ='"+patientId+"'";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |             }else if (wechatId.equalsIgnoreCase("xm_tasy_wx")){
 | 
	
		
			
				|  |  |                 sql+=" and t.consumer ='"+patientId+"'";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql+=" and t.patient_id ='"+patientId+"'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 |