Browse Source

其他信息展示升序修改

wangsy 3 năm trước cách đây
mục cha
commit
f30274836d

+ 17 - 6
src/main/java/com/diagbot/facade/MedicalRecordOtherFacade.java

@@ -2,9 +2,9 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.dto.*;
-import com.diagbot.entity.MedNurse;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.entity.MedicalRecordContent;
 import com.diagbot.enums.IsDeleteEnum;
@@ -14,16 +14,16 @@ 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.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.MedRecordContentOtherVO;
 import com.diagbot.vo.MedRecordOtherVO;
+import com.fasterxml.jackson.databind.ObjectMapper;
 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
@@ -63,7 +63,16 @@ public class MedicalRecordOtherFacade extends MedicalRecordServiceImpl {
         if (medRecordOtherVO.getRecDateEnd() != null && medRecordOtherVO != null) {
             medicalRecordQueryWrapper.le("rec_date", medRecordOtherVO.getRecDateEnd());
         }
-        medicalRecordQueryWrapper.orderByDesc("rec_date");
+        if (medRecordOtherVO.getOrders() != null) {
+            ObjectMapper objectMapper = new ObjectMapper();
+            OrderItem orderName = objectMapper.convertValue(medRecordOtherVO.getOrders().get(0), OrderItem.class);
+            String column = orderName.getColumn();
+            if (StringUtil.isNotEmpty(column)) {
+                medicalRecordQueryWrapper.orderByDesc("rec_date");
+            } else {
+                medicalRecordQueryWrapper.orderByAsc("rec_date");
+            }
+        }
 
         Page<MedicalRecord> pageCase = new Page<MedicalRecord>(medRecordOtherVO.getCurrent(), medRecordOtherVO.getSize());
         IPage<MedicalRecord> medicalRecordIPage = medicalRecordFacade.getBaseMapper().selectPage(pageCase, medicalRecordQueryWrapper);
@@ -80,8 +89,10 @@ public class MedicalRecordOtherFacade extends MedicalRecordServiceImpl {
                 .eq("rec_id", medRecordContentOtherVO.getRecId())
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
         );
-        if (medicalRecordContent != null && medicalRecordContent.getHospitalId() == 35) {
-            medicalRecordContent.setHtmlText(medicalRecordContent.getXmlText());
+        if (medicalRecordContent != null) {
+            if (medicalRecordContent.getHospitalId() == 35) {
+                medicalRecordContent.setHtmlText(medicalRecordContent.getXmlText());
+            }
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "病历id不存在!");
         }