Browse Source

增加成分关键字检查,营业执照检查,商品分类与商家经营许可对比。腾讯ocr对接

Guos 1 day ago
parent
commit
a5b73ec1fa

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

@@ -9,6 +9,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.hisStore.domain.ForbiddenOnlineMedicine;
 import com.fs.hisStore.facade.FsStore580FacadeService;
 import com.fs.hisStore.facade.FsStore580FacadeService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.vo.*;
 import com.fs.hisStore.vo.*;
@@ -48,6 +49,7 @@ import java.util.Map;
 @RestController
 @RestController
 @RequestMapping("/store/store/storeProduct")
 @RequestMapping("/store/store/storeProduct")
 public class FsStoreProductScrmController extends BaseController {
 public class FsStoreProductScrmController extends BaseController {
+
     @Autowired
     @Autowired
     private IFsStoreProductScrmService fsStoreProductService;
     private IFsStoreProductScrmService fsStoreProductService;
 
 
@@ -56,14 +58,43 @@ public class FsStoreProductScrmController extends BaseController {
 
 
     @Autowired
     @Autowired
     private IFsStoreProductAttrValueScrmService attrValueService;
     private IFsStoreProductAttrValueScrmService attrValueService;
+
     @Autowired
     @Autowired
     private Hospital580ScrmService fsStoreHospital580ScrmService;
     private Hospital580ScrmService fsStoreHospital580ScrmService;
+
     @Autowired
     @Autowired
     private FsStore580FacadeService fsStore580FacadeService;
     private FsStore580FacadeService fsStore580FacadeService;
 
 
     @Autowired
     @Autowired
     private StoreAuditLogUtil storeAuditLogUtil;
     private StoreAuditLogUtil storeAuditLogUtil;
 
 
+    /**
+     * 商品关键字检查
+     * 只要商品关键字在数据库中存在,就不允许添加商品。
+     * @param keyWords
+     * @return
+     */
+    @Log(title = "商品管理", businessType = BusinessType.AUDIT, isStoreLog = true, logParam = {"商品", "商品关键字检查"})
+    @GetMapping("/selectForbiddenKeywords/{keyWords}")
+    public R selectForbiddenKeywords(@PathVariable("keyWords")String keyWords) {
+        if(org.apache.commons.lang3.StringUtils.isEmpty(keyWords))return R.ok().put("data", true);
+        List<ForbiddenOnlineMedicine> list = fsStoreProductService.selectForbiddenKeywords(keyWords);
+        if(CollectionUtils.isEmpty(list)){
+            return R.ok().put("data", true);
+        }else{
+            return R.ok().put("data", false).put("msg", list.get(0).getModule());
+        }
+    }
+
+    /**
+     * 判断该药店的经营许可证是否允许上架该商品
+     * @param fsStoreProduct
+     */
+    @Log(title = "商品管理", businessType = BusinessType.AUDIT, isStoreLog = true, logParam = {"商品", "判断该药店的经营许可证是否允许上架该商品"})
+    @PostMapping("/checkStoreDrugLicense")
+    public R checkStoreDrugLicense(@RequestBody FsStoreProductAddEditParam fsStoreProduct) {
+        return R.ok().put("data", fsStoreProductService.checkStoreDrugLicense(fsStoreProduct.getStoreId(), fsStoreProduct.getCateId()));
+    }
 
 
     /**
     /**
      * 批量修改商品
      * 批量修改商品

+ 10 - 0
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreScrmController.java

@@ -9,6 +9,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.utils.txocr.TxOcrClient;
 import com.fs.his.param.FsDoctorParam;
 import com.fs.his.param.FsDoctorParam;
 import com.fs.his.service.IFsDoctorService;
 import com.fs.his.service.IFsDoctorService;
 import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.domain.FsStoreScrm;
@@ -108,6 +109,15 @@ public class FsStoreScrmController extends BaseController
         return AjaxResult.success(fsStore);
         return AjaxResult.success(fsStore);
     }
     }
 
 
+    /**
+     * 新增或修改时候校验上传的营业执照是否包含药品零售
+     */
+    @Log(title = "校验营业执照是否包含药品零售", businessType = BusinessType.INSERT,logParam = {"店铺","校验营业执照是否包含药品零售"},isStoreLog = true)
+    @GetMapping("/businessLicenseCheck")
+    public R businessLicenseCheck(String imageUrl){
+        return R.ok().put("data", TxOcrClient.isContains(imageUrl, null));
+    }
+
     /**
     /**
      * 新增店铺管理
      * 新增店铺管理
      */
      */

+ 12 - 1
fs-common/pom.xml

@@ -147,6 +147,13 @@
             <version>2023.1.0</version>
             <version>2023.1.0</version>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <version>3.1.322</version>
+            <scope>compile</scope>
+        </dependency>
+
 
 
         <dependency>
         <dependency>
             <groupId>com.nuonuo</groupId>
             <groupId>com.nuonuo</groupId>
@@ -154,10 +161,14 @@
             <version>1.0.5.2</version>
             <version>1.0.5.2</version>
         </dependency>
         </dependency>
 
 
+
+
+
         <dependency>
         <dependency>
             <groupId>net.coobird</groupId>
             <groupId>net.coobird</groupId>
             <artifactId>thumbnailator</artifactId>
             <artifactId>thumbnailator</artifactId>
-            <version>0.4.20</version>
+            <version>0.4.8</version>
+            <scope>compile</scope>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
 
 

+ 40 - 0
fs-common/src/main/java/com/fs/common/utils/txocr/ContainsResult.java

@@ -0,0 +1,40 @@
+package com.fs.common.utils.txocr;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * @description:
+ * @author: Guos
+ * @time: 2025/11/19 上午10:04
+ */
+@Data
+@ToString
+public class ContainsResult {
+
+    /**
+     * 是否包含
+     */
+    private Boolean flag;
+
+    /**
+     * 关键词
+     */
+    private String keywords;
+
+    /**
+     * 信息
+     */
+    private String message;
+
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 营业执照识别结果
+     */
+    private String businessStr;
+
+}

+ 149 - 0
fs-common/src/main/java/com/fs/common/utils/txocr/TxOcrClient.java

@@ -0,0 +1,149 @@
+package com.fs.common.utils.txocr;
+
+import com.tencentcloudapi.common.AbstractModel;
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+import com.tencentcloudapi.common.profile.ClientProfile;
+import com.tencentcloudapi.common.profile.HttpProfile;
+import com.tencentcloudapi.ocr.v20181119.OcrClient;
+import com.tencentcloudapi.ocr.v20181119.models.*;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+
+/**
+ * @description:
+ * @author: Guos
+ * @time: 2025/11/18 上午9:57
+ */
+@Slf4j
+public class TxOcrClient  {
+
+    private static final String YPLS = "药品零售";
+
+    /**
+     * BizLicenseOCR
+     * 本接口支持快速精准识别营业执照上的字段,包括统一社会信用代码、公司名称、主体类型、法定代表人、注册资本、组成形式、成立日期、营业期限和经营范围等字段。
+     * 默认接口请求频率限制:10次/秒。
+     * @param imageUrl
+     * @param keywords
+     * @return ContainsResult
+     */
+    public static ContainsResult isContains(String imageUrl, String keywords) {
+        ContainsResult result = new ContainsResult();
+        result.setFlag(false);
+        result.setImageUrl(imageUrl);
+        result.setMessage("识别失败请重试!");
+        try{
+            Credential cred = new Credential("AKIDviPyMZbRp24udCcpqjQxHOK4cx88ze6N", "97tVwEJE81sY0StDPPGukQ2ZvkU3QceY");
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("ocr.tencentcloudapi.com");
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            OcrClient client = new OcrClient(cred, "", clientProfile);
+            BizLicenseOCRRequest req = new BizLicenseOCRRequest();
+            req.setImageUrl(imageUrl);
+            BizLicenseOCRResponse resp = client.BizLicenseOCR(req);
+            log.info("营业执照OCR请求识别成功!结果是:{}",AbstractModel.toJsonString(resp));
+            String business = resp.getBusiness();
+            if(StringUtils.isEmpty(keywords) && StringUtils.isNotEmpty(business)){
+                result.setBusinessStr(business);
+                result.setKeywords(YPLS);
+                result.setFlag(business.contains(YPLS));
+                result.setMessage(result.getFlag()?"包含":"不包含");
+                return result;
+            }
+            if(StringUtils.isNotEmpty(keywords) && StringUtils.isEmpty(business)){
+                result.setKeywords(keywords);
+                result.setBusinessStr(business);
+                result.setFlag(business.contains(keywords));
+                result.setMessage(result.getFlag()?"包含":"不包含");
+                return result;
+            }
+        } catch (TencentCloudSDKException e) {
+            log.info("营业执照OCR请求发生异常!异常信息是:{}",e.toString());
+            result.setFlag(false);
+            result.setMessage(e.getMessage());
+            return result;
+        }
+        return result;
+    }
+
+    /**
+     * EnterpriseLicenseOCR
+     * 本接口支持智能化识别各类企业登记证书、许可证书、企业执照、三证合一类证书,结构化输出统一社会信用代码、公司名称、法定代表人、公司地址、注册资金、企业类型、经营范围、成立日期、有效期、开办资金、经费来源、举办单位等关键字段。
+     * 默认接口请求频率限制:5次/秒。
+     * @param imageUrl
+     * @return EnterpriseLicenseOCRResponse
+     */
+    public static ContainsResult enterpriseLicenseOCR(String imageUrl, String cateName) {
+        ContainsResult result = new ContainsResult();
+        result.setFlag(false);
+        result.setImageUrl(imageUrl);
+        result.setKeywords(cateName);
+        result.setMessage("许可证书经营范围不包含,请更换!");
+        try{
+            Credential cred = new Credential("AKIDviPyMZbRp24udCcpqjQxHOK4cx88ze6N", "97tVwEJE81sY0StDPPGukQ2ZvkU3QceY");
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("ocr.tencentcloudapi.com");
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            OcrClient client = new OcrClient(cred, "", clientProfile);
+            EnterpriseLicenseOCRRequest req = new EnterpriseLicenseOCRRequest();
+            req.setImageUrl(imageUrl);
+            EnterpriseLicenseOCRResponse resp = client.EnterpriseLicenseOCR(req);
+            Arrays.stream(resp.getEnterpriseLicenseInfos()).forEach(enterpriseLicenseInfo -> {
+                String name = enterpriseLicenseInfo.getName();
+                if(name.equals("经营范围")){
+                    String value = enterpriseLicenseInfo.getValue();
+                    boolean contains = value.contains(cateName);
+                    result.setBusinessStr(value);
+                    result.setFlag(contains);
+                    result.setMessage(contains?"包含":"当前店铺经营类别不包含"+cateName);
+                }
+            });
+            log.info("许可证书OCR请求识别成功!结果是:{}",AbstractModel.toJsonString(resp));
+            return result;
+        } catch (TencentCloudSDKException e) {
+            log.info("证书识别失败!异常信息是:{}",e.toString());
+            result.setFlag(false);
+            result.setMessage(e.getMessage());
+            return result;
+        }
+    }
+
+    /**
+     * ClassifyDetectOCR
+     * 支持身份证、护照、名片、银行卡、行驶证、驾驶证、港澳台通行证、户口本、港澳台来往内地通行证、港澳台居住证、不动产证、营业执照的智能分类。
+     *  默认接口请求频率限制:20次/秒。
+     * @param imageUrl ClassifyDetectOCRRequest
+     * @return ClassifyDetectOCRResponse
+     * @throws TencentCloudSDKException
+     */
+//    public static ClassifyDetectOCRResponse classifyDetectOCR(String imageUrl){
+//        try{
+//            Credential cred = new Credential("AKIDviPyMZbRp24udCcpqjQxHOK4cx88ze6N", "97tVwEJE81sY0StDPPGukQ2ZvkU3QceY");
+//            HttpProfile httpProfile = new HttpProfile();
+//            httpProfile.setEndpoint("ocr.tencentcloudapi.com");
+//            ClientProfile clientProfile = new ClientProfile();
+//            clientProfile.setHttpProfile(httpProfile);
+//            OcrClient client = new OcrClient(cred, "", clientProfile);
+//            IDCardOCRRequest req = new IDCardOCRRequest();
+//            req.setImageUrl(imageUrl);
+//            IDCardOCRResponse resp = client.IDCardOCR(req);
+//            System.out.println(AbstractModel.toJsonString(resp));
+//        } catch (TencentCloudSDKException e) {
+//            System.out.println(e.toString());
+//        }
+//        return null;
+//    }
+
+//    public static void main(String [] args) {
+//        ContainsResult contains = enterpriseLicenseOCR("https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/fs/20251119/c97e794b896f4066878913821a1e3287.jpg", "乙类非处方");
+//        System.out.println(contains.toString());
+//    }
+
+
+
+}

+ 38 - 0
fs-service/src/main/java/com/fs/hisStore/domain/ForbiddenOnlineMedicine.java

@@ -0,0 +1,38 @@
+package com.fs.hisStore.domain;
+
+
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @description: 禁止网络销售药品实体类
+ * @author: Guos
+ * @time: 2025/11/18 下午1:52
+ */
+@Data
+public class ForbiddenOnlineMedicine {
+
+    // 自增主键
+    private Integer id;
+    // 模块分类
+    private String module;
+    // 药品类目
+    private String category;
+    // 序号
+    private Integer serialNumber;
+    // 药物成分名称
+    private String medicineIngredient;
+    // 单方/复方
+    private String singleCompound;
+    // 禁止关键字
+    private String forbiddenKeywords;
+    // 例外情况
+    private String exception;
+    // 备注信息
+    private String remarks;
+    // 创建时间
+    private Date createdAt;
+    // 更新时间
+    private Date updatedAt;
+
+}

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsStoreProductScrm.java

@@ -563,4 +563,9 @@ public class FsStoreProductScrm extends BaseEntity {
      * GMP/GSP认证证书是否长期有效
      * GMP/GSP认证证书是否长期有效
      * **/
      * **/
     private Byte isGmpAuthPermanent;
     private Byte isGmpAuthPermanent;
+
+    /**
+     * 添加的药品的成分
+     * **/
+    private String ingredient;
 }
 }

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

@@ -7,6 +7,7 @@ import com.fs.his.param.FsStoreProductListSParam;
 import com.fs.his.vo.FsStoreProductListSVO;
 import com.fs.his.vo.FsStoreProductListSVO;
 import com.fs.his.vo.OptionsVO;
 import com.fs.his.vo.OptionsVO;
 import com.fs.hisStore.config.MedicalMallConfig;
 import com.fs.hisStore.config.MedicalMallConfig;
+import com.fs.hisStore.domain.ForbiddenOnlineMedicine;
 import com.fs.hisStore.domain.FsStoreProductRuleScrm;
 import com.fs.hisStore.domain.FsStoreProductRuleScrm;
 import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.param.FsStoreCartCountParam;
 import com.fs.hisStore.param.FsStoreCartCountParam;
@@ -626,4 +627,13 @@ public interface FsStoreProductScrmMapper
      * @return
      * @return
      * **/
      * **/
     List<FsStoreProductScrmInfoDTO> getStoreInfo(@Param("ids") Long[] ids);
     List<FsStoreProductScrmInfoDTO> getStoreInfo(@Param("ids") Long[] ids);
+
+    /**
+     * 商品关键字检查
+     * 只要商品关键字在数据库中存在,就不允许添加商品。
+     * @param keyword
+     * @return
+     */
+    List<ForbiddenOnlineMedicine> selectForbiddenKeywords(@Param("keyword") String keyword);
+
 }
 }

