|  | @ -20,6 +20,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.file_upload.FileUploadService;
 | 
	
	
		
			
				|  | @ -32,6 +33,7 @@ import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.service.PatientMappingService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.message.service.SystemMessageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.org.dao.BaseOrgDao;
 | 
	
	
		
			
				|  | @ -147,8 +149,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private StringRedisTemplate redisTemplate;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyHttpService wlyyHttpService;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     private SystemMessageService systemMessageService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
		
			
				|  |  |     private boolean demoFlag;
 | 
	
	
		
			
				|  | @ -711,6 +713,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //发送取药系统消息
 | 
	
		
			
				|  |  |             sendPatientGetDrugMes(outpatientDO,wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Boolean sendPatientGetDrugMes(WlyyOutpatientDO outpatient,WlyyPrescriptionDO prescriptionDO){
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             SystemMessageDO systemMessageDO = new SystemMessageDO();
 | 
	
		
			
				|  |  |             systemMessageDO.setTitle("患者取药");
 | 
	
		
			
				|  |  |             systemMessageDO.setType("7");
 | 
	
		
			
				|  |  |             systemMessageDO.setReceiver(outpatient.getDoctor());
 | 
	
		
			
				|  |  |             systemMessageDO.setReceiverName(outpatient.getDoctorName());
 | 
	
		
			
				|  |  |             systemMessageDO.setRelationCode(outpatient.getId());
 | 
	
		
			
				|  |  |             systemMessageDO.setSender(outpatient.getPatient());
 | 
	
		
			
				|  |  |             systemMessageDO.setSenderName(outpatient.getPatientName());
 | 
	
		
			
				|  |  |             systemMessageDO.setRelationCode(outpatient.getId());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |             data.put("name",outpatient.getPatientName());
 | 
	
		
			
				|  |  |             data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("recipeType",prescriptionDO.getDispensaryType());
 | 
	
		
			
				|  |  |             data.put("message","患者已完成取药");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             systemMessageDO.setData(data.toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             systemMessageService.saveMessage(systemMessageDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error("sendPatientGetDrugMes :"+e.toString());
 | 
	
		
			
				|  |  |             return false;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -3452,9 +3486,56 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         //3.创建候诊室
 | 
	
		
			
				|  |  |         createRoom(outpatient,chargeType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //4.发送协同门诊系统消息
 | 
	
		
			
				|  |  |         sendOutPatientMes(outpatient);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return outpatient;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 发送新增门诊信息
 | 
	
		
			
				|  |  |      * @param outpatient
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean sendOutPatientMes(WlyyOutpatientDO outpatient){
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             SystemMessageDO systemMessageDO = new SystemMessageDO();
 | 
	
		
			
				|  |  |             //1.在线复诊2.协同门诊
 | 
	
		
			
				|  |  |             if("2".equals(outpatient.getOutpatientType())){
 | 
	
		
			
				|  |  |                 systemMessageDO.setTitle("协同门诊");
 | 
	
		
			
				|  |  |                 systemMessageDO.setType("3");
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 //1.图文 2.视频
 | 
	
		
			
				|  |  |                 if("1".equals(outpatient.getType())){
 | 
	
		
			
				|  |  |                     systemMessageDO.setTitle("图文复诊");
 | 
	
		
			
				|  |  |                     systemMessageDO.setType("1");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     systemMessageDO.setTitle("视频复诊");
 | 
	
		
			
				|  |  |                     systemMessageDO.setType("2");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             systemMessageDO.setReceiver(outpatient.getDoctor());
 | 
	
		
			
				|  |  |             systemMessageDO.setReceiverName(outpatient.getDoctorName());
 | 
	
		
			
				|  |  |             systemMessageDO.setRelationCode(outpatient.getId());
 | 
	
		
			
				|  |  |             systemMessageDO.setSender(outpatient.getPatient());
 | 
	
		
			
				|  |  |             systemMessageDO.setSenderName(outpatient.getPatientName());
 | 
	
		
			
				|  |  |             systemMessageDO.setRelationCode(outpatient.getId());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |             data.put("name",outpatient.getPatientName());
 | 
	
		
			
				|  |  |             data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("question",outpatient.getDescription());
 | 
	
		
			
				|  |  |             systemMessageDO.setData(data.toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             systemMessageService.saveMessage(systemMessageDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error("sendOutPatientMes :"+e.toString());
 | 
	
		
			
				|  |  |             return false;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 指定门诊医生医生
 | 
	
		
			
				|  |  |      * @param outpatientJson
 |