From 835951395f01aba7ab567d3a6c7b5450b4e54a1b Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 26 六月 2024 16:14:05 +0800
Subject: [PATCH] bug

---
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java                   |   16 ++--
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java        |   10 ++
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java |  130 +-------------------------------
 inspect-server/src/main/resources/mapper/InsOrderMapper.xml                                   |    4 
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml                                  |    4 
 inspect-server/src/main/resources/static/report-template.docx                                 |    0 
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java        |   11 +-
 cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java             |    6 +
 inspect-server/src/main/resources/mapper/StandardTreeMapper.xml                               |   56 +++++++++----
 cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java                    |    1 
 cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml                        |    1 
 11 files changed, 79 insertions(+), 160 deletions(-)

diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
index cf1347c..7be141e 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
@@ -348,6 +348,12 @@
                     }
                 } catch (Exception e) {
                 }
+                try {
+                    if (list1.get(24) != null) {
+                        str.setLaboratory(list1.get(24) + "");
+                    }
+                } catch (Exception e) {
+                }
                 lists.add(str);
             }
         });
diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
index fac6580..c916831 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -49,6 +49,7 @@
     private String price;
 
     @ApiModelProperty(value = "鍦烘墍")
+    @ValueTableShow(4)
     private String laboratory;
 
     @ValueTableShow(4)
diff --git a/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
index 02911c3..e732e26 100644
--- a/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
+++ b/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -44,6 +44,7 @@
         WHEN INSTR(sample, ',') > 0 THEN
         SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
         when sample = '[""]' then null
+        when sample = '[]' then null
         ELSE
         TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
         END AS samples
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
index 0666f69..4b81510 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -12,11 +12,11 @@
 import java.util.List;
 
 /**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_tree(鏍囧噯鏍�)銆戠殑鏁版嵁搴撴搷浣淢apper
-* @createDate 2024-03-01 15:06:44
-* @Entity com.yuanchu.mom.pojo.StandardTree
-*/
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恠tandard_tree(鏍囧噯鏍�)銆戠殑鏁版嵁搴撴搷浣淢apper
+ * @createDate 2024-03-01 15:06:44
+ * @Entity com.yuanchu.mom.pojo.StandardTree
+ */
 public interface StandardTreeMapper extends BaseMapper<StandardTree> {
 
     List<FactoryDto> selectStandardTreeList();
@@ -29,11 +29,11 @@
 
     List<StandardMethodList> getStandardMethodListBySample(String sampleType);
 
-    List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees);
+    List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees, String laboratory);
 
-    List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees);
+    List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees, String laboratory);
 
-    List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees);
+    List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees, String laboratory);
 
     List<SampleTypeDto> getStandardTree2();
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index 3c96fb3..c2720da 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -273,9 +273,12 @@
                 JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
                 InsProduct insProduct = new InsProduct();
                 insProduct.setId(Integer.parseInt(k));