+ 7 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreProductAddEditParam.java

@@ -367,4 +367,11 @@ public class FsStoreProductAddEditParam implements Serializable
      * GMP/GSP认证证书是否长期有效
      * GMP/GSP认证证书是否长期有效
      * **/
      * **/
     private Byte isGmpAuthPermanent;
     private Byte isGmpAuthPermanent;
+
+    /**
+     * 添加的药品的成分
+     * **/
+    private String ingredient;
+
+
 }
 }

+ 18 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreProductScrmService.java

@@ -4,7 +4,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.R;
+import com.fs.common.utils.txocr.ContainsResult;
 import com.fs.his.domain.FsStoreProduct;
 import com.fs.his.domain.FsStoreProduct;
+import com.fs.hisStore.domain.ForbiddenOnlineMedicine;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.domain.FsStoreProductRuleScrm;
 import com.fs.hisStore.domain.FsStoreProductRuleScrm;
 import com.fs.his.param.FsStoreProductListSParam;
 import com.fs.his.param.FsStoreProductListSParam;
@@ -27,6 +29,15 @@ import com.fs.statis.dto.ProductAuditDTO;
  */
  */
 public interface IFsStoreProductScrmService
 public interface IFsStoreProductScrmService
 {
 {
+
+    /**
+     * 商品关键字检查
+     * 只要商品关键字在数据库中存在,就不允许添加商品。
+     * @param keyWords
+     * @return
+     */
+    List<ForbiddenOnlineMedicine> selectForbiddenKeywords(String keyWords);
+
     /**
     /**
      * 查询商品
      * 查询商品
      *
      *
@@ -167,4 +178,11 @@ public interface IFsStoreProductScrmService
      * 复制商品
      * 复制商品
      * **/
      * **/
     R copyProduct(FsStoreProductScrm product);
     R copyProduct(FsStoreProductScrm product);
+
+    /**
+     * 判断该药店的经营许可证是否允许上架该商品
+     * @param storeId 店铺Id
+     * @param cateId 分类id
+     */
+    ContainsResult checkStoreDrugLicense(Long storeId, Long cateId);
 }
 }

