Browse Source

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

recovery
zy_Java 4 years ago
parent
commit
9b389fc4cc
  1. 2
      pom.xml
  2. 7
      tcm/src/main/java/com/ccsens/tcm/api/BiologicalSamplesController.java
  3. 2
      tcm/src/main/java/com/ccsens/tcm/api/ConferenceRecordsController.java
  4. 10
      tcm/src/main/java/com/ccsens/tcm/api/PatientController.java
  5. 6
      tcm/src/main/java/com/ccsens/tcm/api/StatisticalAnalysisController.java
  6. 14
      tcm/src/main/java/com/ccsens/tcm/bean/dto/BiologicalSamplesDto.java
  7. 20
      tcm/src/main/java/com/ccsens/tcm/bean/dto/ConRecDto.java
  8. 27
      tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java
  9. 10
      tcm/src/main/java/com/ccsens/tcm/bean/dto/StatisticDto.java
  10. 22
      tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecords.java
  11. 120
      tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecordsExample.java
  12. 39
      tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecordsWithBLOBs.java
  13. 16
      tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java
  14. 7
      tcm/src/main/java/com/ccsens/tcm/bean/vo/ConRecVo.java
  15. 3
      tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java
  16. 16
      tcm/src/main/java/com/ccsens/tcm/bean/vo/StatisticVo.java
  17. 7
      tcm/src/main/java/com/ccsens/tcm/persist/dao/PatientDao.java
  18. 2
      tcm/src/main/java/com/ccsens/tcm/persist/dao/ReportCodeDao.java
  19. 4
      tcm/src/main/java/com/ccsens/tcm/service/ConferenceService.java
  20. 2
      tcm/src/main/java/com/ccsens/tcm/service/IConferenceService.java
  21. 6
      tcm/src/main/java/com/ccsens/tcm/service/IPatientService.java
  22. 30
      tcm/src/main/java/com/ccsens/tcm/service/PatientService.java
  23. 2
      tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java
  24. 132
      tcm/src/main/resources/mapper_dao/PatientDao.xml
  25. 20
      tcm/src/main/resources/mapper_dao/ReportCodeDao.xml
  26. 66
      tcm/src/main/resources/mapper_raw/ConferenceRecordsMapper.xml
  27. 2
      util/src/main/java/com/ccsens/util/CodeEnum.java
  28. 17
      util/src/main/java/com/ccsens/util/DateUtil.java
  29. 53
      wisdomcar/src/main/java/com/ccsens/wisdomcar/api/RecordController.java
  30. 69
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java
  31. 28
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java
  32. 23
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/WisdomCarRecordDao.java
  33. 22
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IRecordService.java
  34. 128
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java
  35. 11
      wisdomcar/src/main/resources/application-dev.yml
  36. 10
      wisdomcar/src/main/resources/application-prod.yml
  37. 9
      wisdomcar/src/main/resources/application-test.yml
  38. 4
      wisdomcar/src/main/resources/application.yml
  39. 14
      wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml

2
pom.xml

@ -12,7 +12,7 @@
<!-- <module>ht</module>-->
<!-- <module>game</module>-->
<!-- <module>mt</module>-->
<!-- <module>wisdomcar</module>-->
<module>wisdomcar</module>
<module>beneficiation</module>
<!-- <module>form</module>-->
<!-- <module>signin</module>-->

7
tcm/src/main/java/com/ccsens/tcm/api/BiologicalSamplesController.java

@ -58,5 +58,12 @@ public class BiologicalSamplesController {
List<BiologicalSamplesVo.SelBiologNums> selBiologNumsList=patientService.selAllYBS();
return JsonResponse.newInstance().ok(selBiologNumsList);
}
@MustLogin
@ApiOperation(value = "统计某医院下得生物样本数量", notes = "w:统计某个医院的生物样本的数量")
@RequestMapping(value = "/selByHosAllYBS", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<BiologicalSamplesVo.selByHosAllYBS>> selByHosAllYBS(@ApiParam @Validated @RequestBody QueryDto<BiologicalSamplesDto.SelHosId> params){
List<BiologicalSamplesVo.selByHosAllYBS> selBiologNumsList=patientService.selByHosAllYBS(params.getParam().getHospitalId());
return JsonResponse.newInstance().ok(selBiologNumsList);
}
}

2
tcm/src/main/java/com/ccsens/tcm/api/ConferenceRecordsController.java