-                InsProductResult result = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
-                if (BeanUtil.isEmpty(result)) {
-                    result = new InsProductResult();
+                List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
+                InsProductResult result;
+                if (CollectionUtils.isEmpty(results)) {
+                     result = new InsProductResult();
+                } else {
+                     result = results.get(0);
                 }
                 result.setInsProductId(Integer.parseInt(k));
                 if (jo.get("insValue") != null) {
@@ -651,10 +654,8 @@
                             } else if (value.equals("璇曢獙鏂规硶")) {
                                 textRenderData.setText(p.getMethodS());
                             } else if (value.equals("妫�楠岄」")) {
-                                Console.log(p.getInspectionItem() + "\n" + p.getInspectionItemEn());
                                 textRenderData.setText(p.getInspectionItem() + "\n" + p.getInspectionItemEn());
                             } else if (value.equals("妫�楠屽瓙椤�")) {
-                                Console.log(p.getInspectionItemSubclass() + "\n" + p.getInspectionItemSubclassEn());
                                 if (ObjectUtils.isEmpty(p.getInspectionItemSubclassEn())) {
                                     textRenderData.setText(p.getInspectionItemSubclass());
                                 } else {
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
index 59b2c69..9a38d4b 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -139,114 +139,6 @@
 
     @Override
     public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
-        /*String[] trees = tree.split(" - ");
-        List<StandardProductList> list = new ArrayList<>();
-        if (trees.length == 3) {
-            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
-            if (treeList.size() == 0) {
-                StandardTree standardTree = new StandardTree();
-                standardTree.setFactory(trees[0]);
-                standardTree.setLaboratory(trees[1]);
-                standardTree.setSampleType(trees[2]);
-                treeList.add(standardTree);
-            }
-            for (StandardTree standardTree : treeList) {
-                String str = tree + " - " + standardTree.getSample() + " - " + standardTree.getModel();
-                list.addAll(standardTreeMapper.selectStandardProductListByTree3("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
-            }
-        } else if (trees.length == 4) {
-            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
-            if (treeList.size() == 0) {
-                StandardTree standardTree = new StandardTree();
-                standardTree.setFactory(trees[0]);
-                standardTree.setLaboratory(trees[1]);
-                standardTree.setSampleType(trees[2]);
-                standardTree.setSample(trees[2]);
-                treeList.add(standardTree);
-            }
-            for (StandardTree standardTree : treeList) {
-                String str = tree + " - " + standardTree.getModel();
-                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
-                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str));
-            }
-        } else {
-            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3], trees[4], tree));
-            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3], trees[4], tree));
-        }
-        for (StandardProductList productList : list) {
-            productList.setId(IdWorker.getId());
-        }
-        List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
-        for (StandardProductList sp : standardProductLists) {
-            for (StandardProductList pl : list) {
-                if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
-                        && Objects.equals((sp.getInspectionItemSubclass() == null)? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
-                        && Objects.equals(sp.getModel(), pl.getModel())
-                        && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
-                    pl.setId(sp.getId());
-                    if (sp.getState() != null && !sp.getState().equals("")) {
-                        pl.setState(sp.getState());
-                    } else {
-                        pl.setState(id == 0 ? 1 : 0);
-                    }
-                    pl.setMethodS(sp.getMethodS());
-                    if (sp.getAsk() != null && !sp.getAsk().equals("")) {
-                        pl.setAsk(sp.getAsk());
-                    }
-                    if (sp.getTell() != null && !sp.getTell().equals("")) {
-                        pl.setTell(sp.getTell());
-                    }
-                    if (sp.getPrice() != null && !sp.getPrice().equals("")) {
-                        pl.setPrice(sp.getPrice());
-                    }
-                    if (sp.getManHour() != null && !sp.getManHour().equals("")) {
-                        pl.setManHour(sp.getManHour());
-                    }
-                    if (sp.getSection() != null && !sp.getSection().equals("")) {
-                        pl.setSection(sp.getSection());
-                    }
-                    if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
-                        pl.setTemplateId(sp.getTemplateId());
-                    }
-                    if(sp.getTree() != null && !sp.getTree().equals("")){
-                        pl.setTree(sp.getTree());
-                    }
-                    break;
-                }
-            }
-        }
-        if (page == 1) {
-            Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
-            CompletableFuture.supplyAsync(() -> {
-                if(trees.length == 5){
-                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree));
-                }else{
-                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
-                }
-                standardProductListService2.saveBatch(list.stream().map(a -> {
-                    a.setFactory(trees[0]);
-                    a.setLaboratory(trees[1]);
-                    a.setSampleType(trees[2]);
-                    a.setCreateUser(userId);
-                    a.setUpdateUser(userId);
-                    a.setStandardMethodListId(id);
-                    return a;
-                }).collect(Collectors.toList()));
-                return null;
-            }).thenAccept(res -> {
-            }).exceptionally(e -> {
-                e.printStackTrace();
-                return null;
-            });
-        }
-        Map<String, Object> map = new HashMap<>();
-        try {
-            map.put("productList", list.subList((page - 1) * 50, page * 50));
-        } catch (IndexOutOfBoundsException e) {
-            map.put("productList", list.subList((page - 1) * 50, list.size()));
-        }
-        map.put("total", list.size());
-        return map;*/
         String[] trees = tree.split(" - ");
         List<StandardProductList> list = new ArrayList<>();
         if (trees.length == 3) {
@@ -276,18 +168,8 @@
             }
             for (StandardTree standardTree2 : treeList) {
                 String tree2 = trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample() + " - " + standardTree2.getModel();
-                /*if(standardTree2.getSample()!=null){
-                    tree2 += trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample();
-                }
-                if(standardTree2.getModel()!=null){
-                    if(standardTree2.getSample()!=null){
-                        tree2 += standardTree2.getModel();
-                    }else{
-                        tree2 += trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + null + " - " + standardTree2.getModel();
-                    }
-                }*/
-                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2));
-                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2));
+                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
+                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
             }
         } else if (trees.length == 4) {
             List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
@@ -301,12 +183,12 @@
             }
             for (StandardTree standardTree : treeList) {
                 String str = tree + " - " + standardTree.getModel();
-                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
-                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str));
+                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
+                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
             }
         } else {
-            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree));
-            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree));
+            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
+            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
         }
         for (StandardProductList productList : list) {
             productList.setId(IdWorker.getId());
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
index a531710..6c587dc 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -69,6 +69,10 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int addStandardTree(StandardTree standardTree) {
+        StandardTree tree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getModel, standardTree.getModel()));
+        if (tree != null) {
+            throw new ErrorException("璇ュ瀷鍙峰凡瀛樺湪");
+        }
         return standardTreeMapper.insert(standardTree);
     }
 
