Browse Source

Merge branch 'pt' of dd.tall.wiki:ccsens_wiki/ccsenscloud into pt

pt
zy_Java 4 years ago
parent
commit
e7938a4d7b
  1. 4
      tall/src/main/resources/application.yml
  2. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/ProjectDto.java
  3. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StepDto.java
  4. 9
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/WisdomCarDto.java
  5. 12
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientWisdomCar.java
  6. 48
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientWisdomCarExample.java
  7. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepTask.java
  8. 20
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepTaskExample.java
  9. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/ProjectVo.java
  10. 5
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientDataDao.java
  11. 2
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientWisdomCarDao.java
  12. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StepDao.java
  13. 15
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StepTaskDao.java
  14. 12
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java
  15. 16
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java
  16. 14
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StepService.java
  17. 48
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/WisdomCarService.java
  18. 3
      wisdomcar/src/main/resources/application-test.yml
  19. 5
      wisdomcar/src/main/resources/application.yml
  20. 5
      wisdomcar/src/main/resources/mapper_dao/PatientDataDao.xml
  21. 2
      wisdomcar/src/main/resources/mapper_dao/PatientWisdomCarDao.xml
  22. 21
      wisdomcar/src/main/resources/mapper_dao/StepDao.xml
  23. 25
      wisdomcar/src/main/resources/mapper_dao/StepTaskDao.xml
  24. 30
      wisdomcar/src/main/resources/mapper_raw/PatientWisdomCarMapper.xml
  25. 14
      wisdomcar/src/main/resources/mapper_raw/StepTaskMapper.xml

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

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

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/ProjectDto.java

