Browse Source

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

sd
zy_Java 4 years ago
parent
commit
a22b958eab
  1. 3
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  2. 29
      ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java
  3. 1
      ht/src/main/java/com/ccsens/ht/api/QuestionController.java
  4. 24
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java
  5. 30
      ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java
  6. 105
      ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java
  7. 13
      ht/src/main/java/com/ccsens/ht/service/ImportService.java
  8. 11
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  9. 87
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  10. 4
      ht/src/main/resources/application.yml
  11. 41
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  12. 12
      ht/src/main/resources/mapper_dao/HtQuestionDao.xml
  13. 64
      question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java

3
ht/src/main/java/com/ccsens/ht/api/PatientReportController.java

@ -14,7 +14,6 @@ import com.ccsens.util.JsonResponse;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -156,7 +155,7 @@ public class PatientReportController {
public JsonResponse<PatientReportVo.Export> shareReport(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> param) throws IOException {
//查询报告单信息
log.info("查询报告单详情:{}", param);
String path = patientReportService.generateQRCode(param.getParam(), param.getUserId());
String path = patientReportService.generateQrCode(param.getParam(), param.getUserId());
log.info("文件路径:{}", path);
PatientReportVo.Export export = new PatientReportVo.Export();
export.setPath(path);

29
ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java

@ -1,6 +1,8 @@
package com.ccsens.ht.api;
import cn.hutool.core.util.CharsetUtil;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.ht.annotation.DoctorAudit;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.service.IPatientReportService;
@ -20,6 +22,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
/**
* @description:
@ -33,6 +36,8 @@ public class PatientReportExportController {
@Resource
private IPatientReportService patientReportService;
@MustLogin
@DoctorAudit
@ApiOperation(value = "导出报告单",notes = "导出报告单")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出报告单", required = true)
@ -48,9 +53,11 @@ public class PatientReportExportController {
return JsonResponse.newInstance().ok(export);
}
@ApiOperation(value = "导出指定报告单",notes = "导出报告单")
@MustLogin
@DoctorAudit
@ApiOperation(value = "导出指定量表",notes = "导出指定量表")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出报告单", required = true)
@ApiImplicitParam(name = "json", value = "导出指定量表", required = true)
})
@RequestMapping(value="/export", method = RequestMethod.POST)
public JsonResponse<PatientReportVo.Export> export(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.ExportCode> param) {
@ -62,4 +69,22 @@ public class PatientReportExportController {
export.setPath(path);
return JsonResponse.newInstance().ok(export);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "导出指定id的报告单分析",notes = "导出指定id的报告单分析")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "导出指定id的报告单分析", required = true)
})
@RequestMapping(value="/exportAnalyse", method = RequestMethod.POST)
public void exportAnalyse(@RequestBody @ApiParam @Valid QueryDto<List<PatientReportDto.ExportSpecial>> param, HttpServletResponse response) throws IOException {
//查询报告单信息
log.info("导出指定报告单分析:{}", param);
Workbook workbook = patientReportService.exportAnalyse(param.getParam(), param.getUserId());
log.info("导出报告单分析结束");
String fileName = "报告单信息";
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8));
workbook.write(response.getOutputStream());
}
}

1
ht/src/main/java/com/ccsens/ht/api/QuestionController.java

@ -44,7 +44,6 @@ public class QuestionController {
@RequestMapping(value="/queryQuestion", method = RequestMethod.POST)
public JsonResponse<QuestionVo.Query> query(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.Query> queryDto){
log.info("查询试题:{}", queryDto);
QuestionVo.Query query = questionService.queryQuestion(queryDto.getParam(), queryDto.getUserId());
log.info("查询试题结果:{}", query);
return JsonResponse.newInstance().ok(query);

24
ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java

@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.*;
import java.util.List;
/**
* @program: ptpro
@ -98,6 +99,10 @@ public class PatientReportDto {
}
public static class ExportSpecial{
private Long id;
}
/**医生对报告单权限*/
@ApiModel("PatientReportDtoAuthority")
@Data
@ -132,6 +137,12 @@ public class PatientReportDto {
private Byte endAge;
@ApiModelProperty("性别")
private Byte patientSex;
@ApiModelProperty("教育程度(1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他)")
private Byte educationalStatus;
@ApiModelProperty("受教时间-开始")
private Integer startEducationalStatusUnit;
@ApiModelProperty("受教时间-结束")
private Integer endEducationalStatusUnit;
@ApiModelProperty("临床诊断")
private String clinicalDiagnosis;
@ApiModelProperty("严重程度")
@ -140,6 +151,8 @@ public class PatientReportDto {
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("分数")
private List<Score> scores;
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;
@ -149,6 +162,17 @@ public class PatientReportDto {
private int pageSize = 10;
}
@ApiModel("分数")
@Data
public static class Score{
@ApiModelProperty("量表类型")
private String code;
@ApiModelProperty("开始")
private Integer start;
@ApiModelProperty("结束")
private Integer end;
}
@ApiModel("临床诊断统计请求")
@Data
public static class ClinicalDiagnosis{

30
ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java

@ -202,6 +202,18 @@ public class QuestionVo {
private String remark;
@ApiModelProperty("答案")
private List<String> answers;
@ApiModelProperty("选项")
private List<RecordOption> options;
}
@Data
@ApiModel("record的选项")
public static final class RecordOption {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("提交值")
private String dataKey;
@ApiModelProperty("显示值")
private String dataValue;
}
@Data
@ -209,6 +221,7 @@ public class QuestionVo {
public static final class OptionDesc{
@ApiModelProperty("id")
private Long id;
private Byte type;
private String content;
@ -426,17 +439,17 @@ public class QuestionVo {
@ApiModelProperty("中心 暂定为坐标:X,Y")
private String centreCoordinate;
@ApiModelProperty("中心相对原点坐标 X,Y")
private String showCentreCoordinate;
private Coordinate showCentreCoordinate;
@ApiModelProperty("重心 暂定为坐标:X,Y")
private String barycenterCoordinate;
// 上下左右应部分图片存在倒转展示的问题,前端应反向展示
@ApiModelProperty("上边距距离画板中心的距离")
@ApiModelProperty("定点坐标(y最大,图上反而在最下)")
private Coordinate top;
@ApiModelProperty("下边距距离画板中心的距离")
@ApiModelProperty("底点坐标")
private Coordinate bottom ;
@ApiModelProperty("上边距距离画板中心的距离")
@ApiModelProperty("最左点")
private Coordinate left;
@ApiModelProperty("下边距距离画板中心的距离")
@ApiModelProperty("最右点")
private Coordinate right;
@ApiModelProperty("最小外接长方形面积 单位为px")
private double minRectangleAcreage;
@ -454,6 +467,13 @@ public class QuestionVo {
private int quickNums;
@ApiModelProperty("长久思考数量")
private int slowNums;
@ApiModelProperty("过渡时间(在所有短-长笔画序列中画出一个短笔划后开始一个长笔划的总时间)")
private long transitionTime;
@ApiModelProperty("5个早期长笔画的经过时间(从点击开始绘图至前5个长笔画绘制完成")
private long fiveLongLinesTime;
@ApiModelProperty("前5笔长笔画率(前5个笔画中长笔画所占比率)")
private BigDecimal longLineRate;
}
@Data

105
ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java

@ -18,19 +18,19 @@ public interface IPatientReportService {
/**
* 生成病人报告单
* @param patientReport
* @param userId
*@return: com.ccsens.ptpro.util.JsonResponse
*@Author: wuHuiJuan
* @param patientReport patientReport
* @param userId userId
*@return com.ccsens.ptpro.util.JsonResponse
*@author wuHuiJuan
*@date: 2019/10/30 16:45
*/
JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate patientReport, Long userId);
/**
* 编辑病人报告单其他信息初步印象临床诊断床号
* @param patientReport
* @param userId
*@return: com.ccsens.ptpro.util.CodeEnum
*@Author: wuHuiJuan
* @param patientReport patientReport
* @param userId userId
*@return com.ccsens.ptpro.util.CodeEnum
*@author wuHuiJuan
*@date: 2019/11/18 16:16
*/
CodeEnum editPatientReport(PatientReportDto.Edit patientReport, Long userId);
@ -38,101 +38,100 @@ public interface IPatientReportService {
/**
*查询报告单列表
* @param query
* @param userId
*@return: com.github.pagehelper.PageInfo<com.ccsens.ht.bean.vo.PatientReportVo.ReportName>
*@Author: wuHuiJuan
* @param query query
* @param userId userId
*@return com.github.pagehelper.PageInfo<com.ccsens.ht.bean.vo.PatientReportVo.ReportName>
*@author wuHuiJuan
*@date: 2019/11/18 17:00
*/
PageInfo<PatientReportVo.ReportName> queryReports(PatientReportDto.QueryReports query, Long userId);
/**
* 查询报告单详细信息
* @param queryDetail
* @param userId
*@return: com.ccsens.ht.bean.vo.PatientReportVo.ReprotDetail
*@Author: wuHuiJuan
* @param queryDetail queryDetail
* @param userId userId
*@return com.ccsens.ht.bean.vo.PatientReportVo.ReprotDetail
*@author wuHuiJuan
*@date: 2019/11/19 10:18
*/
PatientReportVo.ReprotDetail queryReportDetail(PatientReportDto.QueryDetail queryDetail, Long userId);
/**
* 查询医生对该报告单的权限
* @param authority
* @param userId
*@return: com.ccsens.ht.bean.vo.PatientReportVo.Authority
*@Author: wuHuiJuan
*@date: 2019/11/19 15:50
* @param authority authority
* @param userId userId
* @return com.ccsens.ht.bean.vo.PatientReportVo.Authority
* @author wuHuiJuan
* @date: 2019/11/19 15:50
*/
PatientReportVo.Authority queryReportAuthority(PatientReportDto.Authority authority, Long userId);
/**
* 导出报告单
* @param queryDetail
* @param userId
* @return
* @param queryDetail queryDetail
* @param userId userId
* @return 报告单路径
*/
String exportReport(PatientReportDto.QueryDetail queryDetail, Long userId);
/**
* 生成二维码
* @param queryDetail
* @param userId
* @return
* @param queryDetail queryDetail
* @param userId userId
* @return 二维码路径
*/
String generateQRCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException;
String generateQrCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException;
/**
* 检查有无未完成的报告
* @param userId
* @return
* @param userId userId
* @return 未完成的报告单
*/
PatientReportVo.Complete checkComplete(Long userId);
/**
* 忽略未完成的报告单
* @param ignore
* @param userId
* @return
* @param ignore ignore
* @param userId userId
*/
void ignoreComplete(PatientReportDto.Ignore ignore, Long userId);
/**
* 查询某个医生的报告单列表
* @param param
* @param doctor
* @param userId
* @return
* @param param param
* @param doctor doctor
* @param userId userId
* @return 报告单名字
*/
PageInfo<PatientReportVo.ReportName> queryDoctorReports(PatientReportDto.Doctor param, HtDoctor doctor, Long userId);
/**
* 管理员查询报告单列表
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 报告单名字
*/
PageInfo<PatientReportVo.ReportName> queryAllReports(PatientReportDto.AdminQueryReport param, Long userId);
/**
* 根据临床诊断统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 临床诊断统计
*/
List<PatientReportVo.ClinicalDiagnosis> countByClinicalDiagnosis(PatientReportDto.ClinicalDiagnosis param, Long userId);
/**
* 根据性别年龄统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 年龄统计
*/
List<PatientReportVo.AgeAndSexGroup> countBySexAndAge(PatientReportDto.AgeAndSex param, Long userId);
/**
* 根据日期统计
* @param param
* @param userId
* @return
* @param param param
* @param userId userId
* @return 统计结果
*/
List<PatientReportVo.Day> countByDay(PatientReportDto.Day param, Long userId);
@ -166,4 +165,12 @@ public interface IPatientReportService {
* @return path
*/
String export(PatientReportDto.ExportCode param, Long userId);
/**
* 导出指定报告单分析
* @param param 报告单ID列表
* @param userId 用户ID
* @return workbook
*/
Workbook exportAnalyse(List<PatientReportDto.ExportSpecial> param, Long userId);
}

13
ht/src/main/java/com/ccsens/ht/service/ImportService.java

@ -15,7 +15,6 @@ import com.ccsens.util.PropUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -384,22 +383,23 @@ public class ImportService implements IImportService {
/**
* 封装record option
* @param objs 一列
* @param id 试题ID
* @param questionId 试题ID
* @param questionRecordOptions record选项
* @return record
*/
private HtQuestionRecord initRecord(Object[] objs, Long id, List<HtQuestionRecordOption> questionRecordOptions, byte recordType, int sortIndex ) {
HtQuestionRecord record = new HtQuestionRecord();
private HtQuestionRecord initRecord(Object[] objs, Long questionId, List<HtQuestionRecordOption> questionRecordOptions, byte recordType, int sortIndex ) {
String content = (String)objs[2];
JSONObject json = JSONObject.parseObject(content);
BeanUtils.copyProperties(json, record);
HtQuestionRecord record = JSONObject.parseObject(content, HtQuestionRecord.class);
record.setRecordType(recordType);
record.setQuestionId(questionId);
// 判断是否存在,设置id
int sort = StringUtil.checkNum(String.valueOf(objs[sortIndex]), false) ?
Integer.parseInt(String.valueOf(objs[sortIndex])) : Constant.Ht.Question.RULE_TYPE_DEFAULT;
record.setSort(sort);
HtQuestionRecordExample recordExample = new HtQuestionRecordExample();
recordExample.createCriteria().andQuestionIdEqualTo(id).andSortEqualTo(sort);
recordExample.createCriteria().andQuestionIdEqualTo(questionId).andSortEqualTo(sort);
List<HtQuestionRecord> questionRecords = htQuestionRecordDao.selectByExample(recordExample);
if (CollectionUtil.isEmpty(questionRecords)) {
@ -431,6 +431,7 @@ public class ImportService implements IImportService {
} else {
recordOption.setId(snowflake.nextId());
}
recordOption.setQuestionRecordId(record.getId());
questionRecordOptions.add(recordOption);
}
return record;

11
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -25,6 +25,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -394,7 +395,7 @@ public class PatientReportService implements IPatientReportService {
}
@Override
public String generateQRCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException {
public String generateQrCode(PatientReportDto.QueryDetail queryDetail, Long userId) throws IOException {
log.info("报告单分享:{},用户ID:{}", queryDetail, userId);
HtPatientReport report = htPatientReportDao.selectByPrimaryKey(queryDetail.getId());
if (report == null) {
@ -641,6 +642,14 @@ public class PatientReportService implements IPatientReportService {
return path;
}
@Override
public Workbook exportAnalyse(List<PatientReportDto.ExportSpecial> param, Long userId) {
// PoiUtil.
return null;
}
private List<PatientReportVo.ReportScore> getReportScores(PatientReportDto.ExportCode param, List<PdfUtil.Row> content, List<PatientReportVo.ReportScore> reportScores) {
long reportId = param.getId();
//重新封装报告单信息

87
ht/src/main/java/com/ccsens/ht/service/QuestionService.java

@ -821,48 +821,41 @@ public class QuestionService implements IQuestionService {
int y = (maxY.value + minY.value) / 2;
String centreCoordinate = x + "," + y;
parameter.setCentreCoordinate(centreCoordinate);
parameter.setShowCentreCoordinate((x-centerX) + "," + (y-centerY));
// TODO 重心
parameter.setBarycenterCoordinate(centreCoordinate);
//最小长方形面积
double acreage = (maxX.value - minX.value) * (maxY.value - minY.value);
parameter.setMinRectangleAcreage(acreage);
// 最小圆面积 距离中心最远点-->最小长方形长宽一半的平均数
double radius = ((double)(maxX.value - minX.value + maxY.value - minY.value)) /2 /2;
parameter.setMinCircleAcreage(new BigDecimal(Math.PI * radius * radius).setScale(2, BigDecimal.ROUND_HALF_UP));
// 计算四个边界点构成的长方形距离画板重心的距离
// 四个边界点 + 最小圆面积 四舍五入 sqrt
int radiusSqrt = setFourPoint(canvasPoints, minX, maxX, minY, maxY, x, y);
parameter.setMinCircleAcreage(new BigDecimal(Math.PI * radiusSqrt).setScale(2, BigDecimal.ROUND_HALF_UP));
log.info("half:",half);
// 四个边界点 四舍五入 sqrt
setFourPoint(canvasPoints, minX, maxX, minY, maxY);
log.info("half:{}",half);
if (half) {
// x:-y, y:x
parameter.setShowCentreCoordinate(new QuestionVo.Coordinate(y-centerY, x-centerX ));
// x:y, y:x
parameter.setTop(new QuestionVo.Coordinate(maxY.y - centerY, maxY.x - centerX ));
parameter.setBottom(new QuestionVo.Coordinate(minY.y - centerY, minY.x - centerX));
parameter.setLeft(new QuestionVo.Coordinate(minX.y - centerY, minX.x - centerX));
parameter.setRight(new QuestionVo.Coordinate(maxX.y - centerY, maxX.x - centerX));
} else {
parameter.setShowCentreCoordinate(new QuestionVo.Coordinate(centerX - x, y - centerY));
parameter.setTop(new QuestionVo.Coordinate(centerX - maxY.x , maxY.y - centerY));
parameter.setBottom(new QuestionVo.Coordinate(centerX - minY.x, minY.y - centerY));
parameter.setLeft(new QuestionVo.Coordinate(centerX - minX.x , minX.y - centerY));
parameter.setRight(new QuestionVo.Coordinate(centerX - maxX.x , maxX.y - centerY));
}
log.info("上:{},{};{},{}",maxY.x, maxY.y, parameter.getTop().getX(), parameter.getTop().getY());
log.info("下:{},{};{},{}",minY.x, minY.y, parameter.getBottom().getX(), parameter.getBottom().getY());
log.info("左:{},{};{},{}",minX.x, minX.y, parameter.getLeft().getX(), parameter.getLeft().getY());
log.info("右:{},{};{},{}",maxX.x, maxX.y, parameter.getRight().getX(), parameter.getRight().getY());
//平均长度
BigDecimal aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP);
BigDecimal aveReflectOnTime = BigDecimal.valueOf(reflectOnTime / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP);
parameter.setAveLength(aveLength.doubleValue());
parameter.setAveReflectOnTime(aveReflectOnTime.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
//短笔画数量
// double coefficient = 1.00;
BigDecimal referenceLength = param.getReferenceLength() != null && param.getReferenceLength().compareTo(new BigDecimal(0)) > 0 ? param.getReferenceLength() : aveLength;
BigDecimal referenceReflectOnTime = param.getReferenceReflectOnTime() != null && param.getReferenceReflectOnTime().compareTo(new BigDecimal(0)) > 0 ? param.getReferenceReflectOnTime() : aveReflectOnTime;
@ -884,12 +877,9 @@ public class QuestionService implements IQuestionService {
* @param maxX 最右点
* @param minY 最上点
* @param maxY 最下点
* @param x 中心点 x
* @param y 中心点 y
* @return 点到中心点距离的平方的最大值
*/
private int setFourPoint(List<QuestionVo.Point> canvasPoints, PointPosition minX, PointPosition maxX, PointPosition minY, PointPosition maxY, int x, int y) {
int max = 0;
private void setFourPoint(List<QuestionVo.Point> canvasPoints, PointPosition minX, PointPosition maxX, PointPosition minY, PointPosition maxY) {
// int max = 0;
for (int i = 0; i < canvasPoints.size(); i++) {
QuestionVo.Point point = canvasPoints.get(i);
if (StrUtil.isEmpty(point.getValue())) {
@ -920,13 +910,13 @@ public class QuestionService implements IQuestionService {
if (strArr == null || strArr.length < 2) {
continue;
}
int pointX = Integer.parseInt(strArr[0]);
int pointY = Integer.parseInt(strArr[1]);
max = (int) Math.max(max, Math.pow(pointX-x, 2) + Math.pow(pointY - y, 2));
// int pointX = Integer.parseInt(strArr[0]);
// int pointY = Integer.parseInt(strArr[1]);
// max = (int) Math.max(max, Math.pow(pointX-x, 2) + Math.pow(pointY - y, 2));
}
point.setValue(StringUtils.join(pointArr, ";"));
}
return max;
// return max;
}
@ -938,44 +928,75 @@ public class QuestionService implements IQuestionService {
/**
* 获取短笔画的数量
*
*
* 标志线条为长/短线条 /慢思考
* 计算最长最短线条的速度
* 过渡时间在所有短-长笔画序列中画出一个短笔划后开始一个长笔划的总时间
* 5个早期长笔画的经过时间从点击开始绘图至前5个长笔画绘制完成
* 前5笔长笔画率前5个笔画中长笔画所占比率
* @param aveLength 参考长度
* @param referenceReflectOnTime 参考思考时间
* @param lineParameterList 所有笔画的参数
* @param longIndex
* @param shortIndex
* @param parameter
* @param longIndex 长笔画序号
* @param shortIndex 短笔画序号
* @param parameter 参数
* @return 返回短笔画的数量
*/
private Nums getShortNums(BigDecimal aveLength, BigDecimal referenceReflectOnTime, List<QuestionVo.LineParameter> lineParameterList, int longIndex, int shortIndex, QuestionVo.Parameter parameter) {
Nums nums = new Nums();
// 短笔画数
int shortNums = 0;
// 长笔画数
int quickNums = 0;
// double a = aveLength * coefficient;
// 前5个长笔画的时间
int longLineCount = 5;
int longLineIndex = 0;
// 统计前5条线中长笔画的数量
int lineCount = 5;
int lineIndex = 0;
if(CollectionUtil.isNotEmpty(lineParameterList)){
for (int i = 0; i < lineParameterList.size(); i++) {
QuestionVo.LineParameter lineParameter = lineParameterList.get(i);
// 长短笔画
if(aveLength.compareTo(new BigDecimal(lineParameter.getLength())) >= 0){
lineParameter.setLengthStatus(Constant.LineColour.LENGTH_STATUS_SHORT);
shortNums++;
} else {
// 长笔画
lineParameter.setLengthStatus(Constant.LineColour.LENGTH_STATUS_LONG);
// 判断前一笔是否是短笔画,如果是,计算过渡时间
if (i > 0 && lineParameterList.get(i-1).getLengthStatus() == Constant.LineColour.LENGTH_STATUS_SHORT) {
parameter.setTransitionTime(parameter.getTransitionTime() + lineParameter.getIntervalDuration());
}
longLineIndex++;
}
// 计算前5个长笔画的耗时
if (longLineIndex <= longLineCount) {
parameter.setFiveLongLinesTime(parameter.getFiveLongLinesTime() + lineParameter.getIntervalDuration() + lineParameter.getDuration());
}
// 快慢思考
if(referenceReflectOnTime.compareTo(new BigDecimal(lineParameter.getIntervalDuration())) >= 0){
lineParameter.setReflectOnStatus(Constant.LineColour.REFLECT_ON_STATUS_QUICK);
quickNums++;
} else {
lineParameter.setReflectOnStatus(Constant.LineColour.REFLECT_ON_STATUS_SLOW);
}
// 最长/短笔画速度
if (longIndex == i) {
parameter.setLongSpeed(lineParameter.getSpeed());
}
if (shortIndex == i) {
parameter.setShortSpeed(lineParameter.getSpeed());
}
lineIndex++;
// 第5条线时,计算长线段的比例
if (lineIndex == lineCount) {
parameter.setLongLineRate(new BigDecimal(longLineIndex).divide(new BigDecimal(lineCount)));
}
}
}
nums.shortNums = shortNums;

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

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

41
ht/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -135,16 +135,55 @@
<if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
and r.clinical_diagnosis = #{clinicalDiagnosis}
</if>
<if test="pasi != null">
<if test="pasi != null and pasi != ''">
and r.pasi = #{pasi}
</if>
<if test="educationalStatus != null and educationalStatus != ''">
and p.educational_status = #{educationalStatus}
</if>
<if test="startEducationalStatusUnit != null">
and p.educational_status_unit &gt;= #{startEducationalStatusUnit}
</if>
<if test="endEducationalStatusUnit != null">
and p.educational_status_unit &lt;= #{endEducationalStatusUnit}
</if>
<if test="startTime != null">
and r.report_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and r.report_time &lt;= #{endTime}
</if>
<if test="scores != null and scores.size() > 0">
and r.id in (
SELECT DISTINCT
s.patient_report_id
FROM
t_ht_report r,
t_ht_question q,
t_ht_patient_score s
WHERE
r.CODE = q.evaluation_code
AND q.id = s.question_id
AND r.type = 2
AND s.type IN ( 0, 2 )
GROUP BY
s.patient_report_id,
r.CODE
HAVING
<foreach collection="scores" item="score" separator="and" open="(" close=")">
( r.CODE = #{score.code}
<if test="score.start != null">
AND sum( s.score ) &gt;= #{score.start}
</if>
<if test="score.end != null">
AND sum( s.score ) &lt;= #{score.end}
</if>
)
</foreach>
)
</if>
and r.show_status = 1
AND r.complete_status = 1
and r.is_del = 0
order by r.create_time desc
</select>

12
ht/src/main/resources/mapper_dao/HtQuestionDao.xml

@ -27,6 +27,11 @@
<collection property="answers" ofType="String">
<id column="answer"/>
</collection>
<collection property="options" ofType="com.ccsens.ht.bean.vo.QuestionVo$RecordOption">
<id column="optionId" property="id"/>
<result column="dataKey" property="dataKey"/>
<result column="dataValue" property="dataValue"/>
</collection>
</collection>
</resultMap>
@ -87,6 +92,7 @@
q.allow_clear AS allowClear,
q.clear_times AS clearTimes,
q.timing_length AS timingLength
FROM
t_ht_question q
WHERE
@ -123,5 +129,11 @@
r.question_id,
r.sort
) r ON q.id = r.question_id
left join
(select id as optionId,
data_key as dataKey,
data_value as dataValue,
question_record_id from t_ht_question_record_option where is_del = 0) o
on r.rId = o.question_record_id
</select>
</mapper>

64
question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java

@ -1,6 +1,7 @@
package com.ccsens.question.bean.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.question.uitl.Constant;
import com.ccsens.util.PdfUtil;
@ -139,41 +140,46 @@ public class PatientReportVo {
List<PdfUtil.Row> rows = new ArrayList<>();
//第一栏
rows.add(
fillRow(
"姓名:" + (StrUtil.isEmpty(this.patientName) ? "" : this.patientName),
"性别:" + (this.sex == null ? "" : this.sex == 0 ? "男" : "女"),
"年龄:" + (this.patientAge != null && this.patientAge != 0 ? this.patientAge + " 岁" : ""))
);
//第二栏
rows.add(
fillRow(
"文化程度:" + (StrUtil.isEmpty(this.educationalStatusUnit) ? "" : this.educationalStatusUnit + "年"),
"编号:" + (StrUtil.isEmpty(this.serialNumber) ? "" : this.serialNumber),
"职业:" + (this.career != null ? careerMap.get(this.career) : ""))
);
//第三栏
rows.add(
fillRow(
"科别:" + (StrUtil.isEmpty(this.department) ? "" : this.department),
"床号:" + (StrUtil.isEmpty(this.bedNumber) ? "" : this.bedNumber),
"病案号:" + (StrUtil.isEmpty(this.hospitalNumber) ? "" : this.hospitalNumber))
);
// //第一栏
// rows.add(
// fillRow(
// "姓名:" + (StrUtil.isEmpty(this.patientName) ? "" : this.patientName),
// "性别:" + (this.sex == null ? "" : this.sex == 0 ? "男" : "女"),
// "年龄:" + (this.patientAge != null && this.patientAge != 0 ? this.patientAge + " 岁" : ""))
// );
// //第二栏
// rows.add(
// fillRow(
// "文化程度:" + (StrUtil.isEmpty(this.educationalStatusUnit) ? "" : this.educationalStatusUnit + "年"),
// "编号:" + (StrUtil.isEmpty(this.serialNumber) ? "" : this.serialNumber),
// "职业:" + (this.career != null ? careerMap.get(this.career) : ""))
// );
// //第三栏
// rows.add(
// fillRow(
// "科别:" + (StrUtil.isEmpty(this.department) ? "" : this.department),
// "床号:" + (StrUtil.isEmpty(this.bedNumber) ? "" : this.bedNumber),
// "病案号:" + (StrUtil.isEmpty(this.hospitalNumber) ? "" : this.hospitalNumber))
// );
//第四栏
// Date date = null;
// if (this.reportTime > 0) {
// date = new Date();
// date.setTime(this.reportTime);
// }
Date date = null;
if (this.reportTime > 0) {
date = new Date();
date.setTime(this.reportTime);
}
String pasiStr = this.pasi == 3 ? "重度" : this.pasi == 2 ? "中度" : this.pasi == 1 ? "轻度" : "";
rows.add(
fillRow(
"病案号:",
"临床诊断:" + (StrUtil.isEmpty(this.clinicalDiagnosis) ? "" : this.clinicalDiagnosis),
"","")
"严重程度:" + pasiStr)
// "检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd")))
);
rows.add(
fillRow(
"检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd")))
// )
);
return rows;
}

Loading…
Cancel
Save