Sfoglia il codice sorgente

基本完成国家目录匹配模块。

lighter 4 anni fa
parent
commit
bd3aad68b1

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>9.1</version>
+    <version>9.2</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
 

+ 28 - 0
src/main/java/thyyxxk/webserver/constants/NationalMatchType.java

@@ -0,0 +1,28 @@
+package thyyxxk.webserver.constants;
+
+/**
+ * @description: 国家目录匹配类型
+ * @author: DingJie
+ * @create: 2021-06-10 16:14:15
+ **/
+public class NationalMatchType {
+    /**
+     * 西药,中成药
+     * */
+    public static final int MEDICINE = 1;
+
+    /**
+     * 中草药
+     * */
+    public static final int HERBAL = 2;
+
+    /**
+     * 项目
+     * */
+    public static final int SERVICE = 3;
+
+    /**
+     * 耗材
+     * */
+    public static final int SUPPLY = 4;
+}

+ 45 - 0
src/main/java/thyyxxk/webserver/controller/nationalmatch/NationalMatchController.java

@@ -0,0 +1,45 @@
+package thyyxxk.webserver.controller.nationalmatch;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.nationalmatch.QueryParam;
+import thyyxxk.webserver.entity.nationalmatch.StandardLocalItem;
+import thyyxxk.webserver.service.nationalmatch.NationalMatchService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 新医保国家目录匹配
+ * @author: DingJie
+ * @create: 2021-06-10 14:49:29
+ **/
+@RestController
+@RequestMapping("/nationalMatch")
+public class NationalMatchController {
+    private final NationalMatchService service;
+
+    @Autowired
+    public NationalMatchController(NationalMatchService service) {
+        this.service = service;
+    }
+
+    @PostMapping("/selectLocalItems")
+    public ResultVo<Map<String, Object>> selectLocalItems(@RequestBody QueryParam param) {
+        return service.selectLocalItems(param);
+    }
+
+    @PostMapping("/selectNationalItems")
+    public ResultVo<List> selectNationalItems(@RequestBody StandardLocalItem param) {
+        return service.selectNationalItems(param);
+    }
+
+    @PostMapping("/executeMatch")
+    public ResultVo<String> executeMatch(@RequestBody StandardLocalItem param) {
+        return service.executeMatch(param);
+    }
+}

+ 98 - 0
src/main/java/thyyxxk/webserver/dao/his/nationalmatch/NationalMatchDao.java

