Browse Source

代码修改

LAPTOP-KB9HII50\70708 1 năm trước cách đây
mục cha
commit
445fd7eb7f

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -7,7 +7,6 @@ import com.yihu.jw.base.dao.servicePackage.ServicePackageRecordDao;
import com.yihu.jw.base.dao.servicePackage.ServicePackageSignRecordDao;
import com.yihu.jw.base.dao.sign.ArchiveDao;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.WlyyPatientLabelDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.contant.CommonContant;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -18,6 +17,7 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.label.WlyyPatientLabelDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;

+ 108 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/LabelController.java

@ -0,0 +1,108 @@
package com.yihu.jw.hospital.module.common;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.hospital.module.common.service.LabelService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.entity.ServiceException;
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.*;
import java.util.List;
/**
 * Created by yeshijie on 2024/3/4.
 */
@RestController
@RequestMapping("patientLable")
@Api(tags = "居民标签")
public class LabelController extends EnvelopRestEndpoint {
    @Autowired
    private LabelService labelService;
    @GetMapping(value = "patientLabelLogPage")
    @ApiOperation(value = "查询标签新增日志", notes = "查询标签新增日志")
    public Envelop patientLabelLogPage(@ApiParam(name = "patient", value = "居民id")
                                       @RequestParam(value = "patient", required = false) String patient,
                                       @ApiParam(name = "doctor", value = "医生id")
                                       @RequestParam(value = "doctor", required = false) String doctor,
                                       @ApiParam(name = "labelType", value = "标签类型")
                                       @RequestParam(value = "labelType", required = false) String labelType,
                                       @ApiParam(name = "page", value = "第几页")
                                       @RequestParam(value = "page", required = true) Integer page,
                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true) Integer size) {
        try {
            return labelService.patientLabelLogPage(patient, doctor, labelType, page, size);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = "existDisease")
    @ApiOperation(value = "查询专病的康复管理未执行完成数量")
    public ObjEnvelop existDisease(@ApiParam(name = "patient", value = "居民id")
                                    @RequestParam(value = "patient", required = true) String patient,
                                    @ApiParam(name = "disease", value = "专病id")
                                    @RequestParam(value = "disease", required = true) String disease) {
        try {
            return ObjEnvelop.getSuccess("查询成功", labelService.existDisease(patient,disease));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findPatientLabel")
    @ApiOperation(value = "查询居民标签列表")
    public ListEnvelop findPatientLabel(@ApiParam(name = "patient", value = "居民id")
                                        @RequestParam(value = "patient", required = true) String patient) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findByPatient(patient));
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "savePatientLabel")
    @ApiOperation(value = "保存居民标签", notes = "保存居民标签")
    public Envelop savePatientLabel(@ApiParam(name = "patient", value = "居民ID")
                                    @RequestParam(value = "patient", required = true) String patient,
                                    @ApiParam(name = "doctor", value = "医生ID")
                                    @RequestParam(value = "doctor", required = true) String doctor,
                                    @ApiParam(name = "labelDOS", value = "标签集合",required = false)
                                    @RequestParam(value = "labelDOS", required = false) String labelDOS) {
        try {
            List<WlyyPatientLabelDO> labels = null;
            if(StringUtils.isNotBlank(labelDOS)){
                labels = JSONObject.parseArray(labelDOS,WlyyPatientLabelDO.class);
            }
            labelService.savePatientLabel(labels,patient,doctor);
            return success("保存成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping(value = "addLabelDict")
    @ApiOperation(value = "添加自定义标签字典", notes = "添加自定义标签字典")
    public ObjEnvelop addLabelDict(@ApiParam(name = "labelName", value = "标签名称")
                                   @RequestParam(value = "labelName", required = true) String labelName) {
        try {
            return success(labelService.addLabelDict(labelName));
        }catch (ServiceException se){
            return ObjEnvelop.getError(se.getMessage());
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
}

+ 143 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java

@ -0,0 +1,143 @@
package com.yihu.jw.hospital.module.common.service;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelLogDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.label.WlyyPatientLabelDao;
import com.yihu.jw.label.WlyyPatientLabelLogDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.entity.ServiceException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * Created by yeshijie on 2024/3/4.
 */
@Service
public class LabelService {
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private WlyyPatientLabelLogDao logDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public List<WlyyPatientLabelDO> findByPatient(String patient){
        return patientLabelDao.findByPatient(patient);
    }
    //查询专病的康复管理未执行完成数量
    public int existDisease(String patient,String disease){
        String sql = "SELECT COUNT(id) from wlyy_patient_rehabilitation_plan " +
                " WHERE patient='"+patient+"' and disease ='"+disease+"' and `status` in (1,3)";
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    //添加专病标签
    public void addDiseaseLable(String patient,String disease,String diseaseName){
        try {
            if(patientLabelDao.findByPatient(patient,disease,"3").size()==0){
                WlyyPatientLabelDO label = new WlyyPatientLabelDO();
                label.setCzrq(new Date());
                label.setIsSystem(0);
                label.setPatient(patient);
                label.setLabelCode(disease);
                label.setLabelName(diseaseName);
                label.setLabelType("3");
                patientLabelDao.save(label);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    //查询标签新增日志
    public PageEnvelop patientLabelLogPage(String patient, String doctor, String labelType, int page, int size){
        String sql = "select * ";
        String countSql = "select count(*) ";
        String filter = " from wlyy_patient_label_log where 1=1 ";
        String orderBy = " order by create_time desc limit "+(page-1)*size+","+size;
        if(StringUtils.isNotBlank(patient)){
            filter += " and patient = '"+patient+"' ";
        }
        if(StringUtils.isNotBlank(doctor)){
            filter += " and doctor = '"+doctor+"' ";
        }
        if(StringUtils.isNotBlank(labelType)){
            filter += " and label_type = '"+labelType+"' ";
        }
        List<WlyyPatientLabelLogDO> logDOS = jdbcTemplate.query(sql+filter+orderBy,new BeanPropertyRowMapper<>(WlyyPatientLabelLogDO.class));
        Long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",logDOS,page,size,count);
    }
    //保存居民标签
    public void savePatientLabel(List<WlyyPatientLabelDO> labelDOS, String patient,String doctor) throws Exception{
        List<WlyyPatientLabelDO> patientLabelDOS = patientLabelDao.findByPatient(patient);
        Map<String,String> map = new HashMap<>();
        for (WlyyPatientLabelDO label:patientLabelDOS){
            String labelCode = label.getLabelCode();
            String labelType = label.getLabelType();
            map.put(labelType+"_"+labelCode,label.getLabelName());
        }
        patientLabelDao.deleteByPatient(patient);
        List<WlyyPatientLabelLogDO> labelLogDOS = new ArrayList<>();
        Date now = new Date();
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
        if(labelDOS!=null&&labelDOS.size()>0){
            for (WlyyPatientLabelDO label:labelDOS){
                label.setPatient(patient);
                label.setCzrq(new Date());
                label.setIsSystem(0);
                String key = label.getLabelType()+"_"+label.getLabelCode();
                if(!map.containsKey(key)){
                    WlyyPatientLabelLogDO logDO = new WlyyPatientLabelLogDO();
                    logDO.setCreateTime(now);
                    logDO.setPatient(patient);
                    logDO.setDoctor(doctor);
                    logDO.setDoctorName(doctorDO.getName());
                    logDO.setLabelCode(label.getLabelCode());
                    logDO.setLabelName(label.getLabelName());
                    logDO.setLabelType(label.getLabelType());
                    logDO.setJobTitle(doctorDO.getJobTitleName());
                    labelLogDOS.add(logDO);
                }
            }
            patientLabelDao.saveAll(labelDOS);
            if(labelLogDOS.size()>0){
                logDao.saveAll(labelLogDOS);
            }
        }
    }
    //添加自定义标签字典
    public WlyyHospitalSysDictDO addLabelDict(String labelName) throws Exception{
        if(StringUtils.isBlank(labelName)){
            throw new ServiceException("请填写分组名称");
        }
        labelName = labelName.trim();
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom",labelName);
        if(dictDOList.size()>0){
            throw new ServiceException("该分组已存在");
        }
        WlyyHospitalSysDictDO dictDO = new WlyyHospitalSysDictDO();
        dictDO.setDictValue(labelName);
        dictDO.setDictCode(labelName);
        dictDO.setDictName("patient_lable_custom");
        dictDO = wlyyHospitalSysDictDao.save(dictDO);
        return dictDO;
    }
}

+ 6 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationManageService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.hospital.module.common.service.LabelService;
import com.yihu.jw.hospital.module.followup.dao.FollowUpDao;
import com.yihu.jw.hospital.module.followup.service.FollowUpService;
import com.yihu.jw.hospital.module.rehabilitation.dao.*;
@ -97,6 +98,8 @@ public class RehabilitationManageService {
    private FollowUpService followUpService;
    @Autowired
    private FollowUpDao followupDao;
    @Autowired
    private LabelService labelService;
    //近期康复记录
    public Envelop recentServiceItemPlanRecords(String patient, Integer page, Integer size) {
@ -173,6 +176,9 @@ public class RehabilitationManageService {
            infoDO.setStatus(7);
            rehabilitationPatientInfoDao.save(infoDO);
        }
        //添加专病标签
        labelService.addDiseaseLable(planDO1.getPatient(),planDO1.getDisease(),planDO1.getDiseaseName());
    }
    public List<ServiceItemPlanDO> addServicePlan(Map<String, String> serviceItemMap, PatientRehabilitationPlanDO planDO,