@ -71,7 +71,7 @@ public class ConferenceRecordsController {
@MustLogin
@ApiOperation(value = "查看会议记录", notes = "zy:")
@RequestMapping(value = "/get", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ConRecVo.SelConRecVo> getConference(@ApiParam @Validated @RequestBody QueryDto<ConRecDto.ConferenceTask> params) throws Exception {
public JsonResponse<ConRecVo.SelConRecVo> getConference(@ApiParam @Validated @RequestBody QueryDto<ConRecDto.GetConference> params) throws Exception {
log.info("统计每个医院的完成情况:{}",params);
ConRecVo.SelConRecVo selConRecVo = conferenceService.getConference(params.getParam());
log.info("查找每个医院的病例完成情况");

10
tcm/src/main/java/com/ccsens/tcm/api/PatientController.java

@ -41,6 +41,16 @@ public class PatientController {
log.info("添加患者基本信息成功");
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "修改患者的完成状态", notes = "w:修改患者的完成状态")
@RequestMapping(value = "/upPatientMes", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse upPatientMes(@ApiParam @Validated @RequestBody QueryDto<PatientDto.UpPatient> params) {
log.info("修改患者基本信息:{}",params);
patientService.upPatientMes(params.getParam(),params.getUserId());
log.info("修改患者基本信息成功");
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "查询患者基本信息", notes = "w:查询患者基本信息")
@RequestMapping(value = "/selPatientMes", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})

6
tcm/src/main/java/com/ccsens/tcm/api/StatisticalAnalysisController.java

@ -42,7 +42,7 @@ public class StatisticalAnalysisController {
log.info("统计每日病例调用完成");
return JsonResponse.newInstance().ok(countCase);
}
@MustLogin
// @MustLogin
@ApiOperation(value = "病例分析", notes = "w:病例分析")
@RequestMapping(value = "/countAnalysis", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<StatisticVo.SelGroupNumAdd> countAnalysis(@ApiParam @Validated @RequestBody QueryDto<StatisticDto.SelBinLCount> params) {
@ -59,9 +59,9 @@ public class StatisticalAnalysisController {
@MustLogin
@ApiOperation(value = "统计病例的完成情况", notes = "zy:")
@RequestMapping(value = "/complete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<StatisticVo.StatisticsComplete> statisticsComplete(@ApiParam @Validated @RequestBody QueryDto<StatisticDto.Complete> params) {
public JsonResponse<List<StatisticVo.StatisticsComplete>> statisticsComplete(@ApiParam @Validated @RequestBody QueryDto<StatisticDto.Complete> params) {
log.info("统计病例的完成情况:{}",params);
StatisticVo.StatisticsComplete statisticsComplete = patientService.statisticsComplete(params.getParam());
List<StatisticVo.StatisticsComplete> statisticsComplete = patientService.statisticsComplete(params.getParam());
log.info("查找统计病例的完成情况");
return JsonResponse.newInstance().ok(statisticsComplete);
}

14
tcm/src/main/java/com/ccsens/tcm/bean/dto/BiologicalSamplesDto.java

@ -24,6 +24,7 @@ public class BiologicalSamplesDto {
@ApiModelProperty("采集时间")
private Integer collectTime;
}
@Data
@ApiModel("查询生物样本-1007")
public static class SelBiolog {
@ -32,15 +33,22 @@ public class BiologicalSamplesDto {
@ApiModelProperty("样本类型 0:抗血凝10ml 1:促凝血5ml 2:晨尿10ml 3:24小时尿10ml")
private Byte sampleType;
@ApiModelProperty("患者住院号")
private String hospitalization;
private String hospitalization;
@ApiModelProperty("采集时间")
private Integer collectTime;
@Min(1)
@ApiModelProperty("当前页")
private Integer pageNum=1;
private Integer pageNum = 1;
@Min(1)
@Max(20)
@ApiModelProperty("每页数量")
private Integer pageSize=10;
private Integer pageSize = 10;
}
@Data
@ApiModel("根据医院id查询生物样本得数量统计")
public static class SelHosId {
@NotNull
@ApiModelProperty("医院id")
private Long hospitalId;
}
}

20
tcm/src/main/java/com/ccsens/tcm/bean/dto/ConRecDto.java

@ -48,6 +48,14 @@ public class ConRecDto {
@NotNull(message = "任务id不能为空")
@ApiModelProperty("任务id")
private Long taskId;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务开始时间")
private Date taskStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务结束时间")
private Date taskEndTimek;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("开始时间")
private Date startTime;
@ -78,4 +86,16 @@ public class ConRecDto {
@ApiModelProperty("任务id")
private Long taskId;
}
@Data
@ApiModel("查看会议记录dto")
public class GetConference {
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务开始时间")
private Date taskStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务结束时间")
private Date taskEndTimek;
}
}

27
tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java

@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@ -104,6 +105,9 @@ public class PatientDto {
private List<Condition> conditionList;
@ApiModelProperty("搜索条件集合,是包含时间格式的条件")
private List<ConditionDate> conditionListDate;
@ApiModelProperty("认知报告单相关参数")
private List<Search> reportParams;
@Min(1)
@ApiModelProperty("当前页")
private Integer pageNum=1;
@ -112,6 +116,19 @@ public class PatientDto {
@ApiModelProperty("每页数量")
private Integer pageSize=10;
}
@Data
@ApiModel("搜索报告单参数-请求")
public static class Search {
@ApiModelProperty("报告单类型")
@NotEmpty(message="请选择查询类型")
private String code;
@ApiModelProperty("最低分数")
private Integer start;
@ApiModelProperty("最高分数")
private Integer end;
}
@Data
@ApiModel("查询患者的搜索条件详情")
public static class Condition{
@ -130,4 +147,14 @@ public class PatientDto {
@ApiModelProperty("结束时间,必须填")
private String endTime="";
}
@Data
@ApiModel("修改病人的状态")
public static class UpPatient {
@NotNull
@ApiModelProperty("病人id")
private Long id;
@NotNull
@ApiModelProperty("录入状态:0:新建 1:数据搜集中 2数据搜集完成 3数据搜集超时 4:废弃")
private Byte inputStatus;
}
}

10
tcm/src/main/java/com/ccsens/tcm/bean/dto/StatisticDto.java

@ -31,16 +31,8 @@ public class StatisticDto {
@Data
@ApiModel("每日病例统计传参")
public static class SelCount{
@ApiModelProperty("主治大夫id")
private Long userId;
@ApiModelProperty("医院id")
private Long hospitalId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@ApiModelProperty("开始时间")
private Date startDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@ApiModelProperty("结束时间")
private Date endDate;
}
@Data
@ApiModel("病例分析传参")
@ -49,6 +41,8 @@ public class StatisticDto {
private List<PatientDto.Condition> conditionList;
@ApiModelProperty("搜索条件集合,是包含时间格式的条件")
private List<PatientDto.ConditionDate> conditionListDate;
@ApiModelProperty("认知报告单相关参数")
private List<PatientDto.Search> reportParams;
@ApiModelProperty("对照组id")
private Long[] inpatientId;
@ApiModelProperty("试题id")

22
tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecords.java

@ -8,6 +8,10 @@ public class ConferenceRecords implements Serializable {
private Long taskId;
private Date taskStartTime;
private Date taskEndTime;
private Date startTime;
private Date endTime;
@ -48,6 +52,22 @@ public class ConferenceRecords implements Serializable {
this.taskId = taskId;
}
public Date getTaskStartTime() {
return taskStartTime;
}
public void setTaskStartTime(Date taskStartTime) {
this.taskStartTime = taskStartTime;
}
public Date getTaskEndTime() {
return taskEndTime;
}
public void setTaskEndTime(Date taskEndTime) {
this.taskEndTime = taskEndTime;
}
public Date getStartTime() {
return startTime;
}
@ -144,6 +164,8 @@ public class ConferenceRecords implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", taskId=").append(taskId);
sb.append(", taskStartTime=").append(taskStartTime);
sb.append(", taskEndTime=").append(taskEndTime);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", place=").append(place);

120
tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecordsExample.java

@ -225,6 +225,126 @@ public class ConferenceRecordsExample {
return (Criteria) this;
}
public Criteria andTaskStartTimeIsNull() {
addCriterion("task_start_time is null");
return (Criteria) this;
}
public Criteria andTaskStartTimeIsNotNull() {
addCriterion("task_start_time is not null");
return (Criteria) this;
}
public Criteria andTaskStartTimeEqualTo(Date value) {
addCriterion("task_start_time =", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeNotEqualTo(Date value) {
addCriterion("task_start_time <>", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeGreaterThan(Date value) {
addCriterion("task_start_time >", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeGreaterThanOrEqualTo(Date value) {
addCriterion("task_start_time >=", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeLessThan(Date value) {
addCriterion("task_start_time <", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeLessThanOrEqualTo(Date value) {
addCriterion("task_start_time <=", value, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeIn(List<Date> values) {
addCriterion("task_start_time in", values, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeNotIn(List<Date> values) {
addCriterion("task_start_time not in", values, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeBetween(Date value1, Date value2) {
addCriterion("task_start_time between", value1, value2, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskStartTimeNotBetween(Date value1, Date value2) {
addCriterion("task_start_time not between", value1, value2, "taskStartTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeIsNull() {
addCriterion("task_end_time is null");
return (Criteria) this;
}
public Criteria andTaskEndTimeIsNotNull() {
addCriterion("task_end_time is not null");
return (Criteria) this;
}
public Criteria andTaskEndTimeEqualTo(Date value) {
addCriterion("task_end_time =", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeNotEqualTo(Date value) {
addCriterion("task_end_time <>", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeGreaterThan(Date value) {
addCriterion("task_end_time >", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeGreaterThanOrEqualTo(Date value) {
addCriterion("task_end_time >=", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeLessThan(Date value) {
addCriterion("task_end_time <", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeLessThanOrEqualTo(Date value) {
addCriterion("task_end_time <=", value, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeIn(List<Date> values) {
addCriterion("task_end_time in", values, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeNotIn(List<Date> values) {
addCriterion("task_end_time not in", values, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeBetween(Date value1, Date value2) {
addCriterion("task_end_time between", value1, value2, "taskEndTime");
return (Criteria) this;
}
public Criteria andTaskEndTimeNotBetween(Date value1, Date value2) {
addCriterion("task_end_time not between", value1, value2, "taskEndTime");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;

39
tcm/src/main/java/com/ccsens/tcm/bean/po/ConferenceRecordsWithBLOBs.java

@ -1,39 +0,0 @@
package com.ccsens.tcm.bean.po;
import java.io.Serializable;
public class ConferenceRecordsWithBLOBs extends ConferenceRecords implements Serializable {
private String discussionContent;
private String meetingMinutes;
private static final long serialVersionUID = 1L;
public String getDiscussionContent() {
return discussionContent;
}
public void setDiscussionContent(String discussionContent) {
this.discussionContent = discussionContent == null ? null : discussionContent.trim();
}
public String getMeetingMinutes() {
return meetingMinutes;
}
public void setMeetingMinutes(String meetingMinutes) {
this.meetingMinutes = meetingMinutes == null ? null : meetingMinutes.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", discussionContent=").append(discussionContent);
sb.append(", meetingMinutes=").append(meetingMinutes);
sb.append("]");
return sb.toString();
}
}

16
tcm/src/main/java/com/ccsens/tcm/bean/vo/BiologicalSamplesVo.java

@ -1,9 +1,12 @@
package com.ccsens.tcm.bean.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class BiologicalSamplesVo {
@Data
@ -17,6 +20,9 @@ public class BiologicalSamplesVo {
private Byte sampleType;
@ApiModelProperty("采集时间")
private Integer collectTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("时间")
private Date updateAt;
}
@Data
@ApiModel("统计医院生物样本数量")
@ -28,4 +34,14 @@ public class BiologicalSamplesVo {
@ApiModelProperty("生物样本数量")
private Integer nums;
}
@Data
@ApiModel("统计某医院医院生物样本数量")
public static class selByHosAllYBS{
@ApiModelProperty("数量")
private Integer nums;
@ApiModelProperty("样本名称")
private String name;
@ApiModelProperty("样本类型")
private Byte sampleType;
}
}

7
tcm/src/main/java/com/ccsens/tcm/bean/vo/ConRecVo.java

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
@ -19,6 +20,12 @@ public class ConRecVo {
private Long id;
@ApiModelProperty("任务id")
private Long taskId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务开始时间")
private Date taskStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("任务结束时间")
private Date taskEndTimek;
@ApiModelProperty("会议开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;

3
tcm/src/main/java/com/ccsens/tcm/bean/vo/PatientVo.java

@ -33,6 +33,9 @@ public class PatientVo {
private String hosName;
@ApiModelProperty("搜集次数")
private Integer collectionNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("时间")
private Date updateAt;
}
@Data
@ApiModel("经过搜索条件查询的患者集合")

16
tcm/src/main/java/com/ccsens/tcm/bean/vo/StatisticVo.java

@ -60,16 +60,12 @@ public class StatisticVo {
@Data
@ApiModel("统计病例的完成情况")
public static class StatisticsComplete{
@ApiModelProperty("已完成")
private Integer completed;
@ApiModelProperty("未完成")
private Integer unfinished;
@ApiModelProperty("进行中")
private Integer underway;
@ApiModelProperty("数据采集超时")
private Integer overtime;
@ApiModelProperty("废弃的")
private Integer discarded;
@ApiModelProperty("输入状态")
private Byte id;
@ApiModelProperty("新建")
private String name;
@ApiModelProperty("数量")
private Integer nums;
}
@Data

7
tcm/src/main/java/com/ccsens/tcm/persist/dao/PatientDao.java

@ -30,6 +30,7 @@ public interface PatientDao {
*
* @param conditionList 没有时间条件
* @param conditionListDate 有时间条件
* @param reportParams 认知量表
* @param inpatientId 对照组id
* @param testQuestionsId 测试题id
* @param hospitalization 住院号
@ -37,14 +38,14 @@ public interface PatientDao {
* @param hospitalId 医院id
* @return
*/
List<StatisticVo.SelGroupList> countAnalysis(@Param("conditionList")List<PatientDto.Condition> conditionList, @Param("conditionListDate")List<PatientDto.ConditionDate> conditionListDate, @Param("inpatientId")Long inpatientId, @Param("testQuestionsId")Long testQuestionsId,@Param("hospitalization")String hospitalization,@Param("inputStatus")Byte inputStatus,@Param("hospitalId")Long hospitalId);
List<StatisticVo.SelGroupList> countAnalysis(@Param("conditionList")List<PatientDto.Condition> conditionList, @Param("conditionListDate")List<PatientDto.ConditionDate> conditionListDate, @Param("reportParams") List<PatientDto.Search> reportParams, @Param("inpatientId")Long inpatientId, @Param("testQuestionsId")Long testQuestionsId,@Param("hospitalization")String hospitalization,@Param("inputStatus")Byte inputStatus,@Param("hospitalId")Long hospitalId);
/**
* 统计病例完成情况
* @param hospitalId 医院id
* @param userId 主治医生id
* @return 返回完成情况
*/
StatisticVo.StatisticsComplete statisticsComplete(@Param("hospitalId")Long hospitalId, @Param("userId")Long userId);
List<StatisticVo.StatisticsComplete> statisticsComplete(@Param("hospitalId")Long hospitalId, @Param("userId")Long userId);
/**
* 查询各个医院的病例完成情况
@ -68,4 +69,6 @@ public interface PatientDao {
List<StatisticVo.PatientProgressVo> selPatientProgress(Long userId);
List<String> stringLists(Long testQuestionsId);
List<BiologicalSamplesVo.selByHosAllYBS> selByHosAllYBS(@Param("id") Long id);
}

2
tcm/src/main/java/com/ccsens/tcm/persist/dao/ReportCodeDao.java

@ -30,7 +30,7 @@ public interface ReportCodeDao extends ReportCodeMapper {
* @param code code
* @return 返回类型详细信息
*/
List<QuestionVo.PatientCode> selectCodeByCode(@Param("code") String code);
List<QuestionVo.PatientCode> selectCodeByCode(@Param("code") String code,@Param("nums") Integer nums);
/**
*

4
tcm/src/main/java/com/ccsens/tcm/service/ConferenceService.java

@ -60,10 +60,10 @@ public class ConferenceService implements IConferenceService{
}
@Override
public ConRecVo.SelConRecVo getConference(ConRecDto.ConferenceTask param) {
public ConRecVo.SelConRecVo getConference(ConRecDto.GetConference param) {
ConRecVo.SelConRecVo selConRecVo = new ConRecVo.SelConRecVo();
ConferenceRecordsExample conferenceRecordsExample = new ConferenceRecordsExample();
conferenceRecordsExample.createCriteria().andTaskIdEqualTo(param.getTaskId());
conferenceRecordsExample.createCriteria().andTaskStartTimeGreaterThan(param.getTaskStartTime()).andTaskEndTimeLessThan(param.getTaskEndTimek());
List<ConferenceRecords> conferenceRecordsList = conferenceRecordsMapper.selectByExample(conferenceRecordsExample);
if(CollectionUtil.isNotEmpty(conferenceRecordsList)){
BeanUtil.copyProperties(conferenceRecordsList.get(0),selConRecVo);

2
tcm/src/main/java/com/ccsens/tcm/service/IConferenceService.java

@ -24,5 +24,5 @@ public interface IConferenceService {
* @param param 任务id
* @return 返回会议内容
*/
ConRecVo.SelConRecVo getConference(ConRecDto.ConferenceTask param);
ConRecVo.SelConRecVo getConference(ConRecDto.GetConference param);
}

6
tcm/src/main/java/com/ccsens/tcm/service/IPatientService.java

@ -43,7 +43,7 @@ public interface IPatientService {
* @param param 搜索的条件
* @return 返回完成的情况
*/
StatisticVo.StatisticsComplete statisticsComplete(StatisticDto.Complete param);
List<StatisticVo.StatisticsComplete> statisticsComplete(StatisticDto.Complete param);
/**
* 统计各个医院的病例完成情况
@ -78,4 +78,8 @@ public interface IPatientService {
List<StatisticVo.PatientProgressVo> selPatientProgress(Long userId);
List<String> stringLists(Long testQuestionsId);
List<BiologicalSamplesVo.selByHosAllYBS> selByHosAllYBS(Long id);
void upPatientMes(PatientDto.UpPatient param, Long userId);
}

30
tcm/src/main/java/com/ccsens/tcm/service/PatientService.java

@ -223,7 +223,7 @@ public class PatientService implements IPatientService {
@Override
public PageInfo<PatientVo.SelPatient> selPatientMesList(PatientDto.SelPatlenConditionList param, long l) {
PageHelper.startPage(param.getPageNum(),param.getPageSize());
PageHelper.startPage(param.getPageNum(),param.getPageSize(),"tpi.update_at desc");
List<PatientVo.SelPatient> selPatientLists=patientDao.selPatientMesList(param);
return new PageInfo<>(selPatientLists);
}
@ -263,17 +263,17 @@ public class PatientService implements IPatientService {
public StatisticVo.SelCountS countCase(StatisticDto.SelCount param, Long userId) {
StatisticVo.SelCountS selCountS=new StatisticVo.SelCountS();
selCountS.setNewNums(patientDao.countCase(param,(byte)0));
selCountS.setOverNums(patientDao.countCase(param,(byte)0));
selCountS.setOverNums(patientDao.countCase(param,(byte)2));
return selCountS;
}
@Override
public List<StatisticVo.SelGroupNum> countAnalysis(StatisticDto.SelBinLCount param, Long userId) {
List<StatisticVo.SelGroupNum> selGroupNumsList= new ArrayList<StatisticVo.SelGroupNum>();
if(param.getInpatientId()!=null && param.getInpatientId().length==0) {
if(param.getInpatientId() ==null || param.getInpatientId().length==0) {
StatisticVo.SelGroupNum selGroupNum =new StatisticVo.SelGroupNum();
selGroupNum.setName("总人数");
List<StatisticVo.SelGroupList> selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(),null,param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId());
List<StatisticVo.SelGroupList> selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(), param.getReportParams(),null,param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId());
selGroupNum.setInpatientId(null);
selGroupNum.setList(selGroupList);
selGroupNumsList.add(selGroupNum);
@ -282,7 +282,7 @@ public class PatientService implements IPatientService {
for (int i = 0; i < param.getInpatientId().length; i++) {
StatisticVo.SelGroupNum selGroupNum =new StatisticVo.SelGroupNum();
selGroupNum.setName(inpatientMapper.selectByPrimaryKey(param.getInpatientId()[i]).getName());
List<StatisticVo.SelGroupList> selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(),param.getInpatientId()[i],param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId());
List<StatisticVo.SelGroupList> selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(), param.getReportParams(),param.getInpatientId()[i],param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId());
selGroupNum.setInpatientId(param.getInpatientId()[i]);
selGroupNum.setList(selGroupList);
selGroupNumsList.add(selGroupNum);
@ -308,7 +308,7 @@ public class PatientService implements IPatientService {
* 统计病例完成情况
*/
@Override
public StatisticVo.StatisticsComplete statisticsComplete(StatisticDto.Complete param) {
public List<StatisticVo.StatisticsComplete> statisticsComplete(StatisticDto.Complete param) {
return patientDao.statisticsComplete(param.getHospitalId(),param.getUserId());
}
@ -347,7 +347,7 @@ public class PatientService implements IPatientService {
@Override
public PageInfo<BiologicalSamplesVo.selBiolog> selBiologicalSamples(BiologicalSamplesDto.SelBiolog param, Long userId) {
PageHelper.startPage(param.getPageNum(),param.getPageSize());
PageHelper.startPage(param.getPageNum(),param.getPageSize(),"tbs.update_at desc");
List<BiologicalSamplesVo.selBiolog> selBiologs= patientDao.selBiologicalSamples(param);
return new PageInfo<>(selBiologs);
}
@ -414,5 +414,21 @@ public class PatientService implements IPatientService {
return stringList;
}
@Override
public List<BiologicalSamplesVo.selByHosAllYBS> selByHosAllYBS(Long id) {
return patientDao.selByHosAllYBS(id);
}
@Override
public void upPatientMes(PatientDto.UpPatient param, Long userId) {
PatientInformationExample patientInformationExample=new PatientInformationExample();
patientInformationExample.createCriteria().andIdEqualTo(param.getId()).andRecStatusEqualTo((byte)0);
PatientInformation patientInformation=new PatientInformation();
patientInformation.setId(param.getId());
patientInformation.setInputStatus(param.getInputStatus());
patientInformation.setUserId(userId);
patientInformationMapper.updateByExampleSelective(patientInformation,patientInformationExample);
}
}

2
tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java

@ -28,7 +28,7 @@ public class QuestionService implements IQuestionService{
@Override
public List<QuestionVo.PatientCode> getQuestionAndAnswer(QuestionDto.QueryQuestionAndAnswer param) {
List<QuestionVo.PatientCode> patientCodeList = reportCodeDao.selectCodeByCode(param.getCode());
List<QuestionVo.PatientCode> patientCodeList = reportCodeDao.selectCodeByCode(param.getCode(),param.getNums());
if(CollectionUtil.isNotEmpty(patientCodeList)){
//循环一级code
patientCodeList.forEach(patientCode -> {

132
tcm/src/main/resources/mapper_dao/PatientDao.xml

@ -46,7 +46,8 @@
tpi.hospital_id AS hospitalId,
th.name as hosName,
ti.name,
ti.collection_num as collectionNum
ti.collection_num as collectionNum,
tpi.update_at as updateAt
FROM
t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id
left join t_hospital th on th.rec_status=0 and th.id=tpi.hospital_id
@ -64,7 +65,7 @@
<if test="inputStatus !=null">
and tpi.input_status=#{inputStatus}
</if>
<if test="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )">
<if test="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 ) or (reportParams != null and reportParams.size() != 0)">
and tpi.id IN (
SELECT DISTINCT
( t.patient_id )
@ -106,10 +107,42 @@
INTERSECT
</foreach>
</if>
<if test="reportParams != null and reportParams.size() != 0">
<foreach collection="reportParams" item="item">
<if test="item.code != null and item.code != '' and (item.start != null or item.end != null)">
SELECT
r.patient_id
FROM
question.t_ht_patient_score s,
question.t_ht_question q,
question.t_ht_patient_report r
WHERE
s.question_id = q.id
AND s.patient_report_id = r.id
AND s.question_parent_code = #{item.code}
AND s.type IN ( 0, 2 )
AND s.is_del = 0
AND q.is_del = 0
GROUP BY
patient_report_id
HAVING
<trim suffixOverrides="AND">
<if test="item.start != null">
sum( score ) &gt;= #{item.start} AND
</if>
<if test="item.end != null">
sum( score ) &lt;= #{item.end} AND
</if>
</trim>
INTERSECT
</if>
</foreach>
</if>
</trim>
) t
)
</if>
order by tpi.update_at desc
</select>
<select id="selPatientInformationList" resultType="com.ccsens.tcm.bean.vo.PatientVo$SelPatient">
SELECT
@ -138,25 +171,17 @@
and tpi.input_status= #{inputStatus}
</if>
</if>
order by tpi.update_at desc
</select>
<select id="countCase" resultType="com.ccsens.tcm.bean.vo.StatisticVo$Shuliang">
select DATE_FORMAT(tpi.update_at,'%Y-%d-%m') as shijian,count(*) as nums from t_patient_information tpi
select DATE_FORMAT(tpi.update_at,'%Y-%m-%d') as shijian,count(*) as nums from t_patient_information tpi
where tpi.rec_status=0
<if test="param.userId!=null and param.userId!=0 ">
and tpi.user_id=#{param.userId}
</if>
<if test="param.hospitalId!=null and param.hospitalId!=0 ">
and tpi.hospital_id=#{param.hospitalId}
</if>
<if test="inputStatus!=null and inputStatus!=0 ">
<if test="inputStatus!=null">
and tpi.input_status=#{inputStatus}
</if>
<if test="param.startDate!=null">
and tpi.update_at &gt; #{param.startDate}
</if>
<if test="param.endDate!=null">
and tpi.update_at &lt; #{param.endDate}
</if>
GROUP BY shijian
</select>
<select id="countAnalysis" resultType="com.ccsens.tcm.bean.vo.StatisticVo$SelGroupList">
@ -203,7 +228,7 @@
<if test="inputStatus !=null">
and tpi.input_status=#{inputStatus}
</if>
<if test="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 )">
<if test="(conditionList!=null and conditionList.size()!=0 ) or (conditionListDate != null and conditionListDate.size() !=0 ) or (reportParams != null and reportParams.size() != 0)">
and tpi.id IN (
SELECT DISTINCT
( t.patient_id )
@ -245,6 +270,37 @@
INTERSECT
</foreach>
</if>
<if test="reportParams != null and reportParams.size() != 0">
<foreach collection="reportParams" item="item">
<if test="item.code != null and item.code != '' and (item.start != null or item.end != null)">
SELECT
r.patient_id
FROM
question.t_ht_patient_score s,
question.t_ht_question q,
question.t_ht_patient_report r
WHERE
s.question_id = q.id
AND s.patient_report_id = r.id
AND s.question_parent_code = #{item.code}
AND s.type IN ( 0, 2 )
AND s.is_del = 0
AND q.is_del = 0
GROUP BY
patient_report_id
HAVING
<trim suffixOverrides="AND">
<if test="item.start != null">
sum( score ) &gt;= #{item.start} AND
</if>
<if test="item.end != null">
sum( score ) &lt;= #{item.end} AND
</if>
</trim>
INTERSECT
</if>
</foreach>
</if>
</trim>
) t
)
@ -255,16 +311,17 @@
</if>
</select>
<select id="statisticsComplete" resultType="com.ccsens.tcm.bean.vo.StatisticVo$StatisticsComplete">
SELECT
MAX(CASE t.input_status WHEN 0 THEN nums ELSE 0 END ) unfinished,
MAX(CASE t.input_status WHEN 1 THEN nums ELSE 0 END ) underway,
MAX(CASE t.input_status WHEN 2 THEN nums ELSE 0 END ) completed,
MAX(CASE t.input_status WHEN 3 THEN nums ELSE 0 END ) overtime,
MAX(CASE t.input_status WHEN 4 THEN nums ELSE 0 END ) discarded
FROM(
SELECT
input_status,
count(*) as nums
input_status as id,
(case input_status
when 0 THEN '新建'
when 1 then '数据搜集中'
when 2 then '数据搜集完成'
when 3 then '数据搜集超时'
when 4 then '废弃'
END) as name,
count(*) as nums
FROM
t_patient_information
WHERE
@ -272,12 +329,9 @@
<if test="hospitalId != null and hospitalId != 0">
and hospital_id = #{hospitalId}
</if>
<if test="userId != null and userId != 0">
and user_id = #{userId}
</if>
GROUP BY
input_status
) t
</select>
<select id="completeHospital" resultType="com.ccsens.tcm.bean.vo.StatisticVo$CompleteHospital">
SELECT
@ -337,7 +391,7 @@
t.user_id
</select>
<select id="selBiologicalSamples" resultType="com.ccsens.tcm.bean.vo.BiologicalSamplesVo$selBiolog">
select th.name,tbs.sample_type as sampleType, tpi.hospitalization,tbs.collect_time as collectTime
select th.name,tbs.sample_type as sampleType, tpi.hospitalization,tbs.collect_time as collectTime,tbs.update_at as updateAt
from t_biological_samples tbs
left join t_patient_information tpi on tpi.id=tbs.patient_information_id and tpi.rec_status=0
left join t_hospital th on th.id=tpi.hospital_id and th.rec_status=0
@ -354,6 +408,7 @@
<if test="collectTime!=null">
and tbs.collect_time=#{collectTime}
</if>
order by tbs.update_at desc
</select>
<select id="selAllYBS" resultType="com.ccsens.tcm.bean.vo.BiologicalSamplesVo$SelBiologNums">
select th.id,th.name,count(*) as nums from t_biological_samples tbs
@ -434,4 +489,25 @@
where tpr.rec_status=0
and tpr.test_questions_id=#{testQuestionsId}
</select>
<select id="selByHosAllYBS" resultType="com.ccsens.tcm.bean.vo.BiologicalSamplesVo$selByHosAllYBS" parameterType="java.lang.Long">
SELECT
tbs.sample_type AS sampleType,
(CASE tbs.sample_type
WHEN 0 THEN
'抗血凝10ml'
WHEN 1 THEN '促凝血5ml'
WHEN 2 THEN '晨尿10ml'
WHEN 3 THEN '24小时尿10ml'
end) name,
count( * ) AS nums
FROM
t_biological_samples tbs
, t_patient_information tpi where tpi.rec_status = 0
AND tbs.patient_information_id = tpi.id
AND tpi.hospital_id =#{id}
and
tbs.rec_status = 0
GROUP BY
tbs.sample_type
</select>
</mapper>

20
tcm/src/main/resources/mapper_dao/ReportCodeDao.xml

@ -138,8 +138,26 @@
c1.`level` = 1
and c1.rec_status = 0
<if test="code != null and code != ''">
and (c1.`code` = #{code} or c2.`code` = #{code})
and (c1.`code` = #{code})
</if>
<if test="code==null or code==''">
<if test="nums == 0">
and (c1.`report_type`in (0,1))
</if>
<if test="nums == 14">
and (c1.`report_type`in (1))
</if>
<if test="nums == 90">
and (c1.`report_type`in (1))
</if>
<if test="nums == 180">
and (c1.`report_type`in (2))
</if>
<if test="nums == 365">
and (c1.`report_type`in (2))
</if>
</if>
</select>
<select id="queryCodeAll" resultType="java.lang.String">
SELECT `code` FROM `t_report_code` WHERE rec_status = 0

66
tcm/src/main/resources/mapper_raw/ConferenceRecordsMapper.xml

@ -4,6 +4,8 @@
<resultMap id="BaseResultMap" type="com.ccsens.tcm.bean.po.ConferenceRecords">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="task_id" jdbcType="BIGINT" property="taskId" />
<result column="task_start_time" jdbcType="TIMESTAMP" property="taskStartTime" />
<result column="task_end_time" jdbcType="TIMESTAMP" property="taskEndTime" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="place" jdbcType="VARCHAR" property="place" />
@ -75,8 +77,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, task_id, start_time, end_time, place, host, participants, discussion_content,
meeting_minutes, user_id, created_at, update_at, rec_status
id, task_id, task_start_time, task_end_time, start_time, end_time, place, host, participants,
discussion_content, meeting_minutes, user_id, created_at, update_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.tcm.bean.po.ConferenceRecordsExample" resultMap="BaseResultMap">
select
@ -109,26 +111,35 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.tcm.bean.po.ConferenceRecords">
insert into t_conference_records (id, task_id, start_time,
end_time, place, host,
participants, discussion_content, meeting_minutes,
user_id, created_at, update_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{place,jdbcType=VARCHAR}, #{host,jdbcType=VARCHAR},
#{participants,jdbcType=VARCHAR}, #{discussionContent,jdbcType=VARCHAR}, #{meetingMinutes,jdbcType=VARCHAR},
#{userId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_conference_records (task_id, task_start_time, task_end_time,
start_time, end_time, place,
host, participants, discussion_content,
meeting_minutes, user_id, created_at,
update_at, rec_status)
values (#{taskId,jdbcType=BIGINT}, #{taskStartTime,jdbcType=TIMESTAMP}, #{taskEndTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{place,jdbcType=VARCHAR},
#{host,jdbcType=VARCHAR}, #{participants,jdbcType=VARCHAR}, #{discussionContent,jdbcType=VARCHAR},
#{meetingMinutes,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updateAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.tcm.bean.po.ConferenceRecords">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_conference_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="taskStartTime != null">
task_start_time,
</if>
<if test="taskEndTime != null">
task_end_time,
</if>
<if test="startTime != null">
start_time,
</if>
@ -164,12 +175,15 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="taskId != null">
#{taskId,jdbcType=BIGINT},
</if>
<if test="taskStartTime != null">
#{taskStartTime,jdbcType=TIMESTAMP},
</if>
<if test="taskEndTime != null">
#{taskEndTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
@ -220,6 +234,12 @@
<if test="record.taskId != null">
task_id = #{record.taskId,jdbcType=BIGINT},
</if>
<if test="record.taskStartTime != null">
task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
</if>
<if test="record.taskEndTime != null">
task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
@ -262,6 +282,8 @@
update t_conference_records
set id = #{record.id,jdbcType=BIGINT},
task_id = #{record.taskId,jdbcType=BIGINT},
task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
place = #{record.place,jdbcType=VARCHAR},
@ -283,6 +305,12 @@
<if test="taskId != null">
task_id = #{taskId,jdbcType=BIGINT},
</if>
<if test="taskStartTime != null">
task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
</if>
<if test="taskEndTime != null">
task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
@ -322,6 +350,8 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.tcm.bean.po.ConferenceRecords">
update t_conference_records
set task_id = #{taskId,jdbcType=BIGINT},
task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
place = #{place,jdbcType=VARCHAR},

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

@ -185,7 +185,7 @@ public enum CodeEnum {
NOT_HOSPITAL(154,"未找到医院信息",true),
ZHUYUANIDCHONGFU(155,"住院号重复",true),
MEIYOUGAIYISHENG(156,"该医生信息查询不正确",true),
QINGTIJIAOSHITI(157,"请提交答案",true),
QINGTIJIAOSHITI(157,"未做出修改答案,修改后再提交",true),
;

17
util/src/main/java/com/ccsens/util/DateUtil.java

@ -1,6 +1,5 @@
package com.ccsens.util;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.StrUtil;
import com.ccsens.util.exception.BaseException;
@ -9,6 +8,22 @@ import java.text.SimpleDateFormat;
import java.util.*;
public class DateUtil extends cn.hutool.core.date.DateUtil {
/**年月日时分秒*/
public static final String yyyyMMddHHmmss="yyyyMMddHHmmss";
/**年月日*/
public static final String yyyyMMdd="yyyyMMdd";
/**
* 时间格式转换
* @param date date
* @param format 格式
* @return 时间字符串
*/
public static String format(Date date, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}
public static Long dateBeginSeconds(Long seconds){
if(seconds == null) {
seconds = currentSeconds();

53
wisdomcar/src/main/java/com/ccsens/wisdomcar/api/RecordController.java

@ -1,10 +1,30 @@
package com.ccsens.wisdomcar.api;
import cn.hutool.core.util.CharsetUtil;
import com.ccsens.util.DateUtil;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.wisdomcar.bean.dto.RecordDto;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.ccsens.wisdomcar.service.IRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
/**
* @author
*/
@ -13,4 +33,37 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/record")
public class RecordController {
@Resource
private IRecordService recordService;
@ApiOperation(value = "查询智慧平车称重和rfid记录", notes = "")
@RequestMapping(value = "/weightList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<RecordVo.WeightAndRfid> timeList(@ApiParam @Validated @RequestBody QueryDto<RecordDto.WeightAndRfid> params){
log.info("查询智慧平车称重和rfid记录:{}", params);
if (params.getParam().getEndTime() != null) {
params.getParam().setEndTime(params.getParam().getEndTime() + 24 * 3600 *1000);
}
List<RecordVo.WeightAndRfid> list = recordService.queryWeightAndRfid(params.getParam(), params.getUserId());
log.info("查询智慧平车称重和rfid记录结果:{}",list);
return JsonResponse.newInstance().ok(list);
}
@ApiOperation(value = "智慧平车称重和rfid记录导出", notes = "")
@RequestMapping(value = "/weightExport", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public void weightExport(@ApiParam @Validated RecordDto.WeightAndRfidExport param, HttpServletResponse response) throws IOException {
log.info("导出智慧平车称重和rfid记录:{}", param);
if (param.getEndTime() != null) {
param.setEndTime(param.getEndTime() + 24 * 3600 *1000);
}
Workbook workbook = recordService.exportWeightAndRfid(param);
log.info("导出智慧平车称重和rfid记录结果结束");
Date start = new Date();
start.setTime(param.getStartTime());
Date end = new Date();
end.setTime(param.getEndTime() - 24 * 3600 * 1000);
String fileName = "智慧平车记录"+ DateUtil.format(start, DateUtil.yyyyMMdd) + "-" + DateUtil.format(end, DateUtil.yyyyMMdd) +".xlsx";
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8));
workbook.write(response.getOutputStream());
}
}

69
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/RecordDto.java

@ -0,0 +1,69 @@
package com.ccsens.wisdomcar.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @description: 数据记录
* @author: whj
* @time: 2021/3/5 13:59
*/
@Data
public class RecordDto {
@Data
@ApiModel("称重和rfid记录的请求参数")
public static class WeightAndRfid{
@ApiModelProperty("平车ID,默认1")
private Long carId = 1L;
@ApiModelProperty("开始时间, 默认今天0点")
private Long startTime;
@ApiModelProperty("结束时间, 默认当前时间")
private Long endTime;
// @ApiModelProperty("当前页,默认1")
// private int pageNum=1;
// @ApiModelProperty("每页数量,默认100")
// @Min(value = 1)
// @Max(value=10000)
// private int pageSize = 100;
{
endTime = System.currentTimeMillis();
Date today = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
startTime = sdf.parse(sdf.format(today)).getTime();
} catch (ParseException e) {
}
}
}
@Data
@ApiModel("称重和rfid记录导出的请求参数")
public static class WeightAndRfidExport{
@ApiModelProperty("平车ID,默认1")
private Long carId = 1L;
@ApiModelProperty("开始时间, 默认今天0点")
private Long startTime;
@ApiModelProperty("结束时间, 默认当前时间")
private Long endTime;
{
endTime = System.currentTimeMillis();
Date today = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
startTime = sdf.parse(sdf.format(today)).getTime();
} catch (ParseException e) {
}
}
}
}

28
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/RecordVo.java

@ -0,0 +1,28 @@
package com.ccsens.wisdomcar.bean.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @description: 数据记录
* @author: whj
* @time: 2021/3/5 13:59
*/
@Data
public class RecordVo {
@Data
@ApiModel("称重和rfid记录的响应结果")
public static class WeightAndRfid{
@ApiModelProperty("时间")
private Long time;
@ApiModelProperty("类型:1体重 2rfid")
private Byte type;
private String value;
private String name;
}
}

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

@ -0,0 +1,23 @@
package com.ccsens.wisdomcar.persist.dao;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.ccsens.wisdomcar.persist.mapper.WisdomCarRecordMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
*
* @author whj
*/
public interface WisdomCarRecordDao extends WisdomCarRecordMapper {
/**
* 查询平车的称重和rfid记录
* @param carId 平车ID
* @param startTime 开始时间
* @param endTime 结束时间
* @return 称重和rfid记录
*/
List<RecordVo.WeightAndRfid> queryWeightAndRfid(@Param("carId") Long carId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
}

22
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IRecordService.java

@ -1,7 +1,15 @@
package com.ccsens.wisdomcar.service;
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
import com.ccsens.wisdomcar.bean.dto.RecordDto;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageInfo;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.IOException;
import java.util.List;
public interface IRecordService {
@ -11,4 +19,18 @@ public interface IRecordService {
* @throws Exception
*/
void disposeMessage(CarRecordMessageDto carRecordMessageDto) throws Exception;
/**
* 查询称重和Rfid记录
* @param param 查询条件
* @param userId 查询用户ID
* @return 记录
*/
List<RecordVo.WeightAndRfid> queryWeightAndRfid(RecordDto.WeightAndRfid param, Long userId);
/**
* 导出称重和Rfid记录
* @param param 查询条件
*/
Workbook exportWeightAndRfid(RecordDto.WeightAndRfidExport param) ;
}

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

@ -5,28 +5,33 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.PoiUtil;
import com.ccsens.util.RedisUtil;
import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
import com.ccsens.util.bean.message.common.MessageRule;
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
import com.ccsens.wisdomcar.bean.dto.RecordDto;
import com.ccsens.wisdomcar.bean.po.*;
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.WisdomCarRecordDao;
import com.ccsens.wisdomcar.persist.mapper.*;
import com.ccsens.wisdomcar.util.Constant;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author
@ -53,6 +58,12 @@ public class RecordService implements IRecordService{
private ScreenMapper screenMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private WisdomCarRecordDao wisdomCarRecordDao;
@Value("#{T(java.lang.Long).parseLong('${wisdom.weight:10000}')}")
private Long weightMinus;
@Value("#{T(java.lang.Long).parseLong('${wisdom.time:300000}')}")
private Long timeMinus;
@Override
public void disposeMessage(CarRecordMessageDto carRecordMessageDto) throws Exception {
@ -138,6 +149,115 @@ public class RecordService implements IRecordService{
saveAidRecord(carRecordMessageDto, wisdomCar.getId(),step,userIdSet);
}
@Override
public List<RecordVo.WeightAndRfid> queryWeightAndRfid(RecordDto.WeightAndRfid param, Long userId) {
List<RecordVo.WeightAndRfid> list = queryWeightAndRfid(param.getCarId(), param.getStartTime(), param.getEndTime());
return list;
}
/**
* 查询数据
* @param carId 平车ID
* @param startTime 开始时间
* @param endTime 结束时间
* @return 记录
*/
private List<RecordVo.WeightAndRfid> queryWeightAndRfid(Long carId, Long startTime, Long endTime) {
RecordVo.WeightAndRfid weight = null;
RecordVo.WeightAndRfid rfid = null;
List<RecordVo.WeightAndRfid> list = wisdomCarRecordDao.queryWeightAndRfid(carId, startTime, endTime);
Iterator<RecordVo.WeightAndRfid> iterator = list.iterator();
while (iterator.hasNext()) {
RecordVo.WeightAndRfid next = iterator.next();
log.info("next:{}", next);
if (next.getType() == Constant.CAR_RECORD_WEIGHT) {
// 称重
if (weight == null) {
weight = next;
if (rfid != null) {
for (RecordVo.WeightAndRfid vo : list) {
if (vo == next) {
break;
}
vo.setValue(next.getValue());
}
}
continue;
}
// 体重变化和上一条体重相似且间隔时间较短,删除
if (Integer.parseInt(next.getValue()) - Integer.parseInt(weight.getValue()) <= weightMinus && next.getTime() - weight.getTime() <= timeMinus) {
log.info("删除体重,当前:{}, 上一个:{}", next, weight);
iterator.remove();
} else {
weight = next;
}
} else {
if (weight != null) {
next.setValue(weight.getValue());
}
// rfid
if (rfid == null) {
rfid = next;
continue;
}
// rfid和上一个一样且间隔时间较短,删除
if (next.getName().equals(rfid.getName()) && next.getTime() - rfid.getTime() <= timeMinus) {
log.info("删除rfid,当前rfid:{}, 上一个rfid:{}", next, rfid);
iterator.remove();
} else {
rfid = next;
}
}
}
return list;
}
@Override
public Workbook exportWeightAndRfid(RecordDto.WeightAndRfidExport param) {
log.info("数据导出:{}", param);
List<RecordVo.WeightAndRfid> list = queryWeightAndRfid(param.getCarId(), param.getStartTime(), param.getEndTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 参数封装
List<List<PoiUtil.PoiUtilCell>> rows = new ArrayList<>();
// 标题
List<PoiUtil.PoiUtilCell> headRow = new ArrayList<>();
PoiUtil.PoiUtilCell headCell = new PoiUtil.PoiUtilCell();
headCell.setColspan(4);
headCell.setValue("智慧平车记录");
headRow.add(headCell);
rows.add(headRow);
log.info("标题:{}", headCell);
// 表头
List<PoiUtil.PoiUtilCell> titleRow = new ArrayList<>();
titleRow.add(new PoiUtil.PoiUtilCell("序号"));
titleRow.add(new PoiUtil.PoiUtilCell("时间"));
titleRow.add(new PoiUtil.PoiUtilCell("类型"));
titleRow.add(new PoiUtil.PoiUtilCell("数据"));
rows.add(titleRow);
log.info("表头:{}", titleRow);
for (int i = 0; i < list.size(); i++) {
RecordVo.WeightAndRfid record = list.get(i);
List<PoiUtil.PoiUtilCell> row = new ArrayList<>();
row.add(new PoiUtil.PoiUtilCell("" + (i + 1)));
Date time = new Date();
time.setTime(record.getTime());
row.add(new PoiUtil.PoiUtilCell(sdf.format(time)));
row.add(new PoiUtil.PoiUtilCell(record.getType() == Constant.CAR_RECORD_WEIGHT ? "称重" : "rfid"));
row.add(new PoiUtil.PoiUtilCell(record.getType() == Constant.CAR_RECORD_WEIGHT ? new BigDecimal(record.getValue()).divide(new BigDecimal(1000), 3).toString() + "Kg" : record.getName()));
rows.add(row);
}
log.info("数据:{}", list.size());
//生成一个excel文件
Workbook workbook = new XSSFWorkbook();
PoiUtil.exportWB("智慧平车记录",rows, workbook);
return workbook;
}
private void doseAndSensorMessage(CarRecordMessageDto carRecordMessageDto, Set<String> userIdSet) throws Exception {
//体重 单位g
BigDecimal weightInt = BigDecimal.valueOf(Double.parseDouble(carRecordMessageDto.getValue()));

11
wisdomcar/src/main/resources/application-dev.yml

@ -29,10 +29,13 @@ spring:
swagger:
enable: true
file:
path: /home/cloud/mt/uploads/
path: /home/cloud/wisdomcar/uploads/
signUpUrl: https://test.tall.wiki/compete/
domain: https://test.tall.wiki/gateway/mt/
imgDomain: https://test.tall.wiki/gateway/mt/uploads/
domain: https://test.tall.wiki/gateway/wisdomcar/
imgDomain: https://test.tall.wiki/gateway/wisdomcar/uploads/
#gameMqName: game_status_wisdom
logging:
path:
path:
wisdom:
weight: 10000
time: 600000

10
wisdomcar/src/main/resources/application-prod.yml

@ -34,7 +34,11 @@ eureka:
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
file:
path: /home/cloud/mt/uploads/
path: /home/cloud/wisdomcar/uploads/
signUpUrl: https://www.tall.wiki/compete/
domain: https://www.tall.wiki/gateway/mt/
imgDomain: https://www.tall.wiki/gateway/mt/uploads/
domain: https://www.tall.wiki/gateway/wisdomcar/
imgDomain: https://www.tall.wiki/gateway/wisdomcar/uploads/
wisdom:
weight: 10000
time: 600000

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

@ -30,7 +30,10 @@ eureka:
instance:
ip-address: 192.168.0.99
file:
path: /home/cloud/mt/uploads/
path: /home/cloud/wisdomcar/uploads/
signUpUrl: https://test.tall.wiki/compete/
domain: https://test.tall.wiki/gateway/mt/
imgDomain: https://test.tall.wiki/gateway/mt/uploads/
domain: https://test.tall.wiki/gateway/wisdomcar/
imgDomain: https://test.tall.wiki/gateway/wisdomcar/uploads/
wisdom:
weight: 10000
time: 600000

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

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

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

@ -0,0 +1,14 @@
<?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.dao.WisdomCarRecordDao">
<select id="queryWeightAndRfid" resultType="com.ccsens.wisdomcar.bean.vo.RecordVo$WeightAndRfid">
select * from (
select r.time, r.type, r.value, '称重' as name from t_wisdom_car_record r where r.car_id = #{carId} and r.type = 1 and r.time &gt;= #{startTime} and r.time &lt; #{endTime} and r.value &lt;= 200000 and r.rec_status = 0
union
select r.time, r.type, r.value, s.name from t_wisdom_car_record r, t_rfid rfid, t_step s where r.car_id = #{carId} and r.value = rfid.rfid and rfid.step_id = s.id and r.type = 2 and r.time &gt;= #{startTime} and r.time &lt; #{endTime} and r.rec_status = 0
) t
order by time
</select>
</mapper>
Loading…
Cancel
Save