Ver código fonte

提醒居民上线增加redis的缓存

huangwenjie 5 anos atrás
pai
commit
932056ba02

+ 5 - 0
business/base-service/pom.xml

@ -127,6 +127,11 @@
            <artifactId>ehcsdk</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>1.8.9.RELEASE</version>
        </dependency>
    </dependencies>
    <build>

+ 12 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -66,6 +66,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -77,6 +78,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.lang.Boolean;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * Created by Trick on 2019/5/17
@ -147,6 +149,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    
    @Value("${demo.flag}")
@ -3147,6 +3151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //根据身份证计算年龄
            for(Map<String,Object> outpatient :list){
                String idcard = (String)outpatient.get("idcard");
                String patient_id = (String)outpatient.get("patient_id");
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
    
                String group_date = (String)outpatient.get("group_date");
@ -3162,7 +3167,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //全科医生来源
                outpatient.put("general_doctor_info","");//全科医生名字
                outpatient.put("general_doctor_hospital","");//全科医生社区
                outpatient.put("alert_tag",0);//是否已提醒
                String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
                if(StringUtils.isBlank(isAlert)){
                    outpatient.put("alert_tag",0);//已提醒
                }else{
                    outpatient.put("alert_tag",1);//未提醒
                }
                
                outpatient.put("online_tag",0);//在线状态
            }
        }

+ 9 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -28,11 +28,13 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
@ -65,6 +67,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private BaseDoctorHospitalDao baseDoctorHospitalDao;
	
	@Autowired
	private StringRedisTemplate redisTemplate;
	
	
@ -537,6 +542,10 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public Envelop alertPatientOnline(@ApiParam(name = "patient", value = "居民CODE")
	                                         @RequestParam(value = "patient",required = true) String patient) {
		
		String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient);
		if(StringUtils.isBlank(isAlert)){
			redisTemplate.opsForValue().set("patient_alert_"+patient,patient, 1, TimeUnit.DAYS);
		}
		return success("操作成功");
	}