| 
					
				 | 
			
			
				@ -9330,13 +9330,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop selectByUrlHsjc(Integer id,String wxId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    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不存在!"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9350,7 +9351,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNoneBlank(idcard)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("就诊卡不存在!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(), patientWechatDo.getOpenid(), idcard, "WX"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10530,6 +10536,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("serialNo",registerDO.getRegisterNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("dept",map.get("deptCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("doctor",map.get("doctorMappingCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            baseNatAppointmentDO.setRegisterNo(registerDO.getRegisterNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10554,6 +10561,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("serialNo",serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("dept",map.get("deptCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            jsondate.put("doctor",map.get("doctorMappingCode").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            baseNatAppointmentDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //存储就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            // 存储挂号医生与挂号科室 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10651,13 +10659,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDao.save(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("0".equals(prers)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String realOrder = jsonObject.getString("@real_order"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String voucherNo = jsonObject.getString("@xtgzh0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        baseNatAppointmentDO.setRealOrder(realOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        baseNatAppointmentDO.setIsSuccess("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        baseNatAppointmentDO.setVoucherNo(voucherNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        baseNatAppointmentDao.save(baseNatAppointmentDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String applyDepaName = map.get("deptName").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String voucherNo = jsonObject.getString("@xtgzh0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String applyDoctorName = map.get("doctorName").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        BasePatientDO patientDO = basePatientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String userName = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10677,7 +10687,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.info("获取待结算数据 res: " + res.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String rsCode = res.getString("@RESULT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String free= ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String free= 0+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if ("0".equals(rsCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            free = res.getString("@total_charge"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10703,7 +10713,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.card_no as \"cardNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.card_type as \"cardType\"," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10713,12 +10723,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.is_success as \"isSuccess\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.create_time as \"createTime\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.pay_status as \"payStatus\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.medicare as \"medicare\","+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.voucher_no as \"voucherNo\","+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.id as \"id\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.appointment_time as \"appointmentTime\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from base_nat_appointment t where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(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>> listCount = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MixEnvelop mixnvelop = new MixEnvelop(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10773,6 +10788,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            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("删除处方结束"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |