Prechádzať zdrojové kódy

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

yeshijie 7 rokov pred
rodič
commit
3df51479f1

+ 3 - 6
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/scheme/DoctorSchemeBloodPressure.java

@ -32,7 +32,7 @@ public class DoctorSchemeBloodPressure extends IdEntity {
    private Timestamp createTime;      //创建时间
    private Short alertTag;            //是否提醒用户
    private String content;            //方案说明
    private Short del;          //0为正常,1为删除
    private Integer del;          //0为正常,1为删除
    @Basic
    @Column(name = "name")
@ -210,14 +210,11 @@ public class DoctorSchemeBloodPressure extends IdEntity {
        this.content = content;
    }
    @Basic
    @Column(name = "del")
    public Short getDel() {
    public Integer getDel() {
        return del;
    }
    public void setDel(Short del) {
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 3 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/scheme/DoctorSchemeBloodSugger.java

@ -36,7 +36,7 @@ public class DoctorSchemeBloodSugger extends IdEntity {
    private Timestamp createTime;
    private Short alertTag;                 //是否提醒用户
    private String content;                 //方案说明
    private Short del;          //0为正常,1为删除
    private Integer del;          //0为正常,1为删除
    @Basic
    @Column(name = "name")
@ -242,13 +242,11 @@ public class DoctorSchemeBloodSugger extends IdEntity {
        return alertTag;
    }
    @Basic
    @Column(name = "del")
    public Short getDel() {
    public Integer getDel() {
        return del;
    }
    public void setDel(Short del) {
    public void setDel(Integer del) {
        this.del = del;
    }

+ 3 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientSchemeList.java

@ -16,7 +16,7 @@ public class PatientSchemeList extends IdEntity {
    private String code;
    private String patientcode;
    private String schemecode;
    private Short type;//方案类型:1为血糖,2为血压
    private Integer type;//方案类型:1为血糖,2为血压
    private String doctorcode;
    private Timestamp createTime;
@ -51,13 +51,11 @@ public class PatientSchemeList extends IdEntity {
        this.schemecode = schemecode;
    }
    @Basic
    @Column(name = "type")
    public Short getType() {
    public Integer getType() {
        return type;
    }
    public void setType(Short type) {
    public void setType(Integer type) {
        this.type = type;
    }

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

@ -25,5 +25,5 @@ public interface DoctoreSchemeBloodPressureDao extends
    @Modifying
    @Query("update DoctorSchemeBloodPressure set del=?1 where doctorcode=?2 and code=?3")
    void updateDel(int i, String doctorcode, String schemecode);
    void updateDelStatus(int del, String doctorcode, String schemecode);
}

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

@ -30,5 +30,5 @@ public interface DoctrorSchemeBloodSuggerDao extends
    @Modifying
    @Query("update DoctorSchemeBloodSugger set del=?1 where doctorcode=?2 and code=?3")
    void updateDel(int i, String doctorcode, String schemecode);
    void updateDelStatus(int del, String doctorcode, String schemecode);
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.patient.scheme;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
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;
@ -14,6 +15,7 @@ public interface PatientSchemeListDao extends
        PagingAndSortingRepository<PatientSchemeList, Long>,
        JpaSpecificationExecutor<PatientSchemeList> {
    @Query("delete from PatientSchemeList where patientcode=?1 and type=?2 and schemecode=?3")
    @Modifying
    @Query("delete PatientSchemeList where patientcode=?1 and type=?2 and schemecode=?3")
    void delByPatientCodeAndSchemeCode(String patientcode, int i, String code);
}

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

@ -309,7 +309,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    "  ) " +
                    "  AND t1. STATUS > 0  AND t1.admin_team_code = ?";
            if(isSlowDisease){
                sql = sql + "  AND p.diease >0 " ;
                sql = sql + "  AND p.disease >0 " ;
            }
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
@ -4090,16 +4090,16 @@ public class SignPatientLabelInfoService extends BaseService {
                " FROM " +
                "    wlyy_sign_family t1 " +
                " JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient " +
                " JOIN wlyy_patiend t3 ON t1.patient = t3.code " +
                " JOIN wlyy_patient t3 ON t1.patient = t3.code " +
                (teamCode > 0 ? " join (select * from wlyy_sign_patient_label where label_type != '4' or team_code = " + teamCode + " or (label_type = '4' and (label_code in (1,2)))) lb on t2.label = lb.label_code and t2.label_type = lb.label_type " : "") +
                " WHERE " +
                "    (t1.doctor = ? or t1.doctor_health = ?) " +
                "    AND t1.status > 0 " +
                "    AND t2.status = 1) " +
                "    AND t2.status = 1 " +
                (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 = ? " : "");
                (StringUtils.isNotEmpty(diseaseCondition) ? " AND t3.disease_condition in (?) " : "");
        sql = sql + " AND t3.disease > 0 AND t3.status > 0 ";
        if (matcher.find()) {
@ -4141,17 +4141,17 @@ public class SignPatientLabelInfoService extends BaseService {
            signList = jdbcTemplate.queryForList(sql, args);
        }
        //查询患者设备绑定情况
        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"));
                patientDeviceTypeMap.put(user,sum);
            }
        }
//        //查询患者设备绑定情况
//        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"));
//                patientDeviceTypeMap.put(user,sum);
//            }
//        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
@ -4348,7 +4348,7 @@ public class SignPatientLabelInfoService extends BaseService {
                "  AND" +
                (isIdcard ? " t2.idcard like ? " : " t1.name like ? ");
        sqlTemp = sqlTemp + " AND t2.disease_condition = "+diseaseCondition+" AND t2.diease >0 AND t2.status >0 ";
        sqlTemp = sqlTemp + " AND t2.disease_condition = "+diseaseCondition+" AND t2.disease >0 AND t2.status >0 ";
        String sql = sqlTemp + " order by t2.standard_status,t2.disease_condition,t2.disease,t2.openid desc  limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);

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

@ -25,6 +25,7 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.*;
@ -249,7 +250,7 @@ public class DoctorSchemeService {
            doctorSchemeBloodSugger.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
            doctorSchemeBloodSugger.setContent(content);
            doctorSchemeBloodSugger.setCreateTime(DateUtil.getNowTimestamp());
            doctorSchemeBloodSugger.setDel(new Short("0"));
            doctorSchemeBloodSugger.setDel(0);
            results.add(doctorSchemeBloodSugger);
        }
@ -308,7 +309,7 @@ public class DoctorSchemeService {
            doctorSchemeBloodPressure.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
            doctorSchemeBloodPressure.setContent(content);
            doctorSchemeBloodPressure.setCreateTime(DateUtil.getNowTimestamp());
            doctorSchemeBloodPressure.setDel(new Short("0"));
            doctorSchemeBloodPressure.setDel(0);
            results.add(doctorSchemeBloodPressure);
        }
@ -326,20 +327,23 @@ public class DoctorSchemeService {
     * @param type
     * @throws Exception
     */
    @Transactional
    public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
        List<String> patientcodeList = new ArrayList<>();
        JSONObject dataObj = JSON.parseObject(patientcodes);
        JSONArray codes = dataObj.getJSONArray("patientcodes");
        if (codes == null || codes.size() == 0) {
            throw new Exception("居民列表不能为空");
        }
        String[] codes = patientcodes.split(",");
        for (int i = 0; i < codes.size(); i++) {
            patientcodeList.add(codes.get(i).toString());
        if(patientcodes.contains(",")){
            for (String code : codes) {
                patientcodeList.add(code);
            }
        }else{
            patientcodeList.add(patientcodes);
        }
        if (!patientcodeList.isEmpty()) {
            //使用事务控制批量更新
@ -348,22 +352,21 @@ public class DoctorSchemeService {
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
            try {
                for (String patientcode : patientcodeList) {
                    PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
                    PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                    patientSchemeListObj.setCode(UUID.randomUUID().toString());
                    patientSchemeListObj.setPatientcode(patientcode);
                    patientSchemeListObj.setSchemecode(schemecode);
                    patientSchemeListObj.setDoctorcode(doctorcode);
                    Short _type = new Short(type);
                    patientSchemeListObj.setType(_type);
                    patientSchemeListObj.setType(Integer.parseInt(type));
                    patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
                    patientSchemeListDao.save(patientSchemeListObj);
                }
                //事务提交
                transactionManager.commit(status);
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
                //报错事务回滚
                transactionManager.rollback(status);
            }
@ -380,11 +383,11 @@ public class DoctorSchemeService {
     * @param enddate
     * @return
     */
    public JSONArray getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
    public JSONObject 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 result = new JSONObject();
        JSONObject green = new JSONObject();//绿标
        JSONObject yellow = new JSONObject();//黄标
        JSONObject red = new JSONObject();//红标
@ -414,10 +417,10 @@ public class DoctorSchemeService {
        List<String> bloodsugar_patientcodes = new ArrayList<>();
        if(!patients.isEmpty()){
            for (Patient patient : red_patients) {
            for (Patient patient : patients) {
                //获取居民颜色标签
                if(1 == getcolor){
                if(1 == getcolor && patient.getDiseaseCondition() != null){
                    switch (patient.getDiseaseCondition()){
                        case 0:
                            green_patients.add(patient);
@ -434,15 +437,18 @@ public class DoctorSchemeService {
                }
                //获取预警居民CODES
                if(1 == getstands && 1 == patient.getStandardStatus()){
                if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
                    if( 1 == patient.getDisease() || 3 == patient.getDisease()){
                        bloodpressure_patientcodes.add(patient.getCode());
                    }
                    if(patient.getDisease() != null){
                        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( 2 == patient.getDisease() || 3 == patient.getDisease()){
                            bloodsugar_patientcodes.add(patient.getCode());
                        }
                    }
                }
            }
        }
@ -450,19 +456,19 @@ public class DoctorSchemeService {
        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);
            result.put("greencount",green_patients.size());
            result.put("yellowcount",yellow_patients.size());
            result.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);
            result.put("pressure_standard",bloodpressure_patientcodes);
            result.put("sugar_standard",bloodsugar_patientcodes);
//            result.add(pressure_standard);
//            result.add(sugar_standard);
        }
@ -498,15 +504,15 @@ public class DoctorSchemeService {
                }
            }
            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.put("pressure_count",pressure);
            result.put("pressure_unusual_count",pressure_unusual);
            result.put("sugar_count",sugar);
            result.put("sugar_unusual_count",sugar_unusual);
            result.add(pressure_count);
            result.add(pressure_unusual_ount);
            result.add(sugar_count);
            result.add(sugar_unusual_count);
//            result.add(pressure_count);
//            result.add(pressure_unusual_ount);
//            result.add(sugar_count);
//            result.add(sugar_unusual_count);
        }
@ -519,14 +525,16 @@ public class DoctorSchemeService {
     * @param schemecode
     * @param type
     */
    @Transactional
    public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
        if("1".equals(type)){
            doctroSchemeBloodSuggerDao.updateDel(1,doctorcode,schemecode);
            doctroSchemeBloodSuggerDao.updateDelStatus(1,doctorcode,schemecode);
        }
        if("2".equals(type)){
            doctoreSchemeBloodPressureDao.updateDel(1,doctorcode,schemecode);
            doctoreSchemeBloodPressureDao.updateDelStatus(1,doctorcode,schemecode);
        }
    }
}

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -806,10 +806,11 @@ public class SignPatientLabelInfoController extends BaseController {
            page = page - 1;
            JSONArray result = labelInfoService.searchSlowDiseasePatientByNameOrLabel(getUID(), filter, labelCode, labelType, teamCode, exLabelCode, exLabelType, page, pagesize,diseaseCondition);
            //JSONArray result = labelInfoService.searchPatientByNameOrLabel("test00000000005", filter, labelCode, labelType, teamCode, exLabelCode, exLabelType, page, pagesize);
//            JSONArray result = labelInfoService.searchPatientByNameOrLabel("xy201703150222", filter, labelCode, labelType, teamCode, exLabelCode, exLabelType, page, pagesize,diseaseCondition);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            return error(-1, "查询失败");
        }
    }
@ -845,7 +846,7 @@ public class SignPatientLabelInfoController extends BaseController {
            @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);
            com.alibaba.fastjson.JSONObject result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate);
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
            //日志文件中记录异常信息

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java

@ -124,7 +124,7 @@ public class DoctroSchemeController extends BaseController {
            @ApiParam(name="doctorcode", value="医生CODE") @RequestParam(value = "doctorcode",required = true) String doctorcode,
            @ApiParam(name="schemecode", value="方案CODE") @RequestParam(value = "schemecode",required = true) String schemecode,
            @ApiParam(name="type", value="血糖1、血压2") @RequestParam(value = "type",required = true) String type,
            @ApiParam(name="patientcodes", value="JASON数据") @RequestParam(value = "patientcodes",required = true) String patientcodes){
            @ApiParam(name="patientcodes", value="用户CODE,多个用逗号拼接") @RequestParam(value = "patientcodes",required = true) String patientcodes){
        try {
            doctorSchemeService.savePatientScheme(doctorcode,schemecode,type,patientcodes);
            return write(200, "操作成功");