Pārlūkot izejas kodu

标签 签约统计接口 数据清洗

lyr 8 gadi atpakaļ
vecāks
revīzija
3526120040

+ 4 - 0
src/main/java/com/yihu/wlyy/repository/doctor/SignPatientLabelDao.java

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@ -51,4 +52,7 @@ public interface SignPatientLabelDao extends
    @Query("select a from SignPatientLabel a where a.status = 1 and (a.isSystem = 1  or a.teamCode = ?1) and a.labelType = 4")
    List<SignPatientLabel> findCustomLabels(long teamCode);
    @Query("select a from SignPatientLabel a where a.status = 1 and a.labelName = ?1 and a.labeType = ?2 and a.teamCode = ?3")
    SignPatientLabel findByLabelNameAndLabelTypeAndTeamCode(String labelName,String labelType,Long teamCode);
}

+ 3 - 0
src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -295,4 +295,7 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	@Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 order by a.id")
	Page<SignFamily> findByTypeAndSignSource(Integer type,String signSource,Pageable pageable);
	@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")
	Page<SignFamily> findByTypeAndSignSourceAndId(Integer type,String signSource,Long start,Long end,Pageable pageable);
}

+ 109 - 38
src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -16,6 +16,7 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.beanutils.converters.CalendarConverter;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -24,6 +25,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -74,22 +76,55 @@ public class SignPatientLabelInfoService extends BaseService {
        String sql = "";
        Object[] args = null;
        if (labelCode.equals("0")) {
            sql = "select a.*" +
                    " from" +
                    "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                    " left join" +
                    "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                    " on a.patient = b.patient where b.patient is null limit " + start + "," + pagesize;
            args = new Object[]{doctor, teamCode, labelType};
        if (labelType.equals("5")) {
            Calendar today = Calendar.getInstance();
            Calendar startDate = Calendar.getInstance();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            sql = "select * " +
                    " from " +
                    "     wlyy_sign_family " +
                    " where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ? ";
            if (labelCode.equals("1")) {
                int week = today.get(Calendar.DAY_OF_WEEK) - 1;
                if (week == 0) {
                    week = 6;
                }
                startDate.add(Calendar.DATE, -week);
                sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
            } else if (labelCode.equals("2")) {
                startDate.set(Calendar.DATE, 1);
                sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
            } else if (labelCode.equals("3")) {
                startDate.add(Calendar.DATE, 29);
                sql += " and apply_date >= '" + (df.format(today.getTime()) + " 00:00:00")
                        + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59");
            } else {
                throw new Exception("label is not exist");
            }
            args = new Object[]{doctor, teamCode};
        } else {
            sql = "select a.*" +
                    " from" +
                    "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                    " join" +
                    "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                    " on a.patient = b.patient limit " + start + "," + pagesize;
            args = new Object[]{doctor, teamCode, labelCode, labelType};
            if (labelCode.equals("0")) {
                sql = "select a.*" +
                        " from" +
                        "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                        " left join" +
                        "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                        " on a.patient = b.patient where b.patient is null limit " + start + "," + pagesize;
                args = new Object[]{doctor, teamCode, labelType};
            } else {
                sql = "select a.*" +
                        " from" +
                        "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                        " join" +
                        "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                        " on a.patient = b.patient limit " + start + "," + pagesize;
                args = new Object[]{doctor, teamCode, labelCode, labelType};
            }
        }
        signList = jdbcTemplate.queryForList(sql, args);
@ -181,31 +216,67 @@ public class SignPatientLabelInfoService extends BaseService {
                String sql = "";
                Object[] args = null;
                if (label.getLabelCode().equals("0")) {
                    sql = "select count(DISTINCT a.patient) count" +
                            " from" +
                            "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                            (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                            " left join" +
                            "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                            " on a.patient = b.patient where b.patient is null ";
                    if (teamCode > 0) {
                        args = new Object[]{doctor, teamCode, labelType};
                if(labelType.equals("5")){
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    sql = "select count(DISTINCT patient) " +
                            " from " +
                            "     wlyy_sign_family " +
                            " where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                            (teamCode > 0 ? " and admin_team_code = ? " : "");
                    if (label.getLabelCode().equals("1")) {
                        int week = today.get(Calendar.DAY_OF_WEEK) - 1;
                        if (week == 0) {
                            week = 6;
                        }
                        startDate.add(Calendar.DATE, -week);
                        sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
                                + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
                    } else if (label.getLabelCode().equals("2")) {
                        startDate.set(Calendar.DATE, 1);
                        sql += " and apply_date >= '" + (df.format(startDate.getTime()) + " 00:00:00")
                                + "' and apply_date <= '" + (df.format(today.getTime()) + " 23:59:59");
                    } else if (label.getLabelCode().equals("3")) {
                        startDate.add(Calendar.DATE, 29);
                        sql += " and apply_date >= '" + (df.format(today.getTime()) + " 00:00:00")
                                + "' and apply_date <= '" + (df.format(startDate.getTime()) + " 23:59:59");
                    } else {
                        args = new Object[]{doctor, labelType};
                        throw new Exception("label is not exist");
                    }
                } else {
                    sql = "select count(DISTINCT a.patient) count" +
                            " from" +
                            "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                            (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                            " join" +
                            "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                            " on a.patient = b.patient ";
                    if (teamCode > 0) {
                        args = new Object[]{doctor, teamCode, label.getLabelCode(), labelType};
                        args = new Object[]{doctor, teamCode};
                    } else {
                        args = new Object[]{doctor};
                    }
                }else {
                    if (label.getLabelCode().equals("0")) {
                        sql = "select count(DISTINCT a.patient) count" +
                                " from" +
                                "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                                (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                                " left join" +
                                "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                                " on a.patient = b.patient where b.patient is null ";
                        if (teamCode > 0) {
                            args = new Object[]{doctor, teamCode, labelType};
                        } else {
                            args = new Object[]{doctor, labelType};
                        }
                    } else {
                        args = new Object[]{doctor, label.getLabelCode(), labelType};
                        sql = "select count(DISTINCT a.patient) count" +
                                " from" +
                                "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                                (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                                " join" +
                                "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                                " on a.patient = b.patient ";
                        if (teamCode > 0) {
                            args = new Object[]{doctor, teamCode, label.getLabelCode(), labelType};
                        } else {
                            args = new Object[]{doctor, label.getLabelCode(), labelType};
                        }
                    }
                }
@ -471,7 +542,7 @@ public class SignPatientLabelInfoService extends BaseService {
    /**
     * 添加居民到某个标签
     *
     * @param patient 患者
     * @param patient   患者
     * @param labelCode 标签code
     * @param labelType 标签类型
     * @return
@ -513,7 +584,7 @@ public class SignPatientLabelInfoService extends BaseService {
    /**
     * 删除居民的某个标签
     *
     * @param patient 患者
     * @param patient   患者
     * @param labelCode 标签code
     * @param labelType 标签类型
     * @return

+ 58 - 2
src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelService.java

@ -5,6 +5,9 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelLog;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelLogDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -51,6 +54,17 @@ public class SignPatientLabelService extends BaseService {
        return labelDao.save(label);
    }
    /**
     * 查询某个标签名称是否存在
     *
     * @param labelName
     * @param teamCode
     * @return
     */
    public SignPatientLabel isLabelNameExist(String labelName, long teamCode){
        return labelDao.findByLabelNameAndLabelTypeAndTeamCode(labelName,"4",teamCode);
    }
    /**
     * 修改某个自定义标签
     *
@ -152,7 +166,7 @@ public class SignPatientLabelService extends BaseService {
     * @param teamCode 团队code
     * @return
     */
    public List<SignPatientLabel> getLabelsByTypeAndTeam(String labelType, long teamCode) {
    public List<SignPatientLabel> getLabelsByTypeAndTeam(String labelType, Long teamCode) {
        List<SignPatientLabel> labels = new ArrayList<>();
        if (labelType.equals("4")) {
@ -173,6 +187,48 @@ public class SignPatientLabelService extends BaseService {
     * @return
     */
    public SignPatientLabel getLabelByCodeAndType(String labelCode, String labelType) {
        return labelDao.findByLabelCodeAndLabelTypeAndStatus(labelCode,labelType,1);
        return labelDao.findByLabelCodeAndLabelTypeAndStatus(labelCode, labelType, 1);
    }
    /**
     * 标签排序
     *
     * @param labels 标签集合
     * @return
     */
    public int customLabelSort(JSONArray labels) {
        for (int i = 0; i < labels.length(); i++) {
            JSONObject json = labels.getJSONObject(i);
            String labelCode = "";
            int sort = 0;
            try {
                labelCode = json.getString("labelCode");
                sort = json.getInt("sort");
            } catch (Exception e) {
                e.printStackTrace();
                return -1;
            }
            if (StringUtils.isEmpty(labelCode)) {
                return -2;
            }
            if (labelCode.equals("1") || labelCode.equals("2")) {
                return -3; //系统标签不能修改
            }
            SignPatientLabel label = labelDao.findByLabelCodeAndLabelTypeAndStatus(labelCode, "4", 1);
            if (label == null) {
                return -4;
            }
            label.setSort(sort);
            labelDao.save(label);
        }
        return 1;
    }
}

+ 235 - 0
src/main/java/com/yihu/wlyy/service/common/util/SignTeamAndGroupRunnable.java

@ -0,0 +1,235 @@
package com.yihu.wlyy.service.common.util;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
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.Random;
import java.util.UUID;
/**
 * Created by lyr-pc on 2016/10/11.
 */
@Service
public class SignTeamAndGroupRunnable implements Runnable {
    long start = 0;
    long end = 0;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorPatientGroupInfoDao groupInfoDao;
    @Autowired
    DoctorTeamDao teamDao;
    @Autowired
    DoctorTeamMemberDao teamMemberDao;
    @Autowired
    JpaTransactionManager transactionManager;
    public SignTeamAndGroupRunnable(Long start,Long end){
        this.start = start;
        this.end = end;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    @Override
    public void run() {
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
        boolean flag = true;
        while (flag) {
            PageRequest pageRequest = new PageRequest(0, 500);
            Page<SignFamily> signs = signFamilyDao.findByTypeAndSignSourceAndId(2, "1",start, end,pageRequest);
            if (signs != null && signs.getContent().size() < 500) {
                flag = false;
            }
            DefaultTransactionDefinition def = new DefaultTransactionDefinition();
            def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
            try {
                transform(signs);
                //事物提交
                transactionManager.commit(status);
            } catch (Exception e) {
                transactionManager.rollback(status);
            }
            start = start + 500;
        }
    }
    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()) {
            try {
                if (StringUtils.isNotEmpty(sign.getTeamCode())) {
                    continue;
                }
                //建立团队
                DoctorTeam doctorTeam = new DoctorTeam();
                String doctorTeamCode = getCode();
                doctorTeam.setCode(doctorTeamCode);
                doctorTeam.setCzrq(new Date());
                doctorTeam.setName("团队名称:" + sign.getName());
                doctorTeam.setSignType("2");//家庭签约
                doctorTeam.setDel("1");
                teamDao.save(doctorTeam);
                //添加团队成员
                if (StringUtils.isNotEmpty(sign.getDoctor())) {
                    //添加全科
                    DoctorTeamMember wlyyDoctorTeamDoctor = new DoctorTeamMember();
                    wlyyDoctorTeamDoctor.setTeam(doctorTeamCode);
                    wlyyDoctorTeamDoctor.setMemberCode(sign.getDoctor());
                    wlyyDoctorTeamDoctor.setName(sign.getDoctorName());
                    wlyyDoctorTeamDoctor.setDel("1");
                    wlyyDoctorTeamDoctor.setType(2);
                    wlyyDoctorTeamDoctor.setSignType("2");//家庭签约
                    wlyyDoctorTeamDoctor.setCode(getCode());
                    wlyyDoctorTeamDoctor.setCzrq(new Date());
                    teamMemberDao.save(wlyyDoctorTeamDoctor);
                }
                if (StringUtils.isNotEmpty(sign.getDoctorHealth())) {
                    //添加健康管理师
                    DoctorTeamMember wlyyDoctorTeamDoctor = new DoctorTeamMember();
                    wlyyDoctorTeamDoctor.setTeam(doctorTeamCode);
                    wlyyDoctorTeamDoctor.setMemberCode(sign.getDoctorHealth());
                    wlyyDoctorTeamDoctor.setName(sign.getDoctorHealthName());
                    wlyyDoctorTeamDoctor.setDel("1");
                    wlyyDoctorTeamDoctor.setType(3);
                    wlyyDoctorTeamDoctor.setSignType("2");//家庭签约
                    wlyyDoctorTeamDoctor.setCode(getCode());
                    wlyyDoctorTeamDoctor.setCzrq(new Date());
                    teamMemberDao.save(wlyyDoctorTeamDoctor);
                }
                //添加患者和团队的关系
                DoctorTeamMember wlyyDoctorTeamPatient = new DoctorTeamMember();
                wlyyDoctorTeamPatient.setTeam(doctorTeamCode);
                wlyyDoctorTeamPatient.setMemberCode(sign.getPatient());
                wlyyDoctorTeamPatient.setName(sign.getName());
                wlyyDoctorTeamPatient.setDel("1");
                wlyyDoctorTeamPatient.setSignType("2");//家庭签约
                wlyyDoctorTeamPatient.setType(5);
                wlyyDoctorTeamPatient.setCode(getCode());
                wlyyDoctorTeamPatient.setCzrq(new Date());
                teamMemberDao.save(wlyyDoctorTeamPatient);
                if (StringUtils.isEmpty(sign.getIdcard())) {
                    System.out.println("error:sign-family-set-group:no-idcard:" + sign.getId());
                    continue;
                }
                int age = IdCardUtil.getAgeForIdcard(sign.getIdcard());
                String groupCode = "1";
                if (age >= 65) {
                    groupCode = "3";
                }
                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);
                }
                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);
                }
                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;
                        }
                        DoctorPatientGroupInfo patientGroup = new DoctorPatientGroupInfo();
                        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");//家庭签约
                        groupInfoDao.save(patientGroup);
                    }
                }
                sign.setTeamCode(doctorTeamCode);
                signFamilyDao.save(sign);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.out.println("sign-patient-group-team:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}

+ 18 - 0
src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.common.util.ManageUtilService;
import com.yihu.wlyy.service.common.util.SignTeamAndGroupRunnable;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
@ -211,4 +212,21 @@ public class ManagerUtilController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 签约同步数据设置团队和分组
     *
     * @return
     */
    @RequestMapping(value = "/sign_team_group_thread")
    public String getErrorPage(long start,long end){
        try {
            new Thread(new SignTeamAndGroupRunnable(start,end)).start();
            return write(200,"启动成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "启动失败");
        }
    }
}

+ 38 - 2
src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelController.java

@ -15,7 +15,7 @@ import java.util.List;
/**
 * 标签控制类
 *
 * <p>
 * Created by lyr on 2016/10/9.
 */
@RestController
@ -42,6 +42,12 @@ public class SignPatientLabelController extends BaseController {
                return error(-1, "所属团队不能为空");
            }
            SignPatientLabel labelEx = labelService.isLabelNameExist(labelName, teamCode);
            if (labelEx != null) {
                return error(-1, "该标签名称已存在");
            }
            SignPatientLabel label = labelService.addLabel(labelName, getUID(), teamCode);
            if (label != null) {
@ -137,11 +143,41 @@ public class SignPatientLabelController extends BaseController {
        }
    }
    /**
     * 自定义标签排序
     *
     * @param labels 自定义标签排序集合
     * @return
     */
    @RequestMapping(value = "/labels_sort")
    public String labelSort(String labels) {
        try {
            if (StringUtils.isEmpty(labels)) {
                return error(-1, "参数不能为空");
            }
            int result = labelService.customLabelSort(new JSONArray(labels));
            if (result == -1 || result == -2) {
                return error(-1, "参数有误");
            } else if (result == -3) {
                return error(-1, "系统标签不能更改");
            } else if (result == 1) {
                return write(200, "排序更新成功");
            } else {
                return error(-1, "排序更新失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "排序更新失败");
        }
    }
    /**
     * 获取某个标签类型所有标签
     *
     * @param labelType 标签类型
     * @param teamCode 团队代码
     * @param teamCode  团队代码
     * @return
     */
    @RequestMapping(value = "/labels_by_type")

+ 0 - 1
src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -202,7 +202,6 @@ public class StatisticsController extends BaseController {
     * @param endDate 截止日期
     * @param area    区域
     * @param level   区域级别 4:城市 3:区 2:社区 1:团队
     * @param type    1:签约率  2:签约完成率
     * @return
     */
    @RequestMapping(value = "/sign_info")