Selaa lähdekoodia

添加药品和项目的价格查询

lighter 2 vuotta sitten
vanhempi
commit
e48142c39b

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>10.3</version>
+    <version>10.4</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 

+ 33 - 0
src/main/java/thyyxxk/wxservice_server/controller/QueryPriceController.java

@@ -0,0 +1,33 @@
+package thyyxxk.wxservice_server.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.wxservice_server.entity.ResultVo;
+import thyyxxk.wxservice_server.entity.pricequery.ItemPrice;
+import thyyxxk.wxservice_server.entity.pricequery.MedicinePrice;
+import thyyxxk.wxservice_server.service.QueryPriceService;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/queryPrice")
+public class QueryPriceController {
+    private final QueryPriceService service;
+
+    @Autowired
+    public QueryPriceController(QueryPriceService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectMedicinePrices")
+    public ResultVo<List<MedicinePrice>> selectMedicinePrices() {
+        return service.selectMedicinePrices();
+    }
+
+    @GetMapping("/selectItemPrices")
+    public ResultVo<List<ItemPrice>> selectItemPrices() {
+        return service.selectItemPrices();
+    }
+}

+ 30 - 0
src/main/java/thyyxxk/wxservice_server/dao/QueryPriceDao.java

@@ -0,0 +1,30 @@
+package thyyxxk.wxservice_server.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.wxservice_server.entity.pricequery.ItemPrice;
+import thyyxxk.wxservice_server.entity.pricequery.MedicinePrice;
+
+import java.util.List;
+
+@Mapper
+public interface QueryPriceDao {
+
+    @Select("select drug_kind, " +
+            "drugkindName=(select name from yp_zd_drug_kind where code=drug_kind),name,national_code, " +
+            "max(specification) as specification, " +
+            "max(pack_retprice) as price " +
+            "from yp_zd_dict where isnull(national_code,'')!='' and isnull(del_flag,'0')!=1 " +
+            "group by name,national_code,drug_kind " +
+            "order by drug_kind")
+    List<MedicinePrice> selectMedicinePrices();
+
+    @Select("SELECT " +
+            "class_code, " +
+            "(SELECT name FROM zd_charge_class WHERE code=class_code) AS classCodeName, " +
+            "name,national_code,charge_unit, " +
+            "charge_amount AS price " +
+            "FROM zd_charge_item WHERE isnull(del_flag, '0')!=1 AND isnull(national_code, '')!=''  " +
+            "order by class_code")
+    List<ItemPrice> selectItemPrices();
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/entity/pricequery/ItemPrice.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.entity.pricequery;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ItemPrice {
+    private String classCode;
+    private String classCodeName;
+    private String name;
+    private String nationalCode;
+    private String chargeUnit;
+    private BigDecimal price;
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/entity/pricequery/MedicinePrice.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.entity.pricequery;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class MedicinePrice {
+    private String drugKind;
+    private String drugKindName;
+    private String name;
+    private String nationalCode;
+    private String specification;
+    private BigDecimal price;
+}

+ 29 - 0
src/main/java/thyyxxk/wxservice_server/service/QueryPriceService.java

@@ -0,0 +1,29 @@
+package thyyxxk.wxservice_server.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.wxservice_server.dao.QueryPriceDao;
+import thyyxxk.wxservice_server.entity.ResultVo;
+import thyyxxk.wxservice_server.entity.pricequery.ItemPrice;
+import thyyxxk.wxservice_server.entity.pricequery.MedicinePrice;
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
+
+import java.util.List;
+
+@Service
+public class QueryPriceService {
+    private final QueryPriceDao dao;
+
+    @Autowired
+    public QueryPriceService(QueryPriceDao dao) {
+        this.dao = dao;
+    }
+
+    public ResultVo<List<MedicinePrice>> selectMedicinePrices() {
+        return ResultVoUtil.success(dao.selectMedicinePrices());
+    }
+
+    public ResultVo<List<ItemPrice>> selectItemPrices() {
+        return ResultVoUtil.success(dao.selectItemPrices());
+    }
+}