Parcourir la source

商品管理资质提示

wangxy il y a 1 semaine
Parent
commit
7009fbd206

+ 66 - 66
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreProductScrmController.java

@@ -1,5 +1,6 @@
 package com.fs.hisStore.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
@@ -48,8 +49,7 @@ import java.util.Map;
 @Slf4j
 @RestController
 @RequestMapping("/store/store/storeProduct")
-public class FsStoreProductScrmController extends BaseController
-{
+public class FsStoreProductScrmController extends BaseController {
     @Autowired
     private IFsStoreProductScrmService fsStoreProductService;
 
@@ -64,27 +64,27 @@ public class FsStoreProductScrmController extends BaseController
     private FsStore580FacadeService fsStore580FacadeService;
 
 
-
     /**
      * 批量修改商品
+     *
      * @param modifyMoreDTO
      * @return
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:list')")
     @PostMapping("/batchModify")
-    @Log(title = "商品管理", businessType = BusinessType.UPDATE,isStoreLog = true,logParam = {"商品","批量修改商品信息"})
-    public R batchModify(@RequestBody ModifyMoreDTO modifyMoreDTO){
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE, isStoreLog = true, logParam = {"商品", "批量修改商品信息"})
+    public R batchModify(@RequestBody ModifyMoreDTO modifyMoreDTO) {
         fsStoreProductService.batchModify(modifyMoreDTO);
         return R.ok();
     }
 
     @PreAuthorize("@ss.hasPermi('store:storeProduct:list')")
     @PostMapping("/batchAudit")
-    @Log(title = "商品审核", businessType = BusinessType.AUDIT,isStoreLog = true,logParam = {"商品","批量审核商品信息"},
-    logParamExpression = "#p0.getProductIds().size()>1?"
-            +"(#p0.isAudit==1?new String[]{'商品','商品批量审核通过'}: new String[]{'商品','商品批量审核退回'}):" +
-            "(#p0.isAudit==1?new String[]{'商品','商品审核通过'}: new String[]{'商品','商品审核退回'})")
-    public R batchAudit(@RequestBody ProductAuditDTO auditDTO){
+    @Log(title = "商品审核", businessType = BusinessType.AUDIT, isStoreLog = true, logParam = {"商品", "批量审核商品信息"},
+            logParamExpression = "#p0.getProductIds().size()>1?"
+                    + "(#p0.isAudit==1?new String[]{'商品','商品批量审核通过'}: new String[]{'商品','商品批量审核退回'}):" +
+                    "(#p0.isAudit==1?new String[]{'商品','商品审核通过'}: new String[]{'商品','商品审核退回'})")
+    public R batchAudit(@RequestBody ProductAuditDTO auditDTO) {
         fsStoreProductService.batchAudit(auditDTO);
         return R.ok();
     }
@@ -94,14 +94,13 @@ public class FsStoreProductScrmController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:list')")
     @GetMapping("/list")
-    public TableDataInfo list(FsStoreProductScrm fsStoreProduct)
-    {
+    public TableDataInfo list(FsStoreProductScrm fsStoreProduct) {
         log.info("查询商品列表 参数: {}", fsStoreProduct);
         startPage();
         List<FsStoreProductListVO> list;
-        if(StringUtils.isNullOrEmpty(fsStoreProduct.getBarCode())){
+        if (StringUtils.isNullOrEmpty(fsStoreProduct.getBarCode())) {
             list = fsStoreProductService.selectFsStoreProductListVO(fsStoreProduct);
-        }else{
+        } else {
             list = fsStoreProductService.selectFsStoreProductBarCodeListVO(fsStoreProduct);
         }
         return getDataTable(list);
@@ -111,21 +110,19 @@ public class FsStoreProductScrmController extends BaseController
      * 导出商品列表
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:export')")
-    @Log(title = "商品管理", businessType = BusinessType.EXPORT, isStoreLog = true,logParam = {"商品","导出商品信息"})
+    @Log(title = "商品管理", businessType = BusinessType.EXPORT, isStoreLog = true, logParam = {"商品", "导出商品信息"})
     @GetMapping("/export")
-    public AjaxResult export(FsStoreProductScrm fsStoreProduct)
-    {
+    public AjaxResult export(FsStoreProductScrm fsStoreProduct) {
         List<FsStoreProductExportVO> list = fsStoreProductService.selectFsStoreProductExportList(fsStoreProduct);
         ExcelUtil<FsStoreProductExportVO> util = new ExcelUtil<FsStoreProductExportVO>(FsStoreProductExportVO.class);
         return util.exportExcel(list, "storeProduct");
     }
 
 
-    @Log(title = "商品管理", businessType = BusinessType.IMPORT,isStoreLog = true,logParam = {"商品","商品导入"})
+    @Log(title = "商品管理", businessType = BusinessType.IMPORT, isStoreLog = true, logParam = {"商品", "商品导入"})
     @PreAuthorize("@ss.hasPermi('store:storeProduct:import')")
     @PostMapping("/importData")
-    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
-    {
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
         ExcelUtil<FsStoreProductExportVO> util = new ExcelUtil<>(FsStoreProductExportVO.class);
         List<FsStoreProductExportVO> list = util.importExcel(file.getInputStream());
         String message = fsStoreProductService.importStoreProduct(list, updateSupport);
@@ -134,8 +131,7 @@ public class FsStoreProductScrmController extends BaseController
 
 
     @GetMapping("/importTemplate")
-    public AjaxResult importTemplate()
-    {
+    public AjaxResult importTemplate() {
         ExcelUtil<FsStoreProductExportVO> util = new ExcelUtil<>(FsStoreProductExportVO.class);
         return util.importTemplateExcel("商品数据");
     }
@@ -145,45 +141,40 @@ public class FsStoreProductScrmController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:query')")
     @GetMapping(value = "/{productId}")
-    public R getInfo(@PathVariable("productId") Long productId)
-    {
-        FsStoreProductScrm product=fsStoreProductService.selectFsStoreProductById(productId);
-        List<FsStoreProductAttrScrm> attrs=attrService.selectFsStoreProductAttrByProductId(productId);
-        return R.ok().put("data",product).put("attrs", attrs);
+    public R getInfo(@PathVariable("productId") Long productId) {
+        FsStoreProductScrm product = fsStoreProductService.selectFsStoreProductById(productId);
+        List<FsStoreProductAttrScrm> attrs = attrService.selectFsStoreProductAttrByProductId(productId);
+        return R.ok().put("data", product).put("attrs", attrs);
     }
 
     @PreAuthorize("@ss.hasPermi('store:storeProduct:add')")
     @Log(title = "商品管理", businessType = BusinessType.INSERT, businessTypeExpression = "#p0.getProductId()>0? T(com.fs.common.enums.BusinessType).UPDATE: T(com.fs.common.enums.BusinessType).INSERT"
             , isStoreLog = true, logParamExpression = "#p0.getProductId()>0? new String[]{'商品','修改商品'}: new String[]{'商品','新增商品'}")
     @PostMapping(value = "/addOrEdit")
-    public R addOrEdit(@RequestBody FsStoreProductAddEditParam fsStoreProduct)
-    {
-        if(ObjectUtils.isNotNull(fsStoreProduct.getIsShow())) {
-            if (fsStoreProduct.getIsShow() ==1){
-                logger.info("商品上架:{}",fsStoreProduct.getProductName()+new Date());
+    public R addOrEdit(@RequestBody FsStoreProductAddEditParam fsStoreProduct) {
+        if (ObjectUtils.isNotNull(fsStoreProduct.getIsShow())) {
+            if (fsStoreProduct.getIsShow() == 1) {
+                logger.info("商品上架:{}", fsStoreProduct.getProductName() + new Date());
             }
         }
 
-        if(ObjectUtils.isNotNull(fsStoreProduct.getIsDisplay())) {
-            if (fsStoreProduct.getIsDisplay() ==1){
-                logger.info("商品前端展示:{}",fsStoreProduct.getProductName()+new Date());
+        if (ObjectUtils.isNotNull(fsStoreProduct.getIsDisplay())) {
+            if (fsStoreProduct.getIsDisplay() == 1) {
+                logger.info("商品前端展示:{}", fsStoreProduct.getProductName() + new Date());
             }
         }
         return fsStoreProductService.addOrEdit(fsStoreProduct);
     }
 
 
-
-
     /**
      * 删除商品
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:remove')")
-    @Log(title = "商品管理", businessType = BusinessType.DELETE,isStoreLog = true,
-            logParamExpression ="#p0.length>1?new String[]{'商品','批量删除商品信息'}: new String[]{'商品','删除商品信息'}" )
-	@DeleteMapping("/{productIds}")
-    public AjaxResult remove(@PathVariable Long[] productIds)
-    {
+    @Log(title = "商品管理", businessType = BusinessType.DELETE, isStoreLog = true,
+            logParamExpression = "#p0.length>1?new String[]{'商品','批量删除商品信息'}: new String[]{'商品','删除商品信息'}")
+    @DeleteMapping("/{productIds}")
+    public AjaxResult remove(@PathVariable Long[] productIds) {
         return toAjax(fsStoreProductService.deleteFsStoreProductByIds(productIds));
     }
 
@@ -192,47 +183,44 @@ public class FsStoreProductScrmController extends BaseController
      * 批量复制商品
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:bulkCopy')")
-    @Log(title = "商品管理", businessType = BusinessType.UPDATE,isStoreLog = true,
-            logParamExpression ="#p0.length>1?new String[]{'商品','批量复制商品信息'}: new String[]{'商品','复制商品信息'}" )
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE, isStoreLog = true,
+            logParamExpression = "#p0.length>1?new String[]{'商品','批量复制商品信息'}: new String[]{'商品','复制商品信息'}")
     @GetMapping("/bulkCopy/{productIds}")
-    public R bulkCopy(@PathVariable Long[] productIds)
-    {
+    public R bulkCopy(@PathVariable Long[] productIds) {
         return fsStoreProductService.bulkCopyFsStoreProductByIds(productIds);
     }
 
     @ApiOperation(value = "生成属性")
     @PostMapping(value = "/genFormatAttr/{productId}")
-    public ResponseEntity genFormatAttr(@PathVariable Long productId, @RequestBody String jsonStr,Long[] stores){
-        return new ResponseEntity<>(fsStoreProductService.getFormatAttr(productId,jsonStr, stores), HttpStatus.OK);
+    public ResponseEntity genFormatAttr(@PathVariable Long productId, @RequestBody String jsonStr, Long[] stores) {
+        return new ResponseEntity<>(fsStoreProductService.getFormatAttr(productId, jsonStr, stores), HttpStatus.OK);
     }
 
 
     @GetMapping("/getStoreProductAttrValueList")
-    public TableDataInfo getStoreProductAttrValueList(FsProductAttrValueParam param)
-    {
+    public TableDataInfo getStoreProductAttrValueList(FsProductAttrValueParam param) {
         startPage();
-        List<FsStoreProductAttrValueVO> list=attrValueService.selectFsStoreProductAttrValueListVO(param);
+        List<FsStoreProductAttrValueVO> list = attrValueService.selectFsStoreProductAttrValueListVO(param);
         return getDataTable(list);
     }
 
     @ApiOperation("获取推广商品列表")
     @GetMapping("/getStoreTuiProductAttrValueList")
-    public TableDataInfo getStoreTuiProductAttrValueList(FsStoreTuiProductAttrValueParam param, HttpServletRequest request){
+    public TableDataInfo getStoreTuiProductAttrValueList(FsStoreTuiProductAttrValueParam param, HttpServletRequest request) {
         startPage();
-        List<FsStoreTuiProductAttrValueVO> list=attrValueService.selectStoreTuiProductAttrValueVOList(param);
+        List<FsStoreTuiProductAttrValueVO> list = attrValueService.selectStoreTuiProductAttrValueVOList(param);
         return getDataTable(list);
     }
 
     @GetMapping("/listBySearch")
-    public R listBySearCh(FsStoreProductScrm product)
-    {
+    public R listBySearCh(FsStoreProductScrm product) {
         List<FsStoreProductScrm> list = fsStoreProductService.selectFsStoreProductList(product);
-        return R.ok().put("data",list);
+        return R.ok().put("data", list);
     }
 
     /**
      * 获取店铺商品表字段
-     * */
+     */
     @GetMapping("/getStoreProductColumns")
     public R getStoreProductColumns() {
         List<Map<String, String>> list = fsStoreProductService.getStoreProductColumns();
@@ -244,11 +232,10 @@ public class FsStoreProductScrmController extends BaseController
      * 同步商品到580商城
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:sync')")
-    @Log(title = "同步商品到580医院", businessType = BusinessType.DELETE,isStoreLog = true,
-            logParamExpression ="#p0.length>1?new String[]{'商品','同步商品到580医院'}: new String[]{'商品','同步商品到580医院'}" )
+    @Log(title = "同步商品到580医院", businessType = BusinessType.DELETE, isStoreLog = true,
+            logParamExpression = "#p0.length>1?new String[]{'商品','同步商品到580医院'}: new String[]{'商品','同步商品到580医院'}")
     @PostMapping("/sync580/{productIds}")
-    public R sync(@PathVariable Long[] productIds)
-    {
+    public R sync(@PathVariable Long[] productIds) {
         fsStoreHospital580ScrmService.SynDrugToHospital580(productIds);
         return R.ok("同步成功");
     }
@@ -257,14 +244,27 @@ public class FsStoreProductScrmController extends BaseController
      * 同步商品到580商城
      */
     @PreAuthorize("@ss.hasPermi('store:storeProduct:update')")
-    @Log(title = "批量下架商品", businessType = BusinessType.DELETE,isStoreLog = true,
-            logParamExpression ="#p0.length>1?new String[]{'商品','下架'}: new String[]{'商品','下架'}" )
+    @Log(title = "批量下架商品", businessType = BusinessType.DELETE, isStoreLog = true,
+            logParamExpression = "#p0.length>1?new String[]{'商品','下架'}: new String[]{'商品','下架'}")
     @PostMapping("/updateFsStoreProductIsShowBatch/{productIds}")
-    public R updateFsStoreProductIsShowBatch(@PathVariable Long[] productIds)
-    {
-        if (productIds.length>0){
+    public R updateFsStoreProductIsShowBatch(@PathVariable Long[] productIds) {
+        if (productIds.length > 0) {
             fsStoreProductService.updateFsStoreProductIsShowBatch(productIds);
         }
         return R.ok("操作完成");
     }
+
+    /**
+     * 商品资质信息提示
+     *
+     * @return
+     */
+    @GetMapping("/productNoticeInfo")
+    public R getProductNoticeInfo() {
+        List<String> productNoticeInfo = fsStoreProductService.getProductNoticeInfo();
+        if (!CollectionUtils.isEmpty(productNoticeInfo)) {
+            return R.ok().put("code", 200).put("data", productNoticeInfo);
+        }
+        return R.ok().put("code", 0);
+    }
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -597,4 +597,9 @@ public interface FsStoreProductScrmMapper
      * **/
     int instructionsViewable(@Param("param") FsStoreCartCountParam param);
 
+    /**
+     * 获取商品资质提示信息
+     * @return
+     */
+    List<String> getProductNoticeInfo();
 }

+ 5 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreProductScrmService.java

@@ -155,5 +155,9 @@ public interface IFsStoreProductScrmService
      * **/
     R instructionsViewable(FsStoreCartCountParam param);
 
-
+    /**
+     * 获取商品资质提示信息
+     * @return R
+     * **/
+    List<String> getProductNoticeInfo();
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -1262,6 +1262,11 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         return R.ok().put("data", fsStoreProductMapper.instructionsViewable(param) > 0);
     }
 
+    @Override
+    public List<String> getProductNoticeInfo() {
+        return fsStoreProductMapper.getProductNoticeInfo();
+    }
+
     @Override
     public List<Map<String, String>> getStoreProductColumns() {
         List<Map<String, String>> list = fsStoreProductMapper.getStoreProductColumns();

+ 17 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreProductScrmMapper.xml

@@ -599,4 +599,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
            AND ps.pid IS NOT NULL
         GROUP BY p.product_id
     </select>
+
+    <select id="getProductNoticeInfo" resultType="java.lang.String">
+        SELECT
+        CONCAT(
+        product_name,
+        '商品的',
+        CASE
+        WHEN qualification_certificate_end &lt; CURDATE() THEN '首营资质已过期'
+        ELSE '首营资质即将15天内过期'
+        END
+        ) AS status_text
+        FROM fs_store_product_scrm
+        WHERE qualification_certificate IS NOT NULL
+        AND qualification_certificate_end IS NOT NULL
+        AND qualification_certificate_end &lt;= DATE_ADD(CURDATE(), INTERVAL 15 DAY);
+    </select>
+
 </mapper>

+ 73 - 23
fs-service/src/main/resources/mapper/hisStore/FsStoreScrmMapper.xml

@@ -543,30 +543,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     <select id="queryValidStoreLastInfo" resultType="java.lang.String">
         SELECT
-        CONCAT(
-        store_name,
-        '的',
-        CASE WHEN business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND business_license_expire_end &lt;CURDATE() THEN CONCAT('营业执照已于', business_license_expire_end, '到期;') ELSE '' END,
-        CASE WHEN drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND drug_license_expiry_end &lt;CURDATE() THEN CONCAT('药品经营许可证已于', drug_license_expiry_end, '到期;') ELSE '' END,
-        CASE WHEN medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND medical_device1_expiry_end &lt; CURDATE() THEN CONCAT('一类器械生产备案已于', medical_device1_expiry_end, '到期;') ELSE '' END,
-        CASE WHEN medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND medical_device2_expiry_end &lt; CURDATE() THEN CONCAT('二类医疗器械备案已于', medical_device2_expiry_end, '到期;') ELSE '' END,
-        CASE WHEN medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND medical_device3_expiry_end &lt;CURDATE() THEN CONCAT('三类器械经营许可证已于', medical_device3_expiry_end, '到期;') ELSE '' END,
-        CASE WHEN food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND food_license_expiry_end &lt; CURDATE() THEN CONCAT('食品经营许可证已于', food_license_expiry_end, '到期;') ELSE '' END,
-        CASE WHEN medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND medical_license_expiry_end &lt; CURDATE() THEN CONCAT('医疗机构执业许可证已于', medical_license_expiry_end, '到期;') ELSE '' END
-        ) AS warning_message
-
+            CONCAT(
+                    store_name,
+                    '的',
+                    CASE
+                        WHEN business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND business_license_expire_end &lt; CURDATE()
+                            THEN '营业执照已过期,需要商家更新;'
+                        WHEN business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND DATEDIFF(business_license_expire_end, CURDATE()) &lt;= 15
+                            THEN '营业执照即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND drug_license_expiry_end &lt; CURDATE()
+                            THEN '药品经营许可证已过期,需要商家更新;'
+                        WHEN drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND DATEDIFF(drug_license_expiry_end, CURDATE()) &lt;= 15
+                            THEN '药品经营许可证即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND medical_device1_expiry_end &lt; CURDATE()
+                            THEN '一类器械生产备案已到期,需要商家更新;'
+                        WHEN medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND DATEDIFF(medical_device1_expiry_end, CURDATE()) &lt;= 15
+                            THEN '一类器械生产备案即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND medical_device2_expiry_end &lt; CURDATE()
+                            THEN '二类器械生产备案已到期,需要商家更新;'
+                        WHEN medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND DATEDIFF(medical_device2_expiry_end, CURDATE()) &lt;= 15
+                            THEN '二类器械生产备案即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND medical_device3_expiry_end &lt; CURDATE()
+                            THEN '三类器械生产备案已到期,需要商家更新;'
+                        WHEN medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND DATEDIFF(medical_device3_expiry_end, CURDATE()) &lt;= 15
+                            THEN '三类器械生产备案即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND food_license_expiry_end &lt; CURDATE()
+                            THEN '食品经营许可证已到期,需要商家更新;'
+                        WHEN food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND DATEDIFF(food_license_expiry_end, CURDATE()) &lt;= 15
+                            THEN '食品经营许可证即将15天内过期;'
+                        ELSE ''
+                        END,
+                    CASE
+                        WHEN medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND medical_license_expiry_end &lt; CURDATE()
+                            THEN '医疗机构执业许可证已到期,需要商家更新;'
+                        WHEN medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND DATEDIFF(medical_license_expiry_end, CURDATE()) &lt;= 15
+                            THEN '医疗机构执业许可证即将15天内过期;'
+                        ELSE ''
+                        END
+            ) AS warning_message
         FROM fs_store_scrm
         WHERE STATUS = 1
-        AND account = #{account}
-        AND (
-        (business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND business_license_expire_end &lt; CURDATE())
-        OR (drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND drug_license_expiry_end &lt; CURDATE())
-        OR (medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND medical_device1_expiry_end &lt; CURDATE())
-        OR (medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND medical_device2_expiry_end &lt; CURDATE())
-        OR (medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND medical_device3_expiry_end &lt; CURDATE())
-        OR (food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND food_license_expiry_end &lt; CURDATE())
-        OR (medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND medical_license_expiry_end &lt; CURDATE())
-        )
-        HAVING warning_message != '';
+          AND account = #{account}
+          AND (
+            -- 已过期的条件
+            (business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND business_license_expire_end &lt; CURDATE())
+                OR (drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND drug_license_expiry_end &lt; CURDATE())
+                OR (medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND medical_device1_expiry_end &lt; CURDATE())
+                OR (medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND medical_device2_expiry_end &lt; CURDATE())
+                OR (medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND medical_device3_expiry_end &lt; CURDATE())
+                OR (food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND food_license_expiry_end &lt; CURDATE())
+                OR (medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND medical_license_expiry_end &lt; CURDATE())
+                -- 15天内到期的条件
+                OR (business_license IS NOT NULL AND business_license_expire_end IS NOT NULL AND DATEDIFF(business_license_expire_end, CURDATE()) &lt;= 15)
+                OR (drug_license IS NOT NULL AND drug_license_expiry_end IS NOT NULL AND DATEDIFF(drug_license_expiry_end, CURDATE()) &lt;= 15)
+                OR (medical_device1 IS NOT NULL AND medical_device1_expiry_end IS NOT NULL AND DATEDIFF(medical_device1_expiry_end, CURDATE()) &lt;= 15)
+                OR (medicalDevice2 IS NOT NULL AND medical_device2_expiry_end IS NOT NULL AND DATEDIFF(medical_device2_expiry_end, CURDATE()) &lt;= 15)
+                OR (medicalDevice3 IS NOT NULL AND medical_device3_expiry_end IS NOT NULL AND DATEDIFF(medical_device3_expiry_end, CURDATE()) &lt;= 15)
+                OR (food_license IS NOT NULL AND food_license_expiry_end IS NOT NULL AND DATEDIFF(food_license_expiry_end, CURDATE()) &lt;= 15)
+                OR (medical_license IS NOT NULL AND medical_license_expiry_end IS NOT NULL AND DATEDIFF(medical_license_expiry_end, CURDATE()) &lt;= 15)
+            )
+        HAVING warning_message != ''
     </select>
 </mapper>