ソースを参照

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

hzp 9 年 前
コミット
fba0bfa9fd

+ 35 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/DataProcessController.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.statistics.controller;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.statistics.task.PatientDiseaseToLabel;
import com.yihu.wlyy.statistics.task.PatientGroupToLabelRunnable;
import com.yihu.wlyy.statistics.task.SignTeamAndGroupRunnable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -18,7 +20,7 @@ public class DataProcessController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/sign_team_group_thread")
    public String getErrorPage(long start,long end){
    public String setTeamGroupPage(long start,long end){
        try {
            new Thread(new SignTeamAndGroupRunnable(start,end)).start();
            return write(200,"启动成功");
@ -27,4 +29,36 @@ public class DataProcessController extends BaseController {
            return error(-1, "启动失败");
        }
    }
    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/disease_to_label_thread")
    public String diseaseToLabel(long start){
        try {
            new Thread(new PatientDiseaseToLabel(start)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }
    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/group_to_label_thread")
    public String diseaseToLabel(long start,long end){
        try {
            new Thread(new PatientGroupToLabelRunnable(start,end)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }
}

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/DoctorPatientGroupInfoDao.java

@ -106,6 +106,6 @@ public interface DoctorPatientGroupInfoDao extends PagingAndSortingRepository<Do
	List<DoctorPatientGroupInfo> findByGroupAndStatus(String group, Integer status);
	@Query("select a from DoctorPatientGroupInfo a where a.status = 1 and a.id >= ?2 and a.id < ?3 ")
	@Query("select a from DoctorPatientGroupInfo a where a.id between ?1 and ?2 and a.status = 1")
	Page<DoctorPatientGroupInfo> findByIdRange(Long start, Long end, Pageable pageRequest);
}

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/SignFamilyDao.java

@ -42,6 +42,6 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	List<SignFamily> findByJiatingChaangeSignYesterdayExpensesStatus(String yesterday, String now);
	// 查询同步数据
	@Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 and a.id >= ?3 and a.id <= ?4 order by a.id")
	@Query("select a from SignFamily a where a.id between ?3 and ?4 and a.type = ?1 and a.signSource = ?2 and a.status > 0 order by a.id")
	Page<SignFamily> findByTypeAndSignSourceAndId(Integer type,String signSource,Long start,Long end,Pageable pageable);
}

+ 17 - 5
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/task/PatientDiseaseToLabel.java

@ -14,6 +14,7 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -41,12 +42,14 @@ public class PatientDiseaseToLabel implements Runnable {
        while (flag) {
            PageRequest pageRequest = new PageRequest(0, 500);
            Page<PatientDisease> diseases = diseaseDao.findByIdRange(start,pageRequest);
            Page<PatientDisease> diseases = diseaseDao.findByIdRange(start, pageRequest);
            if (diseases != null && diseases.getContent().size() < 500) {
                flag = false;
            }
            start = diseases.getContent().get(diseases.getContent().size() - 1).getId() + 1;
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
            def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
@ -57,17 +60,24 @@ public class PatientDiseaseToLabel implements Runnable {
            } catch (Exception e) {
                transactionManager.rollback(status);
            }
            start = start + 500;
        }
    }
    void diseasesToLabel(Page<PatientDisease> diseases) {
        Map<String,SignPatientLabelInfo> labelInfos = new HashMap<>();
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        Map<String, SignPatientLabelInfo> labelInfos = new HashMap<>();
        for (PatientDisease disease : diseases.getContent()) {
            SignPatientLabelInfo labelInfo = new SignPatientLabelInfo();
            SignPatientLabelInfo exLabelInfo = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(
                    disease.getPatient(), disease.getDisease(), "3", 1);
            if (exLabelInfo != null) {
                continue;
            }
            labelInfo.setPatient(disease.getPatient());
            labelInfo.setLabel(disease.getDisease());
            labelInfo.setLabelName(disease.getDiseaseName());
@ -75,9 +85,11 @@ public class PatientDiseaseToLabel implements Runnable {
            labelInfo.setStatus(1);
            labelInfo.setCzrq(new Date());
            labelInfos.put(disease.getPatient() + disease.getDisease(),labelInfo);
            labelInfos.put(disease.getPatient() + disease.getDisease(), labelInfo);
        }
        labelInfoDao.save(labelInfos.values());
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}

+ 15 - 2
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/task/PatientGroupToLabelRunnable.java

@ -12,6 +12,7 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -47,6 +48,8 @@ public class PatientGroupToLabelRunnable implements Runnable {
                flag = false;
            }
            start = groups.getContent().get(groups.getContent().size() - 1).getId() + 1;
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
            def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
@ -57,12 +60,12 @@ public class PatientGroupToLabelRunnable implements Runnable {
            } catch (Exception e) {
                transactionManager.rollback(status);
            }
            start = start + 100;
        }
    }
    void groupToLabel(Page<DoctorPatientGroupInfo> groups) {
        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<>();
@ -92,6 +95,13 @@ public class PatientGroupToLabelRunnable implements Runnable {
            groupInfo.setStatus(2);
            SignPatientLabelInfo exLabelInfo = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(
                    groupInfo.getPatient(),labelInfo.getLabel(),"1",1);
            if(exLabelInfo != null){
                continue;
            }
            normalLabel.put(groupInfo.getPatient(), labelInfo);
        }
@ -104,6 +114,9 @@ public class PatientGroupToLabelRunnable implements Runnable {
        if (sixFiveLabel.size() > 0) {
            labelInfoDao.save(sixFiveLabel.values());
        }
        groupInfoDao.save(groups);
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}

+ 39 - 70
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/task/SignTeamAndGroupRunnable.java

@ -1,11 +1,9 @@
package com.yihu.wlyy.statistics.task;
import com.yihu.wlyy.statistics.Application;
import com.yihu.wlyy.statistics.dao.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.statistics.dao.DoctorTeamDao;
import com.yihu.wlyy.statistics.dao.DoctorTeamMemberDao;
import com.yihu.wlyy.statistics.dao.SignFamilyDao;
import com.yihu.wlyy.statistics.dao.*;
import com.yihu.wlyy.statistics.model.doctor.DoctorPatientGroupInfo;
import com.yihu.wlyy.statistics.model.label.SignPatientLabelInfo;
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.model.team.DoctorTeam;
import com.yihu.wlyy.statistics.model.team.DoctorTeamMember;
@ -23,9 +21,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
 * Created by lyr-pc on 2016/10/11.
@ -36,19 +32,19 @@ public class SignTeamAndGroupRunnable implements Runnable {
    long end = 0;
    SignFamilyDao signFamilyDao;
    DoctorPatientGroupInfoDao groupInfoDao;
    DoctorTeamDao teamDao;
    DoctorTeamMemberDao teamMemberDao;
    JpaTransactionManager transactionManager;
    SignPatientLabelInfoDao labelInfoDao;
    public SignTeamAndGroupRunnable(Long start, Long end){
        this.start = start;
        this.end = end;
        this.signFamilyDao = Application.ctx.getBean(SignFamilyDao.class);
        this.groupInfoDao = Application.ctx.getBean(DoctorPatientGroupInfoDao.class);
        this.teamDao = Application.ctx.getBean(DoctorTeamDao.class);
        this.teamMemberDao = Application.ctx.getBean(DoctorTeamMemberDao.class);
        this.transactionManager = Application.ctx.getBean(JpaTransactionManager.class);
        this.labelInfoDao = Application.ctx.getBean(SignPatientLabelInfoDao.class);
    }
    public String getCode() {
@ -67,7 +63,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
            if (signs != null && signs.getContent().size() < 100) {
                flag = false;
            }
            start = signs.getContent().get(signs.getContent().size() - 1).getId() + 1;
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
            def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
@ -78,15 +74,19 @@ public class SignTeamAndGroupRunnable implements Runnable {
            } catch (Exception e) {
                transactionManager.rollback(status);
            }
            start = start + 100;
        }
    }
    public void transform(Page<SignFamily> signs){
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        for (SignFamily sign : signs.getContent()) {
        List<DoctorTeam> teams = new ArrayList<>();
        List<DoctorTeamMember> teamMembers = new ArrayList<>();
        List<DoctorPatientGroupInfo> groupList = new ArrayList<>();
        Map<String,SignPatientLabelInfo> labels =  new HashMap<>();
        List<SignFamily> signList = signs.getContent();
        for (SignFamily sign : signList) {
            try {
                if (StringUtils.isNotEmpty(sign.getTeamCode())) {
                    continue;
@ -102,7 +102,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
                doctorTeam.setSignType("2");//家庭签约
                doctorTeam.setDel("1");
                teamDao.save(doctorTeam);
                teams.add(doctorTeam);
                //添加团队成员
                if (StringUtils.isNotEmpty(sign.getDoctor())) {
@ -118,7 +118,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
                    wlyyDoctorTeamDoctor.setCode(getCode());
                    wlyyDoctorTeamDoctor.setCzrq(new Date());
                    teamMemberDao.save(wlyyDoctorTeamDoctor);
                    teamMembers.add(wlyyDoctorTeamDoctor);
                }
                if (StringUtils.isNotEmpty(sign.getDoctorHealth())) {
                    //添加健康管理师
@ -133,7 +133,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
                    wlyyDoctorTeamDoctor.setCode(getCode());
                    wlyyDoctorTeamDoctor.setCzrq(new Date());
                    teamMemberDao.save(wlyyDoctorTeamDoctor);
                    teamMembers.add(wlyyDoctorTeamDoctor);
                }
                //添加患者和团队的关系
@ -148,7 +148,7 @@ public class SignTeamAndGroupRunnable implements Runnable {
                wlyyDoctorTeamPatient.setCode(getCode());
                wlyyDoctorTeamPatient.setCzrq(new Date());
                teamMemberDao.save(wlyyDoctorTeamPatient);
                teamMembers.add(wlyyDoctorTeamPatient);
                if (StringUtils.isEmpty(sign.getIdcard())) {
                    System.out.println("error:sign-family-set-group:no-idcard:" + sign.getId());
@ -157,74 +157,43 @@ public class SignTeamAndGroupRunnable implements Runnable {
                int age = IdCardUtil.getAgeForIdcard(sign.getIdcard());
                String groupCode = "1";
                String groupName = "普通人群";
                if (age >= 65) {
                    groupCode = "3";
                    groupName = "65岁以上人群";
                }
                if (StringUtils.isNotEmpty(sign.getDoctorHealth())) {
                    //把病人添加到健康管理师的健康分组里
                    DoctorPatientGroupInfo doctorPatientGroupInfo = new DoctorPatientGroupInfo();
                    doctorPatientGroupInfo.setCzrq(new Date());
                    doctorPatientGroupInfo.setDoctor(sign.getDoctorHealth());
                    doctorPatientGroupInfo.setStatus(1);
                    doctorPatientGroupInfo.setPatient(sign.getPatient());
                    doctorPatientGroupInfo.setPname(sign.getName());
                    doctorPatientGroupInfo.setPartAmount(0);
                    doctorPatientGroupInfo.setGroup(groupCode);//默认健康分组
                    doctorPatientGroupInfo.setQyrq(sign.getApplyDate());
                    doctorPatientGroupInfo.setSignType("2");//家庭签约
                    groupInfoDao.save(doctorPatientGroupInfo);
                }
                SignPatientLabelInfo label =  new SignPatientLabelInfo();
                if (StringUtils.isNotEmpty(sign.getDoctor())) {
                    //把病人添加到全科医生的健康分组里
                    DoctorPatientGroupInfo doctorPatientGroupInfo = new DoctorPatientGroupInfo();
                    doctorPatientGroupInfo.setCzrq(new Date());
                    doctorPatientGroupInfo.setDoctor(sign.getDoctor());
                    doctorPatientGroupInfo.setStatus(1);
                    doctorPatientGroupInfo.setPatient(sign.getPatient());
                    doctorPatientGroupInfo.setPname(sign.getName());
                    doctorPatientGroupInfo.setPartAmount(0);
                    doctorPatientGroupInfo.setGroup(groupCode);//默认健康分组
                    doctorPatientGroupInfo.setQyrq(sign.getApplyDate());
                    doctorPatientGroupInfo.setSignType("2");//家庭签约
                    groupInfoDao.save(doctorPatientGroupInfo);
                }
                SignPatientLabelInfo exLabelInfo = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(
                        sign.getPatient(), groupCode, "1", 1);
                List<DoctorPatientGroupInfo> groups = groupInfoDao.findPatientGroups(sign.getPatient());
                if (groups != null && groups.size() > 0) {
                    for (DoctorPatientGroupInfo group : groups) {
                        if (StringUtils.isNotEmpty(group.getSignType()) && group.getSignType().equals("2")) {
                            continue;
                        }
                if (exLabelInfo != null) {
                    continue;
                }
                        DoctorPatientGroupInfo patientGroup = new DoctorPatientGroupInfo();
                label.setPatient(sign.getPatient());
                label.setPatient(sign.getName());
                label.setLabel(groupCode);
                label.setLabelName(groupName);
                label.setLabelType("1");
                label.setStatus(1);
                label.setCzrq(new Date());
                        patientGroup.setCzrq(new Date());
                        patientGroup.setDoctor(group.getDoctor());
                        patientGroup.setStatus(1);
                        patientGroup.setPatient(sign.getPatient());
                        patientGroup.setPname(sign.getName());
                        patientGroup.setPartAmount(0);
                        patientGroup.setGroup(group.getGroup());
                        patientGroup.setQyrq(sign.getApplyDate());
                        patientGroup.setSignType("2");//家庭签约
                labels.put(sign.getPatient(),label);
                        groupInfoDao.save(patientGroup);
                    }
                }
                sign.setTeamCode(doctorTeamCode);
                signFamilyDao.save(sign);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        teamDao.save(teams);
        teamMemberDao.save(teamMembers);
        labelInfoDao.save(labels.values());
        signFamilyDao.save(signList);
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}

+ 13 - 17
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -114,12 +114,10 @@ public class SignPatientLabelInfoService extends BaseService {
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " left join " +
                        "    wlyy_sign_patient_label_info t2 " +
                        "    (select patient,label,label_type from wlyy_sign_patient_label_info where label_type = ? and status = 1) t2 " +
                        " on t1.patient = t2.patient " +
                        " WHERE " +
                        "    t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t2.patient is null " +
                        "    t2.patient is null " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
@ -140,7 +138,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
                args = new Object[]{doctor, teamCode, labelCode, labelType};
                args = new Object[]{labelCode, labelType, doctor, teamCode};
            }
        }
@ -369,20 +367,18 @@ public class SignPatientLabelInfoService extends BaseService {
                                " FROM" +
                                "     wlyy_sign_family t1 " +
                                " left join " +
                                "    wlyy_sign_patient_label_info t2 " +
                                "    (SELECT patient,label,label_type from wlyy_sign_patient_label_info where label_type = ? and status = 1)  t2 " +
                                " on t1.patient = t2.patient " +
                                " WHERE" +
                                "     t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t2.patient is null " +
                                "     t2.patient is null " +
                                "     AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                        if (teamCode > 0) {
                            args = new Object[]{doctor, teamCode, labelType};
                            args = new Object[]{labelType, doctor, teamCode};
                        } else {
                            args = new Object[]{doctor, labelType};
                            args = new Object[]{labelType, doctor};
                        }
                    } else {
                        sql = " SELECT " +
@ -415,7 +411,7 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("amount", amount);
                if (label.getLabelCode().equals("0") && labelType.equals("1") && amount < 0) {
                if (label.getLabelCode().equals("0") && labelType.equals("1") && amount < 1) {
                    continue;
                }
                result.put(json);
@ -631,13 +627,13 @@ public class SignPatientLabelInfoService extends BaseService {
                "    wlyy_sign_family t1 " +
                (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
                        " join " : " left join ") +
                "    wlyy_sign_patient_label_info t2 " +
                "    (select patient,label,label_name,label_type from wlyy_sign_patient_label_info " +
                "    where status = 1 " +
                (StringUtils.isNotEmpty(labelCode) ? " AND label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " AND label_type = ? " : "") + ") t2" +
                " ON t1.patient = t2.patient " +
                " WHERE " +
                (StringUtils.isNotEmpty(labelCode) ? " t2.label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " and t2.label_type = ? " : "") +
                "    AND t2.status = 1 " +
                "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                "    t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                "    AND t1.status > 0 " +
                "    AND (t1.name like ? OR t2.label_name like ?) " +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")

+ 25 - 92
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -796,8 +796,8 @@ public class FamilyContractService extends BaseService {
        doctorTeamDoctor.save(wlyyDoctorTeamPatient);
        // 患者标签设置
        if(!(labelInfoService.setPatientLabels(patient.getCode(),patient.getIdcard(),
                patient.getName(),healthLabel,disease,customLabel) == 1)){
        if (!(labelInfoService.setPatientLabels(patient.getCode(), patient.getIdcard(),
                patient.getName(), healthLabel, disease, customLabel) == 1)) {
            throw new Exception("patient sign label settting error:" + patient.getIdcard());
        }
@ -967,8 +967,8 @@ public class FamilyContractService extends BaseService {
        }
        // 患者标签设置
        if(!(labelInfoService.setPatientLabels(p.getCode(),p.getIdcard(),
                p.getName(),healthLabel,disease,customLabel) == 1)){
        if (!(labelInfoService.setPatientLabels(p.getCode(), p.getIdcard(),
                p.getName(), healthLabel, disease, customLabel) == 1)) {
            throw new Exception("patient sign label settting error:" + p.getIdcard());
        }
@ -1475,96 +1475,29 @@ public class FamilyContractService extends BaseService {
                result.put("msg", "医生不存在");
            }
            if (StringUtils.isNotEmpty(signFamily.getDoctorHealth())) {
                // 取消原有健康管理师的家庭签约分组,并新增分组
                List<DoctorPatientGroupInfo> groups = doctorPatientGroupInfoDao.findGroupInfoByPatientAndDoctor(signFamily.getDoctorHealth(), patient);
                if (groups != null) {
                    List<DoctorPatientGroupInfo> newGroups = new ArrayList<>();
                    for (DoctorPatientGroupInfo group : groups) {
                        if (group.getGroup().equals("1") || group.getGroup().equals("2") || group.getGroup().equals("3")) {
                            DoctorPatientGroupInfo newGroup = new DoctorPatientGroupInfo();
                            newGroup.setDoctor(doctor.getCode());
                            newGroup.setCzrq(new Date());
                            newGroup.setGroup(group.getGroup());
                            newGroup.setPatient(patient);
                            newGroup.setSignType("2");
                            newGroup.setStatus(1);
                            newGroup.setPname(group.getPname());
                            newGroups.add(newGroup);
                        }
                        group.setStatus(0);
                        group.setCzrq(new Date());
                    }
                    if (newGroups.size() > 0) {
                        doctorPatientGroupInfoDao.save(newGroups);
                    }
                    // 更新团队信息
                    if (StringUtils.isNotEmpty(signFamily.getTeamCode())) {
                        DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(), signFamily.getDoctorHealth());
                        if (teamMember != null) {
                            teamMember.setDel("0");
                            teamMember.setCzrq(new Date());
                        }
                        DoctorTeamMember newTeamMember = new DoctorTeamMember();
                        newTeamMember.setCode(getCode());
                        newTeamMember.setMemberCode(doctor.getCode());
                        newTeamMember.setName(doctor.getName());
                        newTeamMember.setTeam(signFamily.getTeamCode());
                        newTeamMember.setDel("1");
                        newTeamMember.setSignType("2");
                        newTeamMember.setType(3);
                        newTeamMember.setCzrq(new Date());
                        doctorTeamDoctor.save(newTeamMember);
                    }
                }
            } else {
                // 新增分组
                List<DoctorPatientGroupInfo> groups = doctorPatientGroupInfoDao.findGroupInfoByPatientAndDoctor(signFamily.getDoctor(), patient);
                if (groups != null) {
                    List<DoctorPatientGroupInfo> newGroups = new ArrayList<>();
                    for (DoctorPatientGroupInfo group : groups) {
                        if (group.getGroup().equals("1") || group.getGroup().equals("2") || group.getGroup().equals("3")) {
                            DoctorPatientGroupInfo newGroup = new DoctorPatientGroupInfo();
                            newGroup.setDoctor(doctor.getCode());
                            newGroup.setCzrq(new Date());
                            newGroup.setGroup(group.getGroup());
                            newGroup.setPatient(patient);
                            newGroup.setSignType("2");
                            newGroup.setStatus(1);
                            newGroup.setPname(group.getPname());
                            newGroups.add(newGroup);
                        }
                    }
                    if (newGroups.size() > 0) {
                        doctorPatientGroupInfoDao.save(newGroups);
                    }
                    // 新增团队信息
                    if (StringUtils.isNotEmpty(signFamily.getTeamCode())) {
                        DoctorTeamMember newTeamMember = new DoctorTeamMember();
                        newTeamMember.setCode(getCode());
                        newTeamMember.setMemberCode(doctor.getCode());
                        newTeamMember.setName(doctor.getName());
                        newTeamMember.setTeam(signFamily.getTeamCode());
                        newTeamMember.setDel("1");
                        newTeamMember.setSignType("2");
                        newTeamMember.setType(3);
                        newTeamMember.setCzrq(new Date());
                        doctorTeamDoctor.save(newTeamMember);
                    }
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(), signFamily.getDoctorHealth());
                if (teamMember != null) {
                    teamMember.setDel("0");
                    teamMember.setCzrq(new Date());
                    doctorTeamDoctor.save(teamMember);
                }
            }
            // 新增团队信息
            if (StringUtils.isNotEmpty(signFamily.getTeamCode())) {
                DoctorTeamMember newTeamMember = new DoctorTeamMember();
                newTeamMember.setCode(getCode());
                newTeamMember.setMemberCode(doctor.getCode());
                newTeamMember.setName(doctor.getName());
                newTeamMember.setTeam(signFamily.getTeamCode());
                newTeamMember.setDel("1");
                newTeamMember.setSignType("2");
                newTeamMember.setType(3);
                newTeamMember.setCzrq(new Date());
                doctorTeamDoctor.save(newTeamMember);
            }
            signFamily.setDoctorHealth(doctor.getCode());
            signFamily.setDoctorHealthName(doctor.getName());

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1419,7 +1419,7 @@ public class StatisticsService extends BaseService {
                map6.put("name", "50~65");
                map6.put("amount", Double.valueOf("0.0"));
                resultList.add(map6);
            } else if (index.equals("14")) {
            } else if (index.equals("16")) {
                Map<String, Object> map1 = new HashMap<>();
                map1.put("code", "0");
                map1.put("name", "未缴费人数");