Browse Source

ht 搜索报告单

sd
zhizhi wu 4 years ago
parent
commit
a7f74616b1
  1. 3
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  2. 63
      ht/src/main/java/com/ccsens/ht/api/PatientReportSearchController.java
  3. 38
      ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportSearchDto.java
  4. 33
      ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportSearchVo.java
  5. 9
      ht/src/main/java/com/ccsens/ht/persist/dao/HtPatientReportDao.java
  6. 9
      ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java
  7. 15
      ht/src/main/java/com/ccsens/ht/service/IPatientReportService.java
  8. 34
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  9. 4
      ht/src/main/resources/application.yml
  10. 32
      ht/src/main/resources/mapper_dao/HtPatientReportDao.xml
  11. 31
      ht/src/main/resources/mapper_dao/HtReportDao.xml
  12. 4
      question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java
  13. 2
      question/src/main/java/com/ccsens/question/service/PatientReportService.java
  14. 4
      question/src/main/resources/application-dev.yml

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

@ -20,6 +20,7 @@ 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.validation.Valid;
import java.io.IOException;
import java.util.List;
@ -35,7 +36,7 @@ import java.util.List;
@RestController
public class PatientReportController {
@Autowired
@Resource
private IPatientReportService patientReportService;
@MustLogin

63
ht/src/main/java/com/ccsens/ht/api/PatientReportSearchController.java

@ -0,0 +1,63 @@
package com.ccsens.ht.api;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.ht.annotation.DoctorAudit;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.dto.PatientReportSearchDto;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.service.IPatientReportService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
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.validation.Valid;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2021/3/10 15:03
*/
@Slf4j
@Api(tags = "报告单搜索",value = "报告单搜索条件,搜索")
@RestController
@RequestMapping("/patientReport")
public class PatientReportSearchController {
@Resource
private IPatientReportService patientReportService;
@MustLogin
@DoctorAudit
@ApiOperation(value = "查询搜索条件",notes = "whj 查询搜索条件")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "查询搜索条件", required = true)
})
@RequestMapping(value="/searchParam", method = RequestMethod.POST)
public JsonResponse<PatientReportSearchVo.SearchParam> searchParam(@RequestBody @ApiParam @Valid QueryDto<PatientReportSearchDto.SearchParam> dto){
log.info("查询搜索条件:{}", dto);
List<PatientReportSearchVo.SearchParam> params = patientReportService.searchParam(dto.getParam());
log.info("查询搜索条件已完成");
return JsonResponse.newInstance().ok(params);
}
@MustLogin
@DoctorAudit
@ApiOperation(value = "根据条件搜索报告单",notes = "whj 搜索报告单")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "查询搜索条件", required = true)
})
@RequestMapping(value="/search", method = RequestMethod.POST)
public JsonResponse<PatientReportSearchVo.Search> search(@RequestBody @ApiParam @Valid QueryDto<PatientReportSearchDto.SearchList> dto){
log.info("搜索报告单:{}", dto);
List<PatientReportSearchVo.Search> params = patientReportService.search(dto.getParam());
log.info("搜索报告单已完成");
return JsonResponse.newInstance().ok(params);
}
}

38
ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportSearchDto.java

@ -0,0 +1,38 @@
package com.ccsens.ht.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2021/3/10 16:21
*/
public class PatientReportSearchDto {
@Data
@ApiModel("搜索条件-请求参数")
public static class SearchParam{
@ApiModelProperty("查询类型")
@NotEmpty(message = "请输入查询报告单类型")
private String parentCode;
}
@Data
@ApiModel("搜索报告单参数列表-请求")
public static class SearchList {
private List<Search> codes;
}
@Data
@ApiModel("搜索报告单参数-请求")
public static class Search {
@NotEmpty(message="请选择查询类型")
private String code;
private Integer start;
private Integer end;
}
}

33
ht/src/main/java/com/ccsens/ht/bean/vo/PatientReportSearchVo.java

@ -0,0 +1,33 @@
package com.ccsens.ht.bean.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2021/3/10 16:06
*/
public class PatientReportSearchVo {
@Data
@ApiModel("搜索条件-响应")
public static class SearchParam {
private Long id;
private String code;
private String name;
private byte optionStatus;
private String parentCode;
private List<SearchParam> children = new ArrayList<>();
}
@Data
@ApiModel("搜索-响应")
public static class Search {
private Long id;
private String name;
}
}

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

