Browse Source

查询患者查询绑定平车

pt
hyy-alt 4 years ago
parent
commit
80bbe0a484
  1. 30
      cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/TaskDto.java
  2. 23
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  3. 6
      cloudutil/src/main/resources/application-util-dev.yml
  4. 19
      cloudutil/src/main/resources/application-util-green.yml
  5. 12
      cloudutil/src/main/resources/application-util-greenvalley.yml
  6. 11
      cloudutil/src/main/resources/application-util-prod.yml
  7. 13
      cloudutil/src/main/resources/application-util-prodsd.yml
  8. 18
      cloudutil/src/main/resources/application-util-test.yml
  9. 2
      mt/src/main/java/com/ccsens/mt/service/ProvinceService.java
  10. 1
      tall/src/main/java/com/ccsens/tall/config/SpringConfig.java
  11. 3
      tall/src/main/java/com/ccsens/tall/service/IProMemberService.java
  12. 157
      tall/src/main/java/com/ccsens/tall/service/ProMemberService.java
  13. 6
      tall/src/main/java/com/ccsens/tall/service/ProRoleService.java
  14. 46
      tall/src/main/java/com/ccsens/tall/service/ProjectService.java
  15. 105
      tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java
  16. 3
      tall/src/main/java/com/ccsens/tall/web/MemberController.java
  17. 11
      tall/src/main/java/com/ccsens/tall/web/TaskController.java
  18. 2
      util/src/main/java/com/ccsens/util/CodeEnum.java
  19. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/api/WisdomCarController.java
  20. 2
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/CreateCaseDto.java
  21. 19
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/WisdomCarDto.java
  22. 84
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientDoctor.java
  23. 561
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientDoctorExample.java
  24. 11
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/Step.java
  25. 70
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepExample.java
  26. 13
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/WisdomCarVo.java
  27. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/HospitalWrokingDao.java
  28. 12
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientDoctorDao.java
  29. 9
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StepTaskDao.java
  30. 9
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarDao.java
  31. 11
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java
  32. 30
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/mapper/PatientDoctorMapper.java
  33. 71
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/AsyncService.java
  34. 20
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IAsyncService.java
  35. 10
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IProjectService.java
  36. 69
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java
  37. 12
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java
  38. 103
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/WisdomCarService.java
  39. 13
      wisdomcar/src/main/java/com/ccsens/wisdomcar/util/Constant.java
  40. 4
      wisdomcar/src/main/resources/application.yml
  41. 12
      wisdomcar/src/main/resources/mapper_dao/HospitalWorkingDao.xml
  42. 18
      wisdomcar/src/main/resources/mapper_dao/StepTaskDao.xml
  43. 24
      wisdomcar/src/main/resources/mapper_dao/WisdomCarDao.xml
  44. 43
      wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml
  45. 228
      wisdomcar/src/main/resources/mapper_raw/PatientDoctorMapper.xml
  46. 27
      wisdomcar/src/main/resources/mapper_raw/StepMapper.xml

30
cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/TaskDto.java

@ -0,0 +1,30 @@
package com.ccsens.cloudutil.bean.tall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @description:
* @author: whj
* @time: 2021/6/3 10:10
*/
public class TaskDto {
@ApiModel
@Data
public static class StartTask {
@ApiModelProperty("项目Id")
@NotNull(message = "projectId is required.")
private Long projectId;
@ApiModelProperty("角色Id")
@NotNull(message = "roleId is required.")
private Long roleId;
@ApiModelProperty("任务在当前时间的subTimeId")
@NotNull(message = "taskId is required.")
private Long taskId;
@ApiModelProperty("开始任务的时间 如果为空则为当前时间")
private Long startTime;
}
}

