| 
															
																@ -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.doctor.WlyyPatientRegisterTimeDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO; 
															 | 
															
															 | 
															
																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.hospital.prescription.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.file_upload.FileUploadService; 
															 | 
															
															 | 
															
																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.httplog.dao.WlyyHttpLogDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.mapping.service.DoctorMappingService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.mapping.service.DoctorMappingService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.mapping.service.PatientMappingService; 
															 | 
															
															 | 
															
																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.dao.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.EntranceService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.EntranceService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.org.dao.BaseOrgDao; 
															 | 
															
															 | 
															
																import com.yihu.jw.org.dao.BaseOrgDao; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -47,6 +49,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
															 | 
															
															 | 
															
																import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.common.IdCardUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.common.IdCardUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.mysql.query.BaseJpaService; 
															 | 
															
															 | 
															
																import com.yihu.mysql.query.BaseJpaService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.utils.security.MD5; 
															 | 
															
															 | 
															
																import com.yihu.utils.security.MD5; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.ylzinfo.ehc.EhcHandler; 
															 | 
															
															 | 
															
																import com.ylzinfo.ehc.EhcHandler; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -145,7 +148,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private WlyyInspectionDao wlyyInspectionDao; 
															 | 
															
															 | 
															
																    private WlyyInspectionDao wlyyInspectionDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private StringRedisTemplate redisTemplate; 
															 | 
															
															 | 
															
																    private StringRedisTemplate redisTemplate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private SystemMessageService systemMessageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Value("${demo.flag}") 
															 | 
															
															 | 
															
																    @Value("${demo.flag}") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private boolean demoFlag; 
															 | 
															
															 | 
															
																    private boolean demoFlag; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -197,14 +202,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 
															 | 
															
															 | 
															
																     * 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String admNo,boolean demoFlag)throws Exception{ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
															 | 
															
															 | 
															
																        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isBlank(patNo)){ 
															 | 
															
															 | 
															
																        if(StringUtils.isBlank(patNo)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            return null; 
															 | 
															
															 | 
															
																            return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
															 | 
															
															 | 
															
																        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" admNo:"+admNo); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return entranceService.BS16017(registerSn,null,patNo,admNo,demoFlag); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -243,17 +248,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " FROM " + 
															 | 
															
															 | 
															
																                " FROM " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_outpatient o " + 
															 | 
															
															 | 
															
																                " wlyy_outpatient o " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " WHERE " + 
															 | 
															
															 | 
															
																                " WHERE " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " o.patient = '"+patient+"' AND o.outpatient_type != '2' "; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " o.patient = ? AND o.outpatient_type != '2' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<Object> totalParams = new ArrayList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        totalParams.add(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(status!=null){ 
															 | 
															
															 | 
															
																        if(status!=null){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            totalSql +=  " AND o.status = "+status; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalSql +=  " AND o.status = ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalParams.add(status); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isNotBlank(startTime)){ 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(startTime)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            totalSql += " AND create_time >='"+startTime+" 00:00:00'"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalSql += " AND create_time >= ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalParams.add(startTime+" 00:00:00"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isNotBlank(endTime)){ 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(endTime)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            totalSql += " AND create_time <='"+endTime+" 23:59:59' "; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalSql += " AND create_time <= ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalParams.add(endTime+" 23:59:59"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Long count = 0L; 
															 | 
															
															 | 
															
																        Long count = 0L; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (rstotal != null && rstotal.size() > 0) { 
															 | 
															
															 | 
															
																        if (rstotal != null && rstotal.size() > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            count = (Long) rstotal.get(0).get("total"); 
															 | 
															
															 | 
															
																            count = (Long) rstotal.get(0).get("total"); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -291,18 +301,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " FROM " + 
															 | 
															
															 | 
															
																                " FROM " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " wlyy_outpatient o " + 
															 | 
															
															 | 
															
																                " wlyy_outpatient o " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " WHERE " + 
															 | 
															
															 | 
															
																                " WHERE " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " o.patient = '"+patient+"'"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " o.patient = ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<Object> params = new ArrayList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        params.add(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(status!=null){ 
															 | 
															
															 | 
															
																        if(status!=null){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql +=  " AND o.status = "+status; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql +=  " AND o.status = ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            params.add(status); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isNotBlank(startTime)){ 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(startTime)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql += " AND o.create_time >='"+startTime+" 00:00:00'"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += " AND o.create_time >= ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            params.add(startTime+" 00:00:00"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isNotBlank(endTime)){ 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(endTime)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql += " AND o.create_time <='"+endTime+" 23:59:59'"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql += " AND o.create_time <= ? "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            params.add(endTime+" 23:59:59"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " "; 
															 | 
															
															 | 
															
																        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class),params.toArray()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
															 | 
															
															 | 
															
																        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -606,7 +622,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        waitingRoom.setHospitalName(outpatientDO.getHospitalName()); 
															 | 
															
															 | 
															
																        waitingRoom.setHospitalName(outpatientDO.getHospitalName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //是否是有协同门诊医生 
															 | 
															
															 | 
															
																        //是否是有协同门诊医生 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor()); 
															 | 
															
															 | 
															
																            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName()); 
															 | 
															
															 | 
															
																            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -697,6 +713,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                prescriptionDao.save(wlyyPrescriptionDO); 
															 | 
															
															 | 
															
																                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; 
															 | 
															
															 | 
															
																        return true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -3051,9 +3099,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 获取正在进行中的视频复诊/协同门诊 
															 | 
															
															 | 
															
																     * 获取正在进行中的视频复诊/协同门诊 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param doctor 
															 | 
															
															 | 
															
																     * @param doctor 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param general_doctor 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor,String general_doctor) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sql ="SELECT " + 
															 | 
															
															 | 
															
																        String sql ="SELECT " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "room.outpatient_id AS id," + 
															 | 
															
															 | 
															
																                "room.outpatient_id AS id," + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "room.patient_id AS patient_id," + 
															 | 
															
															 | 
															
																                "room.patient_id AS patient_id," + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -3079,9 +3128,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "room.patient_id=patient.id " + 
															 | 
															
															 | 
															
																                "room.patient_id=patient.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.outpatient_id=outpatient.id " + 
															 | 
															
															 | 
															
																                "AND room.outpatient_id=outpatient.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND consult.relation_code=outpatient.id " + 
															 | 
															
															 | 
															
																                "AND consult.relation_code=outpatient.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND consult.status = 0 " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.doctor='"+doctor+"' " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.consult_type= 2"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "AND consult.status = 0 "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(StringUtils.isNoneBlank(doctor)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql = sql +"AND room.doctor='"+doctor+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    "AND room.consult_type= 2"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        }else if(StringUtils.isNoneBlank(general_doctor)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql = sql +"AND room.general_doctor='"+general_doctor+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    "AND room.consult_type= 2"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        }else{} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																         
															 | 
														
													
												
													
														
															| 
															 | 
															
																     
															 | 
															
															 | 
															
																     
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
															 | 
															
															 | 
															
																        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(list!=null&&list.size()>0){ 
															 | 
															
															 | 
															
																        if(list!=null&&list.size()>0){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -3135,7 +3190,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND outpatient.status = 0 " + 
															 | 
															
															 | 
															
																                "AND outpatient.status = 0 " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.doctor='"+doctor+"' " + 
															 | 
															
															 | 
															
																                "AND room.doctor='"+doctor+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.reservation_time is not null " + 
															 | 
															
															 | 
															
																                "AND room.reservation_time is not null " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time DESC "; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' "; 
															 | 
															
															 | 
															
																//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     
															 | 
															
															 | 
															
																     
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
															 | 
															
															 | 
															
																        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -3431,9 +3486,56 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //3.创建候诊室 
															 | 
															
															 | 
															
																        //3.创建候诊室 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        createRoom(outpatient,chargeType); 
															 | 
															
															 | 
															
																        createRoom(outpatient,chargeType); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //4.发送协同门诊系统消息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sendOutPatientMes(outpatient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return 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 
															 | 
															
															 | 
															
																     * @param outpatientJson 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -3529,7 +3631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        String salt = UUID.randomUUID().toString().substring(0,5); 
															 | 
															
															 | 
															
																                        String salt = UUID.randomUUID().toString().substring(0,5); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        String mobile = biz.getString("mobile_phone"); 
															 | 
															
															 | 
															
																                        String mobile = biz.getString("mobile_phone"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        String pw = idcard.substring(mobile.length()-6); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        String pw = mobile.substring(mobile.length()-6); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        patient.setIdcard(idcard); 
															 | 
															
															 | 
															
																                        patient.setIdcard(idcard); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        patient.setName(biz.getString("user_name")); 
															 | 
															
															 | 
															
																                        patient.setName(biz.getString("user_name")); 
															 |