@ -1,6 +1,8 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.dto.PatientReportSearchDto;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.persist.mapper.HtPatientReportMapper;
import org.apache.ibatis.annotations.Param;
@ -95,4 +97,11 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
* @return
*/
List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(@Param("id")Long id, @Param("evaluationCode")String evaluationCode);
/**
* 根据分数搜索报告单
* @param codes 分数
* @return 报告单
*/
List<PatientReportSearchVo.Search> search(@Param("codes") List<PatientReportSearchDto.Search> codes);
}

9
ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java

@ -1,7 +1,9 @@
package com.ccsens.ht.persist.dao;
import com.ccsens.ht.bean.po.HtReport;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.persist.mapper.HtReportMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -28,4 +30,11 @@ public interface HtReportDao extends HtReportMapper {
*@date: 2019/11/19 10:10
*/
List<HtReport> queryReportShow();
/**
* 查询所有下级菜单和是否有试题
* @param parentCode 父code
* @return 搜索条件
*/
List<PatientReportSearchVo.SearchParam> queryParam(@Param("parentCode") String parentCode);
}

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

@ -1,7 +1,9 @@
package com.ccsens.ht.service;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.dto.PatientReportSearchDto;
import com.ccsens.ht.bean.po.HtDoctor;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
@ -142,4 +144,17 @@ public interface IPatientReportService {
List<PatientReportVo.ReportDetailAnswer> queryReportAnswer(PatientReportDto.QueryReportAnswer param, Long userId);
/**
* 查询报告单的搜索条件
* @param param 父code
* @return 搜索条件
*/
List<PatientReportSearchVo.SearchParam> searchParam(PatientReportSearchDto.SearchParam param);
/**
* 搜索报告单
* @param param 搜索列表
* @return 报告单
*/
List<PatientReportSearchVo.Search> search(PatientReportSearchDto.SearchList param);
}

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