23
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -12,8 +12,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@ -250,12 +252,20 @@ public interface TallFeignClient {
/**
* 给复制后的模板项目添加成员
* @param memberForTemplate 项目id/角色名称/成员手机号或userId
* @param memberForTemplate 项目id和成员
* @return 成功/失败
*/
@RequestMapping(value = "/members/addMemberForTemplate",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
JsonResponse addMemberForTemplate(MemberRoleDto.SaveMemberForTemplate memberForTemplate);
JsonResponse addMemberForTemplate(QueryDto<MemberRoleDto.SaveMemberForTemplate> memberForTemplate);
/**
* 开始节点
* @param param 时间
* @return 结果
* @throws Exception
*/
@RequestMapping(value = "/tasks/start", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
JsonResponse startNode(TaskDto.StartTask param) throws Exception;
}
@ -423,8 +433,15 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
}
@Override
public JsonResponse addMemberForTemplate(QueryDto<MemberRoleDto.SaveMemberForTemplate> memberForTemplate) {
return JsonResponse.newInstance().fail();
}
@Override
public JsonResponse addMemberForTemplate(MemberRoleDto.SaveMemberForTemplate memberForTemplate) {
public JsonResponse startNode(TaskDto.StartTask param) throws Exception {
return JsonResponse.newInstance().fail();
}
};

6
cloudutil/src/main/resources/application-util-dev.yml

@ -31,8 +31,8 @@ eureka:
status-page-url-path: ${server.servlet.context-path}/actuator/info
health-check-url-path: ${server.servlet.context-path}/actuator/health
ribbon:
ConnectTimeout: 50000
ReadTimeout: 50000
ConnectTimeout: 60000
ReadTimeout: 60000
feign:
client:
config:
@ -50,6 +50,8 @@ hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:

19
cloudutil/src/main/resources/application-util-green.yml

@ -107,6 +107,25 @@ feign:
loggerLevel: basic
hystrix:
enabled: true
hystrix:
threadpool:
default:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

12
cloudutil/src/main/resources/application-util-greenvalley.yml

@ -43,6 +43,18 @@ feign:
loggerLevel: basic
hystrix:
enabled: true
hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

11
cloudutil/src/main/resources/application-util-prod.yml

@ -52,6 +52,17 @@ hystrix:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
command:
default:
execution:
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

13
cloudutil/src/main/resources/application-util-prodsd.yml

@ -52,6 +52,19 @@ hystrix:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

18
cloudutil/src/main/resources/application-util-test.yml

@ -101,8 +101,8 @@ feign:
client:
config:
default:
connectTime: 5000
readTimeout: 5000
connectTime: 60000
readTimeout: 60000
# NONE【性能最佳,适用于生产】:不记录任何日志(默认值)。
# BASIC【适用于生产环境追踪问题】:仅记录请求方法、URL、响应状态代码以及执行时间。
# HEADERS:记录BASIC级别的基础上,记录请求和响应的header。
@ -110,6 +110,20 @@ feign:
loggerLevel: basic
hystrix:
enabled: true
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:

2
mt/src/main/java/com/ccsens/mt/service/ProvinceService.java

@ -598,7 +598,7 @@ public class ProvinceService implements IProvinceService {
// }
//查找此公司此组别是否参加过这个项目
int num = competeCompanyDao.getNumByCompanyAndGroup(competeProject.getId(), player.getCompanyId(), player.getCompeteGroupId(), param.getCompeteTimeId());
if (num >= 2) {
if (num >= 2 && competeProject.getCertificate() == 0) {
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg1("该项目该组别"));
}
//查找个人参赛数量是否符合(个人比赛3个)

1
tall/src/main/java/com/ccsens/tall/config/SpringConfig.java

@ -156,6 +156,7 @@ public class SpringConfig implements WebMvcConfigurer {
.addPathPatterns("/delivers/**")
.addPathPatterns("/tasks/**")
.excludePathPatterns("/tasks/projectId")
.excludePathPatterns("/tasks/start")
.addPathPatterns("/members/**")
.addPathPatterns("/templates/**")
.addPathPatterns("/hardware/**")

3
tall/src/main/java/com/ccsens/tall/service/IProMemberService.java

@ -1,5 +1,6 @@
package com.ccsens.tall.service;
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto;
import com.ccsens.tall.bean.dto.MemberDto;
import com.ccsens.tall.bean.dto.ProjectDto;
import com.ccsens.tall.bean.po.ProMember;
@ -90,5 +91,5 @@ public interface IProMemberService {
* @param param 项目id,成员手机号
*
*/
void addMemberForTemplate(MemberDto.SaveMemberForTemplate param);
void addMemberForTemplate(MemberRoleDto.SaveMemberForTemplate param) throws Exception;
}

157
tall/src/main/java/com/ccsens/tall/service/ProMemberService.java

@ -524,18 +524,133 @@ public class ProMemberService implements IProMemberService {
@Override
public void addMemberForTemplate(MemberDto.SaveMemberForTemplate param) {
public void addMemberForTemplate(com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto.SaveMemberForTemplate param) throws Exception {
if (CollectionUtil.isNotEmpty(param.getMemberForTemplate())){
for (MemberDto.MemberForTemplate memberForTemplate : param.getMemberForTemplate()) {
for (com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto.MemberForTemplate memberForTemplate : param.getMemberForTemplate()) {
//知道成员的userId的情况
if (ObjectUtil.isNotNull(memberForTemplate.getUserId())){
SysUser user = userDao.selectByPrimaryKey(memberForTemplate.getUserId());
if (ObjectUtil.isNotNull(user)){
String phone = userService.getPhone(memberForTemplate.getUserId());
//用项目id和手机号判断用户是否存在
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPhoneEqualTo(phone);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
if (CollectionUtil.isNotEmpty(memberList)) {
//修改userId保持一致
ProMember proMember = new ProMember();
proMember.setId(memberList.get(0).getId());
proMember.setUserId(memberForTemplate.getUserId());
proMemberDao.updateByPrimaryKeySelective(proMember);
SysUser oldUser = userDao.selectByPrimaryKey(proMember.getUserId());
if (ObjectUtil.isNotNull(oldUser)){
//添加用户关注项目信息
if (ObjectUtil.isNotNull(oldUser.getId())) {
//查找此用户是否以关注项目
UserAttentionExample attentionExample = new UserAttentionExample();
attentionExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(oldUser.getId());
if (userAttentionDao.countByExample(attentionExample) <= 0) {
UserAttention userAttention = new UserAttention();
userAttention.setId(snowflake.nextId());
userAttention.setUserId(oldUser.getId());
userAttention.setProjectId(param.getProjectId());
userAttentionDao.insertSelective(userAttention);
}
}
for (String roleName : memberForTemplate.getRoleName()) {
Long roleId = proRoleDao.findRoelIdByProjectAndName(param.getProjectId(),roleName);
if (null != roleId){
ProMemberRole proMemberRole = new MemberRoleDto();
proMemberRole.setId(snowflake.nextId());
proMemberRole.setRoleId(roleId);
proMemberRole.setMemberId(memberList.get(0).getId());
proMemberRoleDao.insertSelective(proMemberRole);
}
}
continue;
}
}
//添加成员
ProMember proMember = new ProMember();
proMember.setId(snowflake.nextId());
proMember.setPhone(phone);
proMember.setUserId(memberForTemplate.getUserId());
proMember.setProjectId(param.getProjectId());
if(ObjectUtil.isNotNull(user.getNickname())){
proMember.setNickname(user.getNickname());
}
proMemberDao.insertSelective(proMember);
//让成员关注项目
//添加用户关注项目信息
if (ObjectUtil.isNotNull(user.getId())) {
//查找此用户是否以关注项目
UserAttentionExample attentionExample = new UserAttentionExample();
attentionExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(user.getId());
if (userAttentionDao.countByExample(attentionExample) <= 0) {
UserAttention userAttention = new UserAttention();
userAttention.setId(snowflake.nextId());
userAttention.setUserId(user.getId());
userAttention.setProjectId(param.getProjectId());
userAttentionDao.insertSelective(userAttention);
}
}
for (String roleName : memberForTemplate.getRoleName()) {
Long roleId = proRoleDao.findRoelIdByProjectAndName(param.getProjectId(),roleName);
if (null != roleId){
ProMemberRole proMemberRole = new MemberRoleDto();
proMemberRole.setId(snowflake.nextId());
proMemberRole.setRoleId(roleId);
proMemberRole.setMemberId(proMember.getId());
proMemberRoleDao.insertSelective(proMemberRole);
}
}
}
}
//只有手机号的情况
if (ObjectUtil.isNotNull(memberForTemplate.getPhone())){
//用项目id和手机号判断用户是否存在
int isExist = proMemberDao.findUserIsExist(param.getProjectId(),memberForTemplate.getPhone());
if (0!=isExist) {
throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE);
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPhoneEqualTo(memberForTemplate.getPhone());
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
if (CollectionUtil.isNotEmpty(memberList)) {
Long userId = userService.selectUserIdByPhone(memberForTemplate.getPhone());
if (ObjectUtil.isNotNull(userId)){
//添加用户关注项目信息
if (ObjectUtil.isNotNull(userId)) {
//查找此用户是否以关注项目
UserAttentionExample attentionExample = new UserAttentionExample();
attentionExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(userId);
if (userAttentionDao.countByExample(attentionExample) <= 0) {
UserAttention userAttention = new UserAttention();
userAttention.setId(snowflake.nextId());
userAttention.setUserId(userId);
userAttention.setProjectId(param.getProjectId());
userAttentionDao.insertSelective(userAttention);
}
}
for (String roleName : memberForTemplate.getRoleName()) {
Long roleId = proRoleDao.findRoelIdByProjectAndName(param.getProjectId(),roleName);
if (null != roleId){
ProMemberRole proMemberRole = new MemberRoleDto();
proMemberRole.setId(snowflake.nextId());
proMemberRole.setRoleId(roleId);
proMemberRole.setMemberId(memberList.get(0).getId());
proMemberRoleDao.insertSelective(proMemberRole);
}
}
continue;
}
}
//添加成员
ProMember proMember = new ProMember();
proMember.setId(snowflake.nextId());
@ -558,38 +673,6 @@ public class ProMemberService implements IProMemberService {
}
}
//知道成员的userId的情况
if (ObjectUtil.isNotNull(memberForTemplate.getUserId())){
SysUser user = userDao.selectByPrimaryKey(memberForTemplate.getUserId());
String phone = userService.getPhone(memberForTemplate.getUserId());
//用项目id和手机号判断用户是否存在
int isExist = proMemberDao.findUserIsExist(param.getProjectId(),phone);
if (0!=isExist) {
throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE);
}
//添加成员
ProMember proMember = new ProMember();
proMember.setId(snowflake.nextId());
proMember.setPhone(phone);
proMember.setUserId(memberForTemplate.getUserId());
proMember.setProjectId(param.getProjectId());
if(ObjectUtil.isNotNull(user.getNickname())){
proMember.setNickname(user.getNickname());
}
proMemberDao.insertSelective(proMember);
for (String roleName : memberForTemplate.getRoleName()) {
Long roleId = proRoleDao.findRoelIdByProjectAndName(param.getProjectId(),roleName);
if (null != roleId){
ProMemberRole proMemberRole = new MemberRoleDto();
proMemberRole.setId(snowflake.nextId());
proMemberRole.setRoleId(roleId);
proMemberRole.setMemberId(proMember.getId());
proMemberRoleDao.insertSelective(proMemberRole);
}
}
}
}
}

6
tall/src/main/java/com/ccsens/tall/service/ProRoleService.java

@ -906,7 +906,11 @@ public class ProRoleService implements IProRoleService {
}
//查询角色名字等具体信息
ProRole proRole = proRoleDao.selectByPrimaryKey(listBefor.get(i).getId());
listBefor.get(i).setName(proRole.getName());
if (ObjectUtil.isNotNull(proRole)){
//TODO NullPointerException
listBefor.get(i).setName(proRole.getName());
}
}
//项目虚拟角色
if (1 == listBefor.get(i).getRoleType()){

46
tall/src/main/java/com/ccsens/tall/service/ProjectService.java

@ -721,30 +721,30 @@ public class ProjectService implements IProjectService {
}
}
//当前创建人默认为项目经理
SysUser sysUser = sysUserDao.selectByPrimaryKey(userId);
// SysUser sysUser = sysUserDao.selectByPrimaryKey(userId);
//添加成员
ProMember proMember = new ProMember();
proMember.setId(snowflake.nextId());
proMember.setUserId(userId);
proMember.setProjectId(newProjectId);
proMember.setNickname(sysUser.getNickname());
proMember.setPhone(sysUser.getPhone());
proMemberDao.insertSelective(proMember);
// ProMember proMember = new ProMember();
// proMember.setId(snowflake.nextId());
// proMember.setUserId(userId);
// proMember.setProjectId(newProjectId);
// proMember.setNickname(sysUser.getNickname());
// proMember.setPhone(sysUser.getPhone());
// proMemberDao.insertSelective(proMember);
//查找项目经理的id
ProRoleExample proRoleExample=new ProRoleExample();
proRoleExample.createCriteria().andRecStatusEqualTo((byte)0).andNameEqualTo(WebConstant.ROLE_NAME.PM.value).andParentIdEqualTo(0L).andProjectIdEqualTo(newProjectId);
List<Long> firstPmId = proRoleDao.selectByExample(proRoleExample).stream().map(ProRole::getId).collect(Collectors.toList());
ProRoleExample secondPMExample=new ProRoleExample();
secondPMExample.createCriteria().andRecStatusEqualTo((byte)0).andParentIdIn(firstPmId);
List<ProRole> proRoles = proRoleDao.selectByExample(secondPMExample);
List<Long> secondPM = proRoles.stream().map(action->action.getId()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(secondPM)){
ProMemberRole proMemberRole = new ProMemberRole();
proMemberRole.setId(snowflake.nextId());
proMemberRole.setMemberId(proMember.getId());
proMemberRole.setRoleId(secondPM.get(0));
memberRoleDao.insertSelective(proMemberRole);
}
// ProRoleExample proRoleExample=new ProRoleExample();
// proRoleExample.createCriteria().andRecStatusEqualTo((byte)0).andNameEqualTo(WebConstant.ROLE_NAME.PM.value).andParentIdEqualTo(0L).andProjectIdEqualTo(newProjectId);
// List<Long> firstPmId = proRoleDao.selectByExample(proRoleExample).stream().map(ProRole::getId).collect(Collectors.toList());
// ProRoleExample secondPMExample=new ProRoleExample();
// secondPMExample.createCriteria().andRecStatusEqualTo((byte)0).andParentIdIn(firstPmId);
// List<ProRole> proRoles = proRoleDao.selectByExample(secondPMExample);
// List<Long> secondPM = proRoles.stream().map(action->action.getId()).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(secondPM)){
// ProMemberRole proMemberRole = new ProMemberRole();
// proMemberRole.setId(snowflake.nextId());
// proMemberRole.setMemberId(proMember.getId());
// proMemberRole.setRoleId(secondPM.get(0));
// memberRoleDao.insertSelective(proMemberRole);
// }
//添加对谁不可见
@ -1553,7 +1553,7 @@ public class ProjectService implements IProjectService {
copyRole(oldProject.getId(), newProject.getId(),userId,newProjectFeign);
//复制项目配置信息
copyProjectConfig(oldProject.getId(), newProject.getId(),userId);
//复制项目下的角色
return newProjectFeign;
}

105
tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java

@ -258,71 +258,74 @@ public class TaskSubTimeService implements ITaskSubTimeService {
//开始指定的任务
taskSubTime.setRealBeginTime(now);
if(taskSubTime.getRealEndTime() != 0){
if (taskSubTime.getRealEndTime() != 0) {
taskSubTime.setRealEndTime(0L);
}
taskSubTime.setComplatedStatus(1);
taskSubTimeDao.updateByPrimaryKeySelective(taskSubTime);
//查找任务的负责人名
String player = null;
ProTaskDetail taskDetail = taskDetailDao.selectByPrimaryKey(taskSubTime.getTaskDetailId());
if (ObjectUtil.isNotNull(taskDetail)) {
player = taskDetail.getDescription();
}
// //发送消息
// SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto();
// SyncMessageWithStartDto.Data syncMessageData = new SyncMessageWithStartDto.Data();
// syncMessageData.setPlayer(player);
// syncMessageData.setBeginTaskId(taskSubTime.getTaskDetailId());
// syncMessageData.setDuration(taskSubTime.getEndTime() - taskSubTime.getBeginTime());
// syncMessageData.setTime(now);
//接收者
List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>();
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(startTaskDto.getProjectId()).andUserIdNotEqualTo(0L);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
Set<String> userSet = new HashSet<>();
if (CollectionUtil.isNotEmpty(memberList)) {
for (ProMember member : memberList) {
if (ObjectUtil.isNotNull(member.getUserId())) {
BaseMessageDto.MessageUser messageUser = new BaseMessageDto.MessageUser();
messageUser.setUserId(member.getUserId());
messageUserList.add(messageUser);
userSet.add(member.getUserId().toString());
if (startTaskDto.getRoleId() != null && startTaskDto.getRoleId() != 0) {
// //发送消息
// SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto();
// SyncMessageWithStartDto.Data syncMessageData = new SyncMessageWithStartDto.Data();
// syncMessageData.setPlayer(player);
// syncMessageData.setBeginTaskId(taskSubTime.getTaskDetailId());
// syncMessageData.setDuration(taskSubTime.getEndTime() - taskSubTime.getBeginTime());
// syncMessageData.setTime(now);
//接收者
List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>();
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(startTaskDto.getProjectId()).andUserIdNotEqualTo(0L);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
Set<String> userSet = new HashSet<>();
if (CollectionUtil.isNotEmpty(memberList)) {
for (ProMember member : memberList) {
if (ObjectUtil.isNotNull(member.getUserId())) {
BaseMessageDto.MessageUser messageUser = new BaseMessageDto.MessageUser();
messageUser.setUserId(member.getUserId());
messageUserList.add(messageUser);
userSet.add(member.getUserId().toString());
}
}
}
BaseMessageDto.MessageUser messageUser1990 = new BaseMessageDto.MessageUser();
messageUser1990.setUserId(1990L);
messageUserList.add(messageUser1990);
userSet.add("1990");
BaseMessageDto.MessageUser messageUser1991 = new BaseMessageDto.MessageUser();
messageUser1991.setUserId(1991L);
messageUserList.add(messageUser1991);
userSet.add("1991");
BaseMessageDto.MessageUser messageUser1995 = new BaseMessageDto.MessageUser();
messageUser1995.setUserId(1995L);
messageUserList.add(messageUser1995);
userSet.add("1995");
BaseMessageDto.MessageUser messageUser1998 = new BaseMessageDto.MessageUser();
messageUser1998.setUserId(1998L);
messageUserList.add(messageUser1998);
userSet.add("1998");
Long duration = taskSubTime.getEndTime() - taskSubTime.getBeginTime();
SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto(startTaskDto.getProjectId(), null, null,
startTaskDto.getRoleId(), taskSubTime.getTaskDetailId(), null, now, duration, player);
// messageService.sendStartTaskMessage(syncMessage);
InMessage inMessage = new InMessage();
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(userSet);
inMessage.setData(JacksonUtil.beanToJson(syncMessage));
log.info("开始任务消息,{}", JacksonUtil.beanToJson(inMessage));
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME,
JacksonUtil.beanToJson(inMessage));
}
BaseMessageDto.MessageUser messageUser1990 = new BaseMessageDto.MessageUser();
messageUser1990.setUserId(1990L);
messageUserList.add(messageUser1990);
userSet.add("1990");
BaseMessageDto.MessageUser messageUser1991 = new BaseMessageDto.MessageUser();
messageUser1991.setUserId(1991L);
messageUserList.add(messageUser1991);
userSet.add("1991");
BaseMessageDto.MessageUser messageUser1995 = new BaseMessageDto.MessageUser();
messageUser1995.setUserId(1995L);
messageUserList.add(messageUser1995);
userSet.add("1995");
BaseMessageDto.MessageUser messageUser1998 = new BaseMessageDto.MessageUser();
messageUser1998.setUserId(1998L);
messageUserList.add(messageUser1998);
userSet.add("1998");
Long duration = taskSubTime.getEndTime() - taskSubTime.getBeginTime();
SyncMessageWithStartDto syncMessage = new SyncMessageWithStartDto(startTaskDto.getProjectId(),null,null,
startTaskDto.getRoleId(),taskSubTime.getTaskDetailId(),null,now,duration,player);
// messageService.sendStartTaskMessage(syncMessage);
InMessage inMessage = new InMessage();
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(userSet);
inMessage.setData(JacksonUtil.beanToJson(syncMessage));
log.info("开始任务消息,{}",JacksonUtil.beanToJson(inMessage));
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME,
JacksonUtil.beanToJson(inMessage));
//3.添加记录
proLogService.addNewProLog(now, taskSubTime.getId(),

3
tall/src/main/java/com/ccsens/tall/web/MemberController.java

@ -1,6 +1,7 @@
package com.ccsens.tall.web;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto;
import com.ccsens.tall.bean.dto.MemberDto;
import com.ccsens.tall.bean.dto.ProjectDto;
import com.ccsens.tall.bean.vo.ProjectVo;
@ -110,7 +111,7 @@ public class MemberController {
@ApiOperation(value = "复制后的项目添加成员", notes = "")
@RequestMapping(value = "/addMemberForTemplate", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse addMemberForTemplate(@ApiParam @Validated @RequestBody QueryDto<MemberDto.SaveMemberForTemplate> params) throws Exception {
public JsonResponse addMemberForTemplate(@ApiParam @Validated @RequestBody QueryDto<MemberRoleDto.SaveMemberForTemplate> params) throws Exception {
log.info("根据模板复制项目新:{}",params);
proMemberService.addMemberForTemplate(params.getParam());
log.info("根据模板复制项目新结束");

11
tall/src/main/java/com/ccsens/tall/web/TaskController.java

@ -14,6 +14,7 @@ import com.ccsens.util.bean.dto.QueryDto;
import io.jsonwebtoken.Claims;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -48,8 +49,14 @@ public class TaskController {
@ApiImplicitParams({
})
@RequestMapping(value = "start", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse startNode(HttpServletRequest request, @Validated @RequestBody TaskDto.StartTask dto) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
public JsonResponse startNode(HttpServletRequest request, @Validated @RequestBody com.ccsens.cloudutil.bean.tall.dto.TaskDto.StartTask param) throws Exception {
Long currentUserId = null;
Claims attribute = (Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS);
if (attribute != null) {
currentUserId = Long.valueOf(attribute.getSubject());
}
TaskDto.StartTask dto = new TaskDto.StartTask();
BeanUtils.copyProperties(param, dto);
subTimeService.startTask(currentUserId,dto);
return JsonResponse.newInstance().ok();
}

2
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -213,6 +213,8 @@ public enum CodeEnum {
DELIVER_REPEAT(173,"交付物已存在",true),
PARENT_PROJECT_NOT_MATCHING(174,"父任务与项目不匹配",true),
PM_NOT_MEMBER(175,"项目经理下必须有一个成员",true),
WisdomCar_NOT_Found(176,"没有找到绑定的平车信息",true),
WISDOM_CAR_RUNNED(177,"这段时间内平车正在运行,请结束平车运行或重新选择平车",true),
;

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/api/WisdomCarController.java

@ -62,7 +62,8 @@ public class WisdomCarController {
return JsonResponse.newInstance().ok();
}
@MustLogin
/* @MustLogin
@ApiOperation(value = "平车数据上传", notes = "")
@RequestMapping(value = "/uploadCarData", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse uploadCarData(@ApiParam @Validated @RequestBody QueryDto<WisdomCarDto.UploadCarData> params) {
@ -70,7 +71,7 @@ public class WisdomCarController {
wisdomCarService.uploadCarData(params.getParam(),params.getUserId());
log.info("平车数据上传");
return JsonResponse.newInstance().ok();
}
}*/
@ApiOperation(value = "查询绑定平车", notes = "")
@ -85,6 +86,7 @@ public class WisdomCarController {
}

2
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/CreateCaseDto.java

@ -27,7 +27,7 @@ public class CreateCaseDto {
@ApiModelProperty("患者身份证号")
private String patientIdCard;
@ApiModelProperty("患者手机号")
private int patientPhone;
private String patientPhone;
@ApiModelProperty("患者病案号")
private String medicalRecordNum;
@ApiModelProperty("患者家属姓名")

19
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/WisdomCarDto.java

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
@ -22,6 +23,23 @@ public class WisdomCarDto {
@Data
@ApiModel("绑定平车")
public static class BindingCar {
@NotNull
@ApiModelProperty("平车ID")
private Long carId;
@NotNull
@ApiModelProperty("项目ID")
private Long projectId;
@ApiModelProperty("分解任务ID")
@NotNull
private Long taskSubId;
@NotNull
@Min(1)
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("是否演示 0:否 1:是")
private byte demo = 0;
}
@Data
@ -34,5 +52,6 @@ public class WisdomCarDto {
public static class QueryBindingCar {
@ApiModelProperty("分解任务id")
private Long taskSubId;
}
}

84
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientDoctor.java

@ -0,0 +1,84 @@
package com.ccsens.wisdomcar.bean.po;
import java.io.Serializable;
import java.util.Date;
public class PatientDoctor implements Serializable {
private Long id;
private Long patientId;
private Long doctorId;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPatientId() {
return patientId;
}
public void setPatientId(Long patientId) {
this.patientId = patientId;
}
public Long getDoctorId() {
return doctorId;
}
public void setDoctorId(Long doctorId) {
this.doctorId = doctorId;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", patientId=").append(patientId);
sb.append(", doctorId=").append(doctorId);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append("]");
return sb.toString();
}
}

561
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientDoctorExample.java

@ -0,0 +1,561 @@
package com.ccsens.wisdomcar.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PatientDoctorExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public PatientDoctorExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPatientIdIsNull() {
addCriterion("patient_id is null");
return (Criteria) this;
}
public Criteria andPatientIdIsNotNull() {
addCriterion("patient_id is not null");
return (Criteria) this;
}
public Criteria andPatientIdEqualTo(Long value) {
addCriterion("patient_id =", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdNotEqualTo(Long value) {
addCriterion("patient_id <>", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdGreaterThan(Long value) {
addCriterion("patient_id >", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdGreaterThanOrEqualTo(Long value) {
addCriterion("patient_id >=", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdLessThan(Long value) {
addCriterion("patient_id <", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdLessThanOrEqualTo(Long value) {
addCriterion("patient_id <=", value, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdIn(List<Long> values) {
addCriterion("patient_id in", values, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdNotIn(List<Long> values) {
addCriterion("patient_id not in", values, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdBetween(Long value1, Long value2) {
addCriterion("patient_id between", value1, value2, "patientId");
return (Criteria) this;
}
public Criteria andPatientIdNotBetween(Long value1, Long value2) {
addCriterion("patient_id not between", value1, value2, "patientId");
return (Criteria) this;
}
public Criteria andDoctorIdIsNull() {
addCriterion("doctor_id is null");
return (Criteria) this;
}
public Criteria andDoctorIdIsNotNull() {
addCriterion("doctor_id is not null");
return (Criteria) this;
}
public Criteria andDoctorIdEqualTo(Long value) {
addCriterion("doctor_id =", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotEqualTo(Long value) {
addCriterion("doctor_id <>", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdGreaterThan(Long value) {
addCriterion("doctor_id >", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdGreaterThanOrEqualTo(Long value) {
addCriterion("doctor_id >=", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdLessThan(Long value) {
addCriterion("doctor_id <", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdLessThanOrEqualTo(Long value) {
addCriterion("doctor_id <=", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdIn(List<Long> values) {
addCriterion("doctor_id in", values, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotIn(List<Long> values) {
addCriterion("doctor_id not in", values, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdBetween(Long value1, Long value2) {
addCriterion("doctor_id between", value1, value2, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotBetween(Long value1, Long value2) {
addCriterion("doctor_id not between", value1, value2, "doctorId");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;
}
public Criteria andCreatedAtIsNotNull() {
addCriterion("created_at is not null");
return (Criteria) this;
}
public Criteria andCreatedAtEqualTo(Date value) {
addCriterion("created_at =", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotEqualTo(Date value) {
addCriterion("created_at <>", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThan(Date value) {
addCriterion("created_at >", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("created_at >=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThan(Date value) {
addCriterion("created_at <", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
addCriterion("created_at <=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtIn(List<Date> values) {
addCriterion("created_at in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotIn(List<Date> values) {
addCriterion("created_at not in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtBetween(Date value1, Date value2) {
addCriterion("created_at between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
addCriterion("created_at not between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNull() {
addCriterion("updated_at is null");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNotNull() {
addCriterion("updated_at is not null");
return (Criteria) this;
}
public Criteria andUpdatedAtEqualTo(Date value) {
addCriterion("updated_at =", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotEqualTo(Date value) {
addCriterion("updated_at <>", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThan(Date value) {
addCriterion("updated_at >", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("updated_at >=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThan(Date value) {
addCriterion("updated_at <", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
addCriterion("updated_at <=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIn(List<Date> values) {
addCriterion("updated_at in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotIn(List<Date> values) {
addCriterion("updated_at not in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
addCriterion("updated_at between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
addCriterion("updated_at not between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andRecStatusIsNull() {
addCriterion("rec_status is null");
return (Criteria) this;
}
public Criteria andRecStatusIsNotNull() {
addCriterion("rec_status is not null");
return (Criteria) this;
}
public Criteria andRecStatusEqualTo(Byte value) {
addCriterion("rec_status =", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotEqualTo(Byte value) {
addCriterion("rec_status <>", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThan(Byte value) {
addCriterion("rec_status >", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("rec_status >=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThan(Byte value) {
addCriterion("rec_status <", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThanOrEqualTo(Byte value) {
addCriterion("rec_status <=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusIn(List<Byte> values) {
addCriterion("rec_status in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotIn(List<Byte> values) {
addCriterion("rec_status not in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusBetween(Byte value1, Byte value2) {
addCriterion("rec_status between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

11
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/Step.java

@ -20,6 +20,8 @@ public class Step implements Serializable {
private Byte recStatus;
private String taskSubName;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -86,6 +88,14 @@ public class Step implements Serializable {
this.recStatus = recStatus;
}
public String getTaskSubName() {
return taskSubName;
}
public void setTaskSubName(String taskSubName) {
this.taskSubName = taskSubName == null ? null : taskSubName.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -100,6 +110,7 @@ public class Step implements Serializable {
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", taskSubName=").append(taskSubName);
sb.append("]");
return sb.toString();
}

70
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepExample.java

@ -604,6 +604,76 @@ public class StepExample {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andTaskSubNameIsNull() {
addCriterion("task_sub_name is null");
return (Criteria) this;
}
public Criteria andTaskSubNameIsNotNull() {
addCriterion("task_sub_name is not null");
return (Criteria) this;
}
public Criteria andTaskSubNameEqualTo(String value) {
addCriterion("task_sub_name =", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameNotEqualTo(String value) {
addCriterion("task_sub_name <>", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameGreaterThan(String value) {
addCriterion("task_sub_name >", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameGreaterThanOrEqualTo(String value) {
addCriterion("task_sub_name >=", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameLessThan(String value) {
addCriterion("task_sub_name <", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameLessThanOrEqualTo(String value) {
addCriterion("task_sub_name <=", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameLike(String value) {
addCriterion("task_sub_name like", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameNotLike(String value) {
addCriterion("task_sub_name not like", value, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameIn(List<String> values) {
addCriterion("task_sub_name in", values, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameNotIn(List<String> values) {
addCriterion("task_sub_name not in", values, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameBetween(String value1, String value2) {
addCriterion("task_sub_name between", value1, value2, "taskSubName");
return (Criteria) this;
}
public Criteria andTaskSubNameNotBetween(String value1, String value2) {
addCriterion("task_sub_name not between", value1, value2, "taskSubName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

13
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/WisdomCarVo.java

@ -1,5 +1,6 @@
package com.ccsens.wisdomcar.bean.vo;
import com.ccsens.wisdomcar.bean.po.StepTask;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -20,6 +21,7 @@ public class WisdomCarVo {
}
@Data
@ApiModel("查询绑定平车")
public static class BindingCar{
@ -46,4 +48,15 @@ public class WisdomCarVo {
@ApiModelProperty("患者联系电话")
private String phone;
}
@Data
public static class CarStepRecord{
@ApiModelProperty("平车记录ID")
private Long id;
@ApiModelProperty("数据上传时间")
private Long time;
@ApiModelProperty("对应任务")
private StepTask stepTask;
}
}

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/HospitalWrokingDao.java

@ -21,4 +21,10 @@ public interface HospitalWrokingDao extends HospitalWrokingMapper {
*/
List<HospitalMember> findWorkingDoctor(@Param("hospitalId") Long hospitalId,@Param("currentTime") Long currentTime);
/**
* 查找主任
* @param hospitalId 医院id
* @return 主任userId
*/
Long findHeadOfPM(@Param("hospitalId") Long hospitalId);
}

12
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientDoctorDao.java

@ -0,0 +1,12 @@
package com.ccsens.wisdomcar.persist.dao;
import com.ccsens.wisdomcar.persist.mapper.PatientDoctorMapper;
/**
* @author AUSU
*/
public interface PatientDoctorDao extends PatientDoctorMapper {
}

9
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StepTaskDao.java

@ -19,4 +19,13 @@ public interface StepTaskDao extends StepTaskMapper {
* @return 绑定平车任务ID
*/
ProjectVo.BindCar getBindCarTaskId(@Param("taskSubId") Long taskSubId);
/**
* 查询当前平车绑定的患者和对应的环节的绑定关系
* @param carId 平车ID
* @param stepId 环节ID
* @param time 数据的时间
* @return 任务环节
*/
StepTask getByCarAndStep(@Param("carId") Long carId, @Param("stepId") Long stepId, @Param("time") Long time);
}

9
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarDao.java

@ -15,4 +15,13 @@ public interface WisdomCarDao {
* @return 空闲平车
*/
List<WisdomCarVo.FreeCar> queryFreeCar(@Param("hospitalId") Long hospitalId);
/**
* 统计时间段内该平车运行的次数
* @param carId 平车ID
* @param startTime 开始时间
* @param endTime 结束时间
* @return 次数
*/
long countUsed(@Param("carId") Long carId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
}

11
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java

@ -2,6 +2,7 @@ package com.ccsens.wisdomcar.persist.dao;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.ccsens.wisdomcar.bean.vo.WisdomCarVo;
import com.ccsens.wisdomcar.persist.mapper.WisdomCarRecordMapper;
import org.apache.ibatis.annotations.Param;
@ -40,4 +41,14 @@ public interface WisdomCarRecordDao extends WisdomCarRecordMapper {
* @return 记录
*/
List<ProjectVo.Record> queryRecent(@Param("carId") Long carId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("typeArr") byte... typeArr);
/**
* 查询平车记录和对应的环节信息
* @param carId 平车ID
* @param patientId 患者ID
* @param startTime 开始时间
* @param endTime 结束时间
* @return 平车记录和对应的环节信息
*/
List<WisdomCarVo.CarStepRecord> queryStepRecord(@Param("carId") Long carId, @Param("patientId") Long patientId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
}

30
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/mapper/PatientDoctorMapper.java

@ -0,0 +1,30 @@
package com.ccsens.wisdomcar.persist.mapper;
import com.ccsens.wisdomcar.bean.po.PatientDoctor;
import com.ccsens.wisdomcar.bean.po.PatientDoctorExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface PatientDoctorMapper {
long countByExample(PatientDoctorExample example);
int deleteByExample(PatientDoctorExample example);
int deleteByPrimaryKey(Long id);
int insert(PatientDoctor record);
int insertSelective(PatientDoctor record);
List<PatientDoctor> selectByExample(PatientDoctorExample example);
PatientDoctor selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") PatientDoctor record, @Param("example") PatientDoctorExample example);
int updateByExample(@Param("record") PatientDoctor record, @Param("example") PatientDoctorExample example);
int updateByPrimaryKeySelective(PatientDoctor record);
int updateByPrimaryKey(PatientDoctor record);
}

71
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/AsyncService.java

@ -0,0 +1,71 @@
package com.ccsens.wisdomcar.service;
import com.ccsens.cloudutil.bean.tall.dto.TaskDto;
import com.ccsens.cloudutil.feign.TallFeignClient;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
import com.ccsens.wisdomcar.bean.po.PatientData;
import com.ccsens.wisdomcar.bean.po.PatientProject;
import com.ccsens.wisdomcar.bean.po.StepTask;
import com.ccsens.wisdomcar.persist.dao.PatientDataDao;
import com.ccsens.wisdomcar.persist.mapper.PatientProjectMapper;
import com.ccsens.wisdomcar.util.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2021/6/3 10:16
*/
@Async
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class AsyncService implements IAsyncService {
@Resource
private TallFeignClient tallFeignClient;
@Resource
private PatientDataDao patientDataDao;
@Resource
private PatientProjectMapper patientProjectMapper;
@Override
public void pushTime(StepTask stepTask, PatientData data) {
PatientData updateData = new PatientData();
updateData.setId(data.getId());
// 查询项目ID
PatientProject patient = patientProjectMapper.selectByPrimaryKey(stepTask.getPatientId());
if (patient == null) {
return;
}
// 推送开始时间
TaskDto.StartTask startTask = new TaskDto.StartTask();
startTask.setTaskId(stepTask.getTaskSubId());
startTask.setRoleId(0L);
startTask.setProjectId(patient.getProjectId());
startTask.setStartTime(data.getStartTime());
updateData.setPushStatus(Constant.PUSH_STATUS_FAIL);
try {
JsonResponse response = tallFeignClient.startNode(startTask);
log.info("推送开始任务结果:{},请求:{}", response, startTask);
if (response != null && response.getCode() != null && response.getCode().intValue() == CodeEnum.SUCCESS.getCode().intValue()) {
updateData.setPushStatus(Constant.PUSH_STATUS_SUCCESS);
}
} catch (Exception e) {
log.error("开始任务出现异常", e);
}
// 更新状态
patientDataDao.updateByPrimaryKeySelective(updateData);
}
}

20
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IAsyncService.java

@ -0,0 +1,20 @@
package com.ccsens.wisdomcar.service;
import com.ccsens.wisdomcar.bean.po.PatientData;
import com.ccsens.wisdomcar.bean.po.StepTask;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2021/6/3 10:16
*/
public interface IAsyncService {
/**
* 推送任务开始并更新推送状态
* @param stepTask 任务
* @param data 数据
*/
void pushTime(StepTask stepTask, PatientData data);
}

10
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IProjectService.java

@ -1,6 +1,7 @@
package com.ccsens.wisdomcar.service;
import com.ccsens.wisdomcar.bean.dto.ProjectDto;
import com.ccsens.wisdomcar.bean.po.StepTask;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import java.util.List;
@ -25,4 +26,13 @@ public interface IProjectService {
*/
List<ProjectVo.Record> queryWeight(ProjectDto.Weight param, Long userId);
/**
* 存储数据
* @param startTime 开始时间
* @param stepTask 任务环节
* @param operationId userID/carRecordId
* @param operation
*/
void saveData(Long startTime, StepTask stepTask, Long operationId, byte operation);
}

69
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java

@ -42,6 +42,8 @@ public class ProjectService implements IProjectService {
@Resource
private PatientWisdomCarMapper patientWisdomCarMapper;
@Resource
private IAsyncService asyncService;
@Resource
private Snowflake snowflake;
@Override
@ -55,53 +57,62 @@ public class ProjectService implements IProjectService {
}
// TODO 待确认,是否处理成已提交不再修改????
StepTask stepTask = stepTasks.get(0);
saveData(param.getStartTime(), stepTask, userId, Constant.OPERATION_USER);
}
@Override
public void saveData(Long startTime, StepTask stepTask, Long operationId, byte operation) {
// 判断是否为结束结点
Step step = stepDao.selectByPrimaryKey(stepTask.getStepId());
Integer max = stepDao.getMaxSequence(Constant.STEP_TYPE_REAL);
if (step != null && max != null && step.getSequence() != null && step.getSequence().intValue() == max.intValue()) {
// 修改平车结束时间点
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(stepTask.getTaskSubId());
if (bindCar == null) {
log.info("出现异常,未找到绑定平车:{}", stepTask.getTaskSubId());
throw new BaseException(CodeEnum.PARAM_ERROR);
}
if (bindCar.getEndTime() == null || bindCar.getEndTime() == 0) {
PatientWisdomCar patientWisdomCar = new PatientWisdomCar();
patientWisdomCar.setId(bindCar.getId());
patientWisdomCar.setEndTime(startTime);
patientWisdomCarMapper.updateByPrimaryKeySelective(patientWisdomCar);
}
}
PatientDataExample dataExample = new PatientDataExample();
dataExample.createCriteria().andTaskSubIdEqualTo(param.getTaskSubId()).andStepIdEqualTo(stepTask.getStepId());
dataExample.createCriteria().andTaskSubIdEqualTo(stepTask.getTaskSubId()).andStepIdEqualTo(stepTask.getStepId());
List<PatientData> patientData = patientDataDao.selectByExample(dataExample);
if (CollectionUtil.isNotEmpty(patientData)){
log.info("taskId:{}, stepId:{}已经存在,不再修改", param.getTaskSubId(), stepTask.getStepId());
log.info("taskId:{}, stepId:{}已经存在,不再修改", stepTask.getTaskSubId(), stepTask.getStepId());
PatientData data = patientData.get(0);
// 未推送
if (data.getPushStatus() == Constant.PUSH_STATUS_SUCCESS) {
log.info("已推送成功,不处理");
return;
}
// TODO 异步推送数据 根据结果修改状态
PatientData updateData = new PatientData();
updateData.setId(data.getId());
updateData.setPushStatus(Constant.PUSH_STATUS_SUCCESS);
patientDataDao.updateByPrimaryKeySelective(updateData);
// 异步推送数据 根据结果修改状态
asyncService.pushTime(stepTask, data);
return;
}
// TODO 判断是否为结束结点
Step step = stepDao.selectByPrimaryKey(stepTask.getStepId());
Integer max = stepDao.getMaxSequence(Constant.STEP_TYPE_REAL);
if (step != null && max != null && step.getSequence() != null && step.getSequence().intValue() == max.intValue()) {
// 修改平车结束时间点
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getTaskSubId());
if (bindCar == null) {
log.info("出现异常,未找到绑定平车:{}", param.getTaskSubId());
throw new BaseException(CodeEnum.PARAM_ERROR);
}
PatientWisdomCar patientWisdomCar = new PatientWisdomCar();
patientWisdomCar.setId(bindCar.getId());
patientWisdomCar.setEndTime(param.getStartTime());
patientWisdomCarMapper.updateByPrimaryKeySelective(patientWisdomCar);
}
PatientData data = new PatientData();
data.setId(snowflake.nextId());
data.setUserId(userId);
data.setTaskSubId(param.getTaskSubId());
if (operation == Constant.OPERATION_USER) {
data.setUserId(operationId);
} else {
data.setWisdomCarRecordId(operationId);
}
data.setTaskSubId(stepTask.getTaskSubId());
data.setStepId(stepTask.getStepId());
data.setPushStatus(Constant.PUSH_STATUS_NO);
data.setStartTime(param.getStartTime());
data.setType(Constant.OPERATION_USER);
data.setStartTime(startTime);
data.setType(operation);
patientDataDao.insertSelective(data);
// TODO 异步推送数据 根据结果修改状态
// 异步推送数据 根据结果修改状态
asyncService.pushTime(stepTask, data);
}
@Override

12
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java

@ -17,6 +17,7 @@ import com.ccsens.wisdomcar.bean.vo.Message.CarRecordMessageVo;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.ccsens.wisdomcar.bean.vo.StepVo;
import com.ccsens.wisdomcar.persist.dao.StepDao;
import com.ccsens.wisdomcar.persist.dao.StepTaskDao;
import com.ccsens.wisdomcar.persist.dao.WisdomCarRecordDao;
import com.ccsens.wisdomcar.persist.mapper.*;
import com.ccsens.wisdomcar.util.Constant;
@ -60,6 +61,11 @@ public class RecordService implements IRecordService{
private RedisUtil redisUtil;
@Resource
private WisdomCarRecordDao wisdomCarRecordDao;
@Resource
private StepTaskDao stepTaskDao;
@Resource
private IProjectService projectService;
@Value("#{T(java.lang.Long).parseLong('${wisdom.weight:10000}')}")
private Long weightMinus;
@Value("#{T(java.lang.Long).parseLong('${wisdom.time:300000}')}")
@ -147,6 +153,12 @@ public class RecordService implements IRecordService{
// }
//新建急救表存储信息
saveAidRecord(carRecordMessageDto, wisdomCar.getId(),step,userIdSet);
// rfid且有对应的真实环节 存储患者数据表
if (carRecordMessageDto.getType() == Constant.CAR_RECORD_RFID && step != null && step.getStepType() == Constant.STEP_TYPE_REAL) {
// TODO 异步推送数据
StepTask stepTask = stepTaskDao.getByCarAndStep(wisdomCarRecord.getCarId(), step.getId(), wisdomCarRecord.getTime());
projectService.saveData(wisdomCarRecord.getTime(), stepTask, wisdomCarRecord.getId(), Constant.OPERATION_CAR);
}
}
@Override

103
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/WisdomCarService.java

@ -1,6 +1,7 @@
package com.ccsens.wisdomcar.service;
import cn.hutool.core.collection.CollectionUtil;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import com.ccsens.wisdomcar.bean.dto.WisdomCarDto;
@ -54,6 +55,16 @@ public class WisdomCarService implements IWisdomCarService {
private TallFeignClient tallFeignClient;
@Resource
private WisdomCarDao wisdomcarDao;
@Resource
private WisdomCarRecordDao wisdomCarRecordDao;
@Resource
private StepDao stepDao;
@Resource
private StepTaskDao stepTaskDao;
@Resource
private IProjectService projectService;
@Resource
private PatientDoctorDao patientDoctorDao;
@Override
@ -138,9 +149,30 @@ public class WisdomCarService implements IWisdomCarService {
if (Constant.SPECIALIST_TWO.equals(member.getPosition())){
roleName.add(Constant.SPECIALIST);
}
if (Constant.TRIAGE_TABLE_THREE.equals(member.getPosition())){
roleName.add(Constant.TRIAGE_TABLE);
}
memberForTemplate.setRoleName(roleName);
memberList.add(memberForTemplate);
//绑定患者与医生关系
PatientDoctor patientDoctor = new PatientDoctor();
patientDoctor.setId(snowflake.nextId());
patientDoctor.setPatientId(patient.getId());
patientDoctor.setDoctorId(member.getId());
patientDoctorDao.insertSelective(patientDoctor);
}
//查找主任,主任为项目经理
Long headOfPM = hospitalWrokingDao.findHeadOfPM(hospitalMembers.get(0).getHospitalId());
if (ObjectUtil.isNotNull(headOfPM)){
List<String> roleName = new ArrayList<>();
MemberRoleDto.MemberForTemplate memberForTemplate = new MemberRoleDto.MemberForTemplate();
roleName.add(Constant.HEAD);
memberForTemplate.setUserId(headOfPM);
memberForTemplate.setRoleName(roleName);
memberList.add(memberForTemplate);
}
}
@ -162,11 +194,40 @@ public class WisdomCarService implements IWisdomCarService {
ProjectVo.ProjectInfo data = projectId.getData();
if (ObjectUtil.isNotNull(data)){
//将患者与项目绑定
PatientProject patientProject = new PatientProject();
patientProject.setId(patient.getId());
patientProject.setProjectId(data.getId());
patientProjectDao.updateByPrimaryKeySelective(patientProject);
//将分解任务与tall绑定
if (ObjectUtil.isNotNull(data.getTaskDetails())){
for (ProjectVo.TaskDetail taskDetail : data.getTaskDetails()) {
if (Constant.TASK_DETAIL_LEVEL_TWO.equals(taskDetail.getTaskDetailLevel())){
StepExample stepExample = new StepExample();
stepExample.createCriteria().andTaskSubNameEqualTo(taskDetail.getTaskDetailName());
List<Step> steps = stepDao.selectByExample(stepExample);
if (ObjectUtil.isNotNull(taskDetail.getTaskSubList())){
for (ProjectVo.TaskSub taskSub : taskDetail.getTaskSubList()) {
StepTask stepTask = new StepTask();
stepTask.setId(snowflake.nextId());
stepTask.setBatch(1);
stepTask.setPatientId(patient.getId());
stepTask.setTaskSubId(taskSub.getTaskSubId());
stepTask.setStepId(steps.get(0).getId());
stepTaskDao.insertSelective(stepTask);
}
}
}
}
}
//调用tall的添加成员接口
saveMemberForTemplate.setProjectId(data.getId());
saveMemberForTemplate.setMemberForTemplate(memberList);
//调用tall的添加成员接口
log.info("调用tall内的给复制的项目添加成员接口");
JsonResponse jsonResponse = tallFeignClient.addMemberForTemplate(saveMemberForTemplate);
QueryDto<MemberRoleDto.SaveMemberForTemplate> queryDto = new QueryDto<>();
queryDto.setParam(saveMemberForTemplate);
JsonResponse jsonResponse = tallFeignClient.addMemberForTemplate(queryDto);
if (!jsonResponse.getCode().equals(Constant.RESPONSE_OK)){
log.info("调用tall异常后返回:{}",jsonResponse.getMsg());
throw new BaseException(Constant.RETURN_ERROR);
@ -193,6 +254,44 @@ public class WisdomCarService implements IWisdomCarService {
@Override
public void bindingCar(WisdomCarDto.BindingCar param, Long userId) {
// 判断平车是否在运行中
long count = wisdomcarDao.countUsed(param.getCarId(), param.getStartTime(), param.getEndTime());
if (count >0) {
log.info("时间段内有绑定的平车:{},{}", param, count);
throw new BaseException(CodeEnum.WISDOM_CAR_RUNNED);
}
// 查询患者信息
PatientProjectExample projectExample = new PatientProjectExample();
projectExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
List<PatientProject> patientProjects = patientProjectDao.selectByExample(projectExample);
if (CollectionUtil.isEmpty(patientProjects)) {
log.info("未找到患者");
throw new BaseException(CodeEnum.PARAM_ERROR);
}
PatientProject patient = patientProjects.get(0);
// TODO 是否需要判断患者是否已经绑定平车???
// 查询平车记录
List<WisdomCarVo.CarStepRecord> carRecords = wisdomCarRecordDao.queryStepRecord(param.getCarId(), patient.getId(), param.getStartTime(), param.getEndTime());
// 绑定平车
PatientWisdomCar pc = new PatientWisdomCar();
pc.setId(snowflake.nextId());
pc.setTaskSubId(param.getTaskSubId());
pc.setPatientId(patient.getId());
pc.setCarId(param.getCarId());
pc.setStartTime(param.getStartTime());
pc.setEndTime(param.getEndTime());
pc.setIsDemo(param.getDemo());
pc.setBindingStatus(Constant.PUSH_STATUS_NO);
if (CollectionUtil.isEmpty(carRecords)) {
pc.setBindingStatus(Constant.PUSH_STATUS_SUCCESS);
patientWisdomCarDao.insertSelective(pc);
return;
}
carRecords.forEach(record -> {
projectService.saveData(record.getTime(), record.getStepTask(), record.getId(), Constant.OPERATION_CAR);
});
pc.setBindingStatus(Constant.PUSH_STATUS_SUCCESS);
patientWisdomCarDao.insertSelective(pc);
}

13
wisdomcar/src/main/java/com/ccsens/wisdomcar/util/Constant.java

@ -75,6 +75,10 @@ public class Constant {
* 角色名称:分诊台
*/
public static final String TRIAGE_TABLE = "分诊台";
/**
* 角色名称:项目经理(主任)
*/
public static final String HEAD = "项目经理";
/**
* 0急诊护士
@ -92,6 +96,10 @@ public class Constant {
* 3-分诊台
*/
public static final Byte TRIAGE_TABLE_THREE = 3;
/**
* 4-主任
*/
public static final Byte HEAD_FOUR = 4;
/**
* 响应成功
@ -111,4 +119,9 @@ public class Constant {
* 调用Tall异常
*/
public static final String RETURN_ERROR = "调用Tall异常";
/**
* 调用Tall异常
*/
public static final Byte TASK_DETAIL_LEVEL_TWO = 2;
}

4
wisdomcar/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: dev
include: common, util-dev
active: test
include: common, util-test

12
wisdomcar/src/main/resources/mapper_dao/HospitalWorkingDao.xml

@ -4,6 +4,7 @@
<select id="findWorkingDoctor" resultType="com.ccsens.wisdomcar.bean.po.HospitalMember">
SELECT
hm.id,
hm.position AS position,
hm.user_id AS userId,
hm.position AS position
@ -18,4 +19,15 @@
AND hw.end_time &gt; #{currentTime}
</select>
<select id="findHeadOfPM" resultType="Long">
SELECT
m.user_id
FROM
t_hospital_member AS m
WHERE
m.rec_status = 0
AND m.hospital_id = #{hospitalId}
AND m.position = 4
LIMIT 1
</select>
</mapper>

18
wisdomcar/src/main/resources/mapper_dao/StepTaskDao.xml

@ -8,6 +8,22 @@
(select id from t_step where code = 1 and step_type = 0 and rec_status = 0) step,
t_step_task st,
t_patient_wisdom_car c
where batch.batch = st.batch and step.id = st.step_id and st.task_sub_id = c.task_sub_id and st.rec_status = 0 and c.rec_status = 0 order by c.start_time desc limit 1
where batch.batch = st.batch and batch.patient_id = st.patient_id and step.id = st.step_id and st.task_sub_id = c.task_sub_id and st.rec_status = 0 and c.rec_status = 0 order by c.start_time desc limit 1
</select>
<select id="getByCarAndStep" resultMap="com.ccsens.wisdomcar.persist.mapper.StepTaskMapper.BaseResultMap">
SELECT
st2.*
FROM
t_patient_wisdom_car pc,
t_step_task st,
t_step_task st2
WHERE
pc.task_sub_id = st.task_sub_id
AND pc.patient_id = st2.patient_id
AND st.batch = st2.batch
AND st2.step_id = #{stepId}
AND pc.car_id = #{carId}
AND pc.start_time $lt;= #{time} AND pc.end_time = 0 AND pc.start_time > #{time - 2 * 60 * 60 * 1000}
order by pc.created_at desc limit 1
</select>
</mapper>

24
wisdomcar/src/main/resources/mapper_dao/WisdomCarDao.xml

@ -6,7 +6,7 @@
( SELECT id, car_number FROM t_wisdom_car WHERE hospital_id = #{hospitalId} AND rec_status = 0 ) EXCEPT
(
SELECT
c.id,
distinct c.id,
c.car_number
FROM
t_patient_wisdom_car pc,
@ -20,4 +20,26 @@ WHERE
AND c.rec_status = 0
)
</select>
<select id="countUsed" resultType="java.lang.Long">
SELECT
count(*)
FROM
t_patient_wisdom_car
WHERE
car_id = 1
AND
((end_time = 0
AND start_time &gt;= #{startTime} - 2 * 60 * 60 * 1000)
or
<choose>
<when test="endTime == null or endTime = 0">
(start_time &lt;= #{startTime} and end_time &gt;=#{startTime})
</when>
<otherwise>
(start_time &lt;= #{endTime} and end_time &gt;= #{startTime})
</otherwise>
</choose>
)
AND rec_status = 0
</select>
</mapper>

43
wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml

@ -2,6 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.wisdomcar.persist.dao.WisdomCarRecordDao">
<resultMap id="stepRecord" type="com.ccsens.wisdomcar.bean.vo.WisdomCarVo$CarStepRecord">
<id property="id" column="id"/>
<result column="time" property="time"/>
<association property="stepTask" javaType="com.ccsens.wisdomcar.bean.po.StepTask">
<result property="id" column="stId"/>
<result property="stepId" column="step_id"/>
<result property="taskSubId" column="task_sub_id"/>
<result property="patientId" column="patient_id"/>
<result property="batch" column="batch"/>
</association>
</resultMap>
<select id="queryWeightAndRfid" resultType="com.ccsens.wisdomcar.bean.vo.RecordVo$WeightAndRfid">
select * from (
@ -52,4 +63,36 @@
order by created_at desc limit 1)
</foreach>
</select>
<select id="queryStepRecord" resultMap="stepRecord">
SELECT
cr.id,
cr.time,
st.id AS stId,
st.step_id,
st.task_sub_id,
st.patient_id,
st.batch
FROM
t_wisdom_car_record cr,
t_rfid r,
t_step s,
t_step_task st
WHERE
cr.car_id = #{carId}
<if test="startTime != null and startTime > 0" >
AND cr.time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime > 0" >
AND cr.time &lt;= #{endTime}
</if>
AND st.patient_id = #{patientId}
AND cr.VALUE = r.rfid
AND r.step_id = s.id
AND s.id = st.step_id
and cr.type = 2
AND cr.rec_status = 0
AND r.rec_status = 0
AND s.rec_status = 0
AND st.rec_status = 0
</select>
</mapper>

228
wisdomcar/src/main/resources/mapper_raw/PatientDoctorMapper.xml

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.wisdomcar.persist.mapper.PatientDoctorMapper">
<resultMap id="BaseResultMap" type="com.ccsens.wisdomcar.bean.po.PatientDoctor">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="doctor_id" jdbcType="BIGINT" property="doctorId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, patient_id, doctor_id, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctorExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_patient_doctor
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_patient_doctor
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_patient_doctor
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctorExample">
delete from t_patient_doctor
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctor">
insert into t_patient_doctor (id, patient_id, doctor_id,
created_at, updated_at, rec_status
)
values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{doctorId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctor">
insert into t_patient_doctor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="patientId != null">
patient_id,
</if>
<if test="doctorId != null">
doctor_id,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="patientId != null">
#{patientId,jdbcType=BIGINT},
</if>
<if test="doctorId != null">
#{doctorId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctorExample" resultType="java.lang.Long">
select count(*) from t_patient_doctor
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_patient_doctor
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.patientId != null">
patient_id = #{record.patientId,jdbcType=BIGINT},
</if>
<if test="record.doctorId != null">
doctor_id = #{record.doctorId,jdbcType=BIGINT},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_patient_doctor
set id = #{record.id,jdbcType=BIGINT},
patient_id = #{record.patientId,jdbcType=BIGINT},
doctor_id = #{record.doctorId,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctor">
update t_patient_doctor
<set>
<if test="patientId != null">
patient_id = #{patientId,jdbcType=BIGINT},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.wisdomcar.bean.po.PatientDoctor">
update t_patient_doctor
set patient_id = #{patientId,jdbcType=BIGINT},
doctor_id = #{doctorId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

27
wisdomcar/src/main/resources/mapper_raw/StepMapper.xml

@ -10,6 +10,7 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="task_sub_name" jdbcType="VARCHAR" property="taskSubName" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -70,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, code, sequence, step_type, created_at, updated_at, rec_status
id, name, code, sequence, step_type, created_at, updated_at, rec_status, task_sub_name
</sql>
<select id="selectByExample" parameterType="com.ccsens.wisdomcar.bean.po.StepExample" resultMap="BaseResultMap">
select
@ -105,10 +106,12 @@
<insert id="insert" parameterType="com.ccsens.wisdomcar.bean.po.Step">
insert into t_step (id, name, code,
sequence, step_type, created_at,
updated_at, rec_status)
updated_at, rec_status, task_sub_name
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{sequence,jdbcType=INTEGER}, #{stepType,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, #{taskSubName,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.wisdomcar.bean.po.Step">
insert into t_step
@ -137,6 +140,9 @@
<if test="recStatus != null">
rec_status,
</if>
<if test="taskSubName != null">
task_sub_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -163,6 +169,9 @@
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="taskSubName != null">
#{taskSubName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.wisdomcar.bean.po.StepExample" resultType="java.lang.Long">
@ -198,6 +207,9 @@
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.taskSubName != null">
task_sub_name = #{record.taskSubName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -212,7 +224,8 @@
step_type = #{record.stepType,jdbcType=TINYINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
rec_status = #{record.recStatus,jdbcType=TINYINT},
task_sub_name = #{record.taskSubName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -241,6 +254,9 @@
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="taskSubName != null">
task_sub_name = #{taskSubName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -252,7 +268,8 @@
step_type = #{stepType,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
rec_status = #{recStatus,jdbcType=TINYINT},
task_sub_name = #{taskSubName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save