|
@@ -28,7 +28,9 @@ import com.diagbot.entity.HomeOperationInfo;
|
|
|
import com.diagbot.entity.HomePage;
|
|
|
import com.diagbot.entity.MedCheckInfo;
|
|
|
import com.diagbot.entity.MedCrisisInfo;
|
|
|
+import com.diagbot.entity.MedLisInfo;
|
|
|
import com.diagbot.entity.MedLisResult;
|
|
|
+import com.diagbot.entity.MedPacsInfo;
|
|
|
import com.diagbot.entity.MedPacsResult;
|
|
|
import com.diagbot.entity.MedicalRecord;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
@@ -63,7 +65,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
@@ -119,8 +120,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
@Autowired
|
|
|
private FilterFacade filterFacade;
|
|
|
@Autowired
|
|
|
+ MedLisInfoFacade medLisInfoFacade;
|
|
|
+ @Autowired
|
|
|
MedLisResultFacade medLisResultFacade;
|
|
|
@Autowired
|
|
|
+ MedPacsInfoFacade medPacsInfoFacade;
|
|
|
+ @Autowired
|
|
|
MedPacsResultFacade medPacsResultFacade;
|
|
|
@Autowired
|
|
|
MedCrisisInfoFacade medCrisisInfoFacade;
|
|
@@ -183,6 +188,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
mapAll.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
mapAll.put("behospital_code", getDetailVO.getBehospitalCode());
|
|
|
mapAll.put("hospital_id", hospitalId);
|
|
|
+ mapAll.put("check_type", 0);
|
|
|
QueryWrapper<MedCheckInfo> medCheckInfoQuerys = new QueryWrapper<>();
|
|
|
medCheckInfoQuerys.allEq(mapAll);
|
|
|
int count = medCheckInfoFacade.count(medCheckInfoQuerys);
|
|
@@ -191,6 +197,20 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
} else {
|
|
|
res.put("checkStatus", 0);
|
|
|
}
|
|
|
+ //增加该病案首页是否核查状态
|
|
|
+ Map<String, Object> mapAllMr = new HashMap<String, Object>();
|
|
|
+ mapAllMr.put("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ mapAllMr.put("behospital_code", getDetailVO.getBehospitalCode());
|
|
|
+ mapAllMr.put("hospital_id", hospitalId);
|
|
|
+ mapAllMr.put("check_type", 1);
|
|
|
+ QueryWrapper<MedCheckInfo> medCheckInfoMr = new QueryWrapper<>();
|
|
|
+ medCheckInfoMr.allEq(mapAllMr);
|
|
|
+ int countMr = medCheckInfoFacade.count(medCheckInfoMr);
|
|
|
+ if (countMr > 0) {
|
|
|
+ res.put("mrStatus", 1);
|
|
|
+ } else {
|
|
|
+ res.put("mrStatus", 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 获取提示信息
|
|
@@ -276,20 +296,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
.eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
);
|
|
|
|
|
|
- // 化验
|
|
|
- List<MedLisResult> medLisResultList = medLisResultFacade.list(new QueryWrapper<MedLisResult>()
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", hospitalId)
|
|
|
- .eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
- );
|
|
|
-
|
|
|
- // 辅检
|
|
|
- List<MedPacsResult> medPacsResultList = medPacsResultFacade.list(new QueryWrapper<MedPacsResult>()
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", hospitalId)
|
|
|
- .eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
- );
|
|
|
-
|
|
|
// 获取病案首页
|
|
|
HomePage homePage = homePageFacade.getOne(new QueryWrapper<HomePage>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
@@ -345,6 +351,11 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
queryVo.setBehospitalInfo(behospitalInfoList.get(0));
|
|
|
}
|
|
|
|
|
|
+ // 化验
|
|
|
+ List<MedLisResult> medLisResultList = getMedLisResultList(behospitalInfoList.get(0));
|
|
|
+ // 辅检
|
|
|
+ List<MedPacsResult> medPacsResultList = getMedPacsResultList(behospitalInfoList.get(0));
|
|
|
+
|
|
|
// 会诊记录
|
|
|
addDataWithKey("会诊", recMap, medrecVoList,
|
|
|
Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
|
|
@@ -412,6 +423,101 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
return queryVo;
|
|
|
}
|
|
|
|
|
|
+ private List<MedLisResult> getMedLisResultList(BehospitalInfo behospitalInfo) {
|
|
|
+ String behospitalDate = null, leaveHospitalDate = null;
|
|
|
+ try {
|
|
|
+ behospitalDate = DateUtil.format(behospitalInfo.getBehospitalDate(), DateUtil.DATE_TIME_FORMAT);
|
|
|
+ leaveHospitalDate = DateUtil.format(behospitalInfo.getLeaveHospitalDate(), DateUtil.DATE_TIME_FORMAT);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(behospitalDate)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<MedLisResult> medLisResultList = null;
|
|
|
+ QueryWrapper<MedLisInfo> medLisInfoQe = new QueryWrapper<>();
|
|
|
+ medLisInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ medLisInfoQe.eq("hospital_id", behospitalInfo.getHospitalId());
|
|
|
+ medLisInfoQe.like("behospital_code", behospitalInfo.getFileCode());
|
|
|
+ medLisInfoQe.isNotNull("rep_name");
|
|
|
+ medLisInfoQe.isNotNull("check_date");
|
|
|
+ medLisInfoQe.apply("check_date!=''");
|
|
|
+ medLisInfoQe.apply(
|
|
|
+ "date_format (check_date,'%Y-%m-%d %H:%i:%s') >= date_format('"
|
|
|
+ + behospitalDate
|
|
|
+ + "','%Y-%m-%d %H:%i:%s')"
|
|
|
+ );
|
|
|
+ if (StringUtil.isNotBlank(behospitalInfo.getIsPlacefile())
|
|
|
+ && behospitalInfo.getIsPlacefile().equals("1")
|
|
|
+ && StringUtil.isNotBlank(leaveHospitalDate)) {
|
|
|
+ medLisInfoQe.apply(
|
|
|
+ "date_format (check_date,'%Y-%m-%d %H:%i:%s') <= date_format('"
|
|
|
+ + leaveHospitalDate
|
|
|
+ + "','%Y-%m-%d %H:%i:%s')"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ medLisInfoQe.select("rep_no", "rep_name");
|
|
|
+ List<MedLisInfo> medLisInfoList = medLisInfoFacade.list(medLisInfoQe);
|
|
|
+ if (ListUtil.isNotEmpty(medLisInfoList)) {
|
|
|
+ Map<String, String> repNoRepNameMap = medLisInfoList.stream().collect(Collectors.toMap(i -> i.getRepNo(), i -> i.getRepName()));
|
|
|
+ medLisResultList = medLisResultFacade.list(new QueryWrapper<MedLisResult>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", behospitalInfo.getHospitalId())
|
|
|
+ .like("behospital_code", behospitalInfo.getFileCode())
|
|
|
+ .isNotNull("item_name")
|
|
|
+ .in("rep_no", medLisInfoList.stream().map(i -> i.getRepNo()).collect(Collectors.toList()))
|
|
|
+ );
|
|
|
+ medLisResultList.forEach(medLisResult -> {
|
|
|
+ medLisResult.setItemName(repNoRepNameMap.get(medLisResult.getRepNo()) + "=" + medLisResult.getItemName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return medLisResultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<MedPacsResult> getMedPacsResultList(BehospitalInfo behospitalInfo) {
|
|
|
+ String behospitalDate = null, leaveHospitalDate = null;
|
|
|
+ try {
|
|
|
+ behospitalDate = DateUtil.format(behospitalInfo.getBehospitalDate(), DateUtil.DATE_TIME_FORMAT);
|
|
|
+ leaveHospitalDate = DateUtil.format(behospitalInfo.getLeaveHospitalDate(), DateUtil.DATE_TIME_FORMAT);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(behospitalDate)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<MedPacsResult> medPacsResultList = null;
|
|
|
+ QueryWrapper<MedPacsInfo> medPacsInfoQe = new QueryWrapper<>();
|
|
|
+ medPacsInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ medPacsInfoQe.eq("hospital_id", behospitalInfo.getHospitalId());
|
|
|
+ medPacsInfoQe.like("behospital_code", behospitalInfo.getFileCode());
|
|
|
+ medPacsInfoQe.isNotNull("check_date");
|
|
|
+ medPacsInfoQe.apply("check_date!=''");
|
|
|
+ medPacsInfoQe.apply(
|
|
|
+ "date_format (check_date,'%Y-%m-%d %H:%i:%s') >= date_format('"
|
|
|
+ + behospitalDate
|
|
|
+ + "','%Y-%m-%d %H:%i:%s')"
|
|
|
+ );
|
|
|
+ if (StringUtil.isNotBlank(behospitalInfo.getIsPlacefile())
|
|
|
+ && behospitalInfo.getIsPlacefile().equals("1")
|
|
|
+ && StringUtil.isNotBlank(leaveHospitalDate)) {
|
|
|
+ medPacsInfoQe.apply(
|
|
|
+ "date_format (check_date,'%Y-%m-%d %H:%i:%s') <= date_format('"
|
|
|
+ + leaveHospitalDate
|
|
|
+ + "','%Y-%m-%d %H:%i:%s')"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ List<MedPacsInfo> medPacsInfoList = medPacsInfoFacade.list(medPacsInfoQe);
|
|
|
+ if (ListUtil.isNotEmpty(medPacsInfoList)) {
|
|
|
+ medPacsResultList = medPacsResultFacade.list(new QueryWrapper<MedPacsResult>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", behospitalInfo.getHospitalId())
|
|
|
+ .like("behospital_code", behospitalInfo.getFileCode())
|
|
|
+ .in("rep_no", medPacsInfoList.stream().map(i -> i.getRepNo()).collect(Collectors.toList()))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return medPacsResultList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 评分-终末质控
|
|
|
*
|
|
@@ -440,73 +546,17 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
OutputInfo outputInfo = response.getData();
|
|
|
- //根据质控结果获取质控条目
|
|
|
- QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
|
+ // 质控编码列表
|
|
|
List<String> codeList = new ArrayList<>();
|
|
|
// code和info的映射map
|
|
|
Map<String, String> codeToInfoMap = new LinkedHashMap<>();
|
|
|
- Map<String, Map<String, String>> codeMap = outputInfo.getResult();
|
|
|
- for (String key : codeMap.keySet()) {
|
|
|
- codeList.add(key);
|
|
|
- Map<String, String> mapInfo = codeMap.get(key);
|
|
|
- if (mapInfo != null && StringUtil.isNotBlank(mapInfo.get("info"))) {
|
|
|
- codeToInfoMap.put(key, mapInfo.get("info"));
|
|
|
- }
|
|
|
- }
|
|
|
- // 判断code是否为空
|
|
|
- List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
- if (ListUtil.isNotEmpty(codeList)) {
|
|
|
- qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
- qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
- qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
- }
|
|
|
-
|
|
|
- // 对info赋值
|
|
|
- for (QcResultAlgVO bean : qcResultAlgVOList) {
|
|
|
- String info = codeToInfoMap.get(bean.getCode());
|
|
|
- if (StringUtil.isNotBlank(info)) {
|
|
|
- bean.setInfo(info);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 评分
|
|
|
- AlgorithmVO algorithmVO = new AlgorithmVO();
|
|
|
- algorithmVO.setType(0);
|
|
|
- algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
|
|
|
- algorithmVO.setHospitalId(hospitalId);
|
|
|
- algorithmVO.setBehospitalCode(analyzeVO.getBehospitalCode());
|
|
|
- AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
|
|
|
- //保存
|
|
|
- Map<String, Object> pageMap = outputInfo.getPageData();
|
|
|
- // 手动拼接数据【知情同意书】【谈话告知书】
|
|
|
- List<MedicalRecord> recordList = medicalRecordFacade.list(new QueryWrapper<MedicalRecord>()
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
- .eq("hospital_id", hospitalId)
|
|
|
- .in("mode_id", Arrays.asList(53, 54, 16))
|
|
|
- .orderByAsc("rec_date")
|
|
|
- );
|
|
|
- List<MedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(recordList, MedicalRecordDTO.class);
|
|
|
- Map<Long, List<MedicalRecordDTO>> recordMap = EntityUtil.makeEntityListMap(medicalRecordDTOList, "modeId");
|
|
|
- List<MedicalRecordDTO> recordDTOList = new ArrayList<>();
|
|
|
- if (recordMap.get(53L) != null) {
|
|
|
- recordDTOList.addAll(recordMap.get(53L)); // 知情同意书
|
|
|
- }
|
|
|
- if (recordMap.get(16L) != null) {
|
|
|
- recordDTOList.addAll(recordMap.get(16L)); // 手术知情同意书
|
|
|
- }
|
|
|
- // 医嘱信息
|
|
|
- pageMap.put("医嘱信息", null);
|
|
|
- // 知情同意书 = 【知情同意书】 + 【手术知情同意书】
|
|
|
- pageMap.put("知情同意书", recordDTOList);
|
|
|
- pageMap.put("谈话告知书", recordMap.get(54L));
|
|
|
+ // 对codeList 和 codeToInfoMap进行赋值
|
|
|
+ setCodeData(outputInfo, codeList, codeToInfoMap);
|
|
|
|
|
|
- String pageData = JSON.toJSONString(pageMap);
|
|
|
- // 获取菜单信息
|
|
|
- List<QcModeDTO> qcModeDTOList = qcModeFacade.getMenu(pageMap);
|
|
|
- String menuData = JSON.toJSONString(qcModeDTOList);
|
|
|
-
|
|
|
- Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask(), null);
|
|
|
+ // 计算分值并保存结果至数据库
|
|
|
+ Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO);
|
|
|
+ AlgorithmDTO algorithmDTO = (AlgorithmDTO)resMap.get("algorithmDTO");
|
|
|
+ Date date = (Date)resMap.get("date");
|
|
|
|
|
|
// 返回提示信息
|
|
|
// List<MsgDTO> msgDTOList = getMsg(analyzeVO);
|
|
@@ -948,41 +998,18 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
OutputInfo outputInfo = response.getData();
|
|
|
- //根据质控结果获取质控条目
|
|
|
- // QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
|
+ // 质控编码列表
|
|
|
List<String> codeList = new ArrayList<>();
|
|
|
// code和info的映射map
|
|
|
Map<String, String> codeToInfoMap = new LinkedHashMap<>();
|
|
|
- Map<String, Map<String, String>> codeMap = outputInfo.getResult();
|
|
|
- for (String key : codeMap.keySet()) {
|
|
|
- codeList.add(key);
|
|
|
- Map<String, String> mapInfo = codeMap.get(key);
|
|
|
- if (mapInfo != null && StringUtil.isNotBlank(mapInfo.get("info"))) {
|
|
|
- codeToInfoMap.put(key, mapInfo.get("info"));
|
|
|
- }
|
|
|
- }
|
|
|
- // List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
- // if (ListUtil.isNotEmpty(codeList)) {
|
|
|
- // qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
- // qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
- // qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
- // }
|
|
|
- //
|
|
|
- // // 评分
|
|
|
- // AlgorithmVO algorithmVO = new AlgorithmVO();
|
|
|
- // algorithmVO.setType(0);
|
|
|
- // algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
|
|
|
- // AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
|
|
|
+ // 对codeList 和 codeToInfoMap进行赋值
|
|
|
+ setCodeData(outputInfo, codeList, codeToInfoMap);
|
|
|
|
|
|
- //保存
|
|
|
- // Map<String, Object> pageMap = outputInfo.getPageData();
|
|
|
- // String pageData = JSON.toJSONString(pageMap);
|
|
|
- // 获取菜单信息
|
|
|
- // List<QcModeDTO> qcModeDTOList = qcModeFacade.getMenu(pageMap);
|
|
|
- // String menuData = JSON.toJSONString(qcModeDTOList);
|
|
|
-
|
|
|
- // 运行质控不保存评分结果信息
|
|
|
- // Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask());
|
|
|
+ // 如果是1,说明已是终末质控,不再保存质控结果数据;如果是0,则保存质控结果数据
|
|
|
+ if ("0".equals(analyzeRunVO.getIsPlacefile())) {
|
|
|
+ // 计算分值并保存结果至数据库
|
|
|
+ Map<String, Object> resMap = calScoreAndSave(outputInfo, codeList, codeToInfoMap, analyzeVO);
|
|
|
+ }
|
|
|
|
|
|
// 返回缺陷提示信息
|
|
|
List<MsgDTO> msgDTOList = new ArrayList<>();
|
|
@@ -1040,15 +1067,15 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
|
|
|
- behospitalPageVO.setIsPlacefile("1");
|
|
|
- if (null != behospitalPageVO.getStatisticsType()
|
|
|
- && null == behospitalPageVO.getLeaveHosDateStart()
|
|
|
- && null == behospitalPageVO.getLeaveHosDateEnd()) {
|
|
|
- String startDate = filterFacade.getStartDateStr(behospitalPageVO.getStatisticsType(), null);
|
|
|
- String endDate = filterFacade.getEndDateStr(behospitalPageVO.getStatisticsType(), null);
|
|
|
- behospitalPageVO.setLeaveHosDateStart(DateUtil.parseDate(startDate));
|
|
|
- behospitalPageVO.setLeaveHosDateEnd(DateUtil.parseDate(endDate));
|
|
|
- }
|
|
|
+// behospitalPageVO.setIsPlacefile("1");
|
|
|
+// if (null != behospitalPageVO.getStatisticsType()
|
|
|
+// && null == behospitalPageVO.getLeaveHosDateStart()
|
|
|
+// && null == behospitalPageVO.getLeaveHosDateEnd()) {
|
|
|
+// String startDate = filterFacade.getStartDateStr(behospitalPageVO.getStatisticsType(), null);
|
|
|
+// String endDate = filterFacade.getEndDateStr(behospitalPageVO.getStatisticsType(), null);
|
|
|
+// behospitalPageVO.setLeaveHosDateStart(DateUtil.parseDate(startDate));
|
|
|
+// behospitalPageVO.setLeaveHosDateEnd(DateUtil.parseDate(endDate));
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
public void exportExcelFac(HttpServletResponse response) {
|
|
@@ -1064,23 +1091,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @param exportQcresultVO
|
|
|
*/
|
|
|
public void exportQcresult(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
|
exportQcresultVO.setHospitalId(hospitalId);
|
|
|
- Date startDate = exportQcresultVO.getLeaveHosDateStart();
|
|
|
- Date endDate = exportQcresultVO.getLeaveHosDateEnd();
|
|
|
- //时间间隔7天
|
|
|
- long interval = 7 * 24 * 60 * 60 * 1000;
|
|
|
- if (endDate.getTime() < startDate.getTime()) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
|
|
|
- }
|
|
|
- if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
|
|
|
- }
|
|
|
-
|
|
|
- exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
|
|
|
+ //时间设置
|
|
|
+ exportQcresultVOSet(exportQcresultVO);
|
|
|
List<ExportExcelDTO> res = this.exportQcresult(exportQcresultVO);
|
|
|
- String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
|
|
|
+ String fileName = "抽查住院病历质量情况.xls";
|
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
}
|
|
@@ -1092,24 +1108,14 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @param exportQcresultVO
|
|
|
*/
|
|
|
public void exportQcresultByDept(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
|
String userId = SysUserUtils.getCurrentPrincipleID();
|
|
|
exportQcresultVO.setHospitalId(hospitalId);
|
|
|
exportQcresultVO.setUserId(Long.valueOf(userId));
|
|
|
- Date startDate = exportQcresultVO.getLeaveHosDateStart();
|
|
|
- Date endDate = exportQcresultVO.getLeaveHosDateEnd();
|
|
|
- //时间间隔7天
|
|
|
- long interval = 7 * 24 * 60 * 60 * 1000;
|
|
|
- if (endDate.getTime() < startDate.getTime()) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
|
|
|
- }
|
|
|
- if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
|
|
|
- }
|
|
|
- exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
|
|
|
+ //时间设置
|
|
|
+ exportQcresultVOSet(exportQcresultVO);
|
|
|
List<ExportExcelDTO> res = this.exportQcresultByDept(exportQcresultVO);
|
|
|
- String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
|
|
|
+ String fileName = "抽查住院病历质量情况.xls";
|
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
}
|
|
@@ -1121,25 +1127,145 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @param exportQcresultVO
|
|
|
*/
|
|
|
public void exportQcresultByGroup(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
|
String userId = SysUserUtils.getCurrentPrincipleID();
|
|
|
exportQcresultVO.setHospitalId(hospitalId);
|
|
|
exportQcresultVO.setUserId(Long.valueOf(userId));
|
|
|
- Date startDate = exportQcresultVO.getLeaveHosDateStart();
|
|
|
- Date endDate = exportQcresultVO.getLeaveHosDateEnd();
|
|
|
- //时间间隔7天
|
|
|
- long interval = 7 * 24 * 60 * 60 * 1000;
|
|
|
- if (endDate.getTime() < startDate.getTime()) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
|
|
|
- }
|
|
|
- if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
|
|
|
- }
|
|
|
- exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
|
|
|
+ //时间设置
|
|
|
+ exportQcresultVOSet(exportQcresultVO);
|
|
|
List<ExportExcelDTO> res = this.exportQcresultByGroup(exportQcresultVO);
|
|
|
- String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
|
|
|
+ String fileName = "抽查住院病历质量情况.xls";
|
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
}
|
|
|
+
|
|
|
+ private void exportQcresultVOSet(ExportQcresultVO exportQcresultVO){
|
|
|
+ //入参验证
|
|
|
+ long interval = 7 * 24 * 60 * 60 * 1000;
|
|
|
+ //入院时间
|
|
|
+ if (null != exportQcresultVO && null != exportQcresultVO.getBehosDateStart() && null != exportQcresultVO.getBehosDateEnd()) {
|
|
|
+ Date startDate = exportQcresultVO.getBehosDateStart();
|
|
|
+ Date endDate = exportQcresultVO.getBehosDateEnd();
|
|
|
+ //时间间隔7天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
|
|
|
+ }
|
|
|
+ exportQcresultVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getBehosDateStart()));
|
|
|
+ exportQcresultVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getBehosDateEnd(), 1)));
|
|
|
+ }
|
|
|
+ //出院时间
|
|
|
+ if (null != exportQcresultVO && null != exportQcresultVO.getLeaveHosDateStart() && null != exportQcresultVO.getLeaveHosDateEnd()) {
|
|
|
+ Date startDate = exportQcresultVO.getLeaveHosDateStart();
|
|
|
+ Date endDate = exportQcresultVO.getLeaveHosDateEnd();
|
|
|
+ //时间间隔7天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
|
|
|
+ }
|
|
|
+ exportQcresultVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getLeaveHosDateStart()));
|
|
|
+ exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getLeaveHosDateEnd(), 1)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置共用code数据
|
|
|
+ *
|
|
|
+ * @param outputInfo 质控出参数据
|
|
|
+ * @param codeList 质控编码列表
|
|
|
+ * @param codeToInfoMap 质控编码对应的info信息
|
|
|
+ */
|
|
|
+ public void setCodeData(OutputInfo outputInfo, List<String> codeList, Map<String, String> codeToInfoMap) {
|
|
|
+ Map<String, Map<String, String>> codeMap = outputInfo.getResult();
|
|
|
+ for (String key : codeMap.keySet()) {
|
|
|
+ codeList.add(key);
|
|
|
+ Map<String, String> mapInfo = codeMap.get(key);
|
|
|
+ if (mapInfo != null && StringUtil.isNotBlank(mapInfo.get("info"))) {
|
|
|
+ codeToInfoMap.put(key, mapInfo.get("info"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算分值并保存结果至数据库
|
|
|
+ *
|
|
|
+ * @param outputInfo 质控出参数据
|
|
|
+ * @param codeList 质控编码列表
|
|
|
+ * @param codeToInfoMap 质控编码对应的info信息
|
|
|
+ * @param analyzeVO 入参
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> calScoreAndSave(OutputInfo outputInfo, List<String> codeList,
|
|
|
+ Map<String, String> codeToInfoMap, AnalyzeVO analyzeVO) {
|
|
|
+ Long hospitalId = analyzeVO.getHospitalId();
|
|
|
+ List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ // 根据质控结果获取质控条目
|
|
|
+ QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
|
+ qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
+ qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
+ qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 对info赋值
|
|
|
+ for (QcResultAlgVO bean : qcResultAlgVOList) {
|
|
|
+ String info = codeToInfoMap.get(bean.getCode());
|
|
|
+ if (StringUtil.isNotBlank(info)) {
|
|
|
+ bean.setInfo(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 评分
|
|
|
+ AlgorithmVO algorithmVO = new AlgorithmVO();
|
|
|
+ algorithmVO.setType(0);
|
|
|
+ algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
|
|
|
+ algorithmVO.setHospitalId(hospitalId);
|
|
|
+ algorithmVO.setBehospitalCode(analyzeVO.getBehospitalCode());
|
|
|
+ algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
|
|
|
+ AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
|
|
|
+
|
|
|
+ //保存
|
|
|
+ Map<String, Object> pageMap = outputInfo.getPageData();
|
|
|
+ // 手动拼接数据【知情同意书】【谈话告知书】
|
|
|
+ List<MedicalRecord> recordList = medicalRecordFacade.list(new QueryWrapper<MedicalRecord>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .in("mode_id", Arrays.asList(53, 54, 16))
|
|
|
+ .orderByAsc("rec_date")
|
|
|
+ );
|
|
|
+ List<MedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(recordList, MedicalRecordDTO.class);
|
|
|
+ Map<Long, List<MedicalRecordDTO>> recordMap = EntityUtil.makeEntityListMap(medicalRecordDTOList, "modeId");
|
|
|
+ List<MedicalRecordDTO> recordDTOList = new ArrayList<>();
|
|
|
+ if (recordMap.get(53L) != null) {
|
|
|
+ recordDTOList.addAll(recordMap.get(53L)); // 知情同意书
|
|
|
+ }
|
|
|
+ if (recordMap.get(16L) != null) {
|
|
|
+ recordDTOList.addAll(recordMap.get(16L)); // 手术知情同意书
|
|
|
+ }
|
|
|
+ // 医嘱信息
|
|
|
+ pageMap.put("医嘱信息", null);
|
|
|
+ // 知情同意书 = 【知情同意书】 + 【手术知情同意书】
|
|
|
+ pageMap.put("知情同意书", recordDTOList);
|
|
|
+ pageMap.put("谈话告知书", recordMap.get(54L));
|
|
|
+
|
|
|
+ String pageData = JSON.toJSONString(pageMap);
|
|
|
+ // 获取菜单信息
|
|
|
+ List<QcModeDTO> qcModeDTOList = qcModeFacade.getMenu(pageMap);
|
|
|
+ String menuData = JSON.toJSONString(qcModeDTOList);
|
|
|
+
|
|
|
+ // 保存评分结果信息
|
|
|
+ Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask(), null);
|
|
|
+
|
|
|
+ // 返回结果信息
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("algorithmDTO", algorithmDTO);
|
|
|
+ map.put("date", date);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|