Browse Source

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

pt
zy_Java 4 years ago
parent
commit
f19d9a542b
  1. 2
      cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/ProjectDto.java
  2. 6
      tall/src/main/java/com/ccsens/tall/service/ProjectService.java
  3. 4
      tall/src/main/resources/application.yml
  4. 1
      util/src/main/java/com/ccsens/util/baidu/BaiDuDto.java
  5. 47
      wisdomcar/src/main/java/com/ccsens/wisdomcar/api/ProjectController.java
  6. 2
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/CreateCaseDto.java
  7. 16
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/ProjectDto.java
  8. 47
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/ProjectVo.java
  9. 14
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/PatientDataDao.java
  10. 7
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IProjectService.java
  11. 11
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/ProjectService.java
  12. 26
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/WisdomCarService.java
  13. 10
      wisdomcar/src/main/java/com/ccsens/wisdomcar/util/Constant.java
  14. 11
      wisdomcar/src/main/resources/mapper_dao/PatientDataDao.xml

2
cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/ProjectDto.java

@ -19,5 +19,7 @@ public class ProjectDto {
@NotNull(message = "请选择要复制得项目")
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("新项目名字")
private String projectName;
}
}

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

@ -1516,7 +1516,11 @@ public class ProjectService implements IProjectService {
BeanUtil.copyProperties(oldProject,newProject);
newProject.setId(snowflake.nextId());
newProject.setCreatorId(userId);
newProject.setName(oldProject.getName()+"-副本");
if (StrUtil.isNotBlank(param.getProjectName())){
newProject.setName(param.getProjectName());
}else{
newProject.setName(oldProject.getName()+"-副本");
}
newProject.setTemplate((byte)0);
newProject.setBeginTime(currentTime);
newProject.setEndTime(currentTime+timeDifference);

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

1
util/src/main/java/com/ccsens/util/baidu/BaiDuDto.java

@ -15,5 +15,6 @@ public class BaiDuDto {
public static class GeneralBasic{
private String image;
private String url;
private String detect_direction = "true";
}
}

47
wisdomcar/src/main/java/com/ccsens/wisdomcar/api/ProjectController.java

@ -1,23 +1,33 @@
package com.ccsens.wisdomcar.api;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ImageUtil;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.baidu.BaiDuDto;
import com.ccsens.util.baidu.BaiDuUtil;
import com.ccsens.util.baidu.BaiDuVo;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.wisdomcar.bean.dto.ProjectDto;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import com.ccsens.wisdomcar.service.IProjectService;
import com.ccsens.wisdomcar.util.Constant;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.Part;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
@ -52,6 +62,35 @@ public class ProjectController {
log.info("查询称重和剂量:{}", list);
return JsonResponse.newInstance().ok(list);
}
@MustLogin
@ApiOperation(value = "查询开始时间", notes = "whj")
@RequestMapping(value = "/getStartTime", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ProjectVo.GetStartTime> getStartTime(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.GetStartTime> params){
log.info("查询开始时间:{}", params);
ProjectVo.GetStartTime time = projectService.getStartTime(params.getParam(), params.getUserId());
log.info("查询开始时间结束:{}", time);
return JsonResponse.newInstance().ok(time);
}
// @MustLogin
@ApiOperation(value = "图像识别", notes = "whj")
@RequestMapping(value = "/identifyWords", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ProjectVo.PersonMsg> identifyWords(@RequestParam(required = true) Part part) throws IOException {
log.info("图像识别");
// 压缩图像
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageUtil.scale(ImageIO.read(part.getInputStream()), out, 0.5f);
String img = Base64.encode(out.toByteArray());
// 图像识别
BaiDuDto.GeneralBasic basic = new BaiDuDto.GeneralBasic();
basic.setImage(img);
BaiDuVo.GeneralBasic words = BaiDuUtil.accurateBasic(Constant.BaiDu.APP_KEY, Constant.BaiDu.SECRET_KEY, basic);
// 返回图像
ProjectVo.PersonMsg personMsg = new ProjectVo.PersonMsg();
personMsg.toMsg(words.getWordsResult());
log.info("图像识别结束:{}", personMsg);
return JsonResponse.newInstance().ok(personMsg);
}
@MustLogin

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

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Pattern;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -26,6 +27,7 @@ public class CreateCaseDto {
private int patientAge;
@ApiModelProperty("患者身份证号")
private String patientIdCard;
@Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号")
@ApiModelProperty("患者手机号")
private String patientPhone;
@ApiModelProperty("患者病案号")

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

@ -32,6 +32,22 @@ public class ProjectDto {
private Long taskSubId;
}
@Data
@ApiModel("查询任务开始时间--请求")
public static class GetStartTime {
@NotNull(message="请说明您的任务")
@ApiModelProperty("分解任务ID")
private Long taskSubId;
}
@Data
@ApiModel("图像识别--请求")
public static class Img {
@NotNull
@ApiModelProperty("文件路径")
private String url;
}
@Data
@ApiModel("切换项目")
public static class SwitchProject {

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

@ -1,9 +1,16 @@
package com.ccsens.wisdomcar.bean.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdcardUtil;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.baidu.BaiDuVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @description:
* @author: whj
@ -40,4 +47,44 @@ public class ProjectVo {
private Long endTime;
}
@Data
@ApiModel("查询任务开始时间--响应")
public static class GetStartTime {
@ApiModelProperty("任务ID")
private Long taskSubId;
@ApiModelProperty("开始时间")
private Long startTime;
}
@Data
@ApiModel("身份信息")
public static class PersonMsg {
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("性别")
private byte sex;
@ApiModelProperty("身份证号")
private String idCardNo;
@ApiModelProperty("年龄")
private int age;
public void toMsg(List<BaiDuVo.GeneralWord> words) {
if (CollectionUtil.isEmpty(words)) {
return;
}
words.forEach(wordNode ->{
String word = wordNode.getWords();
if (word.startsWith("姓名")) {
this.name = word.substring(2);
} else if (word.startsWith("性别")) {
String sexWord = word.substring(2,3);
this.sex = "女".equals(sexWord) ? (byte)0 : (byte)1;
} else if (word.startsWith("公民身份号码")) {
this.idCardNo = word.substring(6);
this.age = IdcardUtil.getAgeByIdCard(this.idCardNo);
}
});
}
}
}

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

@ -2,6 +2,7 @@ package com.ccsens.wisdomcar.persist.dao;
import com.ccsens.wisdomcar.bean.po.PatientData;
import com.ccsens.wisdomcar.bean.po.PatientDataExample;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import com.ccsens.wisdomcar.persist.mapper.PatientDataMapper;
import org.apache.ibatis.annotations.Param;
@ -12,4 +13,17 @@ import java.util.List;
*/
public interface PatientDataDao extends PatientDataMapper {
/**
* 为和taskSubId中一批的尚无消息平车信息的记录添加平车记录
* @param carId 患者绑定平车ID
* @param taskSubId 任务ID
*/
void updateCarId(@Param("carId") Long carId, @Param("taskSubId") Long taskSubId);
/**
* 查询任务开始时间
* @param taskSubId 任务ID
* @return 开始时间
*/
ProjectVo.GetStartTime getStartTime(@Param("taskSubId") Long taskSubId);
}

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

@ -36,6 +36,13 @@ public interface IProjectService {
*/
void saveData(Long startTime, StepTask stepTask, Long operationId, byte operation);
/**
* 查询开始时间
* @param param 任务ID
* @param userId userId
* @return 开始时间
*/
ProjectVo.GetStartTime getStartTime(ProjectDto.GetStartTime param, Long userId);
/**
* 选择历史患者切换项目
* @param param 项目id

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

@ -72,11 +72,9 @@ public class ProjectService implements IProjectService {
if (step != null && max != null && step.getSequence() != null && step.getSequence().intValue() == max.intValue()) {
// 修改平车结束时间点
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(stepTask.getTaskSubId());
if (bindCar == null) {
boolean needModifyEndTime = bindCar != null && (bindCar.getEndTime() == null || bindCar.getEndTime() == 0);
if (needModifyEndTime) {
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);
@ -119,6 +117,11 @@ public class ProjectService implements IProjectService {
asyncService.pushTime(stepTask, data);
}
@Override
public ProjectVo.GetStartTime getStartTime(ProjectDto.GetStartTime param, Long userId) {
return patientDataDao.getStartTime(param.getTaskSubId());
}
@Override
public List<ProjectVo.Record> queryWeight(ProjectDto.Weight param, Long userId) {
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getTaskSubId());

26
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 cn.hutool.core.util.StrUtil;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
@ -65,7 +66,8 @@ public class WisdomCarService implements IWisdomCarService {
private IProjectService projectService;
@Resource
private PatientDoctorDao patientDoctorDao;
@Resource
private PatientDataDao patientDataDao;
@Override
public void createCase(CreateCaseDto.PatientInfo param, Long userId) {
@ -175,9 +177,15 @@ public class WisdomCarService implements IWisdomCarService {
}
//新项目名字
String newProjectName = "";
newProjectName = patient.getMedicalRecordNum()+"-"+Constant.PROJECT_NAME;
if (StrUtil.isNotBlank(param.getPatientName())){
newProjectName +="-"+param.getPatientName();
}
ProjectDto.CopyProject copyProject = new ProjectDto.CopyProject();
copyProject.setProjectId(Constant.TEMPLATE_PROJECT);
copyProject.setProjectName(newProjectName);
log.info("调用tall内的复制项目:{}",copyProject);
QueryDto<ProjectDto.CopyProject> dto = new QueryDto<>();
dto.setParam(copyProject);
@ -285,14 +293,16 @@ public class WisdomCarService implements IWisdomCarService {
if (CollectionUtil.isEmpty(carRecords)) {
pc.setBindingStatus(Constant.PUSH_STATUS_SUCCESS);
patientWisdomCarDao.insertSelective(pc);
return;
} else {
carRecords.forEach(record -> {
projectService.saveData(record.getTime(), record.getStepTask(), record.getId(), Constant.OPERATION_CAR);
});
pc.setBindingStatus(Constant.PUSH_STATUS_SUCCESS);
patientWisdomCarDao.insertSelective(pc);
}
carRecords.forEach(record -> {
projectService.saveData(record.getTime(), record.getStepTask(), record.getId(), Constant.OPERATION_CAR);
});
pc.setBindingStatus(Constant.PUSH_STATUS_SUCCESS);
patientWisdomCarDao.insertSelective(pc);
// 更新患者数据中,尚未绑定平车的数据
patientDataDao.updateCarId(pc.getId(), param.getTaskSubId());
}
@Override

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

@ -53,6 +53,10 @@ public class Constant {
* 智慧平车,模板项目id
*/
public static final Long TEMPLATE_PROJECT = 1399649478197252096L;
/**
* 项目名字
*/
public static final String PROJECT_NAME = "卒中急救流程";
/**
* 角色名称:患者家属
@ -124,4 +128,10 @@ public class Constant {
* 调用Tall异常
*/
public static final Byte TASK_DETAIL_LEVEL_TWO = 2;
public static class BaiDu{
public static final String APP_KEY = "F43SLi3hDra3EgWiSi8bIH8c";
public static final String SECRET_KEY = "wGhbTXGsrbxfuCQT7WyLDndYRxrSYqbD";
public static final String KEY = "key";
public static final String NUM = "num";
}
}

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

@ -2,4 +2,15 @@
<!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.PatientDataDao">
<update id="updateCarId">
update t_patient_data set patient_car_id = #{carId} where task_sub_id in
(select t2.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)
and patient_car_id = 0 and rec_status = 0
</update>
<select id="getStartTime" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$GetStartTime">
select task_sub_id as taskSubId, start_time as startTime from t_patient_data where task_sub_id = #{taskSubId} and rec_status = 0
</select>
</mapper>
Loading…
Cancel
Save