@@ -0,0 +1,98 @@
+package thyyxxk.webserver.dao.his.nationalmatch;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.nationalmatch.*;
+
+import java.util.List;
+
+/**
+ * @description: 新医保国家目录匹配mapper
+ * @author: DingJie
+ * @create: 2021-06-10 14:49:56
+ **/
+@Mapper
+public interface NationalMatchDao {
+
+    @Select("select code,serial,name,type=#{type}, " +
+            "unit=(select name from yp_zd_unit where yp_zd_unit.code=dosage_unit), " +
+            "dosage=(select name from yp_zd_dosage where yp_zd_dosage.code=dosage), " +
+            "specification,rtrim(pzwh) as approvalNumber, " +
+            "factory=(select name from yp_zd_manufactory where yp_zd_manufactory.code=manu_code) " +
+            "from yp_zd_dict where isnull(national_status,0)=#{status} " +
+            "and isnull(del_flag,0)=#{delFlag} " +
+            "and drug_kind in (select code from yp_zd_drug_kind where yp_type in (1,2)) " +
+            "and code like #{code} and name like #{name}")
+    IPage<StandardLocalItem> selectLocalMedicines(IPage<StandardLocalItem> iPage,
+                                                  @Param("code") String code,
+                                                  @Param("name") String name,
+                                                  @Param("type") int type,
+                                                  @Param("delFlag") int delFlag,
+                                                  @Param("status") int status);
+
+    @Select("select code,serial,name,type=#{type}, " +
+            "unit=(select name from yp_zd_unit where yp_zd_unit.code=dosage_unit), " +
+            "dosage=(select name from yp_zd_dosage where yp_zd_dosage.code=dosage), " +
+            "specification,rtrim(pzwh) as approvalNumber, " +
+            "factory=(select name from yp_zd_manufactory where yp_zd_manufactory.code=manu_code) " +
+            "from yp_zd_dict where isnull(national_status,0)=#{status} " +
+            "and isnull(del_flag,0)=#{delFlag} " +
+            "and drug_kind in (select code from yp_zd_drug_kind where yp_type=3) " +
+            "and code like #{code} and name like #{name}")
+    IPage<StandardLocalItem> selectLocalHerbals(IPage<StandardLocalItem> iPage,
+                                                  @Param("code") String code,
+                                                  @Param("name") String name,
+                                                  @Param("type") int type,
+                                                  @Param("delFlag") int delFlag,
+                                                  @Param("status") int status);
+
+    @Select("select code,name,charge_unit as unit,type=#{type}, discription as specification," +
+            "yb_comment as factory from zd_charge_item where isnull(national_status,0)=#{status} " +
+            "and isnull(del_flag,0)=#{delFlag} and class_code='J' and code like #{code} and name like #{name}")
+    IPage<StandardLocalItem> selectLocalSupplies(IPage<StandardLocalItem> iPage,
+                                                 @Param("code") String code,
+                                                 @Param("name") String name,
+                                                 @Param("type") int type,
+                                                 @Param("delFlag") int delFlag,
+                                                 @Param("status") int status);
+
+    @Select("select code,name,charge_unit as unit,type=#{type}, discription as specification," +
+            "yb_comment as factory from zd_charge_item where isnull(national_status,0)=#{status} " +
+            "and isnull(del_flag,0)=#{delFlag} and class_code!='J' and code like #{code} and name like #{name}")
+    IPage<StandardLocalItem> selectLocalServices(IPage<StandardLocalItem> iPage,
+                                                 @Param("code") String code,
+                                                 @Param("name") String name,
+                                                 @Param("type") int type,
+                                                 @Param("delFlag") int delFlag,
+                                                 @Param("status") int status);
+
+    @Select("select * from si_central_medicine where national_name=#{name} and approval_number like #{approve}")
+    List<SiCentralMedicine> selectNationalMedicines(@Param("name") String name,
+                                                    @Param("approve") String approve);
+
+    @Select("select * from si_central_herbal where national_name=#{name}")
+    List<SiCentralHerbal> selectNationalHerbals(@Param("name") String name);
+
+    @Select("select * from si_central_services where national_name=#{name} " +
+            "or local_medical_service_name=#{name}")
+    List<SiCentralServices> selectNationalServices(@Param("name") String name);
+
+    @Select("select * from si_central_supplies_mini where national_name like #{name}")
+    List<SiCentralSuppliesMini> selectNationalSupplies(@Param("name") String name);
+
+    @Update("update yp_zd_dict set national_status=1,national_code=#{nationalCode}," +
+            "national_name=#{nationalName} where code=#{code} and serial=#{serial}")
+    void updateYpZdDict(@Param("code") String code,
+                        @Param("serial") String serial,
+                        @Param("nationalCode") String nationalCode,
+                        @Param("nationalName") String nationalName);
+
+    @Update("update zd_charge_item set national_status=1,national_code=#{nationalCode}," +
+            "national_name=#{nationalName} where code=#{code}")
+    void updateZdChargeItem(@Param("code") String code,
+                            @Param("nationalCode") String nationalCode,
+                            @Param("nationalName") String nationalName);
+}

+ 20 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/QueryParam.java

@@ -0,0 +1,20 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import lombok.Data;
+
+/**
+ * @description: 查询目录参数
+ * @author: DingJie
+ * @create: 2021-06-10 14:51:51
+ **/
+@Data
+public class QueryParam {
+    private Integer status;
+    private Integer delFlag;
+    private Integer type;
+    private String code;
+    private String name;
+
+    private Integer pageSize;
+    private Integer currentPage;
+}

