Jelajahi Sumber

慢病管理

trick9191 7 tahun lalu
induk
melakukan
2508c5aed4

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

@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
/**
 * 患者-医生监测方案关联关系表
@ -18,7 +19,7 @@ public class PatientSchemeList extends IdEntity {
    private String schemecode;
    private Integer type;//方案类型:1为血糖,2为血压
    private String doctorcode;
    private Timestamp createTime;
    private Date createTime;
    @Basic
@ -71,11 +72,11 @@ public class PatientSchemeList extends IdEntity {
    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Timestamp createTime) {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

+ 3 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java

@ -87,7 +87,7 @@ public class PatientVO {
	private Integer standardStatus;
	
	//设备类型(1血糖,2血压,3血糖+血压)
	private Integer deviceType;
	private String deviceType;
	//医疗保险号
	private String medicareNumber;
	
@ -380,11 +380,11 @@ public class PatientVO {
		this.standardStatus = standardStatus;
	}
	
	public Integer getDeviceType() {
	public String getDeviceType() {
		return deviceType;
	}
	
	public void setDeviceType(Integer deviceType) {
	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}
	

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

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

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

@ -1055,32 +1055,32 @@ public class PatientHealthIndexService extends BaseService {
     * @param end   结束时间
     * @return
     */
    public List<DevicePatientHealthIndex> findChartByPatien(String patient, int type, String begin, String end) {
        List<DevicePatientHealthIndex> re = new ArrayList<>();
        Date startDate = DateUtil.strToDate(begin, DateUtil.YYYY_MM_DD_HH_MM_SS);
        Date endDate = DateUtil.strToDate(end, DateUtil.YYYY_MM_DD_HH_MM_SS);
        if (type == 1)   //血糖特殊处理
        {
            //根据时间过滤排序
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, null);
            if (dateList != null && dateList.size() > 0) {
                for (int i = dateList.size() - 1; i >= 0; i--) {
                    String dateString = dateList.get(i);
                    DevicePatientHealthIndex obj = getPatientXT(patient, dateString);
                    if (obj != null) {
                        re.add(obj);
                    }
                }
            }
        } else {
            // 排序
            Sort sort = new Sort(Direction.ASC, "recordDate");
            PageRequest pageRequest = new PageRequest(0, 1000, sort);
            re = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest).getContent();
        }
        return re;
    }
//    public List<DevicePatientHealthIndex> findChartByPatien(String patient, int type, String begin, String end) {
//        List<DevicePatientHealthIndex> re = new ArrayList<>();
//
//        Date startDate = DateUtil.strToDate(begin, DateUtil.YYYY_MM_DD_HH_MM_SS);
//        Date endDate = DateUtil.strToDate(end, DateUtil.YYYY_MM_DD_HH_MM_SS);
//        if (type == 1)   //血糖特殊处理
//        {
//            //根据时间过滤排序
//            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, null);
//            if (dateList != null && dateList.size() > 0) {
//                for (int i = dateList.size() - 1; i >= 0; i--) {
//                    String dateString = dateList.get(i);
//                    DevicePatientHealthIndex obj = getPatientXT(patient, dateString);
//                    if (obj != null) {
//                        re.add(obj);
//                    }
//                }
//            }
//        } else {
//            // 排序
//            Sort sort = new Sort(Direction.ASC, "recordDate");
//            PageRequest pageRequest = new PageRequest(0, 1000, sort);
//            re = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest).getContent();
//        }
//        return re;
//    }
    /**
     * 按时间段查询患者健康指标

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

@ -488,7 +488,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -609,7 +609,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                boolean epTime = false;
                try {
@ -2422,7 +2422,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -2566,7 +2566,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                
                
                boolean epTime = false;
@ -2700,7 +2700,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -2844,7 +2844,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                
                boolean epTime = false;
                try {
@ -3528,7 +3528,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -3656,7 +3656,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                
                boolean epTime = false;
                try {
@ -3717,7 +3717,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -3845,7 +3845,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                
                boolean epTime = false;
                try {
@ -4023,17 +4023,6 @@ public class SignPatientLabelInfoService extends BaseService {
        sql = sql + " limit " + start + "," + pagesize;
        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);
//            }
//        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
@ -4046,8 +4035,8 @@ public class SignPatientLabelInfoService extends BaseService {
                PatientVO p = new PatientVO();
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                    String patientsql = "select a.*,b. as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -4174,7 +4163,7 @@ public class SignPatientLabelInfoService extends BaseService {
//                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
//                }
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                boolean epTime = false;
@ -4498,7 +4487,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -4643,7 +4632,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                boolean epTime = false;
                try {
@ -4709,7 +4698,7 @@ public class SignPatientLabelInfoService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -4837,7 +4826,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                boolean epTime = false;
                try {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -194,7 +194,7 @@ public class PhysicalExaminationRemindService extends BaseService {
                List<PatientVO> plist = new ArrayList<>();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select user,group_concat(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
@ -271,7 +271,7 @@ public class PhysicalExaminationRemindService extends BaseService {
                //预警状态
                json.put("standardStatus", p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                json.put("deviceType",p.getDeviceType());
                json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
                boolean epTime = false;
                try {

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

@ -1945,4 +1945,38 @@ public class DoctorSchemeService extends BaseService{
        sql += " ORDER BY highCount DESC LIMIT "+(page-1)*size+","+size;
        return sql;
    }
    public Map<String,Object> getDefaultScheme(String type){
        Map<String,Object> rs = new HashedMap();
        //1. 血糖2.血压
        if("1".equals(type)){
            List<DoctorSchemeBloodSugger> list =  doctroSchemeBloodSuggerDao.findByCode("default");
            rs.put("code","default");
            rs.put("name",list.get(0).getName());
            rs.put("content",list.get(0).getContent());
            rs.put("list",list);
        }else{
            List<DoctorSchemeBloodPressure> list =  doctoreSchemeBloodPressureDao.findByCode("default");
            rs.put("code","default");
            rs.put("name",list.get(0).getName());
            rs.put("content",list.get(0).getContent());
            rs.put("list",list);
        }
        return rs;
    }
    public String setPatientDefaultScheme(String patient,String type){
        PatientSchemeList pl = new PatientSchemeList();
        pl.setPatientcode(patient);
        pl.setCode(getCode());
        if("0".equals(type)){
            pl.setType(1);
        }else{
            pl.setType(2);
        }
        pl.setSchemecode("default");
        pl.setCreateTime(new Date());
        patientSchemeListDao.save(pl);
        return "0";
    }
}

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java

@ -105,4 +105,28 @@ public class PatientSchemeController extends BaseController {
        }
    }
    @RequestMapping(value="getDefaultScheme",method = RequestMethod.GET)
    @ApiOperation("获取默认监测列表")
    public String getDefaultScheme(@ApiParam(name="type", value="1.糖尿病,2.高血压") @RequestParam(value = "type",required = true)String type){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getDefaultScheme(type));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="setPatientDefaultScheme",method = RequestMethod.POST)
    @ApiOperation("设置居民监测列表")
    public String setPatientDefaultScheme(@ApiParam(name="type", value="1.糖尿病,2.高血压") @RequestParam(value = "type",required = true)String type){
        try {
            return write(200, "设置成功", "data",doctorSchemeService.setPatientDefaultScheme(getUID(),type));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "设置失败");
        }
    }
}