| 
					
				 | 
			
			
				@ -3233,6 +3233,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyOutpatientDO.setDoctorCancelType(cancelType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyOutpatientDO.setDoctorCancelValue(cancelValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            description = "医生拒绝接诊"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //系统消息 医生取消复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SystemMessageDO messageDO = new SystemMessageDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setTitle("医生取消复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setType("12"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setSender(wlyyOutpatientDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setSenderName(wlyyOutpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setRelationCode(wlyyOutpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setReceiver(wlyyOutpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setReceiverName(wlyyOutpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject data = new net.sf.json.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("name",wlyyOutpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("age",IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("gender",IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("question",wlyyOutpatientDO.getIcd10Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String msg=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    data.put("type","9"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    data.put("type","16"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个视频复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("msg",msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                messageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageService.saveMessage(messageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //推送消息到眼科通 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDao.save(wlyyOutpatientDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3734,7 +3773,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.outpatient_type AS \"outpatientType\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " a.total AS \"consultTotal\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_name AS \"orgName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code AS \"orgCode\"" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code AS \"orgCode\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " follow.id AS followid "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3746,6 +3786,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equalsIgnoreCase(isAttention)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(isAttention)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='"+patientid+"' AND follow.doctor = d.id "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(diseaseKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4733,6 +4777,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("sendOutPatientMes :"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4769,11 +4819,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("msg",msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("type",type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5771,9 +5824,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setRelationCode(outpatientDO.getId()+","+wlyyPrescriptionDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setReceiver(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDO.setReceiverName(outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject data = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject data = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("name",outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("age", IdCardUtil.getAgeForIdcard(outpatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("gender",IdCardUtil.getSexForIdcard_new(outpatientDO.getIdcard())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5782,9 +5834,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("msg",msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                messageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageService.saveMessage(messageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patient = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckStatus(status); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6454,6 +6511,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("address",baseOrgDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("distance",distance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("longitude",baseOrgDO.getLongitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("dimension",baseOrgDO.getLatitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6480,4 +6539,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取居民openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patientCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findPatientOpenId(String patientCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientWechatDo basePatientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientCode).get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (basePatientWechatDo==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError("居民不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String openid = basePatientWechatDo.getOpenid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(openid)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError("居民openID不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,openid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |