|  | @ -33,6 +33,8 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.math.BigDecimal;
 | 
	
		
			
				|  |  | import java.net.URL;
 | 
	
		
			
				|  |  | import java.net.URLEncoder;
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -380,7 +382,7 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         jsonObject.put("preNo",preNo);
 | 
	
		
			
				|  |  |         //jsonObject.put("preNo",preNo);
 | 
	
		
			
				|  |  |         jsonObject.put("icCardNo",icCardNo);
 | 
	
		
			
				|  |  |         jsonObject.put("patientName",patientName);
 | 
	
		
			
				|  |  |         jsonObject.put("deptCode",deptCode);
 | 
	
	
		
			
				|  | @ -538,11 +540,11 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |             first.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key1.put("value",baseNatAppointmentD0.getDoctorName());
 | 
	
		
			
				|  |  |             key1.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key2.put("value",baseNatAppointmentD0.getChargeAmount());
 | 
	
		
			
				|  |  |             key2.put("value",baseNatAppointmentD0.getChargeAmount()+".00元");
 | 
	
		
			
				|  |  |             key2.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key3.put("value",wxTemplateConfigDO1.getKeyword3());
 | 
	
		
			
				|  |  |             key3.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key4.put("value",baseNatAppointmentD0.getChargeAmount());
 | 
	
		
			
				|  |  |             key4.put("value",baseNatAppointmentD0.getChargeAmount()+".00元");
 | 
	
		
			
				|  |  |             key4.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key5.put("value",baseNatAppointmentD0.getVoucherNo());
 | 
	
		
			
				|  |  |             key5.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
	
		
			
				|  | @ -582,7 +584,7 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |             key3.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key4.put("value",baseNatAppointmentD0.getDoctorName());
 | 
	
		
			
				|  |  |             key4.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key5.put("value", DateUtil.formatDate(baseNatAppointmentD0.getCreateTime(),"yyyy-MM-dd hh:mm:ss"));
 | 
	
		
			
				|  |  |             key5.put("value", DateUtil.formatDate(baseNatAppointmentD0.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
 | 
	
		
			
				|  |  |             key5.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             remark.put("value",wxTemplateConfigDO1.getRemark());
 | 
	
		
			
				|  |  |             remark.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
	
		
			
				|  | @ -616,7 +618,7 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |             key1.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key2.put("value",baseNatAppointmentD0.getInspectionName());
 | 
	
		
			
				|  |  |             key2.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"));
 | 
	
		
			
				|  |  |             key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd HH:mm:ss"));
 | 
	
		
			
				|  |  |             key3.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
		
			
				|  |  |             key4.put("value",wxTemplateConfigDO1.getKeyword4());
 | 
	
		
			
				|  |  |             key4.put("color",wxTemplateConfigDO1.getKeyword6());
 | 
	
	
		
			
				|  | @ -802,7 +804,7 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void savePayStatusByHis(String patientId) throws Exception {
 | 
	
		
			
				|  |  |         List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
 | 
	
		
			
				|  |  |         List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientIdTASY(patientId);
 | 
	
		
			
				|  |  |         for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
 | 
	
		
			
				|  |  |                 String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = JSON.parseObject(res);
 | 
	
	
		
			
				|  | @ -817,6 +819,20 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |                                 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);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             //取消号源
 | 
	
		
			
				|  |  |                             //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                     }
 | 
	
	
		
			
				|  | @ -850,6 +866,11 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |             orderObj.put("openId",openId);
 | 
	
		
			
				|  |  |             orderObj.put("name",baseNatAppointmentDO.getName());
 | 
	
		
			
				|  |  |             orderObj.put("idNo",baseNatAppointmentDO.getCardNo());
 | 
	
		
			
				|  |  |             Map mapHis=getPatientHisId(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMedicare());
 | 
	
		
			
				|  |  |             orderObj.put("patientId",mapHis.get("Patientid").toString());
 | 
	
		
			
				|  |  |             orderObj.put("mobile",mapHis.get("MobilePhone").toString());
 | 
	
		
			
				|  |  |             //orderObj.put("socialCard","");
 | 
	
		
			
				|  |  |             orderObj.put("icCard",baseNatAppointmentDO.getMedicare());
 | 
	
		
			
				|  |  |             BigDecimal b = new BigDecimal(baseNatAppointmentDO.getChargeAmount());
 | 
	
		
			
				|  |  |             b=b.setScale(2, BigDecimal.ROUND_DOWN);
 | 
	
		
			
				|  |  |             System.out.println("amount"+b);
 | 
	
	
		
			
				|  | @ -926,13 +947,16 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |         params.put("msg",msgBody);
 | 
	
		
			
				|  |  |         logger.info("hdrQueryDataWS params:"+params.toString());
 | 
	
		
			
				|  |  |         String xml = getTaszWebServiceInfo("hdrQueryDataWS",params,gethsQueryDataWS());
 | 
	
		
			
				|  |  |         xml=xml.substring(xml.indexOf("<ArrayList>"),xml.lastIndexOf("]]"));
 | 
	
		
			
				|  |  |         if (xml.contains("<ArrayList>")){
 | 
	
		
			
				|  |  |             xml=xml.substring(xml.indexOf("<ArrayList>"),xml.lastIndexOf("]]"));
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             xml=xml.substring(xml.indexOf("<?xml"),xml.lastIndexOf("]]"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         XMLSerializer xmlSerializer = new XMLSerializer();
 | 
	
		
			
				|  |  |         String json = xmlSerializer.read(xml).toString();
 | 
	
		
			
				|  |  |         logger.info("hdrQueryDataWS json:"+json);
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  Map checkBalance(String relationCode) throws  Exception{
 | 
	
		
			
				|  |  |         BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("MzBalance");
 | 
	
	
		
			
				|  | @ -1002,7 +1026,8 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |         result.put("msg","验证通过");
 | 
	
		
			
				|  |  |         return  result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String getPatientHisId(String idcard,String mediacard) throws Exception{
 | 
	
		
			
				|  |  |     public Map getPatientHisId(String idcard,String mediacard) throws Exception{
 | 
	
		
			
				|  |  |         Map map = new HashMap();
 | 
	
		
			
				|  |  |         String res = findHisPatientCard(idcard);
 | 
	
		
			
				|  |  |         JSONObject jsonObject = JSON.parseObject(res);
 | 
	
		
			
				|  |  |         if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
 | 
	
	
		
			
				|  | @ -1014,7 +1039,10 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |                         JSONObject child = jsonArray.getJSONObject(i);
 | 
	
		
			
				|  |  |                         if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
 | 
	
		
			
				|  |  |                             String Patientid = child.getString("Patientid");
 | 
	
		
			
				|  |  |                             return Patientid;
 | 
	
		
			
				|  |  |                             String MobilePhone = child.getString("MobilePhone");
 | 
	
		
			
				|  |  |                             map.put("Patientid",Patientid);
 | 
	
		
			
				|  |  |                             map.put("MobilePhone",MobilePhone);
 | 
	
		
			
				|  |  |                             return map;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1024,7 +1052,10 @@ public class TasyNatService {
 | 
	
		
			
				|  |  |                     JSONObject jsonObject1 = JSONObject.parseObject(patients);
 | 
	
		
			
				|  |  |                     if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
 | 
	
		
			
				|  |  |                         String Patientid = jsonObject1.getString("Patientid");
 | 
	
		
			
				|  |  |                         return Patientid;
 | 
	
		
			
				|  |  |                         String MobilePhone = jsonObject1.getString("MobilePhone");
 | 
	
		
			
				|  |  |                         map.put("Patientid",Patientid);
 | 
	
		
			
				|  |  |                         map.put("MobilePhone",MobilePhone);
 | 
	
		
			
				|  |  |                         return map;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                    e.printStackTrace();
 | 
	
	
		
			
				|  | @ -1032,6 +1063,6 @@ public class TasyNatService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return "";
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |