|  | @ -69,7 +69,6 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.PageEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
	
		
			
				|  | @ -83,7 +82,6 @@ import com.yihu.jw.utils.CheckSumBuilder;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.GenerateUserSig;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.Pkis.PKIService_PortType;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.WebserviceUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.BasePatientWechatDao;
 | 
	
	
		
			
				|  | @ -107,8 +105,6 @@ import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.checkerframework.checker.units.qual.A;
 | 
	
		
			
				|  |  | import org.checkerframework.checker.units.qual.MixedUnits;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.BeanUtils;
 | 
	
	
		
			
				|  | @ -6023,6 +6019,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         rs.put("mobile", basePatientDO.getMobile());
 | 
	
		
			
				|  |  |         rs.put("photo", basePatientDO.getPhoto());
 | 
	
		
			
				|  |  |         rs.put("address", basePatientDO.getAddress());
 | 
	
		
			
				|  |  |         rs.put("cardType",basePatientDO.getCardType());
 | 
	
		
			
				|  |  |         if (patientMedicareCardDO != null) {
 | 
	
		
			
				|  |  |             rs.put("ssc", patientMedicareCardDO.getCode());
 | 
	
		
			
				|  |  |         } else {
 | 
	
	
		
			
				|  | @ -10427,7 +10424,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
 | 
	
		
			
				|  |  |                                    String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName){
 | 
	
		
			
				|  |  |                                    String 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();
 | 
	
		
			
				|  |  |         Map returnMap = new HashMap();
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject jsondate = new JSONObject();
 | 
	
	
		
			
				|  | @ -10448,169 +10445,214 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         Map<String,Object> map = findRandomDoctor();
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject rs = new JSONObject();
 | 
	
		
			
				|  |  |         if (map!=null){
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 //先进行核算检测预约
 | 
	
		
			
				|  |  |                 JSONArray jsonArray = entranceService.BS10144(map.get("deptCode").toString(),map.get("doctorMappingCode").toString(),natTime,mediaCard,name,patientId,mobile,demoFlag);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
 | 
	
		
			
				|  |  |                 List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(patientId, date,map.get("doctorCode").toString() ,1);
 | 
	
		
			
				|  |  |                 if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
 | 
	
		
			
				|  |  |                     WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
 | 
	
		
			
				|  |  |                     //判断是否已经挂号,如果已经挂号
 | 
	
		
			
				|  |  |                     if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
 | 
	
		
			
				|  |  |                         net.sf.json.JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |                         res.put("@RESULT", "0");
 | 
	
		
			
				|  |  |                         logger.info("已经挂号 res: " + res.toString());
 | 
	
		
			
				|  |  |                         jsondate.put("serialNo",registerDO.getRegisterNo());
 | 
	
		
			
				|  |  |                         jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                         jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         returnMap.put("msg","已经挂号的数据有误");
 | 
	
		
			
				|  |  |                         returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                         return map;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |             //先进行核算检测预约
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String result = entranceService.BS10144(map.get("deptCode").toString(),map.get("doctorMappingCode").toString(),natTime,mediaCard,name,patientId,mobile,demoFlag);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |             logger.info("核酸检测预约结束"+result);
 | 
	
		
			
				|  |  |             Boolean flag = false;
 | 
	
		
			
				|  |  |             if (object!=null){
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
 | 
	
		
			
				|  |  |                 String Msg = jsonObject.getString("Msg");
 | 
	
		
			
				|  |  |                 if (Msg.contains("Error")){
 | 
	
		
			
				|  |  |                     throw new Exception(Msg);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     rs = entranceService.BS10111(cardNo, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
 | 
	
		
			
				|  |  |                     net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 | 
	
		
			
				|  |  |                     logger.info("挂号结果 res: " + res.toString());
 | 
	
		
			
				|  |  |                     String rsCode = res.getString("@RESULT");
 | 
	
		
			
				|  |  |                     if ("0".equals(rsCode)) {
 | 
	
		
			
				|  |  |                         //存储挂号号
 | 
	
		
			
				|  |  |                         // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
 | 
	
		
			
				|  |  |                         String serialNo = (String) res.get("@serial_no");
 | 
	
		
			
				|  |  |                         String conNo = (String) res.get("@times");
 | 
	
		
			
				|  |  |                         String xtgzh = (String) res.get("@xtgzh");
 | 
	
		
			
				|  |  |                         String realOrder = (String) res.get("@real_order");
 | 
	
		
			
				|  |  |                         logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
 | 
	
		
			
				|  |  |                         jsondate.put("serialNo",serialNo);
 | 
	
		
			
				|  |  |                         jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                         jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                         //存储就诊记录
 | 
	
		
			
				|  |  |                         WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 | 
	
		
			
				|  |  |                         // 存储挂号医生与挂号科室
 | 
	
		
			
				|  |  |                         registerDO.setDoctor(map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDept(map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDeptName(map.get("deptName").toString());
 | 
	
		
			
				|  |  |                         registerDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                         registerDO.setXtgzh(xtgzh);
 | 
	
		
			
				|  |  |                         registerDO.setPatient(patientId);
 | 
	
		
			
				|  |  |                         registerDO.setPatientName(name);
 | 
	
		
			
				|  |  |                         //挂号流水号与挂号次数
 | 
	
		
			
				|  |  |                         registerDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  |                         registerDO.setConNo(conNo);
 | 
	
		
			
				|  |  |                         registerDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         registerDO.setDel(1);
 | 
	
		
			
				|  |  |                         registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  |                         patientRegisterDao.save(registerDO);
 | 
	
		
			
				|  |  |                         //保存日志
 | 
	
		
			
				|  |  |                         WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                         log.setCode("registerOutPatient");
 | 
	
		
			
				|  |  |                         log.setName("挂号");
 | 
	
		
			
				|  |  |                         log.setPatient(patientId);
 | 
	
		
			
				|  |  |                         log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                         log.setResponse(rs.toString());
 | 
	
		
			
				|  |  |                         log.setStatus(rsCode);
 | 
	
		
			
				|  |  |                         log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     } else if ("-2".equals(rsCode)) {
 | 
	
		
			
				|  |  |                         String serialNo = (String) res.get("@serial_no");
 | 
	
		
			
				|  |  |                         String xtgzh = (String) res.get("@xtgzh");
 | 
	
		
			
				|  |  |                         String realOrder = (String) res.get("@real_order");
 | 
	
		
			
				|  |  |                         String conNo = (String) res.get("@times");
 | 
	
		
			
				|  |  |                         jsondate.put("serialNo",serialNo);
 | 
	
		
			
				|  |  |                         jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                         jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                         logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
 | 
	
		
			
				|  |  |                         //存储就诊记录
 | 
	
		
			
				|  |  |                         WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 | 
	
		
			
				|  |  |                         registerDO.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDept(map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                         registerDO.setDeptName(map.get("deptName").toString());
 | 
	
		
			
				|  |  |                         registerDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                         registerDO.setXtgzh(xtgzh);
 | 
	
		
			
				|  |  |                         registerDO.setPatient(patientId);
 | 
	
		
			
				|  |  |                         registerDO.setPatientName(name);
 | 
	
		
			
				|  |  |                         registerDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  |                         registerDO.setConNo(conNo);
 | 
	
		
			
				|  |  |                         registerDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         patientRegisterDao.save(registerDO);
 | 
	
		
			
				|  |  |                         //保存日志
 | 
	
		
			
				|  |  |                         WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                         log.setCode("registerOutPatient");
 | 
	
		
			
				|  |  |                         log.setName("挂号");
 | 
	
		
			
				|  |  |                         log.setPatient(patientId);
 | 
	
		
			
				|  |  |                         log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                         log.setResponse(rs.toString());
 | 
	
		
			
				|  |  |                         log.setStatus(rsCode);
 | 
	
		
			
				|  |  |                         log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  |                     flag = true;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     logger.info("挂号开始");
 | 
	
		
			
				|  |  |                     String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
 | 
	
		
			
				|  |  |                     List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(patientId, date,map.get("doctorCode").toString() ,1);
 | 
	
		
			
				|  |  |                     if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
 | 
	
		
			
				|  |  |                         WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
 | 
	
		
			
				|  |  |                         //判断是否已经挂号,如果已经挂号
 | 
	
		
			
				|  |  |                         if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
 | 
	
		
			
				|  |  |                             net.sf.json.JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |                             res.put("@RESULT", "0");
 | 
	
		
			
				|  |  |                             logger.info("已经挂号 res: " + res.toString());
 | 
	
		
			
				|  |  |                             jsondate.put("serialNo",registerDO.getRegisterNo());
 | 
	
		
			
				|  |  |                             jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             returnMap.put("msg","已经挂号的数据有误");
 | 
	
		
			
				|  |  |                             returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                             return map;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         returnMap.put("msg","请求挂号失败");
 | 
	
		
			
				|  |  |                         returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                         return map;
 | 
	
		
			
				|  |  |                         rs = entranceService.BS10111(cardNo, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
 | 
	
		
			
				|  |  |                         net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 | 
	
		
			
				|  |  |                         logger.info("挂号结果 res: " + res.toString());
 | 
	
		
			
				|  |  |                         String rsCode = res.getString("@RESULT");
 | 
	
		
			
				|  |  |                         if ("0".equals(rsCode)) {
 | 
	
		
			
				|  |  |                             //存储挂号号
 | 
	
		
			
				|  |  |                             // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
 | 
	
		
			
				|  |  |                             String serialNo = (String) res.get("@serial_no");
 | 
	
		
			
				|  |  |                             String conNo = (String) res.get("@times");
 | 
	
		
			
				|  |  |                             String xtgzh = (String) res.get("@xtgzh");
 | 
	
		
			
				|  |  |                             String realOrder = (String) res.get("@real_order");
 | 
	
		
			
				|  |  |                             logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
 | 
	
		
			
				|  |  |                             jsondate.put("serialNo",serialNo);
 | 
	
		
			
				|  |  |                             jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                             //存储就诊记录
 | 
	
		
			
				|  |  |                             WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 | 
	
		
			
				|  |  |                             // 存储挂号医生与挂号科室
 | 
	
		
			
				|  |  |                             registerDO.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDept(map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDeptName(map.get("deptName").toString());
 | 
	
		
			
				|  |  |                             registerDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                             registerDO.setXtgzh(xtgzh);
 | 
	
		
			
				|  |  |                             registerDO.setPatient(patientId);
 | 
	
		
			
				|  |  |                             registerDO.setPatientName(name);
 | 
	
		
			
				|  |  |                             //挂号流水号与挂号次数
 | 
	
		
			
				|  |  |                             registerDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  |                             registerDO.setConNo(conNo);
 | 
	
		
			
				|  |  |                             registerDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                             registerDO.setDel(1);
 | 
	
		
			
				|  |  |                             registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  |                             patientRegisterDao.save(registerDO);
 | 
	
		
			
				|  |  |                             //保存日志
 | 
	
		
			
				|  |  |                             WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                             log.setCode("registerOutPatient");
 | 
	
		
			
				|  |  |                             log.setName("挂号");
 | 
	
		
			
				|  |  |                             log.setPatient(patientId);
 | 
	
		
			
				|  |  |                             log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                             log.setResponse(rs.toString());
 | 
	
		
			
				|  |  |                             log.setStatus(rsCode);
 | 
	
		
			
				|  |  |                             log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                             wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         } else if ("-2".equals(rsCode)) {
 | 
	
		
			
				|  |  |                             String serialNo = (String) res.get("@serial_no");
 | 
	
		
			
				|  |  |                             String xtgzh = (String) res.get("@xtgzh");
 | 
	
		
			
				|  |  |                             String realOrder = (String) res.get("@real_order");
 | 
	
		
			
				|  |  |                             String conNo = (String) res.get("@times");
 | 
	
		
			
				|  |  |                             jsondate.put("serialNo",serialNo);
 | 
	
		
			
				|  |  |                             jsondate.put("dept",map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                             jsondate.put("doctor",map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  |                             logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
 | 
	
		
			
				|  |  |                             //存储就诊记录
 | 
	
		
			
				|  |  |                             WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
 | 
	
		
			
				|  |  |                             registerDO.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDoctorName(map.get("doctorName").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDept(map.get("deptCode").toString());
 | 
	
		
			
				|  |  |                             registerDO.setDeptName(map.get("deptName").toString());
 | 
	
		
			
				|  |  |                             registerDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                             registerDO.setXtgzh(xtgzh);
 | 
	
		
			
				|  |  |                             registerDO.setPatient(patientId);
 | 
	
		
			
				|  |  |                             registerDO.setPatientName(name);
 | 
	
		
			
				|  |  |                             registerDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  |                             registerDO.setConNo(conNo);
 | 
	
		
			
				|  |  |                             registerDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                             registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             patientRegisterDao.save(registerDO);
 | 
	
		
			
				|  |  |                             //保存日志
 | 
	
		
			
				|  |  |                             WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                             log.setCode("registerOutPatient");
 | 
	
		
			
				|  |  |                             log.setName("挂号");
 | 
	
		
			
				|  |  |                             log.setPatient(patientId);
 | 
	
		
			
				|  |  |                             log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                             log.setResponse(rs.toString());
 | 
	
		
			
				|  |  |                             log.setStatus(rsCode);
 | 
	
		
			
				|  |  |                             log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                             wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             returnMap.put("msg","请求挂号失败");
 | 
	
		
			
				|  |  |                             returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                             return map;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("开单开始");
 | 
	
		
			
				|  |  |                 logger.info("saveNatAppointment params:"+jsondate.toString());
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     JSONObject jsonObject  = entranceService.BS10112(jsondate.toString(),flag);
 | 
	
		
			
				|  |  |                     //判断返回结果
 | 
	
		
			
				|  |  |                     String prers = jsonObject.getString("@RESULT");
 | 
	
		
			
				|  |  |                     //保存日志
 | 
	
		
			
				|  |  |                     WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                     log.setCode("saveNatAppointment");
 | 
	
		
			
				|  |  |                     log.setName("核酸检测开方");
 | 
	
		
			
				|  |  |                     log.setPatient(patientId);
 | 
	
		
			
				|  |  |                     log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                     log.setResponse(jsonObject.toString());
 | 
	
		
			
				|  |  |                     log.setRequest(jsondate.toString());
 | 
	
		
			
				|  |  |                     log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  |                     if ("0".equals(prers)) {
 | 
	
		
			
				|  |  |                         String realOrder = jsonObject.getString("@real_order");
 | 
	
		
			
				|  |  |                         baseNatAppointmentDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                         String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
 | 
	
		
			
				|  |  |                         String applyDepaName = map.get("deptCode").toString();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         String voucherNo = jsonObject.getString("@xtgzh0") ;
 | 
	
		
			
				|  |  |                         String applyDoctorName = map.get("doctorName").toString();
 | 
	
		
			
				|  |  |                         BasePatientDO patientDO = basePatientDao.findById(patientId);
 | 
	
		
			
				|  |  |                         String userName = null;
 | 
	
		
			
				|  |  |                         String idcard = null;
 | 
	
		
			
				|  |  |                         if (patientDO != null) {
 | 
	
		
			
				|  |  |                             userName = patientDO.getName();
 | 
	
		
			
				|  |  |                             idcard = patientDO.getIdcard();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientId);
 | 
	
		
			
				|  |  |                         String userNo = null;
 | 
	
		
			
				|  |  |                         if (patientMappingDO != null) {
 | 
	
		
			
				|  |  |                             userNo = patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } catch (Exception e) {
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("saveNatAppointment params:"+jsondate.toString());
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 JSONObject jsonObject  = entranceService.BS10112(jsondate.toString(),flag);
 | 
	
		
			
				|  |  |                 //判断返回结果
 | 
	
		
			
				|  |  |                 String prers = jsonObject.getString("@RESULT");
 | 
	
		
			
				|  |  |                 //保存日志
 | 
	
		
			
				|  |  |                 WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |                 log.setCode("saveNatAppointment");
 | 
	
		
			
				|  |  |                 log.setName("核酸检测开方");
 | 
	
		
			
				|  |  |                 log.setPatient(patientId);
 | 
	
		
			
				|  |  |                 log.setDoctor(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |                 log.setResponse(jsonObject.toString());
 | 
	
		
			
				|  |  |                 log.setRequest(jsondate.toString());
 | 
	
		
			
				|  |  |                 log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  |                 if ("0".equals(prers)) {
 | 
	
		
			
				|  |  |                     String realOrder = jsonObject.getString("@real_order");
 | 
	
		
			
				|  |  |                     baseNatAppointmentDO.setRealOrder(realOrder);
 | 
	
		
			
				|  |  |                     //成功后发送模板消息
 | 
	
		
			
				|  |  |                     sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     returnMap.put("msg","核酸检测开方失败");
 | 
	
		
			
				|  |  |                     returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                     return map;
 | 
	
		
			
				|  |  |                         logger.info("cardNo:" + cardNo);
 | 
	
		
			
				|  |  |                         JSONObject jsonObject1 =entranceService.BS15054(patientMappingDO.getMappingCode(),realOrder,demoFlag);
 | 
	
		
			
				|  |  |                         net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
 | 
	
		
			
				|  |  |                         logger.info("获取待结算数据 res: " + res.toString());
 | 
	
		
			
				|  |  |                         String rsCode = res.getString("@RESULT");
 | 
	
		
			
				|  |  |                         String free= 0+"";
 | 
	
		
			
				|  |  |                         if ("0".equals(rsCode)) {
 | 
	
		
			
				|  |  |                             free = res.getString("@total_charge");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
 | 
	
		
			
				|  |  |                         /*//成功后发送模板消息
 | 
	
		
			
				|  |  |                         sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
 | 
	
		
			
				|  |  |                     }else{
 | 
	
		
			
				|  |  |                         returnMap.put("msg","核酸检测开方失败");
 | 
	
		
			
				|  |  |                         returnMap.put("status","-1");
 | 
	
		
			
				|  |  |                         return map;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } catch (Exception e) {
 | 
	
		
			
				|  |  |                 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.setStreet(streetName);
 | 
	
		
			
				|  |  |         baseNatAppointmentDO.setPatientId(patientId);
 | 
	
		
			
				|  |  |         baseNatAppointmentDO.setIsSuccess("0");
 | 
	
		
			
				|  |  |         baseNatAppointmentDO.setPayStatus("0");
 | 
	
		
			
				|  |  |         baseNatAppointmentDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         baseNatAppointmentDO.setMobile(mobile);
 | 
	
		
			
				|  |  |         baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |         returnMap.put("msg","预约成功");
 | 
	
		
			
				|  |  |         returnMap.put("status","200");
 | 
	
		
			
				|  |  |             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.setStreet(streetName);
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setPatientId(patientId);
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setIsSuccess("0");
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setPayStatus("0");
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             baseNatAppointmentDO.setMobile(mobile);
 | 
	
		
			
				|  |  |             baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |             returnMap.put("msg","预约成功");
 | 
	
		
			
				|  |  |             returnMap.put("status","200");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public MixEnvelop getNatRecords(String patientId,Integer page ,Integer pageSize){
 |