Browse Source

导出报表时去除小数点

sd
zy_Java 5 years ago
parent
commit
774fe4654f
  1. 2
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  2. 3
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java
  3. 2
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  4. 17
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  5. 6
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java
  6. 10
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  7. 2
      tall/src/main/resources/application-prod.yml
  8. 4
      tall/src/main/resources/application.yml

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

@ -28,7 +28,7 @@ import java.util.Map;
* @create: 2019/11/27 10:03 * @create: 2019/11/27 10:03
*/ */
@FeignClient(name = "tall-ht", path = "v1.0", fallbackFactory = TallFeignClientFallBack.class) @FeignClient(name = "tall", path = "v1.0", fallbackFactory = TallFeignClientFallBack.class)
public interface TallFeignClient { public interface TallFeignClient {
/** /**

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

@ -81,8 +81,11 @@ public class PatientReportDto {
@ApiModelProperty("病人报告单ID") @ApiModelProperty("病人报告单ID")
@NotNull(message = "病人报告单ID不能为空") @NotNull(message = "病人报告单ID不能为空")
private Long id; private Long id;
@ApiModelProperty("是否需要rey 默认为0 0全部查询导出 1不导出rey 2只导出rey")
private int rey = 0;
} }
/**医生对报告单权限*/ /**医生对报告单权限*/
@ApiModel("PatientReportDtoAuthority") @ApiModel("PatientReportDtoAuthority")
@Data @Data

2
ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java

@ -29,7 +29,7 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
*@Author: wuHuiJuan *@Author: wuHuiJuan
*@date: 2019/11/19 11:46 *@date: 2019/11/19 11:46
*/ */
List<PatientReportVo.ReportScore> queryReportScore(@Param("id") Long id); List<PatientReportVo.ReportScore> queryReportScore(@Param("id") Long id,@Param("rey") int rey);
/** /**
* 查询NPI的分数 * 查询NPI的分数

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

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdcardUtil; import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ccsens.ht.bean.dto.PatientReportDto; import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.po.*; import com.ccsens.ht.bean.po.*;
@ -217,11 +218,16 @@ public class PatientReportService implements IPatientReportService {
//查询报告单信息和病人信息 //查询报告单信息和病人信息
PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(queryDetail.getId()); PatientReportVo.ReprotPatient reportPatient = htPatientReportDao.queryReportResult(queryDetail.getId());
//查询报告单分数 //查询报告单分数
List<PatientReportVo.ReportScore> reportScore = htPatientReportDao.queryReportScore(queryDetail.getId()); List<PatientReportVo.ReportScore> reportScore = htPatientReportDao.queryReportScore(queryDetail.getId(),queryDetail.getRey());
//重新封装报告单信息 //重新封装报告单信息
Map<String, PatientReportVo.ReportScore> map = new HashMap<>(32); Map<String, PatientReportVo.ReportScore> map = new HashMap<>(32);
List<PatientReportVo.ReportScore> scores = new ArrayList<>(); List<PatientReportVo.ReportScore> scores = new ArrayList<>();
reportScore.forEach(score -> { reportScore.forEach(score -> {
if(ObjectUtil.isNotNull(score.getScore())){
if(BigDecimal.valueOf(score.getScore().intValue()).compareTo(score.getScore()) == 0){
score.setScore(score.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
}
map.put(score.getCode(), score); map.put(score.getCode(), score);
//测评类(MOCA等) //测评类(MOCA等)
if (Constant.Ht.Report.TYPE_EVALUATION.equals(score.getType())) { if (Constant.Ht.Report.TYPE_EVALUATION.equals(score.getType())) {
@ -231,6 +237,7 @@ public class PatientReportService implements IPatientReportService {
} }
scores.add(score); scores.add(score);
} else { } else {
log.info("score:{}", score); log.info("score:{}", score);
map.get(score.getParentCode()).addSub(score); map.get(score.getParentCode()).addSub(score);
} }
@ -259,6 +266,9 @@ public class PatientReportService implements IPatientReportService {
carer.setName("照顾者"); carer.setName("照顾者");
carer.setTotalScore(-1); carer.setTotalScore(-1);
carer.setScore(npiScore == null || npiScore.get("carer") == null ? null : ((BigDecimal)npiScore.get("carer"))); carer.setScore(npiScore == null || npiScore.get("carer") == null ? null : ((BigDecimal)npiScore.get("carer")));
if(ObjectUtil.isNotNull(carer.getScore())){
carer.setScore(carer.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
carer.setType((byte)3); carer.setType((byte)3);
carer.setParentCode("NPI"); carer.setParentCode("NPI");
score.addSub(carer); score.addSub(carer);
@ -267,6 +277,9 @@ public class PatientReportService implements IPatientReportService {
patient.setName("患者"); patient.setName("患者");
patient.setTotalScore(-1); patient.setTotalScore(-1);
patient.setScore(npiScore == null || npiScore.get("result") == null ? null : ((BigDecimal) npiScore.get("result"))); patient.setScore(npiScore == null || npiScore.get("result") == null ? null : ((BigDecimal) npiScore.get("result")));
if(ObjectUtil.isNotNull(patient.getScore())){
patient.setScore(patient.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
patient.setType((byte)3); patient.setType((byte)3);
patient.setParentCode("NPI"); patient.setParentCode("NPI");
score.addSub(patient); score.addSub(patient);
@ -354,6 +367,8 @@ public class PatientReportService implements IPatientReportService {
@Override @Override
public String exportReport(PatientReportDto.QueryDetail queryDetail, Long userId) { public String exportReport(PatientReportDto.QueryDetail queryDetail, Long userId) {
log.info("导出报告单:{}, 操作用户:{}", queryDetail, userId); log.info("导出报告单:{}, 操作用户:{}", queryDetail, userId);
// TODO 暂时不导出rey试题,将传入参数改为1
queryDetail.setRey(1);
//查看是否已生成对应文件路径 //查看是否已生成对应文件路径
HtPatientReport report = htPatientReportDao.selectByPrimaryKey(queryDetail.getId()); HtPatientReport report = htPatientReportDao.selectByPrimaryKey(queryDetail.getId());
if (report == null) { if (report == null) {

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

@ -244,6 +244,12 @@ public class QuestionService implements IQuestionService {
for(QuestionDto.Option option : score.getOptions()) { for(QuestionDto.Option option : score.getOptions()) {
HtQuestionOption questionOption = htQuestionOptionDao.selectByPrimaryKey(option.getId()); HtQuestionOption questionOption = htQuestionOptionDao.selectByPrimaryKey(option.getId());
//去除整数后多余的小数点
if(ObjectUtil.isNotNull(questionOption.getScore())){
if(BigDecimal.valueOf(questionOption.getScore().intValue()).compareTo(questionOption.getScore()) == 0){
questionOption.setScore(questionOption.getScore().setScale(0,BigDecimal.ROUND_HALF_UP));
}
}
//未找到对应选项 或选项不是该试题的选项 //未找到对应选项 或选项不是该试题的选项
if (questionOption == null || questionOption.getQuestionId().longValue() != question.getId()) { if (questionOption == null || questionOption.getQuestionId().longValue() != question.getId()) {
log.info("选项不存在或不是对应试题的选项"); log.info("选项不存在或不是对应试题的选项");

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

@ -47,7 +47,15 @@
<select id="queryReportScore" resultMap="ScoreMap"> <select id="queryReportScore" resultMap="ScoreMap">
select t1.code,t1.name, t1.description, t1.total_score, t1.remark,t1.type,t1.parent_code, sum(t2.score) as score select t1.code,t1.name, t1.description, t1.total_score, t1.remark,t1.type,t1.parent_code, sum(t2.score) as score
from from
(select code,name, description, total_score, remark, type, parent_code, sort from t_ht_report where is_show = 1 and is_del = 0) t1 (select code,name, description, total_score, remark, type, parent_code, sort from t_ht_report
where is_show = 1 and is_del = 0
<if test="rey == 1">
and `code` != 'Rey' and `code` != 'XFXPD' and parent_code != 'Rey'
</if>
<if test="rey == 2">
AND (`code` = 'Rey' or parent_code = 'Rey')
</if>
) t1
left join t_ht_patient_score t2 left join t_ht_patient_score t2
on t1.code = t2.question_parent_code and on t1.code = t2.question_parent_code and
( (

2
tall/src/main/resources/application-prod.yml

@ -7,7 +7,7 @@ spring:
datacenterId: 1 datacenterId: 1
workerId: 1 workerId: 1
application: application:
name: tall-ht name: tall
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
rabbitmq: rabbitmq:

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

@ -1,4 +1,4 @@
spring: spring:
profiles: profiles:
active: prod active: dev
include: util-prod,common include: util-dev,common
Loading…
Cancel
Save