LAPTOP-KB9HII50\70708 11 ヶ月 前
コミット
76aa4ac544

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

@ -3,16 +3,14 @@ package com.yihu.jw.hospital.module.health.controller;
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.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@ -30,6 +28,35 @@ public class ChronicDiseaseController extends EnvelopRestEndpoint {
    @Autowired
    private DoctorSchemeService doctorSchemeService;
    @PostMapping(value = "delTrack")
    @ApiOperation("取消重点关注")
    public Envelop delTrack(
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            doctorSchemeService.delTrack(patient,doctor);
            return Envelop.getSuccess("取消成功");
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("取消失败");
        }
    }
    @PostMapping(value = "addTrack")
    @ApiOperation("添加重点关注")
    public Envelop addTrack(
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            doctorSchemeService.addTrack(patient,doctor);
            return Envelop.getSuccess("添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("添加失败");
        }
    }
    /**
     * 获取i健康的数据-同安签约居民,并且是三院关系的,有慢病的

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

@ -7,9 +7,11 @@ import com.yihu.jw.device.dao.DevicePatientHealthIndexDao;
import com.yihu.jw.device.dao.PatientAimBloodPressureDao;
import com.yihu.jw.device.dao.PatientAimBloodSuggerDao;
import com.yihu.jw.device.dao.PatientAimSportsDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.device.PatientAimBloodPressure;
import com.yihu.jw.entity.base.device.PatientAimBloodSugger;
import com.yihu.jw.entity.base.device.PatientAimSports;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.scheme.*;
@ -68,7 +70,8 @@ public class DoctorSchemeService {
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
@ -90,6 +93,56 @@ public class DoctorSchemeService {
    @Value("${im.data_base_name}")
    private String im_dataBase_name;
    //取消重点关注
    public void delTrack(String patient,String doctor){
        synchronized (patient.intern()){
            //查询是否与医生建立重点跟踪关系,诺无关系则建立
            TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
            if(trackPatient == null){
                BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
                BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
                TrackPatient t = new TrackPatient();
                t.setCreateTime(new Date());
                t.setDoctorCode(doctorDO.getId());
                t.setDoctorName(doctorDO.getName());
                t.setIdcard(patientDO.getIdcard());
                t.setSsc(patientDO.getSsc());
                t.setPatientCode(patient);
                t.setPatientName(patientDO.getName());
                t.setDel("0");
                trackPatientDao.save(t);
            }else {
                trackPatient.setDel("0");
                trackPatientDao.save(trackPatient);
            }
        }
    }
    //添加重点关注
    public void addTrack(String patient,String doctor){
        synchronized (patient.intern()){
            //查询是否与医生建立重点跟踪关系,诺无关系则建立
            TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
            if(trackPatient == null){
                BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
                BasePatientDO patientDO = patientDao.findByIdAndDel(patient,"1");
                TrackPatient t = new TrackPatient();
                t.setCreateTime(new Date());
                t.setDoctorCode(doctorDO.getId());
                t.setDoctorName(doctorDO.getName());
                t.setIdcard(patientDO.getIdcard());
                t.setSsc(patientDO.getSsc());
                t.setPatientCode(patient);
                t.setPatientName(patientDO.getName());
                t.setDel("1");
                trackPatientDao.save(t);
            }else {
                trackPatient.setDel("1");
                trackPatientDao.save(trackPatient);
            }
        }
    }
    /**
     * 根据团队CODE/居民标签/病情/设备绑定状态查询团队具名CODE列表
@ -1044,7 +1097,6 @@ public class DoctorSchemeService {
    }
    public Map<String, Object> getTrackPatientCountTitle(String doctor, String startDate, String endDate) {
//        List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctor, teamCode, "1");
        List<TrackPatient> trackPatients = trackPatientDao.findByDoctor(doctor, "1");
        Map<String, Object> rs = new HashedMap();
        rs.put("trackPatientCount", trackPatients.size());