+ 71 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/SiCentralHerbal.java

@@ -0,0 +1,71 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class SiCentralHerbal  implements Serializable {
+
+	private static final long serialVersionUID =  7501324178638823432L;
+
+	/**
+	 * herbalCode
+	 */
+	private String nationalCode;
+
+	/**
+	 * herbalName
+	 */
+	private String nationalName;
+
+	/**
+	 * medicinalMaterialsName
+	 */
+	private String medicinalMaterialsName;
+
+	/**
+	 * efficacyClass
+	 */
+	private String efficacyClass;
+
+	/**
+	 * medicinalMaterialsFamily
+	 */
+	private String medicinalMaterialsFamily;
+
+	/**
+	 * medicinalMaterialsSpecies
+	 */
+	private String medicinalMaterialsSpecies;
+
+	/**
+	 * medicinalParts
+	 */
+	private String medicinalParts;
+
+	/**
+	 * processingMethod
+	 */
+	private String processingMethod;
+
+	/**
+	 * properties
+	 */
+	private String properties;
+
+	/**
+	 * functions
+	 */
+	private String functions;
+
+	/**
+	 * usageDosage
+	 */
+	private String usageDosage;
+
+	/**
+	 * siPolicy
+	 */
+	private String siPolicy;
+
+}

+ 157 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/SiCentralMedicine.java

@@ -0,0 +1,157 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+public class SiCentralMedicine implements Serializable {
+
+    private static final long serialVersionUID = 1731317857334895794L;
+
+    /**
+     * medicineCode
+     */
+    private String nationalCode;
+
+    /**
+     * registeredName
+     */
+    private String nationalName;
+
+    /**
+     * goodsName
+     */
+    private String goodsName;
+
+    /**
+     * registeredDosage
+     */
+    private String registeredDosage;
+
+    /**
+     * actualDosage
+     */
+    private String actualDosage;
+
+    /**
+     * registeredSpecifications
+     */
+    private String registeredSpecifications;
+
+    /**
+     * actualSpecifications
+     */
+    private String actualSpecifications;
+
+    /**
+     * packingMaterial
+     */
+    private String packingMaterial;
+
+    /**
+     * minPackageNum
+     */
+    private Double minPackageNum;
+
+    /**
+     * minPackageUnit
+     */
+    private String minPackageUnit;
+
+    /**
+     * minPreparationUnit
+     */
+    private String minPreparationUnit;
+
+    /**
+     * pharmaceuticalEnterprises
+     */
+    private String pharmaceuticalEnterprises;
+
+    /**
+     * approvalNumber
+     */
+    private String approvalNumber;
+
+    /**
+     * drugStandardCode
+     */
+    private Double drugStandardCode;
+
+    /**
+     * subPackagingEnterprises
+     */
+    private String subPackagingEnterprises;
+
+    /**
+     * listStatus
+     */
+    private String listStatus;
+
+    /**
+     * siDrugName
+     */
+    private String siDrugName;
+
+    /**
+     * classIn2020
+     */
+    private String classIn2020;
+
+    /**
+     * siDosage
+     */
+    private String siDosage;
+
+    /**
+     * serialNo
+     */
+    private String serialNo;
+
+    /**
+     * remark
+     */
+    private String remark;
+
+    /**
+     * outpatientSelfPayPercentage
+     */
+    private Double outpatientSelfPayPercentage;
+
+    /**
+     * inpatientSelfPayPercentage
+     */
+    private Double inpatientSelfPayPercentage;
+
+    /**
+     * classificationMark
+     */
+    private String classificationMark;
+
+    /**
+     * specialDrugsMark
+     */
+    private String specialDrugsMark;
+
+    /**
+     * siSpecialDrugsPaymentStandard
+     */
+    private String siSpecialDrugsPaymentStandard;
+
+    /**
+     * nationalSiPaymentStandard
+     */
+    private String nationalSiPaymentStandard;
+
+    private String makeRegisteredSpecification;
+    private String makeActualSpecification;
+
+    public String getMakeRegisteredSpecification() {
+        return registeredSpecifications + " x" + minPackageNum + minPreparationUnit + "/" + minPackageUnit;
+    }
+
+    public String getMakeActualSpecification() {
+        return actualSpecifications + " x" + minPackageNum + minPreparationUnit + "/" + minPackageUnit;
+    }
+}