@@ -78,7 +82,11 @@
         String[] trees = tree.split(" - ");
         switch (trees.length) {
             case 5:
-                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
+                if (trees[3] == null) {
+                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).isNull(StandardTree::getSample).eq(StandardTree::getModel, trees[4]));
+                } else {
+                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
+                }
                 break;
             /*case 4:
                 standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index ab1e206..59724f5 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -169,8 +169,8 @@
         </if>
     </select>
     <select id="selectDeviceList" resultType="java.util.Map">
-        select device_name,specification_model,management_number,DATE_ADD(date_format(last_calibration_date,
-        '%Y-%m-%d'),INTERVAL calibration_date month) latest_traceability
+        select device_name,specification_model,management_number,<!--DATE_ADD(date_format(last_calibration_date,
+        '%Y-%m-%d'),INTERVAL calibration_date month)-->  next_calibration_date latest_traceability
         from device
         where device.management_number in
         <foreach collection="names" index="index" open="(" separator="," close=")" item="val">
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 0138951..ea1827b 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -141,6 +141,7 @@
                man_day,
                bsm,
                ask,
+               tell,
                `last_value`,
                ip.ins_result  ip_ins_result,
                state,
@@ -289,7 +290,7 @@
         left join ins_product ip on isa.id = ip.ins_sample_id
         left join ins_product_result ipr on ip.id = ipr.ins_product_id
         left join ins_order io on io.id = ins_order_id
-        where  ip.state = 1
+        where ip.state = 1
         and ins_order_id in
         <foreach collection="ids" open="(" close=")" item="id" separator=",">
             #{id}
@@ -499,6 +500,7 @@
         <result property="manDay" column="man_day" jdbcType="INTEGER"/>
         <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
         <result property="ask" column="ask" jdbcType="VARCHAR"/>
+        <result property="tell" column="tell" jdbcType="VARCHAR"/>
         <result property="lastValue" column="last_value" jdbcType="VARCHAR"/>
         <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/>
         <result property="state" column="state" jdbcType="INTEGER"/>
diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
index a01d630..d7fcdae 100644
--- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -57,7 +57,7 @@
                  left join product p on p.object_id = sto.id
                  left join standard_tree st on st.sample_type = sto.specimen_name
             and st.sample = p.name
-        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL (st.id), st.id
+        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
     </select>
 
     <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList">
@@ -161,18 +161,24 @@
                id        structure_item_parameter_id
         from structure_item_parameter
         where (
-                      sample is NULL
-                      OR sample = ''
-                      or sample = '[]'
-                      OR sample LIKE CONCAT('%[', #{tree}, ']%')
-                  )
-        order by case when man_hour_group is NULL then 1
-                      when man_hour_group ='' then 1  else 0 end,
+                sample is NULL
+                OR sample = ''
+                or sample = '[]'
+                OR sample LIKE CONCAT('%[', #{tree}, ']%')
+            )
+          and (laboratory is null
+            or laboratory=''
+            or laboratory = #{laboratory})
+        order by case
+                     when man_hour_group is NULL then 1
+                     when man_hour_group = '' then 1
+                     else 0 end,
                  CASE
                      WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+                     WHEN man_hour_group REGEXP '[0-9]+'
+                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
 
-                ,id asc
+                , id asc
     </select>
 
     <select id="selectStandardProductListByTree2" resultType="com.yuanchu.mom.pojo.StandardProductList">
@@ -207,13 +213,19 @@
                id        structure_item_parameter_id
         from structure_item_parameter
         where sample LIKE CONCAT('%[', #{tree}, ']%')
-        order by case when man_hour_group is NULL then 1
-                      when man_hour_group ='' then 1  else 0 end,
+            and (laboratory is null
+            or laboratory=''
+           or laboratory = #{laboratory})
+        order by case
+                     when man_hour_group is NULL then 1
+                     when man_hour_group = '' then 1
+                     else 0 end,
                  CASE
                      WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+                     WHEN man_hour_group REGEXP '[0-9]+'
+                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
 
-                ,id asc
+                , id asc
     </select>
 
     <select id="getStandardTree2" resultMap="SampleTypeDto">
@@ -262,16 +274,22 @@
                       or sample = '[]'
                       OR sample LIKE CONCAT('%', #{tree}, '%')
                   )
-        order by case when man_hour_group is NULL then 1
-                      when man_hour_group ='' then 1  else 0 end,
+            and (laboratory is null
+            or laboratory=''
+           or laboratory = #{laboratory})
+        order by case
+                     when man_hour_group is NULL then 1
+                     when man_hour_group = '' then 1
+                     else 0 end,
                  CASE
                      WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+                     WHEN man_hour_group REGEXP '[0-9]+'
+                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
 
-                ,id asc
+                , id asc
     </select>
     <select id="getStandardTree3" resultType="com.yuanchu.mom.dto.SampleDto">
-        select model label,
+        select  model label,
                model value
         from standard_tree
         where sample_type = #{sampleType}
diff --git a/inspect-server/src/main/resources/static/report-template.docx b/inspect-server/src/main/resources/static/report-template.docx
index 5196cdf..3e90e73 100644
--- a/inspect-server/src/main/resources/static/report-template.docx
+++ b/inspect-server/src/main/resources/static/report-template.docx
Binary files differ

--
Gitblit v1.9.3