+ 38 - 6
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -20,6 +20,8 @@ import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.txocr.ContainsResult;
+import com.fs.common.utils.txocr.TxOcrClient;
 import com.fs.company.cache.ICompanyCacheService;
 import com.fs.company.cache.ICompanyCacheService;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.erp.domain.ErpGoods;
 import com.fs.erp.domain.ErpGoods;
@@ -126,6 +128,19 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
 
     private final static String CZT = "纯正堂";
     private final static String CZT = "纯正堂";
 
 
+
+    /**
+     * 商品关键字检查
+     * 只要商品关键字在数据库中存在,就不允许添加商品。
+     * @param keyWords
+     * @return
+     */
+    @Override
+    public List<ForbiddenOnlineMedicine> selectForbiddenKeywords(String keyWords){
+       return fsStoreProductMapper.selectForbiddenKeywords(keyWords);
+    }
+
+
     /**
     /**
      * 查询商品
      * 查询商品
      *
      *
@@ -476,12 +491,12 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         }
         }
 
 
         //校验是否药品网络销售禁止清单
         //校验是否药品网络销售禁止清单
-//        if(product.getIsDrug().equals("1")){//药品进入校验
-//            String checkStr = checkProductInfo(product);
-//            if(checkStr != null){
-//                return R.error(checkStr);
-//            }
-//        }
+        if(product.getIsDrug().equals("1")){//药品进入校验
+            String checkStr = checkProductInfo(product);
+            if(checkStr != null){
+                return R.error(checkStr);
+            }
+        }
 
 
         if(param.getProductId() != null && param.getProductId() > 0){
         if(param.getProductId() != null && param.getProductId() > 0){
             FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
             FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
@@ -1463,6 +1478,23 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         return R.ok().put("msg",new StringBuilder().append("一键复制商品/").append("商品名称:").append(product.getProductName()));
         return R.ok().put("msg",new StringBuilder().append("一键复制商品/").append("商品名称:").append(product.getProductName()));
     }
     }
 
 
+    /**
+     * 判断该药店的经营许可证是否允许上架该商品
+     * @param storeId 店铺Id
+     * @param cateId 分类id
+     */
+    @Override
+    public ContainsResult checkStoreDrugLicense(Long storeId, Long cateId) {
+        //先通过分类id获取具体的分类名称
+        FsStoreProductCategoryScrm fsStoreProductCategoryScrm = fsStoreProductCategoryService.selectFsStoreProductCategoryById(cateId);
+        String cateName = fsStoreProductCategoryScrm.getCateName();//分类名称
+        //通过店铺id获取上传的药品经营许可证。
+        FsStoreScrm fsStoreScrm = fsStoreScrmService.selectFsStoreByStoreId(storeId);
+        String drugLicenseUrl = fsStoreScrm.getDrugLicense();
+        //调用对比,看经营范围是否包含这个类别
+        return TxOcrClient.enterpriseLicenseOCR(drugLicenseUrl, cateName);
+    }
+
     @Override
     @Override
     public List<Map<String, String>> getStoreProductColumns() {
     public List<Map<String, String>> getStoreProductColumns() {
         List<Map<String, String> > list = fsStoreProductMapper.getStoreProductColumns();
         List<Map<String, String> > list = fsStoreProductMapper.getStoreProductColumns();

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

@@ -278,6 +278,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="manufacturer != null and manufacturer != ''">manufacturer ,</if>
             <if test="manufacturer != null and manufacturer != ''">manufacturer ,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">manufacturer_address,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">manufacturer_address,</if>
             <if test="indications != null and indications != ''">indications ,</if>
             <if test="indications != null and indications != ''">indications ,</if>
+            <if test="ingredient != null and ingredient != ''">ingredient ,</if>
             <if test="dosage != null and dosage != ''">dosage ,</if>
             <if test="dosage != null and dosage != ''">dosage ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">adverse_reactions ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">adverse_reactions ,</if>
             <if test="contraindications != null and contraindications != ''">contraindications ,</if>
             <if test="contraindications != null and contraindications != ''">contraindications ,</if>
@@ -368,6 +369,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="manufacturer != null and manufacturer != ''">#{manufacturer} ,</if>
             <if test="manufacturer != null and manufacturer != ''">#{manufacturer} ,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">#{manufacturerAddress} ,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">#{manufacturerAddress} ,</if>
             <if test="indications != null and indications != ''">#{indications} ,</if>
             <if test="indications != null and indications != ''">#{indications} ,</if>
+            <if test="ingredient != null and ingredient != ''">#{ingredient} ,</if>
             <if test="dosage != null and dosage != ''">#{dosage} ,</if>
             <if test="dosage != null and dosage != ''">#{dosage} ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">#{adverseReactions} ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">#{adverseReactions} ,</if>
             <if test="contraindications != null and contraindications != ''">#{contraindications} ,</if>
             <if test="contraindications != null and contraindications != ''">#{contraindications} ,</if>
@@ -461,6 +463,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer} ,</if>
             <if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer} ,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">manufacturer_address= #{manufacturerAddress} ,</if>
             <if test="manufacturerAddress != null and manufacturerAddress != ''">manufacturer_address= #{manufacturerAddress} ,</if>
             <if test="indications != null and indications != ''">indications = #{indications} ,</if>
             <if test="indications != null and indications != ''">indications = #{indications} ,</if>
