浏览代码

病理检测附件样本数量判空

陈长荣 2 月之前
父节点
当前提交
d3066b9769

+ 0 - 16
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/sample/service/biz/SamplePathologicalServiceImpl.java

@@ -7,7 +7,6 @@ import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -42,7 +41,6 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -157,20 +155,6 @@ public class SamplePathologicalServiceImpl extends ServiceImpl<SamplePathologica
                 RandomUtil.randomString(RandomUtil.BASE_CHAR_NUMBER_LOWER, 4));
         log.info("生成word 课题名称:{} 文件名称:{}", pathologicalVo.getSubjectName(), fileName);
 
-        //切片数量为负数,重新设置为null
-        Field[] intFields = ReflectUtil.getFields(SamplePathologicalVo.class, f -> f.getType().equals(Integer.class));
-        for (Field field : intFields) {
-            try {
-                field.setAccessible(true);
-                Integer value = (Integer) field.get(pathologicalVo);
-                if (value!= null && value < 0) {
-                    field.set(pathologicalVo, null);
-                }
-            } catch (IllegalAccessException e) {
-                log.error("反射获取字段值失败", e);
-            }
-        }
-
         JSONObject dataMap = new JSONObject();
         wordDataService.fillDocCreator(dataMap);
 

+ 205 - 15
jfcloud-gene-biz/src/main/resources/ftlTemplate/animalPathological.ftl

@@ -394,7 +394,9 @@
 										<w:rPr>
 											<w:spacing w:val="3"/>
 										</w:rPr>
+										<#if pathological.xkts?? && pathological.xkts &gt; -1 >
 										<w:t xml:space="preserve"> ${pathological.xkts!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -453,7 +455,9 @@
 										<w:rPr>
 											<w:spacing w:val="3"/>
 										</w:rPr>
+										<#if pathological.slbm?? && pathological.slbm &gt; -1 >
 										<w:t xml:space="preserve"> ${pathological.slbm!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -794,14 +798,32 @@
 											<w:spacing w:val="2"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">蜡块数量 ${pathological.sllk!}           </w:t>
+										<w:t xml:space="preserve">蜡块数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.sllk?? && pathological.sllk &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.sllk!}</w:t>
+										</#if>
 									</w:r>
 									<w:r>
 										<w:rPr>
 											<w:spacing w:val="1"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">     切片数量 ${pathological.slqp!}</w:t>
+										<w:t xml:space="preserve">                切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="1"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.slqp?? && pathological.slqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.slqp!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -881,7 +903,16 @@
 											<w:spacing w:val="3"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">样本数量 ${pathological.bdyb!}</w:t>
+										<w:t xml:space="preserve">样本数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="3"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.bdyb?? && pathological.bdyb &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.bdyb!}</w:t>
+										</#if>
 									</w:r>
 									<w:r>
 										<w:rPr>
@@ -895,7 +926,16 @@
 											<w:spacing w:val="3"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.bdqp!}</w:t>
+										<w:t xml:space="preserve">切片数量 </w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="3"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.bdqp?? && pathological.bdqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.bdqp!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1042,7 +1082,16 @@
 											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
 											<w:spacing w:val="4"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.he!}</w:t>
+										<w:t xml:space="preserve">切片数量 </w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="4"/>
+										</w:rPr>
+										<#if pathological.he?? && pathological.he &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.he!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1109,7 +1158,16 @@
 											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
 											<w:spacing w:val="6"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.masson!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="6"/>
+										</w:rPr>
+										<#if pathological.masson?? && pathological.masson &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.masson!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1206,7 +1264,18 @@
 											<w:position w:val="-1"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.psr!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="4"/>
+											<w:position w:val="-1"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.psr?? && pathological.psr &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.psr!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1273,7 +1342,16 @@
 											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
 											<w:spacing w:val="4"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.pas!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="4"/>
+										</w:rPr>
+										<#if pathological.pas?? && pathological.pas &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.pas!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1380,7 +1458,18 @@
 											<w:position w:val="-1"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="2"/>
+											<w:position w:val="-1"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.yho?? && pathological.yho &gt; -1 >
 										<w:t xml:space="preserve">切片数量 ${pathological.yho!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1450,7 +1539,17 @@
 											<w:spacing w:val="4"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="4"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.fjb?? && pathological.fjb &gt; -1 >
 										<w:t xml:space="preserve">切片数量 ${pathological.fjb!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1559,7 +1658,18 @@
 											<w:position w:val="-1"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="4"/>
+											<w:position w:val="-1"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.evg?? && pathological.evg &gt; -1 >
 										<w:t xml:space="preserve">切片数量 ${pathological.evg!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1628,7 +1738,17 @@
 											<w:spacing w:val="5"/>
 											<w:position w:val="-1"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.tunel!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="5"/>
+											<w:position w:val="-1"/>
+										</w:rPr>
+										<#if pathological.tunel?? && pathological.tunel &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.tunel!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1725,7 +1845,18 @@
 											<w:position w:val="-1"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.wga!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="5"/>
+											<w:position w:val="-1"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.wga?? && pathological.wga &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.wga!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1807,7 +1938,16 @@
 											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
 											<w:spacing w:val="2"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.qtqp!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
+											<w:spacing w:val="2"/>
+										</w:rPr>
+										<#if pathological.qtqp?? && pathological.qtqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.qtqp!}</w:t>
+										</#if>
 									</w:r>
 								</w:p>
 							</w:tc>
@@ -1890,7 +2030,23 @@
 											<w:spacing w:val="2"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t>切片数量 ${pathological.myzhqp!}                具体指标 </w:t>
+										<w:t>切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.myzhqp?? && pathological.myzhqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.myzhqp!}</w:t>
+										</#if>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<w:t xml:space="preserve">                具体指标 </w:t>
 									</w:r>
 									<#if pathological.myzhzb?? >
 										<w:r>
@@ -1979,7 +2135,23 @@
 											<w:spacing w:val="2"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t>切片数量 ${pathological.myygqp!}                具体指标 </w:t>
+										<w:t>切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.myygqp?? && pathological.myygqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.myygqp!}</w:t>
+										</#if>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<w:t xml:space="preserve">                具体指标 </w:t>
 									</w:r>
 									<#if pathological.myygzb?? >
 										<w:r>
@@ -2092,7 +2264,16 @@
 											<w:spacing w:val="2"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t xml:space="preserve">切片数量 ${pathological.qpsmqp!}</w:t>
+										<w:t xml:space="preserve">切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="2"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.qpsmqp?? && pathological.qpsmqp &gt; -1 >
+										<w:t xml:space="preserve"> ${pathological.qpsmqp!}</w:t>
+										</#if>
 									</w:r>
 									<w:r>
 										<w:rPr>
@@ -2328,7 +2509,16 @@
 											<w:spacing w:val="3"/>
 											<w:lang w:eastAsia="zh-CN"/>
 										</w:rPr>
-										<w:t>切片数量 ${pathological.ypqp!}</w:t>
+										<w:t>切片数量</w:t>
+									</w:r>
+									<w:r>
+										<w:rPr>
+											<w:spacing w:val="3"/>
+											<w:lang w:eastAsia="zh-CN"/>
+										</w:rPr>
+										<#if pathological.ypqp?? && pathological.ypqp &gt; -1 >
+										<w:t> ${pathological.ypqp!}</w:t>
+										</#if>
 									</w:r>
 									<w:r>
 										<w:rPr>