@ -28,8 +28,8 @@ public class ProjectDto {
@ApiModel("查询称重和剂量--请求")
public static class Weight {
@NotNull(message="请说明您的任务")
@ApiModelProperty("分解任务ID")
private Long taskSubId;
@ApiModelProperty("项目ID")
private Long projectId;
}
@Data

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StepDto.java

@ -16,7 +16,7 @@ public class StepDto {
@ApiModel("查看环节完成状态")
public static class FindStepStatus{
@NotNull(message = "请选择要查看的数据")
@ApiModelProperty("分解任务id")
private Long taskSubId;
@ApiModelProperty("项目id")
private Long projectId;
}
}

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

@ -30,9 +30,10 @@ public class WisdomCarDto {
@NotNull(message="项目ID不能为空")
@ApiModelProperty("项目ID")
private Long projectId;
@NotNull(message="分解任务ID不能为空")
@ApiModelProperty("分解任务ID")
private Long taskSubId;
// @NotNull(message="分解任务ID不能为空")
// @ApiModelProperty("分解任务ID")
// private Long taskSubId;
@NotNull(message="开始时间不能为空")
@Min(1)
@ApiModelProperty("开始时间")
@ -53,7 +54,7 @@ public class WisdomCarDto {
public static class QueryInfo {
@NotNull(message="请说明您的任务")
@ApiModelProperty("分解任务id")
private Long taskSubId;
private Long projectId;
}

12
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientWisdomCar.java

@ -8,7 +8,7 @@ public class PatientWisdomCar implements Serializable {
private Long patientId;
private Long taskSubId;
private Long batch;
private Long carId;
@ -44,12 +44,12 @@ public class PatientWisdomCar implements Serializable {
this.patientId = patientId;
}
public Long getTaskSubId() {
return taskSubId;
public Long getBatch() {
return batch;
}
public void setTaskSubId(Long taskSubId) {
this.taskSubId = taskSubId;
public void setBatch(Long batch) {
this.batch = batch;
}
public Long getCarId() {
@ -124,7 +124,7 @@ public class PatientWisdomCar implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", patientId=").append(patientId);
sb.append(", taskSubId=").append(taskSubId);
sb.append(", batch=").append(batch);
sb.append(", carId=").append(carId);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);

48
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientWisdomCarExample.java

@ -225,63 +225,63 @@ public class PatientWisdomCarExample {
return (Criteria) this;
}
public Criteria andTaskSubIdIsNull() {
addCriterion("task_sub_id is null");
public Criteria andBatchIsNull() {
addCriterion("batch is null");
return (Criteria) this;
}
public Criteria andTaskSubIdIsNotNull() {
addCriterion("task_sub_id is not null");
public Criteria andBatchIsNotNull() {
addCriterion("batch is not null");
return (Criteria) this;
}
public Criteria andTaskSubIdEqualTo(Long value) {
addCriterion("task_sub_id =", value, "taskSubId");
public Criteria andBatchEqualTo(Long value) {
addCriterion("batch =", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdNotEqualTo(Long value) {
addCriterion("task_sub_id <>", value, "taskSubId");
public Criteria andBatchNotEqualTo(Long value) {
addCriterion("batch <>", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdGreaterThan(Long value) {
addCriterion("task_sub_id >", value, "taskSubId");
public Criteria andBatchGreaterThan(Long value) {
addCriterion("batch >", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdGreaterThanOrEqualTo(Long value) {
addCriterion("task_sub_id >=", value, "taskSubId");
public Criteria andBatchGreaterThanOrEqualTo(Long value) {
addCriterion("batch >=", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdLessThan(Long value) {
addCriterion("task_sub_id <", value, "taskSubId");
public Criteria andBatchLessThan(Long value) {
addCriterion("batch <", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdLessThanOrEqualTo(Long value) {
addCriterion("task_sub_id <=", value, "taskSubId");
public Criteria andBatchLessThanOrEqualTo(Long value) {
addCriterion("batch <=", value, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdIn(List<Long> values) {
addCriterion("task_sub_id in", values, "taskSubId");
public Criteria andBatchIn(List<Long> values) {
addCriterion("batch in", values, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdNotIn(List<Long> values) {
addCriterion("task_sub_id not in", values, "taskSubId");
public Criteria andBatchNotIn(List<Long> values) {
addCriterion("batch not in", values, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdBetween(Long value1, Long value2) {
addCriterion("task_sub_id between", value1, value2, "taskSubId");
public Criteria andBatchBetween(Long value1, Long value2) {
addCriterion("batch between", value1, value2, "batch");
return (Criteria) this;
}
public Criteria andTaskSubIdNotBetween(Long value1, Long value2) {
addCriterion("task_sub_id not between", value1, value2, "taskSubId");
public Criteria andBatchNotBetween(Long value1, Long value2) {
addCriterion("batch not between", value1, value2, "batch");
return (Criteria) this;
}

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepTask.java

@ -12,7 +12,7 @@ public class StepTask implements Serializable {
private Long patientId;
private Integer batch;
private Long batch;
private Date createdAt;
@ -54,11 +54,11 @@ public class StepTask implements Serializable {
this.patientId = patientId;
}
public Integer getBatch() {
public Long getBatch() {
return batch;
}
public void setBatch(Integer batch) {
public void setBatch(Long batch) {
this.batch = batch;
}

20
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/StepTaskExample.java

@ -355,52 +355,52 @@ public class StepTaskExample {
return (Criteria) this;
}
public Criteria andBatchEqualTo(Integer value) {
public Criteria andBatchEqualTo(Long value) {
addCriterion("batch =", value, "batch");
return (Criteria) this;
}
public Criteria andBatchNotEqualTo(Integer value) {
public Criteria andBatchNotEqualTo(Long value) {
addCriterion("batch <>", value, "batch");
return (Criteria) this;
}
public Criteria andBatchGreaterThan(Integer value) {
public Criteria andBatchGreaterThan(Long value) {
addCriterion("batch >", value, "batch");
return (Criteria) this;
}
public Criteria andBatchGreaterThanOrEqualTo(Integer value) {
public Criteria andBatchGreaterThanOrEqualTo(Long value) {
addCriterion("batch >=", value, "batch");
return (Criteria) this;
}
public Criteria andBatchLessThan(Integer value) {
public Criteria andBatchLessThan(Long value) {
addCriterion("batch <", value, "batch");
return (Criteria) this;
}
public Criteria andBatchLessThanOrEqualTo(Integer value) {
public Criteria andBatchLessThanOrEqualTo(Long value) {
addCriterion("batch <=", value, "batch");
return (Criteria) this;
}
public Criteria andBatchIn(List<Integer> values) {
public Criteria andBatchIn(List<Long> values) {
addCriterion("batch in", values, "batch");
return (Criteria) this;
}
public Criteria andBatchNotIn(List<Integer> values) {
public Criteria andBatchNotIn(List<Long> values) {
addCriterion("batch not in", values, "batch");
return (Criteria) this;
}
public Criteria andBatchBetween(Integer value1, Integer value2) {
public Criteria andBatchBetween(Long value1, Long value2) {
addCriterion("batch between", value1, value2, "batch");
return (Criteria) this;
}
public Criteria andBatchNotBetween(Integer value1, Integer value2) {
public Criteria andBatchNotBetween(Long value1, Long value2) {
addCriterion("batch not between", value1, value2, "batch");
return (Criteria) this;
}

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/ProjectVo.java

@ -35,8 +35,8 @@ public class ProjectVo {
public static class BindCar {
@ApiModelProperty("患者平车绑定ID")
private Long id;
@ApiModelProperty("任务ID")
private Long taskSubId;
@ApiModelProperty("批次")
private Long batch;
@ApiModelProperty("患者ID")
private Long patientId;
@ApiModelProperty("平车ID")

5
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientDataDao.java

@ -15,10 +15,11 @@ public interface PatientDataDao extends PatientDataMapper {
/**
* 为和taskSubId中一批的尚无消息平车信息的记录添加平车记录
* 为同一项目中的尚无消息平车信息的记录添加平车记录
* @param carId 患者绑定平车ID
* @param taskSubId 任务ID
* @param projectId 项目ID
*/
void updateCarId(@Param("carId") Long carId, @Param("taskSubId") Long taskSubId);
void updateCarId(@Param("carId") Long carId, @Param("projectId") Long projectId);
/**
* 查询任务开始时间

2
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientWisdomCarDao.java

@ -10,7 +10,7 @@ public interface PatientWisdomCarDao extends PatientWisdomCarMapper {
List<Long> queryByNew(@Param("id")Long id);
List<WisdomCarVo.BindingCarInfo> queryBindingCarList(@Param("taskSubId")Long taskSubId);
List<WisdomCarVo.BindingCarInfo> queryBindingCarList(@Param("projectId")Long projectId);
/**
* 查看患者平车id是否存在

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StepDao.java

@ -33,8 +33,8 @@ public interface StepDao extends StepMapper {
/**
* 查看环节是否完成
* @param taskSubId 患者平车id
* @param projectId 患者平车id
* @return 环节信息
*/
List<StepVo.StepStatus> findStepIsOver(@Param("taskSubId") Long taskSubId);
List<StepVo.StepStatus> findStepIsOver(@Param("projectId") Long projectId);
}

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

@ -14,11 +14,11 @@ import java.util.List;
public interface StepTaskDao extends StepTaskMapper {
/**
* 查找对应绑定平车的任务ID
* @param taskSubId 查询的任务ID
* @return 绑定平车任务ID
* 查找对应绑定平车信息
* @param batch 查询的项目ID
* @return 绑定平车信息
*/
ProjectVo.BindCar getBindCarTaskId(@Param("taskSubId") Long taskSubId);
ProjectVo.BindCar getBindCarByBatch(@Param("batch") Long batch);
/**
* 查询当前平车绑定的患者和对应的环节的绑定关系
@ -42,4 +42,11 @@ public interface StepTaskDao extends StepTaskMapper {
* @return 0不存在
*/
Integer findTaskIsTriageTask(Long taskSubId);
/**
* 查找对应绑定平车的任务ID
* @param taskSubId 查询的任务ID
* @return 绑定平车任务ID
*/
ProjectVo.BindCar getBindCarByTaskNew(@Param("taskSubId") Long taskSubId);
}

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

@ -3,34 +3,24 @@ package com.ccsens.wisdomcar.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.StringUtil;
import com.ccsens.util.exception.BaseException;
import com.ccsens.wisdomcar.bean.dto.OtherRecordsDto;
import com.ccsens.wisdomcar.bean.dto.ProjectDto;
import com.ccsens.wisdomcar.bean.po.PatientInformationRecord;
import com.ccsens.wisdomcar.bean.po.PatientInformationRecordExample;
import com.ccsens.wisdomcar.bean.po.PatientWisdomCar;
import com.ccsens.wisdomcar.bean.po.PatientWisdomCarExample;
import com.ccsens.wisdomcar.bean.vo.OtherRecordsVo;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import com.ccsens.wisdomcar.persist.dao.PatientWisdomCarDao;
import com.ccsens.wisdomcar.persist.dao.StepTaskDao;
import com.ccsens.wisdomcar.persist.mapper.PatientInformationRecordMapper;
import com.ccsens.wisdomcar.persist.mapper.PatientWisdomCarMapper;
import com.ccsens.wisdomcar.persist.mapper.WisdomCarMapper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.management.ObjectName;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Slf4j
@ -59,7 +49,7 @@ public class OtherRecordsService implements IOtherRecordsService {
public void upload(OtherRecordsDto.PicturesAndRecords param,Long userId,Byte carOrUser) {
//通过t_patient_information_record里面的分解任务id 找到患者平车id 最新的 拿到患者平车id t_patient_information_record
//拿到患者平车id
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getId());
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarByBatch(param.getId());
/*if (bindCar == null) {
log.info("没有找到绑定的平车信息:{}", param);
throw new BaseException(CodeEnum.PARAM_ERROR);

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

@ -68,7 +68,7 @@ public class ProjectService implements IProjectService {
public void saveData(Long startTime, StepTask stepTask, Long operationId, byte operation) {
//患者平车id
Long patientCarId = null;
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(stepTask.getTaskSubId());
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarByBatch(stepTask.getBatch());
if(ObjectUtil.isNotNull(bindCar)){
patientCarId = bindCar.getId();
}
@ -79,7 +79,6 @@ public class ProjectService implements IProjectService {
// 修改平车结束时间点
boolean needModifyEndTime = bindCar != null && (bindCar.getEndTime() == null || bindCar.getEndTime() == 0);
if (needModifyEndTime) {
// log.info("出现异常,未找到绑定平车:{}", stepTask.getTaskSubId());
PatientWisdomCar patientWisdomCar = new PatientWisdomCar();
patientWisdomCar.setId(bindCar.getId());
patientWisdomCar.setEndTime(startTime);
@ -91,7 +90,6 @@ public class ProjectService implements IProjectService {
dataExample.createCriteria().andTaskSubIdEqualTo(stepTask.getTaskSubId()).andStepIdEqualTo(stepTask.getStepId());
List<PatientData> patientData = patientDataDao.selectByExample(dataExample);
if (CollectionUtil.isNotEmpty(patientData)){
// log.info("taskId:{}, stepId:{}已经存在,不再修改", stepTask.getTaskSubId(), stepTask.getStepId());
log.info("修改开始时间");
PatientData data = patientData.get(0);
data.setStartTime(startTime);
@ -107,11 +105,11 @@ public class ProjectService implements IProjectService {
data.setType(operation);
patientDataDao.updateByPrimaryKeySelective(data);
// 未推送
if (data.getPushStatus() == Constant.PUSH_STATUS_SUCCESS) {
log.info("已推送成功,不处理");
return;
}
// // 未推送
// if (data.getPushStatus() == Constant.PUSH_STATUS_SUCCESS) {
// log.info("已推送成功,不处理");
// return;
// }
// 异步推送数据 根据结果修改状态
asyncService.pushTime(stepTask, data);
return;
@ -146,7 +144,7 @@ public class ProjectService implements IProjectService {
@Override
public List<ProjectVo.Record> queryWeight(ProjectDto.Weight param, Long userId) {
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getTaskSubId());
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarByBatch(param.getProjectId());
if (bindCar == null) {
log.info("没有找到绑定的平车信息:{},userId:{}", param, userId);
return new ArrayList<>();

14
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StepService.java

@ -36,13 +36,13 @@ public class StepService implements IStepService {
@Override
public List<StepVo.StepStatus> findStepIsOver(StepDto.FindStepStatus param) {
StepTaskExample stepTaskExample = new StepTaskExample();
stepTaskExample.createCriteria().andTaskSubIdEqualTo(param.getTaskSubId());
List<StepTask> stepTasks = stepTaskDao.selectByExample(stepTaskExample);
if (CollectionUtil.isEmpty(stepTasks)){
throw new BaseException(CodeEnum.TASK_IS_EXIST);
}
return stepDao.findStepIsOver(param.getTaskSubId());
// StepTaskExample stepTaskExample = new StepTaskExample();
// stepTaskExample.createCriteria().andTaskSubIdEqualTo(param.getTaskSubId());
// List<StepTask> stepTasks = stepTaskDao.selectByExample(stepTaskExample);
// if (CollectionUtil.isEmpty(stepTasks)){
// throw new BaseException(CodeEnum.TASK_IS_EXIST);
// }
return stepDao.findStepIsOver(param.getProjectId());
}
}

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

@ -31,6 +31,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
/**
* @author AUSU
@ -110,6 +111,9 @@ public class WisdomCarService implements IWisdomCarService {
hospitalMember = hospitalMembers.get(0);
long incr = redisUtil.incr("hospital_" + hospitalMember.getHospitalId().toString(), 1L);
patient.setMedicalRecordNum(String.valueOf(incr));
}else {
long incr = redisUtil.incr("hospital_", 1L);
patient.setMedicalRecordNum(String.valueOf(incr));
}
if (ObjectUtil.isNotNull(param.getPatientName())){
patient.setName(param.getPatientName());
@ -167,6 +171,21 @@ public class WisdomCarService implements IWisdomCarService {
long currentTime = System.currentTimeMillis();
//正在值班的医生(0-急诊护士,1-急诊医生,2-专科医生,3-分诊台)
List<HospitalMember> doctor = hospitalWrokingDao.findWorkingDoctor(hospitalMembers.get(0).getHospitalId(),currentTime);
//查看正在值班的医生是否包含创建者
boolean flag = doctor.stream().anyMatch(dc -> dc.getUserId().equals(userId));
if (!flag){
HospitalMemberExample memberExample = new HospitalMemberExample();
memberExample.createCriteria().andUserIdEqualTo(userId);
List<HospitalMember> member = hospitalMemberDao.selectByExample(memberExample);
if (CollectionUtil.isNotEmpty(member)){
PatientDoctor patientDoctor = new PatientDoctor();
patientDoctor.setId(snowflake.nextId());
patientDoctor.setDoctorId(member.get(0).getId());
patientDoctor.setPatientId(patient.getId());
patientDoctorDao.insertSelective(patientDoctor);
}
}
for (HospitalMember member : doctor) {
MemberRoleDto.MemberForTemplate memberForTemplate = new MemberRoleDto.MemberForTemplate();
List<String> roleName = new ArrayList<>();
@ -252,7 +271,7 @@ public class WisdomCarService implements IWisdomCarService {
for (ProjectVo.TaskSub taskSub : taskDetail.getTaskSubList()) {
StepTask stepTask = new StepTask();
stepTask.setId(snowflake.nextId());
stepTask.setBatch(1);
stepTask.setBatch(data.getId());
stepTask.setPatientId(patient.getId());
stepTask.setTaskSubId(taskSub.getTaskSubId());
if (CollectionUtil.isNotEmpty(steps)){
@ -304,17 +323,18 @@ public class WisdomCarService implements IWisdomCarService {
if (0 == carIsExist){
throw new BaseException(CodeEnum.WISDOM_CAR_IS_EXIST);
}
//查询任务是否存在
Integer taskIsExist = stepTaskDao.findTaskIsExist(param.getTaskSubId());
if (0 == taskIsExist){
throw new BaseException(CodeEnum.TASK_IS_EXIST);
}
// //查询任务是否存在
// Integer taskIsExist = stepTaskDao.findTaskIsExist(param.getTaskSubId());
// if (0 == taskIsExist){
// throw new BaseException(CodeEnum.TASK_IS_EXIST);
// }
//查询任务是否是分诊环节的任务ID
// Integer taskIsTriageTask = stepTaskDao.findTaskIsTriageTask(param.getTaskSubId());
// if (0 == taskIsTriageTask){
// throw new BaseException(CodeEnum.PARAM_ERROR);
// }
//查询患者是否存在
// TODO 患者校验需重设置
Integer patientIsExist = patientProjectDao.findPatientIsExist(param.getProjectId());
if (0 == patientIsExist){
throw new BaseException(Constant.PATIENT_NOT_FOUND);
@ -331,6 +351,7 @@ public class WisdomCarService implements IWisdomCarService {
throw new BaseException(CodeEnum.WISDOM_CAR_RUNNED);
}
// 查询患者信息
// TODO 患者校验需重设置
PatientProjectExample projectExample = new PatientProjectExample();
projectExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
List<PatientProject> patientProjects = patientProjectDao.selectByExample(projectExample);
@ -345,7 +366,8 @@ public class WisdomCarService implements IWisdomCarService {
// 绑定平车
PatientWisdomCar pc = new PatientWisdomCar();
pc.setId(snowflake.nextId());
pc.setTaskSubId(param.getTaskSubId());
// pc.setTaskSubId(param.getTaskSubId());
pc.setBatch(param.getProjectId());
pc.setPatientId(patient.getId());
pc.setCarId(param.getCarId());
pc.setStartTime(param.getStartTime());
@ -364,12 +386,7 @@ public class WisdomCarService implements IWisdomCarService {
}
// 更新患者数据中,尚未绑定平车的数据
patientDataDao.updateCarId(pc.getId(), param.getTaskSubId());
// 添加分诊任务开始
com.ccsens.wisdomcar.bean.dto.ProjectDto.Start start = new com.ccsens.wisdomcar.bean.dto.ProjectDto.Start();
start.setTaskSubId(param.getTaskSubId());
start.setStartTime(param.getStartTime());
projectService.start(start,userId);
patientDataDao.updateCarId(pc.getId(), param.getProjectId());
}
@Override
@ -379,7 +396,7 @@ public class WisdomCarService implements IWisdomCarService {
@Override
public List<WisdomCarVo.BindingCarInfo> queryBindingCar(WisdomCarDto.QueryInfo param) {
List<WisdomCarVo.BindingCarInfo> bindingCarList = patientWisdomCarDao.queryBindingCarList(param.getTaskSubId());
List<WisdomCarVo.BindingCarInfo> bindingCarList = patientWisdomCarDao.queryBindingCarList(param.getProjectId());
if(CollectionUtil.isEmpty(bindingCarList)){
// log.info("未找到对应的任务");
// throw new BaseException(CodeEnum.PARAM_ERROR);
@ -405,7 +422,8 @@ public class WisdomCarService implements IWisdomCarService {
List<WisdomCarVo.QueryBindingCarRun> queryBindingCarRunList = patientWisdomCarDao.queryBindingCarIsRun(param.getCarId());
if(CollectionUtil.isEmpty(queryBindingCarRunList)){
log.info("未找到对应的平车在运行");
throw new BaseException(CodeEnum.PARAM_ERROR);
//throw new BaseException(CodeEnum.PARAM_ERROR);
return queryBindingCarRunList;
}
for (WisdomCarVo.QueryBindingCarRun queryBindingCarRun : queryBindingCarRunList) {
//通过平车id把 平车的平车编号信息存入

3
wisdomcar/src/main/resources/application-test.yml

@ -4,7 +4,8 @@ server:
context-path:
spring:
application:
name: wisdomcar
# name: wisdomcar
name: wisdomcar2
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:

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

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

5
wisdomcar/src/main/resources/mapper_dao/PatientDataDao.xml

@ -4,10 +4,7 @@
<update id="updateCarId">
update t_patient_data set patient_car_id = #{carId} where task_sub_id in
(select t2.task_sub_id from t_step_task t1, t_step_task t2
where t1.patient_id = t2.patient_id and t1.batch = t2.batch
and t1.task_sub_id = #{taskSubId}
and t1.rec_status = 0 and t2.rec_status = 0)
(select task_sub_id from t_step_task where batch = #{projectId} and rec_status = 0)
and patient_car_id = 0 and rec_status = 0
</update>
<select id="getStartTime" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$GetStartTime">

2
wisdomcar/src/main/resources/mapper_dao/PatientWisdomCarDao.xml

@ -25,7 +25,7 @@
a.end_time as endTime
from t_patient_wisdom_car a,t_wisdom_car b
where a.car_id=b.id
and a.task_sub_id=#{taskSubId}
and a.batch=#{projectId}
order by a.start_time desc
</select>

21
wisdomcar/src/main/resources/mapper_dao/StepDao.xml

@ -31,8 +31,8 @@
`value`
FROM `t_wisdom_car_record`
WHERE
car_id = 1
and type = 1
car_id = #{carId}
and type = #{type}
ORDER BY time DESC
limit 1
</select>
@ -54,21 +54,10 @@
LEFT JOIN t_patient_data AS pd ON s.id = pd.step_id
AND pd.task_sub_id IN (
SELECT
st.task_sub_id
task_sub_id
FROM
t_step_task AS st,
(
SELECT
st.batch,
st.patient_id
FROM
t_step_task AS st
WHERE
st.task_sub_id = #{taskSubId}
) AS bat
WHERE
st.patient_id = bat.patient_id
AND st.batch = bat.batch
t_step_task
where batch = #{projectId}
)
LEFT JOIN t_hospital_member AS hm ON pd.user_id = hm.user_id
WHERE

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

@ -2,26 +2,21 @@
<!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.StepTaskDao">
<select id="getBindCarTaskId" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$BindCar" parameterType="java.lang.Long">
select c.id, c.task_sub_id as taskSubId, c.patient_id as patientId, c.car_id as carId, c.start_time as startTime, c.end_time as endTime FROM
(select patient_id, batch from t_step_task where task_sub_id = #{taskSubId} and rec_status = 0) batch,
(select id from t_step where code = 1 and step_type = 0 and rec_status = 0) step,
t_step_task st,
<select id="getBindCarByBatch" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$BindCar" parameterType="java.lang.Long">
select c.id, c.batch as batch, c.patient_id as patientId, c.car_id as carId, c.start_time as startTime, c.end_time as endTime FROM
t_patient_wisdom_car c
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
where c.batch = #{batch} 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.*
st.*
FROM
t_patient_wisdom_car pc,
t_step_task st,
t_step_task st2
t_step_task st
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}
pc.batch = st.batch
AND pc.patient_id = st.patient_id
AND st.step_id = #{stepId}
AND pc.car_id = #{carId}
AND pc.start_time &lt;= #{time} AND pc.end_time = 0 AND pc.start_time + 2 * 60 * 60 * 1000 > #{time}
order by pc.created_at desc limit 1
@ -47,4 +42,8 @@
AND step_id = 29
AND rec_status = 0
</select>
<select id="getBindCarByTaskNew" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$BindCar">
</select>
</mapper>

30
wisdomcar/src/main/resources/mapper_raw/PatientWisdomCarMapper.xml

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.wisdomcar.bean.po.PatientWisdomCar">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="task_sub_id" jdbcType="BIGINT" property="taskSubId" />
<result column="batch" jdbcType="BIGINT" property="batch" />
<result column="car_id" jdbcType="BIGINT" property="carId" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
@ -73,7 +73,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, patient_id, task_sub_id, car_id, start_time, end_time, is_demo, created_at, updated_at,
id, patient_id, batch, car_id, start_time, end_time, is_demo, created_at, updated_at,
rec_status, binding_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientWisdomCarExample" resultMap="BaseResultMap">
@ -107,11 +107,11 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.wisdomcar.bean.po.PatientWisdomCar">
insert into t_patient_wisdom_car (id, patient_id, task_sub_id,
insert into t_patient_wisdom_car (id, patient_id, batch,
car_id, start_time, end_time,
is_demo, created_at, updated_at,
is_demo, created_at, updated_at,
rec_status, binding_status)
values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{taskSubId,jdbcType=BIGINT},
values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{batch,jdbcType=BIGINT},
#{carId,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{isDemo,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT}, #{bindingStatus,jdbcType=TINYINT})
@ -125,8 +125,8 @@
<if test="patientId != null">
patient_id,
</if>
<if test="taskSubId != null">
task_sub_id,
<if test="batch != null">
batch,
</if>
<if test="carId != null">
car_id,
@ -160,8 +160,8 @@
<if test="patientId != null">
#{patientId,jdbcType=BIGINT},
</if>
<if test="taskSubId != null">
#{taskSubId,jdbcType=BIGINT},
<if test="batch != null">
#{batch,jdbcType=BIGINT},
</if>
<if test="carId != null">
#{carId,jdbcType=BIGINT},
@ -204,8 +204,8 @@
<if test="record.patientId != null">
patient_id = #{record.patientId,jdbcType=BIGINT},
</if>
<if test="record.taskSubId != null">
task_sub_id = #{record.taskSubId,jdbcType=BIGINT},
<if test="record.batch != null">
batch = #{record.batch,jdbcType=BIGINT},
</if>
<if test="record.carId != null">
car_id = #{record.carId,jdbcType=BIGINT},
@ -240,7 +240,7 @@
update t_patient_wisdom_car
set id = #{record.id,jdbcType=BIGINT},
patient_id = #{record.patientId,jdbcType=BIGINT},
task_sub_id = #{record.taskSubId,jdbcType=BIGINT},
batch = #{record.batch,jdbcType=BIGINT},
car_id = #{record.carId,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
@ -259,8 +259,8 @@
<if test="patientId != null">
patient_id = #{patientId,jdbcType=BIGINT},
</if>
<if test="taskSubId != null">
task_sub_id = #{taskSubId,jdbcType=BIGINT},
<if test="batch != null">
batch = #{batch,jdbcType=BIGINT},
</if>
<if test="carId != null">
car_id = #{carId,jdbcType=BIGINT},
@ -292,7 +292,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.wisdomcar.bean.po.PatientWisdomCar">
update t_patient_wisdom_car
set patient_id = #{patientId,jdbcType=BIGINT},
task_sub_id = #{taskSubId,jdbcType=BIGINT},
batch = #{batch,jdbcType=BIGINT},
car_id = #{carId,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},

14
wisdomcar/src/main/resources/mapper_raw/StepTaskMapper.xml

@ -6,7 +6,7 @@
<result column="step_id" jdbcType="BIGINT" property="stepId" />
<result column="task_sub_id" jdbcType="BIGINT" property="taskSubId" />
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="batch" jdbcType="INTEGER" property="batch" />
<result column="batch" jdbcType="BIGINT" property="batch" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
@ -107,7 +107,7 @@
patient_id, batch, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{stepId,jdbcType=BIGINT}, #{taskSubId,jdbcType=BIGINT},
#{patientId,jdbcType=BIGINT}, #{batch,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{patientId,jdbcType=BIGINT}, #{batch,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.wisdomcar.bean.po.StepTask">
@ -152,7 +152,7 @@
#{patientId,jdbcType=BIGINT},
</if>
<if test="batch != null">
#{batch,jdbcType=INTEGER},
#{batch,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
@ -187,7 +187,7 @@
patient_id = #{record.patientId,jdbcType=BIGINT},
</if>
<if test="record.batch != null">
batch = #{record.batch,jdbcType=INTEGER},
batch = #{record.batch,jdbcType=BIGINT},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
@ -209,7 +209,7 @@
step_id = #{record.stepId,jdbcType=BIGINT},
task_sub_id = #{record.taskSubId,jdbcType=BIGINT},
patient_id = #{record.patientId,jdbcType=BIGINT},
batch = #{record.batch,jdbcType=INTEGER},
batch = #{record.batch,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
@ -230,7 +230,7 @@
patient_id = #{patientId,jdbcType=BIGINT},
</if>
<if test="batch != null">
batch = #{batch,jdbcType=INTEGER},
batch = #{batch,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
@ -249,7 +249,7 @@
set step_id = #{stepId,jdbcType=BIGINT},
task_sub_id = #{taskSubId,jdbcType=BIGINT},
patient_id = #{patientId,jdbcType=BIGINT},
batch = #{batch,jdbcType=INTEGER},
batch = #{batch,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}

Loading…
Cancel
Save