+ 86 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/SiCentralServices.java

@@ -0,0 +1,86 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class SiCentralServices implements Serializable {
+
+	private static final long serialVersionUID =  7867062654238773122L;
+
+	/**
+	 * nationalMedicalServiceCode
+	 */
+	private String nationalCode;
+
+	/**
+	 * nationalMedicalServiceName
+	 */
+	private String nationalName;
+
+	/**
+	 * localMedicalServiceCode
+	 */
+	private Double localMedicalServiceCode;
+
+	/**
+	 * localMedicalServiceName
+	 */
+	private String localMedicalServiceName;
+
+	/**
+	 * dictionaryValueCode
+	 */
+	private String dictionaryValueCode;
+
+	/**
+	 * projectConnotation
+	 */
+	private String projectConnotation;
+
+	/**
+	 * exclusions
+	 */
+	private String exclusions;
+
+	/**
+	 * valuationUnit
+	 */
+	private String valuationUnit;
+
+	/**
+	 * projectDescription
+	 */
+	private String projectDescription;
+
+	/**
+	 * remark
+	 */
+	private String remark;
+
+	/**
+	 * firstClassPrice
+	 */
+	private String firstClassPrice;
+
+	/**
+	 * nineBitCode
+	 */
+	private Double nineBitCode;
+
+	/**
+	 * reimbursementFlag
+	 */
+	private String reimbursementFlag;
+
+	/**
+	 * siReimbursementClass
+	 */
+	private String siReimbursementClass;
+
+	/**
+	 * selfpayPercentage
+	 */
+	private Double selfpayPercentage;
+
+}

+ 66 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/SiCentralSuppliesMini.java

@@ -0,0 +1,66 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class SiCentralSuppliesMini  implements Serializable {
+
+	private static final long serialVersionUID =  7728350900892531939L;
+
+	/**
+	 * supplyCode
+	 */
+	private String nationalCode;
+
+	/**
+	 * firstClass
+	 */
+	private String firstClass;
+
+	/**
+	 * secondClass
+	 */
+	private String secondClass;
+
+	/**
+	 * thirdClass
+	 */
+	private String thirdClass;
+
+	/**
+	 * siName
+	 */
+	private String siName;
+
+	/**
+	 * material
+	 */
+	private String material;
+
+	/**
+	 * fetures
+	 */
+	private String fetures;
+
+	/**
+	 * registrationCertificateNo
+	 */
+	private String registrationCertificateNo;
+
+	/**
+	 * productName
+	 */
+	private String nationalName;
+
+	/**
+	 * factory
+	 */
+	private String factory;
+
+	/**
+	 * specificationNum
+	 */
+	private Double specificationNum;
+
+}

+ 26 - 0
src/main/java/thyyxxk/webserver/entity/nationalmatch/StandardLocalItem.java

@@ -0,0 +1,26 @@
+package thyyxxk.webserver.entity.nationalmatch;
+
+import lombok.Data;
+
+/**
+ * @description: 所有本地目录的标准返回
+ * @author: DingJie
+ * @create: 2021-06-10 14:55:18
+ **/
+@Data
+public class StandardLocalItem {
+    private Integer type;
+    private String code;
+    private String name;
+    private String unit;
+    private String serial;
+    private String dosage;
+    private String specification;
+    private String approvalNumber;
+    private String factory;
+
+    private String searchNameForSupply;
+
+    private String nationalCode;
+    private String nationalName;
+}

+ 102 - 0
src/main/java/thyyxxk/webserver/service/nationalmatch/NationalMatchService.java

