LAPTOP-KB9HII50\70708 преди 11 месеца
родител
ревизия
3a4877f5fa

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/device/dao/DevicePatientHealthIndexDao.java

@ -41,6 +41,6 @@ public interface DevicePatientHealthIndexDao
			"	AND a.record_date BETWEEN ?1 AND ?2 \n" +
			"	AND c.doctor =?3 \n" +
			"	AND b.disease IN('1','2','3')\n" +
			"	AND b.disease_condition IN ('1','2','1,2')",nativeQuery = true)
			"	AND b.disease_condition IN ('1','2','0')",nativeQuery = true)
	List<DevicePatientHealthIndex> findByDoctor(Date start, Date end, String doctorcode);
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -891,7 +891,7 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
                "	base_patient a \n" +
                "	INNER JOIN wlyy_outpatient b ON a.id=b.patient\n" +
                "WHERE 1=1\n" +
                "AND a.disease_condition IN('1','2','3')\n" +
                "AND a.disease_condition IN('1','2','0')\n" +
                "AND a.disease IN ('1','2','1,2','2,1')\n" +
                "AND b.doctor_id ='"+doctorId+"'";
        List<BasePatientDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePatientDO.class));

+ 18 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/controller/ChronicDiseaseController.java

@ -4,6 +4,7 @@ import com.yihu.jw.entity.scheme.vo.DoctorSchemeBloodPressureVO;
import com.yihu.jw.entity.scheme.vo.DoctorSchemeBloodSuggerVO;
import com.yihu.jw.hospital.module.health.service.scheme.DoctorSchemeService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -254,7 +255,20 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
        try {
            return write(200, "查询成功", "data", doctorSchemeService.getControlObjectives(patient));
        } catch (Exception e) {
            return error(-1, e.getMessage());
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "findLatelyIndex", method = RequestMethod.GET)
    @ApiOperation("获取居民最近一次体征记录")
    public Envelop findLatelyIndex(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "type", value = "类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温,7呼吸)") @RequestParam(value = "type", required = true) String type) {
        try {
            return ObjEnvelop.getSuccess( "查询成功", doctorSchemeService.findLatelyIndex(patient, type));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
@ -312,12 +326,13 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
            @ApiParam(name = "startDate", value = "开始时间,YYYY-MM-dd") @RequestParam(value = "startDate", required = true) String startDate,
            @ApiParam(name = "endDate", value = "结束时间,YYYY-MM-dd") @RequestParam(value = "endDate", required = true) String endDate,
            @ApiParam(name = "type", value = "0血糖,1.血压") @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "doctorId", value = "医生id") @RequestParam(value = "doctorId", required = true) String doctorId) {
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "doctorId", value = "医生id") @RequestParam(value = "doctorId", required = false) String doctorId) {
        try {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
            }
            return write(200, "查询成功", "data", doctorSchemeService.getPatientHealthIndexNew(startDate, endDate, type, doctorId));
            return write(200, "查询成功", "data", doctorSchemeService.getPatientHealthIndexNew(startDate, endDate, type,patient, doctorId));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, e.getMessage());

+ 27 - 21
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/scheme/DoctorSchemeService.java

@ -787,10 +787,16 @@ public class DoctorSchemeService {
        return rs;
    }
    public Map<String, Object> getPatientHealthIndexNew(String startDate, String endDate, String type, String doctor) {
    public Map<String, Object> getPatientHealthIndexNew(String startDate, String endDate, String type,String patient, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        String filter = "";
        if(StringUtils.isNotBlank(patient)){
            filter += " AND i.user = '"+patient+"' ";
        }
        if(StringUtils.isNotBlank(patient)){
            filter += " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' ) ";
        }
        String highSql = "SELECT  " +
                " (bf.befHighCount + aft.aftHighCount) AS highCount " +
                " FROM " +
@ -805,9 +811,7 @@ public class DoctorSchemeService {
                " AND i.value2 in(1,3,5,7) " +
                " AND i.value1 > 7 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (" +
                "SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" + filter +
                " ) bf, " +
                " (  " +
                " SELECT " +
@ -820,8 +824,7 @@ public class DoctorSchemeService {
                " AND i.value2 in(2,4,6) " +
                " AND i.value1 > 11.1 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" + filter +
                " ) aft";
        String stdSql = "SELECT  " +
                " (bf.befHighCount + aft.aftHighCount) AS stdCount " +
@ -838,8 +841,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 7 " +
                " AND i.value1 >= 4 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" + filter +
                " ) bf, " +
                " (  " +
                " SELECT " +
@ -853,8 +855,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 11.1 " +
                " AND i.value1 >= 4 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" + filter +
                " ) aft";
        String lowSql = "SELECT  " +
                " (bf.befHighCount + aft.aftHighCount) AS lowCount " +
@ -870,8 +871,7 @@ public class DoctorSchemeService {
                " AND i.value2 in(1,3,5,7) " +
                " AND i.value1 < 4 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" +filter +
                " ) bf, " +
                " (  " +
                " SELECT " +
@ -884,8 +884,7 @@ public class DoctorSchemeService {
                " AND i.value2 in(2,4,6) " +
                " AND i.value1 < 4 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )" +
                " AND i.record_date <='" + endDate + "'" +filter +
                " ) aft";
        String pHighSql = "SELECT " +
@ -897,8 +896,7 @@ public class DoctorSchemeService {
                " AND i.type = '2' " +
                " AND i.value1 > 139 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
                " AND i.record_date <='" + endDate + "'" +filter ;
        String pStdSql = "SELECT " +
                " count(1) AS stdCount " +
                " FROM " +
@ -909,8 +907,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 139 " +
                " AND i.value1 >= 90 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "' )";
                " AND i.record_date <='" + endDate + "'" +filter ;
        String pLowSql = "SELECT " +
                " count(1) AS lowCount " +
                " FROM " +
@ -920,8 +917,7 @@ public class DoctorSchemeService {
                " AND i.type = '2' " +
                " AND i.value1 < 90 " +
                " AND i.record_date >='" + startDate + "'" +
                " AND i.record_date <='" + endDate + "'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='" + doctor + "')";
                " AND i.record_date <='" + endDate + "'" +filter ;
        Map<String, Object> rs = new HashedMap();
        //0血檀
@ -1040,6 +1036,16 @@ public class DoctorSchemeService {
        return rs;
    }
    //获取居民最近一次体征记录
    public DevicePatientHealthIndex findLatelyIndex(String patient,String type){
        String sql = "select * from wlyy_patient_health_index where user='"+patient+"' and type="+type+" order by id desc limit 1 ";
        List<DevicePatientHealthIndex> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(DevicePatientHealthIndex.class));
        if(list.size()>0){
            return list.get(0);
        }
        return null;
    }
    public List<Map<String, Object>> getBodyInfo(String patient, String startDate, String endDate, Integer page, Integer size) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";