|  | @ -618,7 +618,7 @@ public class TasyNatService {
 | 
												
													
														
															|  |             key1.put("color",wxTemplateConfigDO1.getKeyword6());
 |  |             key1.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
												
													
														
															|  |             key2.put("value",baseNatAppointmentD0.getInspectionName());
 |  |             key2.put("value",baseNatAppointmentD0.getInspectionName());
 | 
												
													
														
															|  |             key2.put("color",wxTemplateConfigDO1.getKeyword6());
 |  |             key2.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
												
													
														
															|  |             key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd HH:mm:ss"));
 |  | 
 | 
												
													
														
															|  | 
 |  |             key3.put("value",wxTemplateConfigDO1.getKeyword3());//DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd")
 | 
												
													
														
															|  |             key3.put("color",wxTemplateConfigDO1.getKeyword6());
 |  |             key3.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
												
													
														
															|  |             key4.put("value",wxTemplateConfigDO1.getKeyword4());
 |  |             key4.put("value",wxTemplateConfigDO1.getKeyword4());
 | 
												
													
														
															|  |             key4.put("color",wxTemplateConfigDO1.getKeyword6());
 |  |             key4.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
												
											
												
													
														
															|  | @ -804,37 +804,108 @@ public class TasyNatService {
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void savePayStatusByHis(String patientId) throws Exception {
 |  |     public void savePayStatusByHis(String patientId) throws Exception {
 | 
												
													
														
															|  |         List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientIdTASY(patientId);
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findByTasy(patientId);
 | 
												
													
														
															|  |         for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
 |  |         for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
 | 
												
													
														
															|  | 
 |  |             System.out.println("baseNatAppointmentDO==="+baseNatAppointmentDO.getName());
 | 
												
													
														
															|  |                 String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
 |  |                 String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
 | 
												
													
														
															|  |                 JSONObject jsonObject = JSON.parseObject(res);
 |  |                 JSONObject jsonObject = JSON.parseObject(res);
 | 
												
													
														
															|  |                 if (jsonObject!=null){
 |  |                 if (jsonObject!=null){
 | 
												
													
														
															|  |                     if (jsonObject.getString("ReturnCode").equalsIgnoreCase("1")){
 |  |                     if (jsonObject.getString("ReturnCode").equalsIgnoreCase("1")){
 | 
												
													
														
															|  |                         String voucherNo = jsonObject.getString("ApplyNo");
 |  | 
 | 
												
													
														
															|  |                         baseNatAppointmentDO.setVoucherNo(voucherNo);
 |  | 
 | 
												
													
														
															|  |                         if ("已扣费".equalsIgnoreCase(jsonObject.getString("Status"))){
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setPayStatus("1");
 |  | 
 | 
												
													
														
															|  |                             BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 |  | 
 | 
												
													
														
															|  |                             if (businessOrderDO!=null){
 |  | 
 | 
												
													
														
															|  |                                 businessOrderDO.setStatus(1);
 |  | 
 | 
												
													
														
															|  |                                 businessOrderDao.save(businessOrderDO);
 |  | 
 | 
												
													
														
															|  |                             }
 |  | 
 | 
												
													
														
															|  |                         }else if ("已退费".equalsIgnoreCase(jsonObject.getString("Status"))){
 |  | 
 | 
												
													
														
															|  |                             logger.info("进入退费订单同步");
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setPayStatus("-1");
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setIsSuccess("-1");
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setCancelReson("患者本人线下取消");
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setCancelTime(new Date());
 |  | 
 | 
												
													
														
															|  |                             baseNatAppointmentDO.setCancelBy(patientId);
 |  | 
 | 
												
													
														
															|  |                             BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 |  | 
 | 
												
													
														
															|  |                             if (businessOrderDO!=null){
 |  | 
 | 
												
													
														
															|  |                                 businessOrderDO.setStatus(-1);
 |  | 
 | 
												
													
														
															|  |                                 businessOrderDao.save(businessOrderDO);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         String applyinfo = jsonObject.getString("applyinfo");
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNoneBlank(applyinfo)){
 | 
												
													
														
															|  | 
 |  |                             if (applyinfo.contains("[")){
 | 
												
													
														
															|  | 
 |  |                                 JSONArray jsonArray = JSON.parseArray(applyinfo);
 | 
												
													
														
															|  | 
 |  |                                 if (jsonArray!=null&&jsonArray.size()>0) {
 | 
												
													
														
															|  | 
 |  |                                     if (StringUtils.isNoneBlank(baseNatAppointmentDO.getVoucherNo())) {
 | 
												
													
														
															|  | 
 |  |                                         for (int i = 0; i < jsonArray.size(); i++) {
 | 
												
													
														
															|  | 
 |  |                                             JSONObject child = jsonArray.getJSONObject(i);
 | 
												
													
														
															|  | 
 |  |                                             System.out.println("数组" + child.getString("ApplyNo"));
 | 
												
													
														
															|  | 
 |  |                                             if (child.getString("ApplyNo").equalsIgnoreCase(baseNatAppointmentDO.getVoucherNo())) {
 | 
												
													
														
															|  | 
 |  |                                                 if ("已扣费".equalsIgnoreCase(child.getString("Status"))) {
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setPayStatus("1");
 | 
												
													
														
															|  | 
 |  |                                                     BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                                     if (businessOrderDO != null) {
 | 
												
													
														
															|  | 
 |  |                                                         businessOrderDO.setStatus(1);
 | 
												
													
														
															|  | 
 |  |                                                         businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                                     }
 | 
												
													
														
															|  | 
 |  |                                                 } else if ("已退费".equalsIgnoreCase(child.getString("Status"))) {
 | 
												
													
														
															|  | 
 |  |                                                     logger.info("进入退费订单同步");
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setPayStatus("-1");
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setIsSuccess("-1");
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setCancelReson("患者本人线下取消");
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setCancelTime(new Date());
 | 
												
													
														
															|  | 
 |  |                                                     baseNatAppointmentDO.setCancelBy(patientId);
 | 
												
													
														
															|  | 
 |  |                                                     BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                                     if (businessOrderDO != null) {
 | 
												
													
														
															|  | 
 |  |                                                         businessOrderDO.setStatus(-1);
 | 
												
													
														
															|  | 
 |  |                                                         businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                                     }
 | 
												
													
														
															|  | 
 |  |                                                     //取消号源
 | 
												
													
														
															|  | 
 |  |                                                     //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
 | 
												
													
														
															|  | 
 |  |                                                 }
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
												
													
														
															|  | 
 |  |                                             }
 | 
												
													
														
															|  | 
 |  |                                         }
 | 
												
													
														
															|  | 
 |  |                                     }else {
 | 
												
													
														
															|  | 
 |  |                                         JSONObject child = jsonArray.getJSONObject(jsonArray.size()-1);
 | 
												
													
														
															|  | 
 |  |                                         System.out.println("数组" + child.getString("ApplyNo"));
 | 
												
													
														
															|  | 
 |  |                                         if (child.getString("ApplyNo").equalsIgnoreCase(baseNatAppointmentDO.getVoucherNo())) {
 | 
												
													
														
															|  | 
 |  |                                             if ("已扣费".equalsIgnoreCase(child.getString("Status"))) {
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setPayStatus("1");
 | 
												
													
														
															|  | 
 |  |                                                 BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                                 if (businessOrderDO != null) {
 | 
												
													
														
															|  | 
 |  |                                                     businessOrderDO.setStatus(1);
 | 
												
													
														
															|  | 
 |  |                                                     businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                                 }
 | 
												
													
														
															|  | 
 |  |                                             } else if ("已退费".equalsIgnoreCase(child.getString("Status"))) {
 | 
												
													
														
															|  | 
 |  |                                                 logger.info("进入退费订单同步");
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setPayStatus("-1");
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setIsSuccess("-1");
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setCancelReson("患者本人线下取消");
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setCancelTime(new Date());
 | 
												
													
														
															|  | 
 |  |                                                 baseNatAppointmentDO.setCancelBy(patientId);
 | 
												
													
														
															|  | 
 |  |                                                 BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                                 if (businessOrderDO != null) {
 | 
												
													
														
															|  | 
 |  |                                                     businessOrderDO.setStatus(-1);
 | 
												
													
														
															|  | 
 |  |                                                     businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                                 }
 | 
												
													
														
															|  | 
 |  |                                                 //取消号源
 | 
												
													
														
															|  | 
 |  |                                                 //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
 | 
												
													
														
															|  | 
 |  |                                             }
 | 
												
													
														
															|  | 
 |  |                                             baseNatAppointmentDO.setVoucherNo(child.getString("ApplyNo"));
 | 
												
													
														
															|  | 
 |  |                                             baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
												
													
														
															|  | 
 |  |                                         }
 | 
												
													
														
															|  | 
 |  |                                     }
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  |                             }else {
 | 
												
													
														
															|  | 
 |  |                                 JSONObject jsonObject1 = JSONObject.parseObject(applyinfo);
 | 
												
													
														
															|  | 
 |  |                                 System.out.println("单条"+jsonObject1.getString("ApplyNo"));
 | 
												
													
														
															|  | 
 |  |                                 if ("已扣费".equalsIgnoreCase(jsonObject1.getString("Status"))){
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setPayStatus("1");
 | 
												
													
														
															|  | 
 |  |                                     BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                     if (businessOrderDO!=null){
 | 
												
													
														
															|  | 
 |  |                                         businessOrderDO.setStatus(1);
 | 
												
													
														
															|  | 
 |  |                                         businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                     }
 | 
												
													
														
															|  | 
 |  |                                 }else if ("已退费".equalsIgnoreCase(jsonObject1.getString("Status"))){
 | 
												
													
														
															|  | 
 |  |                                     logger.info("进入退费订单同步");
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setPayStatus("-1");
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setIsSuccess("-1");
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setCancelReson("患者本人线下取消");
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setCancelTime(new Date());
 | 
												
													
														
															|  | 
 |  |                                     baseNatAppointmentDO.setCancelBy(patientId);
 | 
												
													
														
															|  | 
 |  |                                     BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
 | 
												
													
														
															|  | 
 |  |                                     if (businessOrderDO!=null){
 | 
												
													
														
															|  | 
 |  |                                         businessOrderDO.setStatus(-1);
 | 
												
													
														
															|  | 
 |  |                                         businessOrderDao.save(businessOrderDO);
 | 
												
													
														
															|  | 
 |  |                                     }
 | 
												
													
														
															|  | 
 |  |                                     //取消号源
 | 
												
													
														
															|  | 
 |  |                                     //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
 | 
												
													
														
															|  | 
 |  |                                 }
 | 
												
													
														
															|  | 
 |  |                                 baseNatAppointmentDO.setVoucherNo(jsonObject1.getString("ApplyNo"));
 | 
												
													
														
															|  | 
 |  |                                 baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
												
													
														
															|  |                             }
 |  |                             }
 | 
												
													
														
															|  |                             //取消号源
 |  | 
 | 
												
													
														
															|  |                             //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
 |  | 
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         baseNatAppointmentDao.save(baseNatAppointmentDO);
 |  | 
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 |