+            <if test="ingredient != null and ingredient != ''">ingredient = #{ingredient} ,</if>
             <if test="dosage != null and dosage != ''">dosage = #{dosage} ,</if>
             <if test="dosage != null and dosage != ''">dosage = #{dosage} ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">adverse_reactions = #{adverseReactions} ,</if>
             <if test="adverseReactions != null and adverseReactions != ''">adverse_reactions = #{adverseReactions} ,</if>
             <if test="contraindications != null and contraindications != ''">contraindications = #{contraindications} ,</if>
             <if test="contraindications != null and contraindications != ''">contraindications = #{contraindications} ,</if>
@@ -797,4 +800,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE p.product_id IN <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
         WHERE p.product_id IN <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
     </select>
     </select>
 
 
+    <select id="selectForbiddenKeywords" parameterType="String" resultType="com.fs.hisStore.domain.ForbiddenOnlineMedicine">
+        SELECT
+            id,
+            module,
+            category,
+            serial_number,
+            medicine_ingredient,
+            single_compound,
+            forbidden_keywords,
+            exception,
+            remarks
+        FROM forbidden_online_medicines
+        <where>
+            <if test="keyword == null or keyword.trim() == ''">
+                1 = 0
+            </if>
+            <if test="keyword != null and keyword.trim() != ''">
+                AND (
+                (medicine_ingredient IS NOT NULL
+                AND medicine_ingredient != ''
+                AND medicine_ingredient LIKE CONCAT('%', #{keyword}, '%')
+                )
+                OR
+                (forbidden_keywords IS NOT NULL
+                AND forbidden_keywords != ''
+                AND forbidden_keywords LIKE CONCAT('%', #{keyword}, '%')
+                )
+                OR
+                (medicine_ingredient IS NOT NULL
+                AND medicine_ingredient != ''
+                AND REPLACE(medicine_ingredient, ' ', '') != ''
+                AND REPLACE(medicine_ingredient, ' ', '') LIKE CONCAT('%', #{keyword}, '%')
+                )
+                OR
+                (forbidden_keywords IS NOT NULL
+                AND forbidden_keywords != ''
+                AND REPLACE(forbidden_keywords, ' ', '') != ''
+                AND REPLACE(forbidden_keywords, ' ', '') LIKE CONCAT('%', #{keyword}, '%')
+                )
+                )
+            </if>
+        </where>
+        <if test="keyword != null and keyword.trim() != ''">
+            ORDER BY
+            CASE
+            WHEN medicine_ingredient = #{keyword} THEN 1
+            WHEN forbidden_keywords = #{keyword} THEN 1
+            WHEN medicine_ingredient LIKE CONCAT(#{keyword}, '%') THEN 2
+            WHEN forbidden_keywords LIKE CONCAT(#{keyword}, '%') THEN 2
+            ELSE 3
+            END,
+            module, category, serial_number
+        </if>
+    </select>
+
 </mapper>
 </mapper>