Quellcode durchsuchen

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wujunjie vor 8 Jahren
Ursprung
Commit
937848fc71

+ 5 - 1
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/listener/LabelDataListener.java

@ -29,6 +29,7 @@ public class LabelDataListener {
    //@Scheduled(cron = "0 0/1 * * * ?") //每分钟执行一次
    @KafkaListener(topics = "flumeLog1")
    public void labelData(ConsumerRecord<?, ?> record) {
        Long startTime = System.currentTimeMillis();
        logger.info("Kafka开始消费");
        Optional<?> kafkaMessage = Optional.ofNullable(record.value());
        if (kafkaMessage.isPresent()) {
@ -40,7 +41,10 @@ public class LabelDataListener {
                    mongoTemplate.insert(
                            new LabelDataModel(value[0], value[1], value[2], value[3], value[4]), mongoDbTableName
                    );
                    logger.info("保存成功,message:" + message);
                    Long endTime = System.currentTimeMillis();
                    Long time = startTime - endTime;
                    logger.info("time(ms):" + time);
                    logger.info("保存成功 message:" + message);
                } else {
                    logger.error("数据格式错误,message:" + message);
                }

+ 13 - 13
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/model/LabelDataModel.java

@ -15,27 +15,27 @@ public class LabelDataModel implements Serializable {
    private String id;
    private String createTime;//时间
    private String code;//操作人code
    private String classMethod;//完整的类路径
    private String requestMapping;//web路径
    private String operaTime;//操作时间
    private String date;//具体的数据
    private String data;//具体的数据
    public LabelDataModel() {
    }
    public LabelDataModel(String createTime, String code, String classMethod, String operaTime, String date) {
    public LabelDataModel(String createTime, String code, String requestMapping, String operaTime, String data) {
        this.createTime = createTime;
        this.code = code;
        this.classMethod = classMethod;
        this.requestMapping = requestMapping;
        this.operaTime = operaTime;
        this.date = date;
        this.data = data;
    }
    public String getDate() {
        return date;
    public String getData() {
        return data;
    }
    public void setDate(String date) {
        this.date = date;
    public void setData(String data) {
        this.data = data;
    }
    public String getId() {
@ -62,12 +62,12 @@ public class LabelDataModel implements Serializable {
        this.code = code;
    }
    public String getClassMethod() {
        return classMethod;
    public String getRequestMapping() {
        return requestMapping;
    }
    public void setClassMethod(String classMethod) {
        this.classMethod = classMethod;
    public void setRequestMapping(String requestMapping) {
        this.requestMapping = requestMapping;
    }
    public String getOperaTime() {

+ 11 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/BaseInterceptor.java

@ -41,4 +41,15 @@ abstract public class BaseInterceptor implements HandlerInterceptor {
		}
	}
	public String write(int code, String msg) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			return json.toString();
		} catch (Exception e) {
			return null;
		}
	}
}

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.interceptors;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.entity.url.CudUrl;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
@ -73,6 +74,11 @@ public class DoctorInterceptor extends BaseInterceptor {
                url = url.replace("\\", "/").replace("//", "/");
                CudUrl cudUrl = cudUrlDao.findByUrl(url);
                if (url.equals("/doctor/consult/readed")) {
                    response.getOutputStream().write(write(200, "操作成功").getBytes());
                    return false;
                }
                if (cudUrl != null) {
                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -40,7 +40,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" from Message a where a.read = 1 and over ='1' and a.sender = ?1 and a.receiver=?2 and a.signStatus='1'")
    Message findByPatient(String patient,String doctor);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.czrq desc")
    @Query("select a from Message a where a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.czrq desc")
    List<Message> getHealthIndexMessageByPatient(String doctor,String patient,String type,Pageable pageRequest);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2) order by a.czrq desc")

+ 65 - 28
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -1,23 +1,18 @@
package com.yihu.wlyy.service.app.message;
import java.util.*;
import javax.transaction.Transactional;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.deviece.DeviceDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -33,9 +28,11 @@ import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.service.BaseService;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 消息业务处理类
@ -279,37 +276,77 @@ public class MessageService extends BaseService {
     */
    public List<Map<String, Object>> getHealthIndexMessage(String doctor) throws Exception {
        List<Map<String, Object>> re = new ArrayList<>();
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.czrq,'%Y-%c-%d %H:%i:%s')) last_time from wlyy_Message a where a.receiver='" + doctor + "' and a.has_read='1' and a.type='2' group by a.sender,a.tz_type order by last_time desc";
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.czrq,'%Y-%c-%d %H:%i:%s')) last_time,a.has_read from wlyy_Message a where a.receiver='" + doctor + "' and a.type='2' group by a.sender,a.tz_type,a.has_read order by last_time desc";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Map<String, Object>> map = new HashMap<>();
        for (Map<String, Object> item : list) {
            Map<String, Object> obj = new HashMap<>();
            Map<String, Object> obj = null;
            String patientCode = String.valueOf(item.get("sender"));
            //获取患者信息
            Patient patient = patientDao.findByCode(patientCode);
            if (patient != null) {
                String type = String.valueOf(item.get("tz_type")); //1血糖,2血压,3体重,4腰
                obj.put("patient", patientCode);
                obj.put("type", type);
                obj.put("time", item.get("last_time"));
                obj.put("name", patient.getName());
                obj.put("sex", patient.getSex());
                obj.put("birthday", DateUtil.dateToStrShort(patient.getBirthday()));
                obj.put("sex", patient.getSex());
                obj.put("photo", patient.getPhoto());
                if ("1".equals(type)) {
                    obj.put("message", "有" + item.get("count") + "条血糖异常未读消息");
                } else if ("2".equals(type)) {
                    obj.put("message", "有" + item.get("count") + "条血压异常未读消息");
                } else {
                    break;
                String read = String.valueOf(item.get("has_read")); //0已读,1未读
                String patientType = patientCode + type;
                if(map.containsKey(patientType)){
                    obj = map.get(patientType);
                    if(obj.get("time").toString().compareTo(item.get("last_time").toString())<0){
                        obj.put("time", item.get("last_time"));
                    }
                }else{
                    obj = new HashMap<>();
                    obj.put("patient", patientCode);
                    obj.put("type", type);
                    obj.put("time", item.get("last_time"));
                    obj.put("name", patient.getName());
                    obj.put("sex", patient.getSex());
                    obj.put("birthday", DateUtil.dateToStrShort(patient.getBirthday()));
                    obj.put("photo", patient.getPhoto());
                }
                if("1".equals(read)){
                    obj.put("count1", item.get("count"));
                }else{
                    obj.put("count0", item.get("count"));
                }
                re.add(obj);
                map.put(patientType,obj);
//                if ("1".equals(type)) {
//                    obj.put("message", "有" + item.get("count") + "条血糖异常未读消息");
//                } else if ("2".equals(type)) {
//                    obj.put("message", "有" + item.get("count") + "条血压异常未读消息");
//                } else {
//                    break;
//                }
//                re.add(obj);
            } else {
                System.out.print("not exit patient!code:" + patientCode);
            }
        }
        for (Map<String, Object> item : map.values()) {
            Map<String, Object> obj = new HashMap<>();
            String type = String.valueOf(item.get("type")); //1血糖,2血压,3体重,4腰
            String count1 = item.get("count1")==null?"0":item.get("count1").toString();
            String count0 = item.get("count0")==null?"0":item.get("count0").toString();
            obj.put("patient", item.get("patient"));
            obj.put("type", type);
            obj.put("time", item.get("time"));
            obj.put("name", item.get("name"));
            obj.put("sex", item.get("sex"));
            obj.put("birthday", item.get("birthday"));
            obj.put("photo", item.get("photo"));
            if ("1".equals(type)) {
                obj.put("message", "有血糖异常未读消息"+count1+"条,已读消息"+count0+"条");
            } else if ("2".equals(type)) {
                obj.put("message", "有血压异常未读消息"+count1+"条,已读消息"+count0+"条");
            } else {
                break;
            }
            re.add(obj);
        }
        return re;
    }

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java

@ -20,6 +20,7 @@ import java.util.Map;
 */
@Transactional
@Service
@Transactional
public class DoctorGuidanceTempService extends BaseService {
    @Autowired