|
@@ -2,6 +2,7 @@ package com.ruoyi.web.work.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import com.ruoyi.common.annotation.DataScope;
|
|
import com.ruoyi.common.annotation.DataScope;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
@@ -10,7 +11,9 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
import com.ruoyi.web.work.domain.*;
|
|
import com.ruoyi.web.work.domain.*;
|
|
import com.ruoyi.web.work.domain.dto.PatientCardDto;
|
|
import com.ruoyi.web.work.domain.dto.PatientCardDto;
|
|
|
|
+import com.ruoyi.web.work.domain.vo.VisitVoList;
|
|
import com.ruoyi.web.work.mapper.*;
|
|
import com.ruoyi.web.work.mapper.*;
|
|
|
|
+import com.ruoyi.web.work.service.IFollowRecordService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.ruoyi.web.work.service.IVisitService;
|
|
import com.ruoyi.web.work.service.IVisitService;
|
|
@@ -28,6 +31,9 @@ public class VisitServiceImpl extends ServiceImpl<VisitMapper, Visit> implements
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserMapper userMapper;
|
|
private SysUserMapper userMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFollowRecordService followRecordService;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<Visit> selectList(Visit visit) {
|
|
public List<Visit> selectList(Visit visit) {
|
|
@@ -35,34 +41,43 @@ public class VisitServiceImpl extends ServiceImpl<VisitMapper, Visit> implements
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @DataScope(deptAlias = "v",userAlias = "u")
|
|
|
|
- public List<PatientCardDto> getPatientCardByNameOrDepartmentOrPhysician(PatientCardDto patientCardDto) {
|
|
|
|
- return visitMapper.getPatientCardByNameOrDepartmentOrPhysician(patientCardDto);
|
|
|
|
-
|
|
|
|
|
|
+ @DataScope(deptAlias = "v", userAlias = "u")
|
|
|
|
+ public List<VisitVoList> getPatientCardByNameOrDepartmentOrPhysician(PatientCardDto patientCardDto) {
|
|
|
|
+ List<VisitVoList> list = visitMapper.getPatientCardByNameOrDepartmentOrPhysician(patientCardDto);
|
|
|
|
+ list.forEach(e -> {
|
|
|
|
+ List<FollowRecord> records = followRecordService.selectList(new FollowRecord().setPatientId(e.getPatId()).setDelFlag(0));
|
|
|
|
+ if (!records.isEmpty()) {
|
|
|
|
+ e.setUp(records.stream().filter(record -> record.getType() == 0).collect(Collectors.toList()).size());
|
|
|
|
+ e.setUpRead(records.stream().filter(record -> record.getType() == 0 && record.getState() == 1).collect(Collectors.toList()).size());
|
|
|
|
+ e.setRecord(records.stream().filter(record -> record.getType() == 1).collect(Collectors.toList()).size());
|
|
|
|
+ e.setRecordRead(records.stream().filter(record -> record.getType() == 1 && record.getState() == 1).collect(Collectors.toList()).size());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Visit> getVisitByPatId(String patId,String startTime,String endTime) {
|
|
|
|
- return visitMapper.selectVisitsByPatId(patId,startTime,endTime);
|
|
|
|
|
|
+ public List<Visit> getVisitByPatId(String patId, String startTime, String endTime) {
|
|
|
|
+ return visitMapper.selectVisitsByPatId(patId, startTime, endTime);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据deptId获取所有部门的患者
|
|
* 根据deptId获取所有部门的患者
|
|
|
|
+ *
|
|
* @param deptId
|
|
* @param deptId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<Visit> getPatientByDeptId(Long deptId,String userName) {
|
|
|
|
|
|
+ public List<Visit> getPatientByDeptId(Long deptId, String userName) {
|
|
SysUser sysUser = userMapper.queryUserByUserName(userName);
|
|
SysUser sysUser = userMapper.queryUserByUserName(userName);
|
|
- if (sysUser != null){
|
|
|
|
|
|
+ if (sysUser != null) {
|
|
String dirDocSign = sysUser.getDirDocSign();
|
|
String dirDocSign = sysUser.getDirDocSign();
|
|
- if ("1".equals(dirDocSign)){
|
|
|
|
|
|
+ if ("1".equals(dirDocSign)) {
|
|
//获取所有部门下的所有患者
|
|
//获取所有部门下的所有患者
|
|
return visitMapper.selectVisitsByDeptId(deptId);
|
|
return visitMapper.selectVisitsByDeptId(deptId);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
//获取当前用户部门下的患者信息
|
|
//获取当前用户部门下的患者信息
|
|
- return visitMapper.selectVisitsByIdAndUserName(deptId,userName);
|
|
|
|
|
|
+ return visitMapper.selectVisitsByIdAndUserName(deptId, userName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new ServiceException("当前用户不存在");
|
|
throw new ServiceException("当前用户不存在");
|