|
@@ -0,0 +1,101 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.dto.*;
|
|
|
+import com.diagbot.entity.MedicalRecord;
|
|
|
+import com.diagbot.entity.MedicalRecordContent;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.facade.data.AMedicalRecordContentFacade;
|
|
|
+import com.diagbot.service.impl.MedicalRecordServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.EncrypDES;
|
|
|
+import com.diagbot.util.SysUserUtils;
|
|
|
+import com.diagbot.vo.MedRecordContentOtherVO;
|
|
|
+import com.diagbot.vo.MedRecordOtherVO;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @author: Wsy
|
|
|
+ * @time: 2022/3/9 11:39
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class MedicalRecordOtherFacade extends MedicalRecordServiceImpl {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MedicalRecordFacade medicalRecordFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AMedicalRecordContentFacade AMedicalRecordContentFacade;
|
|
|
+
|
|
|
+ @Value("${encrypt.enable}")
|
|
|
+ Boolean encryptFlag;
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param medRecordOtherVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MedRecordOtherDTO> RecordOtherList(MedRecordOtherVO medRecordOtherVO) {
|
|
|
+ QueryWrapper<MedicalRecord> medicalRecordQueryWrapper = new QueryWrapper<>();
|
|
|
+ medicalRecordQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ medicalRecordQueryWrapper.eq("hospital_id", Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ medicalRecordQueryWrapper.eq("mode_id", 0);
|
|
|
+ if (medRecordOtherVO != null) {
|
|
|
+ medicalRecordQueryWrapper.eq("behospital_code", medRecordOtherVO.getBehospitalCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (medRecordOtherVO.getRecTitle() != null && medRecordOtherVO != null) {
|
|
|
+ medicalRecordQueryWrapper.like("rec_title", medRecordOtherVO.getRecTitle());
|
|
|
+ }
|
|
|
+ if (medRecordOtherVO.getRecDateStart() != null && medRecordOtherVO != null) {
|
|
|
+ medicalRecordQueryWrapper.ge("rec_date", medRecordOtherVO.getRecDateStart());
|
|
|
+ }
|
|
|
+ if (medRecordOtherVO.getRecDateEnd() != null && medRecordOtherVO != null) {
|
|
|
+ medicalRecordQueryWrapper.le("rec_date", medRecordOtherVO.getRecDateEnd());
|
|
|
+ }
|
|
|
+ medicalRecordQueryWrapper.orderByDesc("rec_date");
|
|
|
+
|
|
|
+ List<MedicalRecord> medicalRecordList = medicalRecordFacade.list(medicalRecordQueryWrapper);
|
|
|
+ List<MedRecordOtherDTO> medRecordOtherDTOList = BeanUtil.listCopyTo(medicalRecordList, MedRecordOtherDTO.class);
|
|
|
+ return medRecordOtherDTOList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文书详情
|
|
|
+ */
|
|
|
+ public MedRecordContentOtherDTO getRecordContentOther(MedRecordContentOtherVO medRecordContentOtherVO) {
|
|
|
+ MedicalRecordContent medicalRecordContent = AMedicalRecordContentFacade.getOne(new QueryWrapper<MedicalRecordContent>()
|
|
|
+ .eq("hospital_id", Long.valueOf(SysUserUtils.getCurrentHospitalID()))
|
|
|
+ .eq("rec_id", medRecordContentOtherVO.getRecId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ );
|
|
|
+ if (medicalRecordContent != null && medicalRecordContent.getHospitalId() == 35) {
|
|
|
+ medicalRecordContent.setHtmlText(medicalRecordContent.getXmlText());
|
|
|
+ }
|
|
|
+ MedRecordContentOtherDTO medRecordContentOtherDTO = new MedRecordContentOtherDTO();
|
|
|
+ BeanUtil.copyProperties(medicalRecordContent, medRecordContentOtherDTO);
|
|
|
+ // 解密数据
|
|
|
+ if (encryptFlag) {
|
|
|
+ try {
|
|
|
+ EncrypDES encrypDES = new EncrypDES();
|
|
|
+ if (StringUtils.isNotEmpty(medRecordContentOtherDTO.getHtmlText())) {
|
|
|
+ medRecordContentOtherDTO.setHtmlText(encrypDES.decryptor(medRecordContentOtherDTO.getHtmlText()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ medRecordContentOtherDTO.setHtmlText(null);
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "解密错误!病历ID=【" + medRecordContentOtherDTO.getRecId() + "】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return medRecordContentOtherDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|