@@ -0,0 +1,102 @@
+package thyyxxk.webserver.service.nationalmatch;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.constants.Capacity;
+import thyyxxk.webserver.constants.NationalMatchType;
+import thyyxxk.webserver.dao.his.nationalmatch.NationalMatchDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.nationalmatch.*;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 新医保国家目录匹配Service
+ * @author: DingJie
+ * @create: 2021-06-10 14:50:27
+ **/
+@Slf4j
+@Service
+public class NationalMatchService {
+    private final NationalMatchDao dao;
+
+    @Autowired
+    public NationalMatchService(NationalMatchDao dao) {
+        this.dao = dao;
+    }
+
+    public ResultVo<Map<String, Object>> selectLocalItems(QueryParam param) {
+        IPage<StandardLocalItem> iPage = new Page<>(param.getCurrentPage(), param.getPageSize());
+        String code = param.getCode();
+        code = StringUtil.isBlank(code) ? "%%" : code.trim().toUpperCase();
+        String name = param.getName();
+        name = StringUtil.isBlank(name) ? "%%" : "%" + name.trim() + "%";
+        if (param.getType() == NationalMatchType.MEDICINE) {
+            iPage = dao.selectLocalMedicines(iPage, code, name, param.getType(), param.getDelFlag(), param.getStatus());
+        } else if(param.getType() == NationalMatchType.HERBAL) {
+            iPage = dao.selectLocalHerbals(iPage, code, name, param.getType(), param.getDelFlag(), param.getStatus());
+        } else if (param.getType() == NationalMatchType.SERVICE) {
+            iPage = dao.selectLocalServices(iPage, code, name, param.getType(), param.getDelFlag(), param.getStatus());
+        } else {
+            iPage = dao.selectLocalSupplies(iPage, code, name, param.getType(), param.getDelFlag(), param.getStatus());
+        }
+        if (iPage.getTotal() == 0) {
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有符合条件的数据。");
+        }
+        Map<String, Object> map = new HashMap<>(Capacity.TWO);
+        map.put("total", iPage.getTotal());
+        map.put("list", iPage.getRecords());
+        return ResultVoUtil.success(map);
+    }
+
+    public ResultVo<List> selectNationalItems(StandardLocalItem param) {
+        int type = param.getType();
+        if (type == NationalMatchType.MEDICINE) {
+            String approve = param.getApprovalNumber();
+            approve = StringUtil.isBlank(approve) ? "%%" : approve;
+            List<SiCentralMedicine> list = dao.selectNationalMedicines(param.getName(), approve);
+            if (null == list || list.isEmpty()) {
+                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有符合条件的国家目录。");
+            }
+            return ResultVoUtil.success(list);
+        } else if (type == NationalMatchType.HERBAL){
+            List<SiCentralHerbal> list = dao.selectNationalHerbals(param.getName());
+            if (null == list || list.isEmpty()) {
+                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有符合条件的国家目录。");
+            }
+            return ResultVoUtil.success(list);
+        } else if (type == NationalMatchType.SERVICE) {
+            List<SiCentralServices> list = dao.selectNationalServices(param.getName());
+            if (null == list || list.isEmpty()) {
+                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有符合条件的国家目录。");
+            }
+            return ResultVoUtil.success(list);
+        } else {
+            String name = "%" + param.getSearchNameForSupply() + "%";
+            List<SiCentralSuppliesMini> list = dao.selectNationalSupplies(name);
+            if (null == list || list.isEmpty()) {
+                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有符合条件的国家目录。");
+            }
+            return ResultVoUtil.success(list);
+        }
+    }
+
+    public ResultVo<String> executeMatch(StandardLocalItem param) {
+        log.info("【操作员:{}】匹配国家目录:{}", TokenUtil.getTokenUserId(), param);
+        if (param.getType() < NationalMatchType.SERVICE) {
+            dao.updateYpZdDict(param.getCode(), param.getSerial(), param.getNationalCode(), param.getNationalName());
+        } else {
+            dao.updateZdChargeItem(param.getCode(), param.getNationalCode(), param.getNationalName());
+        }
+        return ResultVoUtil.success("匹配成功。");
+    }
+}