Browse Source

修改导出 根据报告单的就诊号查询就诊信息

whszxyjhyy
ccsens_zhengzhichuan 7 days ago
parent
commit
b0e0a5d83d
  1. 2
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java
  2. 96
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java
  3. 68
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java

2
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java

@ -31,6 +31,8 @@ public interface IPmsPatientService {
PmsPatientVo.PatientInfo getPatientInfoById(Long id);
PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo);
PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient);
Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param);

96
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java

@ -634,7 +634,7 @@ public class AmsReportServiceImpl implements AmsReportService {
HashMap<String, Object> params = new HashMap<>();
XWPFTemplate template = XWPFTemplate.compile(grPath);
// XWPFTemplate template = XWPFTemplate.compile(grPath);
params.put("h_name", patientInfo.getHospitalName());
// params.put("qrcode_img_url", Pictures.ofLocal(reportPath + patientInfo.getQrCodeUrl()).size(130, 130).create());
params.put("p_name", patientInfo.getPatientName());
@ -886,6 +886,70 @@ public class AmsReportServiceImpl implements AmsReportService {
params.put("title" + i, scores.get(i).getName());
List<Map<String, Object>> listMap = new ArrayList<>();
// for (int i = 0; i < exportInfos.size(); i++) {
// //遍历问题
// //生成问题表格
////
//// TextRenderData text5 = Texts.of("问题描述").bold().fontSize(12).create();
//// TextRenderData text6 = Texts.of("问题结果").bold().fontSize(12).create();
//// TextRenderData text7 = Texts.of("得 分").bold().fontSize(12).create();
////// TextRenderData text8 = Texts.of("总 分").bold().fontSize(12).create();
//// RowRenderData detailHeaderRow = Rows.of(text5, text6, text7).create();
//// Tables.TableBuilder of1 = Tables.of(detailHeaderRow);
//// RmsDto.QueryReportAnswer queryReportAnswer = new RmsDto.QueryReportAnswer();
//// queryReportAnswer.setEvaluationCode(exportInfos.get(i).getScaleCode());
//// queryReportAnswer.setId(dto.getReportId());
//// List<RmsVo.ReportDetailAnswer> reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer);
//// MergeCellRule detailMerge = null;
// if (CollUtil.isNotEmpty(reportDetailAnswerList)) {
// RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0);
// List<List<RmsVo.QuestionInfo>> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList());
// List<RmsVo.QuestionInfo> list = new ArrayList<>();
// for (int j = 0; j < collect.size(); j++) {
// list.addAll(collect.get(j));
// }
// Map<String, Object> map = new HashMap<>();
// List<RmsVo.QuestionTable> questionTableList = new ArrayList<>();
// for (RmsVo.QuestionInfo questionInfo : list) {
// RmsVo.QuestionTable questionTable = new RmsVo.QuestionTable();
// questionTable.setQuestion(questionInfo.getQuestionName());
// //查询患者答题得分
// BigDecimal score = new BigDecimal("0");
// AmsPatientAnswerScoreExample amsPatientAnswerScoreExample = new AmsPatientAnswerScoreExample();
// amsPatientAnswerScoreExample.createCriteria()
//// .andPatientIdEqualTo(patientInfo.getId())
// .andQuestionIdEqualTo(questionInfo.getQuestionId())
// .andEvaluationIdEqualTo(dto.getEvaluationId());
// amsPatientAnswerScoreExample.setOrderByClause("id desc");
// List<AmsPatientAnswerScore> amsPatientAnswerScores = amsPatientAnswerScoreMapper.selectByExample(amsPatientAnswerScoreExample);
// if (CollUtil.isNotEmpty(amsPatientAnswerScores)) {
// score = BigDecimal.valueOf(amsPatientAnswerScores.stream().filter(e -> e.getOptionId() != null && e.getOptionId() != 0).map(AmsPatientAnswerScore::getScore).mapToDouble(BigDecimal::doubleValue).sum());
// }
// questionTable.setScore(score + "");
// //处理答案
// String answers = "";
// for (RmsVo.Answer answer : questionInfo.getAnswers()) {
// if (StrUtil.isNotEmpty(answer.getAnswer())) {
// answers += answer.getAnswer() + ",";
// }
// }
// if (StrUtil.isNotEmpty(answers)) {
// answers = answers.substring(0, answers.length() - 1);
// }
// questionTable.setResult(StrUtil.isEmpty(answers) || "null".equals(answers) ? "" : answers);
// questionTableList.add(questionTable);
// }
// map.put("questionList", questionTableList);
// map.put("title", exportInfos.get(i).getScaleName());
// if (StrUtil.isNotEmpty(exportInfos.get(i).getPlan())) {
// map.put("fzjy", exportInfos.get(i).getPlan());
// map.put("fzjyFlag", true);
// }
// listMap.add(map);
// }
// }
}
if (emsEvaluation.getVersion() != null) {
@ -903,9 +967,22 @@ public class AmsReportServiceImpl implements AmsReportService {
.create();
params.put("table", tableData);
// params.put("questionTables", listMap);
// Long hospitalId = SecurityUtils.getDeptId();
String s = IdUtil.randomUUID();
// 或使用 RenderData 和 MiniTableRenderData 更高级表格渲染(后面介绍)
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
Configure config = Configure.builder()
.bind("zdList", policy)
.bind("yyList", policy)
.bind("questionTables", policy)
.bind("questionList", policy).build();
XWPFTemplate template = XWPFTemplate.compile(allPath, config);
// Long hospitalId = SecurityUtils.getDeptId();
// 将表格数据放入参数中
// params.put("table", tableDataList);
try {
@ -1632,6 +1709,13 @@ public class AmsReportServiceImpl implements AmsReportService {
return pattern.matcher(str).matches();
}
public static Map<String, Object> getParams(RmsDto.ExportReport1Dto dto) {
Map<String, Object> params = new HashMap<>();
return params;
}
@Override
public AmsReportVo.Result exportAll(RmsDto.ExportReport1Dto dto) {
RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getReportId());
@ -1658,7 +1742,13 @@ public class AmsReportServiceImpl implements AmsReportService {
return null;
}
//查询就诊、诊断信息
PmsPatientVo.PatientInfo patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId());
PmsPatientVo.PatientInfo patientInfoById;
if (StrUtil.isNotEmpty(report.getVisitNo())) {
patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId(), report.getVisitNo());
}else {
patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId());
}
//查询
RmsVo.ReportPatient patientInfo = detail.getPatient();

68
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java

@ -297,6 +297,74 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
return patientInfo;
}
@Override
public PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo) {
PmsPatient pmsPatient = patientDao.selectByPrimaryKey(id);
if (ObjectUtil.isNull(pmsPatient)) {
return null;
}
PmsPatientVo.PatientInfo patientInfo = new PmsPatientVo.PatientInfo();
BeanUtils.copyProperties(pmsPatient, patientInfo);
if (pmsPatient.getBirthYear() != null) {
patientInfo.setAge(Calendar.getInstance().get(Calendar.YEAR) - pmsPatient.getBirthYear());
}
//查询其他疾病史信息
Map<String, List<Map<String, Object>>> patientOtherMsg = new HashMap<>();
//先查询就诊信息(PmsPatientBody)
//根据就诊号和患者id查询就诊信息是否存在
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample();
patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
patientBodyExample.setOrderByClause("id desc");
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample);
if (CollUtil.isNotEmpty(pmsPatientBodies)) {
PmsPatientBody body = pmsPatientBodies.get(0);
List<Map<String, Object>> pmsPatientBodyReturn = new ArrayList<>();
pmsPatientBodyReturn.add(JSON.parseObject(JSON.toJSONString(body), Map.class));
patientOtherMsg.put("pmsPatientBody", pmsPatientBodyReturn);
if (visitNo != null) {
//烟酒史
PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample();
patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
List<PmsPatientPersonal> pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample);
if (CollUtil.isNotEmpty(pmsPatientPersonals)) {
String jsonStr = JSON.toJSONString(pmsPatientPersonals);
List<Map<String, Object>> allList = JSON.parseObject(jsonStr, List.class);
List<Map<String, Object>> singleItemList = new ArrayList<>();
if (!allList.isEmpty()) {
singleItemList.add(allList.get(0));
}
patientOtherMsg.put("pmsPatientPersonal", singleItemList);
}
//用药信息
PmsPatientParentIllnessExample patientParentIllnessExample = new PmsPatientParentIllnessExample();
patientParentIllnessExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
List<PmsPatientParentIllness> pmsPatientParentIllnesses = pmsPatientParentIllnessMapper.selectByExample(patientParentIllnessExample);
if (CollUtil.isNotEmpty(pmsPatientParentIllnesses)) {
String jsonStr = JSON.toJSONString(pmsPatientParentIllnesses);
patientOtherMsg.put("pmsPatientParentIllness", JSON.parseObject(jsonStr, List.class));
}
//诊断信息
PmsPatientDiagnosisExample patientDiagnosisExample = new PmsPatientDiagnosisExample();
patientDiagnosisExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
List<PmsPatientDiagnosis> pmsPatientDiagnoses = pmsPatientDiagnosisMapper.selectByExample(patientDiagnosisExample);
if (CollUtil.isNotEmpty(pmsPatientDiagnoses)) {
String jsonStr = JSON.toJSONString(pmsPatientDiagnoses);
patientOtherMsg.put("pmsPatientDiagnosis", JSON.parseObject(jsonStr, List.class));
}
}
}
patientInfo.setOtherMsg(patientOtherMsg);
return patientInfo;
}
@Override
public PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient) {

Loading…
Cancel
Save