浏览代码

慢病管理相关接口BUG修改

huangwenjie 7 年之前
父节点
当前提交
f648b87b31

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

@ -53,7 +53,7 @@ public class PatientVO {
	// 地址
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	private String disease;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	// 病历记录总数
@ -257,14 +257,6 @@ public class PatientVO {
		this.address = address;
	}
	
	public Integer getDisease() {
		return disease;
	}
	
	public void setDisease(Integer disease) {
		this.disease = disease;
	}
	
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
@ -392,4 +384,12 @@ public class PatientVO {
	public void setDeviceType(Integer deviceType) {
		this.deviceType = deviceType;
	}
	
	public String getDisease() {
		return disease;
	}
	
	public void setDisease(String disease) {
		this.disease = disease;
	}
}

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

@ -66,7 +66,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
    @Query(value=" select p.* from wlyy_patient p LEFT JOIN wlyy_sign_family s on s.patient = p.code WHERE s.status > 0  and p.disease >0 and p.status>0 and s.admin_team_code = ?1 and (s.doctor = ?2 or s.doctor_health =?2)",nativeQuery = true)
    @Query(value=" select p.* from wlyy_patient p  LEFT JOIN wlyy_sign_family s on s.patient = p.code  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code WHERE s.status > 0 and sp.label_type = 3 and (sp.label = 1 or sp.label = 2)  and s.admin_team_code = ?1 and (s.doctor = ?2 or s.doctor_health =?2))",nativeQuery = true)
    List<Patient> findAllSignPatientTeamcode(String teamcode, String  doctorcode);
    @Query(value="SELECT DISTINCT t.* FROM wlyy_sign_family t1,wlyy_patient t WHERE t.`code`=t1.patient AND t1.STATUS>0 AND " +

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

@ -518,7 +518,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -3923,7 +3923,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -4366,7 +4366,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -4553,7 +4553,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());

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

@ -10,6 +10,7 @@ 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.entity.patient.vo.PatientVO;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctoreSchemeBloodPressureDao;
import com.yihu.wlyy.repository.doctor.DoctrorSchemeBloodSuggerDao;
@ -20,6 +21,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
@ -78,13 +80,15 @@ public class DoctorSchemeService {
        if(-1 != deviceType){
            sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
        }
    
        sql = sql+ " LEFT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code ";
        sql = sql+ " LEFT JOIN wlyy_sign_family sf on sf.patient = p.code where sf.admin_team_code = "+teamCode;
        if(-1 != disease){
            sql = sql + " and (p.disease ="+disease+" or p.disease = 3) ";
        if(-1 != disease && 3 != disease){
            sql = sql + " and sp.label ="+disease;
        }else{
            sql = sql + " and p.disease >0 ";
            sql = sql + " and (sp.label = 1 or sp.label = 2) ";
        }
        if(StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)){
@ -103,7 +107,7 @@ public class DoctorSchemeService {
        sql = sql + " and (sf.doctor = '"+doctorcode+"' or sf.doctor_health ='"+doctorcode+"')";
        sql = sql + " and p.status > 0 and p.disease > 0 and sf.status > 0 ";
        sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
        List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
@ -389,7 +393,18 @@ public class DoctorSchemeService {
     */
    public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate,String doctorcode) throws Exception{
        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
//        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
    
        List<PatientVO> patients = new ArrayList<>();
        String patientsql = "select p.name,b.deviceType as deviceType,group_concat(sp.label) diseaseType from wlyy_patient p " +
                "  LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
                "  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and (sp.label = 1 or sp.label = 2) " +
                "  LEFT JOIN (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on p.code = b.user " +
                "WHERE s.status > 0 and s.admin_team_code ='"+teamCode+"' and (s.doctor = '"+doctorcode+"' or s.doctor_health ='"+doctorcode+"') GROUP BY p.code";
        patients= jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
        
        JSONObject result = new JSONObject();
        JSONObject green = new JSONObject();//绿标
@ -406,13 +421,13 @@ public class DoctorSchemeService {
        int count = patients.size();
        //绿标居民
        List<Patient> green_patients = new ArrayList<>();
        List<PatientVO> green_patients = new ArrayList<>();
        //黄标居民
        List<Patient> yellow_patients = new ArrayList<>();
        List<PatientVO> yellow_patients = new ArrayList<>();
        //红标居民
        List<Patient> red_patients = new ArrayList<>();
        List<PatientVO> red_patients = new ArrayList<>();
        //高血压居民预警居民CODE
        List<String> bloodpressure_patientcodes = new ArrayList<>();
@ -421,7 +436,7 @@ public class DoctorSchemeService {
        List<String> bloodsugar_patientcodes = new ArrayList<>();
        if(!patients.isEmpty()){
            for (Patient patient : patients) {
            for (PatientVO patient : patients) {
                //获取居民颜色标签
                if(1 == getcolor && patient.getDiseaseCondition() != null){
@ -444,11 +459,11 @@ public class DoctorSchemeService {
                if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
                    if(patient.getDisease() != null){
                        if( 1 == patient.getDisease() || 3 == patient.getDisease()){
                        if( "1" == patient.getDisease() || "1,2" == patient.getDisease()){
                            bloodpressure_patientcodes.add(patient.getCode());
                        }
                        if( 2 == patient.getDisease() || 3 == patient.getDisease()){
                        if( "2" == patient.getDisease() || "1,2" == patient.getDisease()){
                            bloodsugar_patientcodes.add(patient.getCode());
                        }
                    }