@ -7,11 +7,14 @@ import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.ht.bean.dto.PatientReportDto;
import com.ccsens.ht.bean.dto.PatientReportSearchDto;
import com.ccsens.ht.bean.po.*;
import com.ccsens.ht.bean.vo.PatientReportSearchVo;
import com.ccsens.ht.bean.vo.PatientReportVo;
import com.ccsens.ht.persist.dao.HtDoctorDao;
import com.ccsens.ht.persist.dao.HtPatientReportDao;
import com.ccsens.ht.persist.dao.HtPositionDao;
import com.ccsens.ht.persist.dao.HtReportDao;
import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper;
import com.ccsens.ht.persist.mapper.HtPatientMapper;
import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper;
@ -22,7 +25,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -46,7 +48,7 @@ import java.util.concurrent.atomic.AtomicReference;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class PatientReportService implements IPatientReportService {
@Autowired
@Resource
private Snowflake snowflake;
@Resource
private HtDoctorDao htDoctorDao;
@ -60,6 +62,8 @@ public class PatientReportService implements IPatientReportService {
private HtPatientReportRecordMapper htPatientReportRecordMapper;
@Resource
private HtPatientFollowUpMapper htPatientFollowUpMapper;
@Resource
private HtReportDao htReportDao;
@Override
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) {
@ -577,5 +581,31 @@ public class PatientReportService implements IPatientReportService {
return htPatientReportDao.queryReportAnswer(param.getId(),param.getEvaluationCode());
}
@Override
public List<PatientReportSearchVo.SearchParam> searchParam(PatientReportSearchDto.SearchParam param) {
List<PatientReportSearchVo.SearchParam> list = htReportDao.queryParam(param.getParentCode());
if (CollectionUtil.isEmpty(list)) {
return list;
}
Map<String, PatientReportSearchVo.SearchParam> map = new HashMap<>();
List<PatientReportSearchVo.SearchParam> nodes = new ArrayList<>();
list.forEach(searchParam -> {
if (param.getParentCode().equals(searchParam.getParentCode())) {
nodes.add(searchParam);
} else {
PatientReportSearchVo.SearchParam parent = map.get(searchParam.getParentCode());
parent.getChildren().add(searchParam);
}
map.put(searchParam.getCode(), searchParam);
});
return nodes;
}
@Override
public List<PatientReportSearchVo.Search> search(PatientReportSearchDto.SearchList param) {
List<PatientReportSearchVo.Search> list = htPatientReportDao.search(param.getCodes());
return list;
}
}

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

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

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

@ -224,6 +224,38 @@
and a.questionId = t.question_id
ORDER BY a.questionId ,a.sort
</select>
<select id="search" resultType="com.ccsens.ht.bean.vo.PatientReportSearchVo$Search">
<foreach collection="codes" item="item" separator="INTERSECT">
<if test="item.code != null and item.code != '' and (item.start != null or item.end != null)">
SELECT
r.id,
r.NAME
FROM
t_ht_patient_score s,
t_ht_question q,
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>
<if test="item.start != null">
AND sum( score ) &gt;= #{item.start}
</if>
<if test="item.end != null">
AND sum( score ) &lt;= #{item.end}
</if>
</trim>
</if>
</foreach>
</select>
</mapper>

31
ht/src/main/resources/mapper_dao/HtReportDao.xml

@ -35,5 +35,36 @@
<select id="queryReportShow" resultMap="BaseResultMap">
select * from t_ht_report where is_show = 1 and is_del = 0 order by type,sort
</select>
<select id="queryParam" resultType="com.ccsens.ht.bean.vo.PatientReportSearchVo$SearchParam">
SELECT
t.id,
t.code,
t.parent_code as parentCode,
t.name,
IF( count( q.id ) > 0, 1, 0 ) AS optionStatus
FROM
(
SELECT
t.id,
t.CODE,
t.parent_code,
t.NAME,
t.type,
t.sort
FROM
(
SELECT
t1.*,
IF ( find_in_set( parent_code, @pcodes ) > 0, @pcodes := concat( @pcodes, ',', CODE ), 0 ) AS ischild
FROM
( SELECT id, CODE, parent_code, NAME, type, sort FROM t_ht_report WHERE is_del = 0 ) t1,
( SELECT @pcodes := #{parentCode} ) t2
) t
WHERE t.ischild != '0'
) t
LEFT JOIN t_ht_question q ON t.CODE = q.parent_code AND q.is_del = 0
GROUP BY t.CODE
ORDER BY t.type,t.parent_code,t.sort
</select>
</mapper>

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

@ -273,7 +273,7 @@ public class PatientReportVo {
cell.setContent(this.code + (StrUtil.isBlank(this.remark) ? "" : "("+this.remark+")"));
cell.setRowSpan(2);
cell.setColSpan(npi.equalsIgnoreCase(this.code) ? headNum : 1);
cell.setBorderTop(mmse.equalsIgnoreCase(this.code) ? 1 : 0);
// cell.setBorderTop(mmse.equalsIgnoreCase(this.code) ? 1 : 0);
row1.addCell(cell);
//被合并cell
PdfUtil.Row row2 = new PdfUtil.Row();
@ -328,7 +328,7 @@ public class PatientReportVo {
PdfUtil.Row row5 = new PdfUtil.Row();
//延迟回忆特殊处理
String ychy = "YCHY";
int size = this.subReport.size() - 1;
int size = this.subReport.size();
for (int i = firstIndex; i < size; i++) {
ReportScore reportScore = this.subReport.get(i);
//设置名字

2
question/src/main/java/com/ccsens/question/service/PatientReportService.java

@ -402,7 +402,7 @@ public class PatientReportService implements IPatientReportService {
dateCell.setBorderBottom(null);
dateCell.setBorderLeft(null);
content.add(row2);
log.info("导出列表:{}", content);
String path = PropUtil.imgDomain + "/" + PdfUtil.credatePdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, detail.getPatient().toPdfRow(), content, new PdfUtil.Margin());
report.setUrl(path);
htPatientReportDao.updateByPrimaryKeySelective(report);

4
question/src/main/resources/application-dev.yml

@ -30,8 +30,8 @@ swagger:
file:
path: /home/cloud/question/uploads/
#domain: https://api.ccsens.com/test/
domain: http://localhost:7040/
imgDomain: http://localhost:7040/uploads
domain: http://localhost:7160/
imgDomain: http://localhost:7160/uploads
ht:
project:
patientUrl: https://www.baidu.com/

Loading…
Cancel
Save