Explorar el Código

Merge branch 'dev' of lyr/patient-co-management into dev

lyr hace 8 años
padre
commit
a480fbf99c

+ 46 - 13
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/task/PatientGroupToLabelRunnable.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.statistics.task;
import com.yihu.wlyy.statistics.Application;
import com.yihu.wlyy.statistics.dao.*;
import com.yihu.wlyy.statistics.model.doctor.DoctorPatientGroupInfo;
import com.yihu.wlyy.statistics.model.label.SignPatientLabel;
import com.yihu.wlyy.statistics.model.label.SignPatientLabelInfo;
import com.yihu.wlyy.statistics.model.patient.Patient;
import com.yihu.wlyy.statistics.util.SpringUtil;
@ -68,8 +69,7 @@ public class PatientGroupToLabelRunnable implements Runnable {
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        Map<String, SignPatientLabelInfo> normalLabel = new HashMap<>();
        Map<String, SignPatientLabelInfo> manbingLabel = new HashMap<>();
        Map<String, SignPatientLabelInfo> sixFiveLabel = new HashMap<>();
        Map<String, SignPatientLabelInfo> healthMap = new HashMap<>();
        List<DoctorPatientGroupInfo> groupInfos = groups.getContent();
@ -94,26 +94,59 @@ public class PatientGroupToLabelRunnable implements Runnable {
            labelInfo.setStatus(1);
            labelInfo.setCzrq(new Date());
            groupInfo.setStatus(2);
            List<SignPatientLabelInfo> patientLabels = labelInfoDao.findByPatientAndStatus(labelInfo.getPatient(), 1);
            SignPatientLabelInfo healthLabel = null;
            SignPatientLabelInfo wjwGroup = null;
            String typeTwo = "1";
            for (SignPatientLabelInfo patientLabel : patientLabels) {
                if (patientLabel.getLabelType().equals("3")) {
                    typeTwo = "2";
                }
                if (patientLabel.getLabelType().equals("1")) {
                    wjwGroup = patientLabel;
                }
                if (patientLabel.getLabelType().equals("2")) {
                    healthLabel = patientLabel;
                }
            }
            SignPatientLabelInfo exLabelInfo = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(
                    groupInfo.getPatient(),labelInfo.getLabel(),"1",1);
            if (healthLabel == null) {
                healthLabel = new SignPatientLabelInfo();
            if(exLabelInfo != null){
                continue;
                healthLabel.setPatient(groupInfo.getPatient());
                healthLabel.setPname(groupInfo.getPname());
                healthLabel.setLabelType("2");
                healthLabel.setStatus(1);
                healthLabel.setCzrq(new Date());
            }
            if (typeTwo.equals("1")) {
                healthLabel.setLabel("1");
                healthLabel.setLabelName("健康人群");
            } else {
                healthLabel.setLabel("2");
                healthLabel.setLabelName("患病人群");
            }
            normalLabel.put(groupInfo.getPatient(), labelInfo);
            healthMap.put(groupInfo.getPatient(), healthLabel);
            if (wjwGroup != null) {
                wjwGroup.setLabel(labelInfo.getLabel());
                wjwGroup.setLabelName(labelInfo.getLabelName());
                wjwGroup.setCzrq(new Date());
                normalLabel.put(groupInfo.getPatient(), wjwGroup);
            } else {
                normalLabel.put(groupInfo.getPatient(), labelInfo);
            }
        }
        if (normalLabel.size() > 0) {
            labelInfoDao.save(normalLabel.values());
        }
        if (manbingLabel.size() > 0) {
            labelInfoDao.save(manbingLabel.values());
        }
        if (sixFiveLabel.size() > 0) {
            labelInfoDao.save(sixFiveLabel.values());
        if (healthMap.size() > 0) {
            labelInfoDao.save(healthMap.values());
        }
        groupInfoDao.save(groups);