gaodm преди 4 години
родител
ревизия
a263aecc61

+ 15 - 1
src/main/java/com/diagbot/facade/DoctorAdviceFacade.java

@@ -2,7 +2,10 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.DoctorAdviceDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.DoctorAdviceServiceImpl;
+import com.diagbot.util.DateUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.DoctorAdviceVO;
 import org.springframework.stereotype.Component;
@@ -15,8 +18,19 @@ import org.springframework.stereotype.Component;
 @Component
 public class DoctorAdviceFacade extends DoctorAdviceServiceImpl {
 
-    public IPage<DoctorAdviceDTO> getPageFac(DoctorAdviceVO doctorAdviceVO){
+    public IPage<DoctorAdviceDTO> getPageFac(DoctorAdviceVO doctorAdviceVO) {
         doctorAdviceVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
+        if (null != doctorAdviceVO.getDaStartDateStart()) {
+            doctorAdviceVO.setDaStartDateStart(DateUtil.getFirstTimeOfDay(doctorAdviceVO.getDaStartDateStart()));
+        }
+        if (null != doctorAdviceVO.getDaStartDateEnd()) {
+            doctorAdviceVO.setDaStartDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(doctorAdviceVO.getDaStartDateEnd(), 1)));
+        }
+        if (null != doctorAdviceVO.getDaStartDateStart() && null != doctorAdviceVO.getDaStartDateEnd()) {
+            if (DateUtil.after(doctorAdviceVO.getDaStartDateStart(), doctorAdviceVO.getDaStartDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+            }
+        }
         return this.getPage(doctorAdviceVO);
     }
 }

+ 22 - 0
src/main/java/com/diagbot/vo/DoctorAdviceVO.java

@@ -6,6 +6,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
+import java.util.Date;
 
 /**
  * @Description:
@@ -26,4 +27,25 @@ public class DoctorAdviceVO extends Page {
      */
     @NotBlank(message = "请输入病人ID")
     private String behospitalCode;
+
+    /**
+     * 医嘱类型判别(嘱托长嘱、长期医嘱等)
+     */
+    private String doctorAdviceType;
+
+    /**
+     * 医嘱项目名称
+     */
+    private String daItemName;
+
+    /**
+     * 医嘱开始时间开始
+     */
+    private Date daStartDateStart;
+
+    /**
+     * 医嘱开始时间结束
+     */
+    private Date daStartDateEnd;
+
 }

+ 12 - 0
src/main/resources/mapper/DoctorAdviceMapper.xml

@@ -48,6 +48,18 @@
         <if test="behospitalCode != null and behospitalCode != ''">
             and t.behospital_code = #{behospitalCode}
         </if>
+        <if test="doctorAdviceType != null and doctorAdviceType != ''">
+            and t.doctor_advice_type like CONCAT('%',#{doctorAdviceType},'%')
+        </if>
+        <if test="daItemName != null and daItemName != ''">
+            and t.da_item_name like CONCAT('%',#{daItemName},'%')
+        </if>
+        <if test="daStartDateStart != null">
+            <![CDATA[ and t.da_start_date >= #{daStartDateStart}]]>
+        </if>
+        <if test="daStartDateEnd != null">
+            <![CDATA[ and t.da_start_date < #{daStartDateEnd}]]>
+        </if>
         ORDER BY
             da_start_date ASC
     </select>