Browse Source

代码修改

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
4fdcf4c0b1

+ 5 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/dao/ServiceItemPlanDao.java

@ -18,6 +18,11 @@ public interface ServiceItemPlanDao extends PagingAndSortingRepository<ServiceIt
    @Query("from ServiceItemPlanDO w where w.planId =?1 ")
    List<ServiceItemPlanDO> findByPlanId(String planId);
    ServiceItemPlanDO findByRelationCodeAndRelationType(String relationCode,String relationType);
    @Query("from ServiceItemPlanDO w where w.planDetailId =?1 and w.status=?2")
    List<ServiceItemPlanDO> findByPlanDetailId(String planDetailId,String status);
    @Modifying
    @Query(value ="UPDATE  base_service_item_plan SET status='1' ,complete_time=?3 WHERE status='0' AND plan_id=?1 AND plan_detail_id=?2 ORDER BY plan_time DESC LIMIT 1", nativeQuery = true)
    void updateState(String planId, String planDetailId, Date date);

+ 7 - 27
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/service/FollowUpService.java

@ -9,16 +9,17 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServiceItemPlanDO;
import com.yihu.jw.entity.followup.Followup;
import com.yihu.jw.entity.followup.FollowupContent;
import com.yihu.jw.entity.followup.FollowupMapping;
import com.yihu.jw.entity.followup.FollowupSign;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.MessageNoticeSetting;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.module.followup.dao.*;
import com.yihu.jw.hospital.module.followup.dao.FollowUpDao;
import com.yihu.jw.hospital.module.followup.dao.FollowupContentDao;
import com.yihu.jw.hospital.module.followup.dao.FollowupDrugsDao;
import com.yihu.jw.hospital.module.followup.dao.FollowupSignDao;
import com.yihu.jw.hospital.module.rehabilitation.service.RehabilitationManageService;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.task.PushMsgTask;
@ -97,7 +98,7 @@ public class FollowUpService {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private FollowUpMappingDao followUpMappingDao;
    private RehabilitationManageService rehabilitationManageService;
    @Autowired
    private FollowupDrugsDao followupDrugsDao;
@ -123,14 +124,6 @@ public class FollowUpService {
    private FollowupSignDao followupSignDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Value("${fastDFS.fastdfs_file_url}")
    private String imgUrlDomain;
    @Autowired
    private RehabilitationManageService rehabilitationManageService;
    //字典
    public String getDictValue(String dictName,String code){
@ -839,20 +832,8 @@ public class FollowUpService {
            followup.setStatus("1");  //状态 0取消 1已完成 2未开始 3进行中
            followup = followupDao.save(followup);
            //上传随访计划映射表记录
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            if (followupMapping == null) {
                followupMapping = new FollowupMapping();
            }
            followupMapping.setFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            followupMapping.setCode(UUID.randomUUID().toString());
            followupMapping.setCreateTime(DateUtil.getNowTimestamp());
            followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
            followupMapping.setNeedUpload(1);
            followUpMappingDao.save(followupMapping);
            //关联康复计划完成
            rehabilitationManageService.completePlanFollowup(followup.getId());
            //随访完成,增加随访状态完成的标记
//            Prescription prescription = prescriptionDao.findByCode(followup.getPrescriptionCode());
@ -861,7 +842,6 @@ public class FollowUpService {
//                prescriptionDao.save(prescription);
//            }
//            new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
        } else {
            throw new RuntimeException("查找不到该随访计划!");
        }

+ 16 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/PatientRehabilitationManageController.java

@ -54,9 +54,22 @@ public class PatientRehabilitationManageController extends EnvelopRestEndpoint {
    private PatientRestTimeService patientRestTimeService;
    @Autowired
    private DrugsPlanService drugsPlanService;
//    @Autowired
//    private GuahaoXMService guahaoXM;//挂号
    @RequestMapping(value = "recentServiceItemPlanRecords", method = RequestMethod.GET)
    @ApiOperation("近期康复记录")
    public Envelop recentServiceItemPlanRecords(@ApiParam(name = "patient", value = "居民code", required = true)
                                      @RequestParam(value = "patient", required = true) String patient,
                                      @ApiParam(name = "page", value = "第几页", required = true)
                                      @RequestParam(value = "page", required = true) Integer page,
                                      @ApiParam(name = "size", value = "分页大小", required = true)
                                      @RequestParam(value = "size", required = true) Integer size) {
        try {
            return rehabilitationManageService.recentServiceItemPlanRecords(patient, page, size);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @RequestMapping(value = "selectPlanByPatient", method = RequestMethod.GET)
    @ApiOperation("康复管理-根据居民code查找康复计划")
@ -68,7 +81,7 @@ public class PatientRehabilitationManageController extends EnvelopRestEndpoint {
            List<Map<String, Object>> result = rehabilitationManageService.selectPlanByPatient(patient, status, null, null);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            return error(-1, "请求失败");
            return error(-1, "查询失败");
        }
    }

+ 20 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/RehabilitationManageController.java

@ -37,6 +37,26 @@ public class RehabilitationManageController extends EnvelopRestEndpoint {
    @Autowired
    private SynchronizePatientService synchronizePatientService;
    @PostMapping(value = "completePlan")
    @ApiOperation("确认完成服务,填写服务笔记")
    public Envelop completePlan(
            @ApiParam(name = "id", value = "执行计划id", required = true)
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "content", value = "服务完成笔记", required = false)
            @RequestParam(value = "content", required = false) String content,
            @ApiParam(name = "appendixs", value = "附件", required = false)
            @RequestParam(value = "appendixs", required = false) String appendixs) {
        try {
            rehabilitationManageService.completePlan(id,content,appendixs,getUID());
            return Envelop.getSuccess("操作成功");
        }catch (ServiceException se){
            return Envelop.getError(se.getMessage());
        }catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
    }
    @GetMapping(value = "rehabilitationDetailInfo")
    @ApiOperation("康复计划服务项列表")
    public Envelop rehabilitationDetailInfo(

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

@ -26,6 +26,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
@ -96,6 +97,17 @@ public class RehabilitationManageService {
    @Autowired
    private FollowUpDao followupDao;
    //近期康复记录
    public Envelop recentServiceItemPlanRecords(String patient,Integer page,Integer size){
        String sql = "select p.* ";
        String countSql = "select count(p.id) ";
        String filter = " from base_service_item_plan p where p.patient='"+patient+"' and p.plan_time<='"+DateUtil.getStringDateShort()+" 23:59:59' ";
        String ordereBy = " order by p.plan_time desc limit "+(page-1)*size+","+size;
        List<ServiceItemPlanDO> planDOList = jdbcTemplate.query(sql+filter+ordereBy,new BeanPropertyRowMapper<>(ServiceItemPlanDO.class));
        long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("获取成功",planDOList,page,size,count);
    }
    //添加康复计划日志
    public void addPlanLog(String planId,String doctorCode,String doctorName){
        if(StringUtils.isBlank(doctorCode)){
@ -1348,6 +1360,56 @@ public class RehabilitationManageService {
        return detailDOList;
    }
    //确认完成服务,填写服务笔记
    public ServiceItemPlanDO completePlan(String id,String content,String appendixs,String doctor){
        ServiceItemPlanDO planDO = serviceItemPlanDao.findById(id).orElse(null);
        if(!planDO.getDoctor().equals(doctor)){
            throw new ServiceException("不是您的任务,无法完成");
        }
        if("1".equals(planDO.getStatus())){
            throw new ServiceException("请勿重复填写");
        }
        planDO.setAppendixs(appendixs);
        planDO.setContent(content);
        planDO = completePlan(planDO);
        return planDO;
    }
    public ServiceItemPlanDO completePlan(ServiceItemPlanDO planDO){
        planDO.setStatus("1");
        planDO.setCompleteTime(DateUtil.getStringDate());
        serviceItemPlanDao.save(planDO);
        updPlanStatus(planDO.getPlanId(),planDO.getPlanDetailId());
        return planDO;
    }
    //完成随访
    public ServiceItemPlanDO completePlanFollowup(Long followupId){
        ServiceItemPlanDO serviceItemPlanDO = serviceItemPlanDao.findByRelationCodeAndRelationType(followupId+"","6");
        if(serviceItemPlanDO!=null&&"0".equals(serviceItemPlanDO.getStatus())){
            serviceItemPlanDO = completePlan(serviceItemPlanDO);
        }
        return serviceItemPlanDO;
    }
    //康复计划状态更新
    public void updPlanStatus(String planId,String planDetailId){
        List<ServiceItemPlanDO> itemPlanDOS =  serviceItemPlanDao.findByPlanDetailId(planDetailId,"0");
        if(itemPlanDOS.size()>0){
            //服务项计划都完成了
            jdbcTemplate.update("update wlyy_rehabilitation_plan_detail set status=1 where id='"+planDetailId+"'");
            String sql = "SELECT COUNT(*) total,COUNT(if(`status`=1,1,null)) num from wlyy_rehabilitation_plan_detail  " +
                    "WHERE plan_id='"+planId+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            String total = list.get(0).get("total")+"";
            String num = list.get(0).get("num")+"";
            if(total.equals(num)){
                jdbcTemplate.update("update wlyy_patient_rehabilitation_plan set status=2 where id='"+planId+"'");
            }
        }
    }
    //执行计划详情
    public ServiceItemPlanDO findServiceItemPlanDetail(String id){
        ServiceItemPlanDO planDO = serviceItemPlanDao.findById(id).orElse(null);
@ -1388,7 +1450,16 @@ public class RehabilitationManageService {
    @Transactional
    public Envelop saveGuidanceMessage(String messageId, String doctor, Integer doctorType, String content,String imgs,
                                       String planDetailId, Integer contentType) {
        GuidanceMessageLogDO guidanceMessageLogDO = new GuidanceMessageLogDO();
        GuidanceMessageLogDO guidanceMessageLogDO = null;
        List<GuidanceMessageLogDO> logDOS =  guidanceMessageLogDao.findByPlanDetailId(planDetailId);
        if(logDOS.size()>0){
            guidanceMessageLogDO = logDOS.get(0);
            guidanceMessageLogDO.setUpdateTime(new Date());
        }else {
            guidanceMessageLogDO = new GuidanceMessageLogDO();
            guidanceMessageLogDO.setCreateTime(new Date());
            guidanceMessageLogDO.setUpdateTime(new Date());
        }
        guidanceMessageLogDO.setMessageId(messageId);
        guidanceMessageLogDO.setPlanDetailId(planDetailId);
        guidanceMessageLogDO.setContent(content);
@ -1400,8 +1471,6 @@ public class RehabilitationManageService {
//        guidanceMessageLogDO.setAdminTeamCode(adminTeamCode);
//        guidanceMessageLogDO.setAdminTeamName(adminTeamName);
        guidanceMessageLogDO.setDoctorName(doctorDO.getName());
        guidanceMessageLogDO.setCreateTime(new Date());
        guidanceMessageLogDO.setUpdateTime(new Date());
        guidanceMessageLogDO = guidanceMessageLogDao.save(guidanceMessageLogDO);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,guidanceMessageLogDO);
    }