Browse Source

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

yeshijie 7 years ago
parent
commit
af3ad30404

+ 4 - 4
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/health/DoctorHealthStandard.java

@ -22,13 +22,13 @@ public class DoctorHealthStandard extends IdEntity {
    private String doctor;
    // 健康指标类型:1血糖,2血压,3体重,4腰围
    private Integer type;
    // 最低安全值(血糖餐前\收缩压\体重\腰围)
    // 最低安全值(血糖餐前\收缩压\BMI\腰围)
    private Double minValue1;
    // 最高安全值(血糖餐前\收缩压\体重\腰围)
    // 最高安全值(血糖餐前\收缩压\BMI\腰围)
    private Double maxValue1;
    // 最低安全值(血糖餐后\舒张压)
    // 最低安全值(血糖餐后\舒张压\步数)
    private Double minValue2;
    // 最高安全值(血糖餐后\舒张压)
    // 最高安全值(血糖餐后\舒张压\步数)
    private Double maxValue2;
    // 设置时间
    private Date czrq;

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -98,4 +98,6 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from device.wlyy_patient_health_index a where a.user = ?1 and a.record_date >= ?2 and a.record_date <= ?3 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?4 ,?5",nativeQuery = true)
	List<String> findDateList(String patient,Date start ,Date end,int currentSize,int pageSize);
	@Query(value= " select * from device.wlyy_patient_health_index where type in (?1) and record_date BETWEEN ?2 AND ?3  AND user in (select p.code from wlyy_patient p INNER JOIN wlyy_sign_family s on s.patient = p.code and s.status > 0 AND s.admin_team_code = ?4 and p.disease >0)",nativeQuery = true)
	List<DevicePatientHealthIndex> findByTeamcodeAndRecordDate(String type ,Date start, Date end,String teamcode);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctoreSchemeBloodPressureDao.java

@ -20,5 +20,5 @@ public interface DoctoreSchemeBloodPressureDao extends
    List<DoctorSchemeBloodPressure> getListByDoctorcode(String doctorCode);
    @Query(" from DoctorSchemeBloodPressure p where p.code=?1")
    DoctorSchemeBloodPressure findByCode(String code);
    List<DoctorSchemeBloodPressure> findByCode(String code);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctroSchemeBloodSuggerDao.java

@ -25,5 +25,5 @@ public interface DoctroSchemeBloodSuggerDao extends
    List<DoctorSchemeBloodSugger> getListByDoctorcode(String doctorcode);
    @Query(" from DoctorSchemeBloodSugger p where p.code=?1")
    DoctorSchemeBloodSugger findByCode(String code);
    List<DoctorSchemeBloodSugger> findByCode(String code);
}

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

@ -64,4 +64,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    //获取所有的openid并排重
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
    @Query(" select p from Patient p,SignFamily s where p.code=s.patient and s.status > 0 and s.adminTeamId = ?1 and p.disease > 0")
    List<Patient> findAllSignPatientTeamcode(String teamcode);
}

+ 13 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -743,16 +743,21 @@ public class PatientHealthIndexService extends BaseService {
                    DecimalFormat df1 = new DecimalFormat("###.00");
                    obj.setValue3(df1.format(bmi));
                    double bmiMin = new Double("18.5");
                    double bmiMax = new Double("23.9");
                    if(patientAimSports != null && StringUtils.isNoneEmpty(patientAimSports.getCode())){
                        bmiMin = Double.parseDouble(patientAimSports.getBmiMin());
                        bmiMax = Double.parseDouble(patientAimSports.getBmiMax());
                    }
                        //设置BMI值
                        if(bmi < Double.parseDouble(patientAimSports.getBmiMin())){
                            obj.setValue4("1");
                        }else if(bmi > Double.parseDouble(patientAimSports.getBmiMax())){
                            obj.setValue4("-1");
                        }else{
                            obj.setValue4("0");
                        }
                    //设置BMI值
                    if(bmi < bmiMin){
                        obj.setValue4("1");
                    }else if(bmi > bmiMax){
                        obj.setValue4("-1");
                    }else{
                        obj.setValue4("0");
                    }
                    break;

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

@ -307,8 +307,10 @@ public class SignPatientLabelInfoService extends BaseService {
                    "   t1.doctor = ? " +
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?" ;
                    "  AND t1. STATUS > 0  AND t1.admin_team_code = ?";
            if(isSlowDisease){
                sql = sql + "  AND p.diease >0 " ;
            }
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
            }
@ -356,14 +358,13 @@ public class SignPatientLabelInfoService extends BaseService {
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        String _pdsql = "select user,floor(sum(category_code)) deviceType FROM wlyy_patient_device GROUP BY user";
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
@ -481,9 +482,9 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                Integer deviceType = 0;
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
@ -537,11 +538,11 @@ public class SignPatientLabelInfoService extends BaseService {
                                //判断微信绑定情况
                                re = openid1.compareTo(openid2);
                            }else{
                                re = diseaseCondition1 - diseaseCondition2;
                                re = diseaseCondition2 - diseaseCondition1;
                            }
                        }else{
                            re = disease1 - disease2;
                            re = disease2 - disease1;
                        }
                    }else{
@ -3583,7 +3584,7 @@ public class SignPatientLabelInfoService extends BaseService {
     * @return
     * @throws Exception
     */
    public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean sortByStandardStatus, String diseaseCondition) throws Exception {
    public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean isSlowDisease, String diseaseCondition) throws Exception {
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
@ -3643,6 +3644,9 @@ public class SignPatientLabelInfoService extends BaseService {
            }else{
                args = new Object[]{teamCode};
            }
            if(isSlowDisease){
                sql = sql + " AND p.disease >0 ";
            }
            sql = sql +
                    " ) f " +
                    "WHERE " +
@ -3706,7 +3710,6 @@ public class SignPatientLabelInfoService extends BaseService {
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
@ -3825,9 +3828,9 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                Integer deviceType = 0;
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
@ -3882,11 +3885,11 @@ public class SignPatientLabelInfoService extends BaseService {
                                //判断微信绑定情况
                                re = openid1.compareTo(openid2);
                            }else{
                                re = diseaseCondition1 - diseaseCondition2;
                                re = diseaseCondition2 - diseaseCondition1;
                            }
                        }else{
                            re = disease1 - disease2;
                            re = disease2 - disease1;
                        }
                    }else{
@ -4094,10 +4097,11 @@ public class SignPatientLabelInfoService extends BaseService {
                "    (t1.doctor = ? or t1.doctor_health = ?) " +
                "    AND t1.status > 0 " +
                "    AND t2.status = 1) " +
                (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : " AND (t2.label = 4 or t2.label = 5 )") +
                (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")+
                (StringUtils.isNotEmpty(diseaseCondition) ? " AND t3.diseaseCondition = ? " : "");
        sql = sql + " AND t3.disease > 0 AND t3.status > 0 ";
        if (matcher.find()) {
            sql = sql + "  AND (t1.idcard like ?) ";
@ -4146,7 +4150,6 @@ public class SignPatientLabelInfoService extends BaseService {
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
@ -4287,9 +4290,9 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                Integer deviceType = 0;
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
@ -4347,7 +4350,7 @@ public class SignPatientLabelInfoService extends BaseService {
                "  AND" +
                (isIdcard ? " p.idcard like ? " : " t1.name like ? ");
        sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition;
        sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition+" AND p.diease >0 AND p.status >0 ";
        String sql = sqlTemp + " order by t2.diseaseCondition,t2.disease,t2,diseaseCondition,t2.openid desc  limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
@ -4360,7 +4363,6 @@ public class SignPatientLabelInfoService extends BaseService {
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                System.out.println(user+sum);
                patientDeviceTypeMap.put(user,sum);
            }
        }
@ -4485,9 +4487,9 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                Integer deviceType = 0;
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);

+ 193 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -3,14 +3,18 @@ package com.yihu.wlyy.service.app.scheme;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodPressure;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodSugger;
import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodPressureVO;
import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodSuggerVO;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctoreSchemeBloodPressureDao;
import com.yihu.wlyy.repository.doctor.DoctoreSchemeBloodSuggerDao;
import com.yihu.wlyy.repository.doctor.DoctroSchemeBloodSuggerDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.scheme.PatientSchemeListDao;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang.StringUtils;
@ -53,6 +57,11 @@ public class DoctorSchemeService {
    @Autowired
    private DoctoreSchemeBloodSuggerDao doctoreSchemeBloodSuggerDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
    /**
@ -79,7 +88,7 @@ public class DoctorSchemeService {
            sql = sql + " and p.disease ="+disease;
        }
        if(StringUtils.isNotBlank(diseaseCondition)){
        if(StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)){
            sql = sql + " and p.disease_condition IN ("+diseaseCondition +")";
        }
@ -93,6 +102,8 @@ public class DoctorSchemeService {
        }
        sql = sql + " and p.status > 0 and p.disease > 0 ";
        List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
@ -115,29 +126,30 @@ public class DoctorSchemeService {
        List<DoctorSchemeBloodSugger> schemelist = doctroSchemeBloodSuggerDao.getListByDoctorcode(doctorcode);
        DoctorSchemeBloodSugger defaultSchemeBloodSugger = doctroSchemeBloodSuggerDao.findByCode("default");
        List<DoctorSchemeBloodSugger> defaultSchemeBloodSugger = doctroSchemeBloodSuggerDao.findByCode("default");
        schemelist.add(defaultSchemeBloodSugger);
        schemelist.addAll(defaultSchemeBloodSugger);
        for (DoctorSchemeBloodSugger doctorSchemeBloodSugger : schemelist) {
            if(mapresult.keySet().contains(doctorSchemeBloodSugger.getCode())){
                mapresult.get(doctorSchemeBloodSugger.getCode()).add(doctorSchemeBloodSugger);
            }else{
                List<DoctorSchemeBloodSugger> list = new ArrayList<>();
                list.add(doctorSchemeBloodSugger);
                mapresult.put(doctorSchemeBloodSugger.getCode(),list);
        if(!schemelist.isEmpty()){
            for (DoctorSchemeBloodSugger doctorSchemeBloodSugger : schemelist) {
                if(mapresult.keySet().contains(doctorSchemeBloodSugger.getCode())){
                    mapresult.get(doctorSchemeBloodSugger.getCode()).add(doctorSchemeBloodSugger);
                }else{
                    List<DoctorSchemeBloodSugger> list = new ArrayList<>();
                    list.add(doctorSchemeBloodSugger);
                    mapresult.put(doctorSchemeBloodSugger.getCode(),list);
                }
            }
        }
        for (String key :mapresult.keySet()) {
            DoctorSchemeBloodSuggerVO doctorSchemeBloodSuggerVO = new DoctorSchemeBloodSuggerVO();
            doctorSchemeBloodSuggerVO.setCode(key);
            doctorSchemeBloodSuggerVO.setName(mapresult.get(key).get(0).getName());
            doctorSchemeBloodSuggerVO.setContent(mapresult.get(key).get(0).getContent());
            doctorSchemeBloodSuggerVO.setList(mapresult.get(key));
            result.add(doctorSchemeBloodSuggerVO);
            for (String key :mapresult.keySet()) {
                DoctorSchemeBloodSuggerVO doctorSchemeBloodSuggerVO = new DoctorSchemeBloodSuggerVO();
                doctorSchemeBloodSuggerVO.setCode(key);
                doctorSchemeBloodSuggerVO.setName(mapresult.get(key).get(0).getName());
                doctorSchemeBloodSuggerVO.setContent(mapresult.get(key).get(0).getContent());
                doctorSchemeBloodSuggerVO.setList(mapresult.get(key));
                result.add(doctorSchemeBloodSuggerVO);
            }
        }
        return result;
    }
@ -155,27 +167,29 @@ public class DoctorSchemeService {
        List<DoctorSchemeBloodPressure> schemelist = doctoreSchemeBloodPressureDao.getListByDoctorcode(doctorcode);
        DoctorSchemeBloodPressure defaultSchemeBloodPressure = doctoreSchemeBloodPressureDao.findByCode("default");
        List<DoctorSchemeBloodPressure> defaultSchemeBloodPressure = doctoreSchemeBloodPressureDao.findByCode("default");
        schemelist.add(defaultSchemeBloodPressure);
        schemelist.addAll(defaultSchemeBloodPressure);
        for (DoctorSchemeBloodPressure doctorSchemeBloodPressure : schemelist) {
            if(mapresult.keySet().contains(doctorSchemeBloodPressure.getCode())){
                mapresult.get(doctorSchemeBloodPressure.getCode()).add(doctorSchemeBloodPressure);
            }else{
                List<DoctorSchemeBloodPressure> list = new ArrayList<>();
                list.add(doctorSchemeBloodPressure);
                mapresult.put(doctorSchemeBloodPressure.getCode(),list);
        if(!schemelist.isEmpty()){
            for (DoctorSchemeBloodPressure doctorSchemeBloodPressure : schemelist) {
                if(mapresult.keySet().contains(doctorSchemeBloodPressure.getCode())){
                    mapresult.get(doctorSchemeBloodPressure.getCode()).add(doctorSchemeBloodPressure);
                }else{
                    List<DoctorSchemeBloodPressure> list = new ArrayList<>();
                    list.add(doctorSchemeBloodPressure);
                    mapresult.put(doctorSchemeBloodPressure.getCode(),list);
                }
            }
        }
        for (String key :mapresult.keySet()) {
            DoctorSchemeBloodPressureVO doctorSchemeBloodPressureVO = new DoctorSchemeBloodPressureVO();
            doctorSchemeBloodPressureVO.setCode(key);
            doctorSchemeBloodPressureVO.setName(mapresult.get(key).get(0).getName());
            doctorSchemeBloodPressureVO.setContent(mapresult.get(key).get(0).getContent());
            doctorSchemeBloodPressureVO.setList(mapresult.get(key));
            result.add(doctorSchemeBloodPressureVO);
            for (String key :mapresult.keySet()) {
                DoctorSchemeBloodPressureVO doctorSchemeBloodPressureVO = new DoctorSchemeBloodPressureVO();
                doctorSchemeBloodPressureVO.setCode(key);
                doctorSchemeBloodPressureVO.setName(mapresult.get(key).get(0).getName());
                doctorSchemeBloodPressureVO.setContent(mapresult.get(key).get(0).getContent());
                doctorSchemeBloodPressureVO.setList(mapresult.get(key));
                result.add(doctorSchemeBloodPressureVO);
            }
        }
        return result;
@ -351,4 +365,147 @@ public class DoctorSchemeService {
            }
        }
    }
    /**
     * 医生端-获取慢病管理居民管理端数据
     * @param teamCode
     * @param getcolor
     * @param getstands
     * @param gethealthindex
     * @param startdate
     * @param enddate
     * @return
     */
    public JSONArray getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode);
        JSONArray result = new JSONArray();
        JSONObject green = new JSONObject();//绿标
        JSONObject yellow = new JSONObject();//黄标
        JSONObject red = new JSONObject();//红标
        JSONObject pressure_standard =  new JSONObject();//血压预警
        JSONObject sugar_standard =  new JSONObject();//血糖预警
        JSONObject pressure_count =  new JSONObject();//血压体征总数
        JSONObject pressure_unusual_ount =  new JSONObject();//血压体征总数
        JSONObject sugar_count =  new JSONObject();//血糖体征总数
        JSONObject sugar_unusual_count =  new JSONObject();//血糖体征总数
        int count = patients.size();
        //绿标居民
        List<Patient> green_patients = new ArrayList<>();
        //黄标居民
        List<Patient> yellow_patients = new ArrayList<>();
        //红标居民
        List<Patient> red_patients = new ArrayList<>();
        //高血压居民预警居民CODE
        List<String> bloodpressure_patientcodes = new ArrayList<>();
        //高血糖居民预警居民CODE
        List<String> bloodsugar_patientcodes = new ArrayList<>();
        if(!patients.isEmpty()){
            for (Patient patient : red_patients) {
                //获取居民颜色标签
                if(1 == getcolor){
                    switch (patient.getDiseaseCondition()){
                        case 0:
                            green_patients.add(patient);
                            break;
                        case 1:
                            yellow_patients.add(patient);
                            break;
                        case 2:
                            red_patients.add(patient);
                            break;
                    }
                }
                //获取预警居民CODES
                if(1 == getstands && 1 == patient.getStandardStatus()){
                    if( 1 == patient.getDisease() || 3 == patient.getDisease()){
                        bloodpressure_patientcodes.add(patient.getCode());
                    }
                    if( 2 == patient.getDisease() || 3 == patient.getDisease()){
                        bloodsugar_patientcodes.add(patient.getCode());
                    }
                }
            }
        }
        if(1 == getcolor){
            green.put("greencount",green_patients.size());
            yellow.put("yellowcount",yellow_patients.size());
            red.put("redcount",red_patients.size());
            result.add(green);
            result.add(yellow);
            result.add(red);
        }
        if(1 == getstands){
            pressure_standard.put("pressure_standard",bloodpressure_patientcodes);
            sugar_standard.put("sugar_standard",bloodsugar_patientcodes);
            result.add(pressure_standard);
            result.add(sugar_standard);
        }
        if(1 == gethealthindex){
            Date start = DateUtil.strToDate(startdate);
            Date end = DateUtil.strToDate(enddate);
            List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByTeamcodeAndRecordDate("1,2",start,end,teamCode);
            int sugar = 0;
            int sugar_unusual = 0;
            int pressure = 0;
            int pressure_unusual = 0;
            if(!devicePatientHealthIndices.isEmpty()){
                for (DevicePatientHealthIndex devicePatientHealthIndex : devicePatientHealthIndices) {
                    if( 1 == devicePatientHealthIndex.getType()){
                        sugar++;
                        if( 1 == devicePatientHealthIndex.getStatus()){
                            sugar_unusual++;
                        }
                    }
                    if( 2 == devicePatientHealthIndex.getType()){
                        pressure++;
                        if( 1 == devicePatientHealthIndex.getStatus()){
                            pressure_unusual++;
                        }
                    }
                }
            }
            pressure_count.put("pressure_count",pressure);
            pressure_unusual_ount.put("pressure_unusual_count",pressure_unusual);
            sugar_count.put("sugar_count",sugar);
            sugar_unusual_count.put("sugar_unusual_count",sugar_unusual);
            result.add(pressure_count);
            result.add(pressure_unusual_ount);
            result.add(sugar_count);
            result.add(sugar_unusual_count);
        }
        return result;
    }
}

+ 8 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -808,8 +808,13 @@ public class PatientService extends TokenService {
                "    f.`code` " +
                "   FROM " +
                "    wlyy_sign_family f " ;
        if(isSlowDisease){
            totalGSql = totalGSql + " ,wlyy_patient p WHERE f.patient = p.code AND p.disease >0 AND p.status > 0 ";
        }
        if(StringUtils.isNotBlank(diseaseCondition)){
            totalGSql = totalGSql + " ,wlyy_patient p WHERE f.patient = p.code AND p.disease_condition = "+diseaseCondition +" AND ";
            totalGSql = totalGSql + " AND p.disease_condition = "+diseaseCondition +" AND ";
        }else{
            totalGSql = totalGSql + " WHERE ";
        }
@ -830,7 +835,7 @@ public class PatientService extends TokenService {
                " d.`year` = '" + DateUtil.getSignYear() + "' " ;
        if(isSlowDisease){
            //获取预警分组数量
            totalGSql = totalGSql +"  AND d. CODE in (4,5)  ";
//            totalGSql = totalGSql +"  AND d. CODE in (4,5)  ";
        }
        totalGSql = totalGSql +
@ -886,7 +891,7 @@ public class PatientService extends TokenService {
        if(isSlowDisease){
            //获取预警分组数量
            fousGSql = fousGSql +"  AND d. CODE in (4,5)  ";
//            fousGSql = fousGSql +"  AND d. CODE in (4,5)  ";
        }
        fousGSql = fousGSql +

+ 11 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -208,8 +208,12 @@ public class DoctorHealthController extends BaseController {
				return error(-1, "保存失败!");
			}
			if(patient.contains(",")){
				String[] pcodeArray = patient.split(",");
				String[] pcodeArray = new String[1];
				if(patient.contains(",")){
					pcodeArray = patient.split(",");
				}else{
					pcodeArray = new String[]{patient};
				}
				if(pcodeArray != null && pcodeArray.length > 0){
					// 生成数据对象
					List<PatientHealthStandard> list = new ArrayList<>();
@ -262,7 +266,6 @@ public class DoctorHealthController extends BaseController {
					}
				}
			}
			return write(200, "保存成功");
		} catch (Exception e) {
@ -365,15 +368,15 @@ public class DoctorHealthController extends BaseController {
						continue;
					}
					JSONObject json = new JSONObject();
					// 最低安全值(血糖餐前\收缩压\体重\腰围)
					// 最低安全值(血糖餐前\收缩压\体重\腰围\BMI)
					json.put("min_value_1", phs.getMinValue1());
					// 最高安全值(血糖餐前\收缩压\体重\腰围)
					// 最高安全值(血糖餐前\收缩压\体重\腰围\BMI)
					json.put("max_value_1", phs.getMaxValue1());
					// 最低安全值(血糖餐后\舒张压)
					// 最低安全值(血糖餐后\舒张压\步数)
					json.put("min_value_2", phs.getMinValue2());
					// 最高安全值(血糖餐后\舒张压)
					// 最高安全值(血糖餐后\舒张压\步数)
					json.put("max_value_2", phs.getMaxValue2());
					// 健康指标类型:1血糖,2血压,3体重,4腰围
					// 健康指标类型:1血糖,2血压,3BMI,4腰围
					json.put("type", phs.getType());
					userArray.put(json);
				}

+ 25 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -2,12 +2,14 @@ package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.scheme.DoctorSchemeService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -32,6 +34,8 @@ public class SignPatientLabelInfoController extends BaseController {
    SignWebService signWebService;
    @Autowired
    PatientService patientService;
    @Autowired
    private DoctorSchemeService doctorSchemeService;
    /**
@ -830,4 +834,25 @@ public class SignPatientLabelInfoController extends BaseController {
        }
    }
    @RequestMapping(value="/slowdisease/get/teaminfos",method = RequestMethod.GET)
    @ApiOperation("医生端-获取慢病管理居民管理端数据")
    public String getDiseasePatientCodes (
            @ApiParam(name="teamCode", value="团队CODE") @RequestParam(value = "teamCode",required = true,defaultValue = "642") String teamCode,
            @ApiParam(name="getcolor", value="是否获取颜色标签") @RequestParam(value = "getcolor",required = true,defaultValue = "1")  int getcolor,
            @ApiParam(name="getstands", value="是否获取预警人数数据") @RequestParam(value = "getstands",required = true,defaultValue = "1")  int getstands,
            @ApiParam(name="gethealthindex", value="是否获取体征数据") @RequestParam(value = "gethealthindex",required = true,defaultValue = "1")  int gethealthindex,
            @ApiParam(name="startdate", value="体征数据开始时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "startdate",required = false,defaultValue = "")  String startdate,
            @ApiParam(name="enddate", value="体征数据结束时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "enddate",required = false,defaultValue = "")  String enddate){
        try {
            com.alibaba.fastjson.JSONArray result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate);
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败,"+e.getMessage());
        }
    }
}