diff --git a/lab-ops-api/lab-resource-api/src/main/java/org/springblade/resource/entity/Message.java b/lab-ops-api/lab-resource-api/src/main/java/org/springblade/resource/entity/Message.java index 310abb9..43357f7 100644 --- a/lab-ops-api/lab-resource-api/src/main/java/org/springblade/resource/entity/Message.java +++ b/lab-ops-api/lab-resource-api/src/main/java/org/springblade/resource/entity/Message.java @@ -104,5 +104,8 @@ public class Message implements Serializable { // 跳转路径 private String routerPath; + @TableField(exist = false) + private Integer isAll; + } diff --git a/lab-ops/lab-resource/src/main/java/org/springblade/resource/controller/MessageController.java b/lab-ops/lab-resource/src/main/java/org/springblade/resource/controller/MessageController.java index 6f31e50..59d88c3 100644 --- a/lab-ops/lab-resource/src/main/java/org/springblade/resource/controller/MessageController.java +++ b/lab-ops/lab-resource/src/main/java/org/springblade/resource/controller/MessageController.java @@ -3,6 +3,7 @@ package org.springblade.resource.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; @@ -112,7 +113,20 @@ public class MessageController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入message") public R update(@Valid @RequestBody Message message) { - messageService.updateById(message); + if (message.getIsAll() == 1) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Message::getMassageUser, AuthUtil.getUserId().toString()); + wrapper.eq(Message::getIsRead, 0); + List messages = messageService.list(wrapper); + if (CollectionUtils.isNotEmpty(messages)) { + for (Message message1 : messages) { + message1.setIsRead(1); + } + messageService.updateBatchById(messages); + } + } else { + messageService.updateById(message); + } return R.data(messageService.getById(message.getId()).getRouterPath()); } diff --git a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/capital/entity/ProductStoreDetial.java b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/capital/entity/ProductStoreDetial.java index 42b424b..ef83591 100644 --- a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/capital/entity/ProductStoreDetial.java +++ b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/capital/entity/ProductStoreDetial.java @@ -34,6 +34,13 @@ public class ProductStoreDetial extends BaseEntity { */ @ApiModelProperty(value = "数量") private Integer num; + + /** + * 入库数量 + */ + @ApiModelProperty(value = "数量") + private Integer inNum; + /** * 超期时间 */ @@ -83,6 +90,10 @@ public class ProductStoreDetial extends BaseEntity { // 质检人 private Long qualityTest; + // 质检人姓名 + @TableField(exist = false) + private String qualityTestName; + // 质检时间 private Date qualityTestDate; diff --git a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/ApplyDetail.java b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/ApplyDetail.java index 0e79668..8d9a635 100644 --- a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/ApplyDetail.java +++ b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/ApplyDetail.java @@ -1,6 +1,7 @@ package org.springblade.lims.goods.entity; +import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -46,12 +47,14 @@ public class ApplyDetail extends BaseEntity { private Long productId; @ApiModelProperty(value = "物品名称") + @ExcelProperty("物品名称") private String productName; @ApiModelProperty(value = "是否危险品") private Integer danger; @ApiModelProperty(value = "申领数量") + @ExcelProperty("申领数量") private Integer applyNum; @ApiModelProperty(value = "实际出库数量") @@ -105,12 +108,14 @@ public class ApplyDetail extends BaseEntity { * 型号 */ @ApiModelProperty(value = "型号") + @ExcelProperty("型号") private String xh; /** * 规格 */ @ApiModelProperty(value = "规格") + @ExcelProperty("规格") private String rule; /** @@ -119,4 +124,40 @@ public class ApplyDetail extends BaseEntity { @ApiModelProperty(value = "物品厂商") private String company; + // 过期时间 + @TableField(exist = false) + private Date beyondTime; + + /** + * 开始时间 + */ + @TableField(exist = false) + private Date startTime; + + /** + * 结束时间 + */ + @TableField(exist = false) + private Date endTime; + + @TableField(exist = false) + @ExcelProperty("品牌") + private String brand; + + @TableField(exist = false) + @ExcelProperty("申领人") + private String applyUser; + + @TableField(exist = false) + @ExcelProperty("备注") + private String remark; + + @TableField(exist = false) + @ExcelProperty("申领时间") + private Date applyTime; + + @TableField(exist = false) + private String applyStatus; + + } diff --git a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Contract.java b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Contract.java index 873bfd4..cf55ca8 100644 --- a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Contract.java +++ b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Contract.java @@ -4,8 +4,6 @@ package org.springblade.lims.goods.entity; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import com.sun.org.apache.xerces.internal.impl.xpath.XPath; -import io.swagger.models.auth.In; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; diff --git a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Goods.java b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Goods.java index db81c95..5bbd9a2 100644 --- a/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Goods.java +++ b/lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/goods/entity/Goods.java @@ -97,7 +97,21 @@ public class Goods extends BaseEntity { @TableField(exist = false) private String sort; - @TableField(exist = false) // 批次数 + @TableField(exist = false) private Integer pNum; + + @TableField(exist = false) + private Date startTime; + + @TableField(exist = false) + private Date endTime; + + // 入库数量 + @TableField(exist = false) + private Integer inNum; + + // 出库数量 + @TableField(exist = false) + private Integer outNum; } diff --git a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Entrust.java b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Entrust.java index 4db8890..70e3691 100644 --- a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Entrust.java +++ b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Entrust.java @@ -1,5 +1,6 @@ package org.springblade.lims.entry; +import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -51,12 +52,19 @@ public class Entrust extends BaseEntity implements Serializable { public Long entrustCustomerId; // 3.受检单位 + @ExcelProperty("养殖场名称(受检单位)") public String entrustCustomerName; + // 3.城市 + @ExcelProperty("城市") + public String city; + // 3.受检单位地址 + @ExcelProperty("养殖场地址(受检单位地址)") public String customeAddress; // 20.送检人 + @ExcelProperty("畜主姓名(送检人)") public String submittedBy; // 4.邮编 @@ -66,6 +74,7 @@ public class Entrust extends BaseEntity implements Serializable { public String facsimile; // 6.联系电话 + @ExcelProperty("联系电话(送检人)") public String phone; // 7.样品来源 @@ -78,9 +87,11 @@ public class Entrust extends BaseEntity implements Serializable { public String simpleState; // 10.样品名称 + @ExcelProperty("样品名称") private String simpleName; // 11.样品数量 + @ExcelProperty("样品数量") public Integer simpleCount; // 12.原始编号 @@ -107,6 +118,7 @@ public class Entrust extends BaseEntity implements Serializable { // 18.接样日期 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ExcelProperty("收样日期") public Date samplingDate; // 19.拟完成时间 @@ -159,6 +171,7 @@ public class Entrust extends BaseEntity implements Serializable { // 采样单位 public String takeCompany; // 联系人 + @ExcelProperty("采样人") public String takePerson; // 采样单位地址 public String takeCompanyAddress; @@ -204,4 +217,11 @@ public class Entrust extends BaseEntity implements Serializable { // 合同编号 private String contractCode; + + @TableField(exist = false) + private Date startTime; + + @TableField(exist = false) + private Date endTime; + } diff --git a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Reagent.java b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Reagent.java index 883dd23..c3c9c58 100644 --- a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Reagent.java +++ b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Reagent.java @@ -68,8 +68,8 @@ public class Reagent extends BaseEntity implements Serializable { // 仪器设备名称 private String instrumentName; - @TableField(exist = false) - private List instrumentList; +// @TableField(exist = false) +// private List instrumentList; private String typeAndOperation; diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/ApplyDetailExcel.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/ApplyDetailExcel.java new file mode 100644 index 0000000..8ed93dc --- /dev/null +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/ApplyDetailExcel.java @@ -0,0 +1,56 @@ + +package org.springblade.lims.capital.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * UserExcel + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class ApplyDetailExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(20) + @ExcelProperty("物品名称") + private String productName; + + @ColumnWidth(20) + @ExcelProperty("申领数量") + private Integer applyNum; + + @ColumnWidth(20) + @ExcelProperty("型号") + private String xh; + + @ColumnWidth(20) + @ExcelProperty("规格") + private String rule; + + @ColumnWidth(20) + @ExcelProperty("品牌") + private String brand; + + @ColumnWidth(20) + @ExcelProperty("申领人") + private String applyUser; + + @ColumnWidth(20) + @ExcelProperty("备注") + private String remark; + + @ColumnWidth(20) + @ExcelProperty("申领时间") + private Date applyTime; + +} diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/DetailExcel.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/DetailExcel.java new file mode 100644 index 0000000..4c8a339 --- /dev/null +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/DetailExcel.java @@ -0,0 +1,47 @@ + +package org.springblade.lims.capital.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serializable; + +/** + * UserExcel + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class DetailExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(20) + @ExcelProperty("入库时间") + private String inPutTime; + + @ColumnWidth(20) + @ExcelProperty("数量") + private Integer inPutCount; + + @ColumnWidth(20) + @ExcelProperty("确认人") + private String inPutPerson; + + @ColumnWidth(20) + @ExcelProperty("出库时间") + private String outPutTime; + + @ColumnWidth(20) + @ExcelProperty("数量") + private Integer outPutCount; + + @ColumnWidth(20) + @ExcelProperty("申领人") + private String outPutPerson; + +} diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/InAndOutExcel.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/InAndOutExcel.java new file mode 100644 index 0000000..517a83e --- /dev/null +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/capital/excel/InAndOutExcel.java @@ -0,0 +1,55 @@ + +package org.springblade.lims.capital.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * UserExcel + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class InAndOutExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(20) + @ExcelProperty("物品名称") + private String name; + + @ColumnWidth(20) + @ExcelProperty("品牌") + private String brand; + + @ColumnWidth(20) + @ExcelProperty("物品厂商") + private String company; + + @ColumnWidth(20) + @ExcelProperty("物品型号") + private String xh; + + @ColumnWidth(20) + @ExcelProperty("物品规格") + private String rule; + + @ColumnWidth(20) + @ExcelProperty("入库数量") + private Integer inNum; + + @ColumnWidth(20) + @ExcelProperty("出库数量") + private Integer outNum; + + @ColumnWidth(20) + @ExcelProperty("库存数量") + private Integer num; +} diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java index 30e025f..cd7e895 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java @@ -418,6 +418,18 @@ public class ApplyController extends BladeController { for (ApplyDetail detail : applyDetails) { if (detail.getOutNum() != null && detail.getReturnNum() != null) { detail.setNeedReturnNum(detail.getOutNum() - detail.getReturnNum()); + + // 批次号及其数量 + String[] split = detail.getBatchNum().split(":"); + + // 条件查询对应的物品详情 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ProductStoreDetial::getGoodsId, detail.getProductId()); + queryWrapper.eq(ProductStoreDetial::getPNum, Integer.parseInt(split[0])); + ProductStoreDetial productStoreDetial = productStoreDetialService.getOne(queryWrapper); + + // 过期时间 + detail.setBeyondTime(productStoreDetial.getBeyondTime()); } } apply1.setDetailList(applyDetails); diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyDetailController.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyDetailController.java index 46d8948..b158bdd 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyDetailController.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyDetailController.java @@ -1,12 +1,33 @@ package org.springblade.lims.goods.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.lims.capital.excel.ApplyDetailExcel; +import org.springblade.lims.goods.entity.Apply; +import org.springblade.lims.goods.entity.ApplyDetail; +import org.springblade.lims.goods.entity.Goods; +import org.springblade.lims.goods.service.IApplyDetailService; +import org.springblade.lims.goods.service.IApplyService; +import org.springblade.lims.goods.service.IGoodsService; +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 javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + /** * 申请明细表 控制器 */ @@ -16,4 +37,65 @@ import org.springframework.web.bind.annotation.RestController; @Api(value = "物品入库接口", tags = "物品入库接口") public class ApplyDetailController extends BladeController { + private final IApplyDetailService applyDetailService; + + private final IGoodsService goodsService; + + /** + * 分页 申领统计 + */ + @GetMapping("/list") + public R list(ApplyDetail apply, Query query) { + IPage page = applyDetailService.tjlist(apply, Condition.getPage(query)); + List details = page.getRecords(); + if (CollectionUtils.isNotEmpty(details)) { + for (ApplyDetail detail : details) { + Goods goods = goodsService.getById(detail.getProductId()); + detail.setBrand(goods.getBrand()); + } + page.setRecords(details); + } + return R.data(page); + } + + /** + * 分页 申领统计 + */ + @GetMapping("/statistics") + public void list(HttpServletResponse response, ApplyDetail apply) { +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// if (StringUtils.isNotBlank(apply.getProductName())) { +// wrapper.and(wq -> wq +// .like(ApplyDetail::getProductName, apply.getProductName()).or() +// .like(ApplyDetail::getBrand, apply.getProductName()).or() +// .like(ApplyDetail::getApplyUser, apply.getProductName())); +// } +// +// if (apply.getStartTime() != null && apply.getEndTime() != null) { +// wrapper.between(ApplyDetail::getCreateTime, apply.getStartTime(), apply.getEndTime()); +// } +// wrapper.orderByDesc(ApplyDetail::getCreateTime); + List details = applyDetailService.listOut(apply); + + List excels = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(details)) { + for (ApplyDetail detail : details) { + ApplyDetailExcel excel = new ApplyDetailExcel(); + Goods goods = goodsService.getById(detail.getProductId()); + if (goods != null) { + excel.setBrand(goods.getBrand()); + } + excel.setApplyUser(detail.getApplyUser()); + excel.setApplyTime(detail.getApplyTime()); + excel.setRemark(detail.getRemark()); + excel.setProductName(detail.getProductName()); + excel.setApplyNum(detail.getApplyNum()); + excel.setXh(detail.getXh()); + excel.setRule(detail.getRule()); + excels.add(excel); + } + } + + ExcelUtil.export(response, "申领信息统计", "申领信息统计", excels, ApplyDetailExcel.class); + } } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ContractController.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ContractController.java index 177c0aa..ce2fc24 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ContractController.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ContractController.java @@ -339,6 +339,7 @@ public class ContractController extends BladeController { productStoreDetial.setPNum(list.size() + 1); productStoreDetial.setGoodsName(contractDetail.getGoodsName()); productStoreDetial.setNum(contractDetail.getNum()); + productStoreDetial.setInNum(contractDetail.getNum()); productStoreDetial.setCompany(contractVO.getSupplierName()); productStoreDetial.setStatus(0); productStoreDetials.add(productStoreDetial); diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java index e70017e..7f0d5f6 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java @@ -1,16 +1,19 @@ package org.springblade.lims.goods.controller; +import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.apache.commons.lang.math.RandomUtils; +import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; @@ -21,15 +24,16 @@ import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.lims.capital.entity.*; +import org.springblade.lims.capital.excel.ApplyDetailExcel; +import org.springblade.lims.capital.excel.DetailExcel; import org.springblade.lims.capital.excel.GoodsExcel; +import org.springblade.lims.capital.excel.InAndOutExcel; import org.springblade.lims.capital.service.IGoodsCheckLogService; import org.springblade.lims.capital.service.IProductClassService; import org.springblade.lims.capital.service.IProductStoreDetialService; -import org.springblade.lims.goods.entity.ApplyDetail; -import org.springblade.lims.goods.entity.Goods; -import org.springblade.lims.goods.entity.InAndOutRecord; -import org.springblade.lims.goods.entity.Report; +import org.springblade.lims.goods.entity.*; import org.springblade.lims.goods.service.IApplyDetailService; +import org.springblade.lims.goods.service.IApplyService; import org.springblade.lims.goods.service.IGoodsService; import org.springblade.lims.goods.service.IReportService; import org.springblade.resource.enums.SysTypeEnum; @@ -41,6 +45,7 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; @@ -73,6 +78,8 @@ public class GoodsController extends BladeController { private final IApplyDetailService applyDetailService; + private final IApplyService applyService; + //物品列表 分页 @GetMapping("/list") public IPage list(Goods goods, Query query) { @@ -105,7 +112,7 @@ public class GoodsController extends BladeController { @GetMapping("/listByPnum") public IPage listByPnum(Goods goods, Query query) { - return goodsService.listByPnum(goods,Condition.getPage(query)); + return goodsService.listByPnum(goods, Condition.getPage(query)); } @@ -643,4 +650,291 @@ public class GoodsController extends BladeController { return R.data(page); } + /** + * 出入库统计 + */ + @GetMapping("/census") + public R census(Goods goods, Query query) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(goods.getName())) { + wrapper.and(wq -> wq + .like(Goods::getName, goods.getName()).or() + .like(Goods::getBrand, goods.getName()).or() + .like(Goods::getCompany, goods.getName())); + } + if (goods.getStartTime() != null && goods.getEndTime() != null) { + wrapper.between(Goods::getCreateTime, goods.getStartTime(), goods.getEndTime()); + } + wrapper.orderByDesc(Goods::getCreateTime); + IPage page = goodsService.page(Condition.getPage(query), wrapper); + List records = page.getRecords(); + if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(records)) { + for (Goods record : records) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ApplyDetail::getProductId, record.getId()); + lqw.eq(ApplyDetail::getIsCk, 1); + List details = applyDetailService.list(lqw); + int outNum = details.stream().mapToInt(ApplyDetail::getOutNum).sum(); + record.setOutNum(outNum); + + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(ProductStoreDetial::getGoodsId, record.getId()); + qw.eq(ProductStoreDetial::getStatus, 1); + List storeDetials = productStoreDetialService.list(qw); + int inNum = storeDetials.stream().mapToInt(ProductStoreDetial::getInNum).sum(); + record.setInNum(inNum); + } + } + return R.data(page); + } + + /** + * 出入库统计详情 + */ + @GetMapping("/censusDetail") + public R censusDetail(String id) { + return R.data(getDetail(id)); + } + + /** + * 出入库统计导出 + */ + @GetMapping("/censusOut") + public void censusOut(HttpServletResponse response, Goods goods) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(goods.getName())) { + wrapper.and(wq -> wq + .like(Goods::getName, goods.getName()).or() + .like(Goods::getBrand, goods.getName()).or() + .like(Goods::getCompany, goods.getName())); + } + if (goods.getStartTime() != null && goods.getEndTime() != null) { + wrapper.between(Goods::getCreateTime, goods.getStartTime(), goods.getEndTime()); + } + wrapper.orderByDesc(Goods::getCreateTime); + List goodsList = goodsService.list(wrapper); + List excels = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(goodsList)) { + for (Goods record : goodsList) { + InAndOutExcel excel = new InAndOutExcel(); + excel.setNum(record.getNum()); + excel.setName(record.getName()); + excel.setBrand(record.getBrand()); + excel.setCompany(record.getCompany()); + excel.setXh(record.getXh()); + excel.setRule(record.getRule()); + + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ApplyDetail::getProductId, record.getId()); + lqw.eq(ApplyDetail::getIsCk, 1); + List details = applyDetailService.list(lqw); + int outNum = details.stream().mapToInt(ApplyDetail::getOutNum).sum(); + excel.setOutNum(outNum); + + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(ProductStoreDetial::getGoodsId, record.getId()); + qw.eq(ProductStoreDetial::getStatus, 1); + List storeDetials = productStoreDetialService.list(qw); + int inNum = storeDetials.stream().mapToInt(ProductStoreDetial::getInNum).sum(); + excel.setInNum(inNum); + + excels.add(excel); + } + } + + ExcelUtil.export(response, "出入库统计", "出入库统计", excels, InAndOutExcel.class); + } + + /** + * 出入库统计详情导出 + */ + @GetMapping("/detailOut") + public void detailOut(HttpServletResponse response, String id) { + Goods goods = getInfo(id); + + Map result = new HashMap(); + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ApplyDetail::getProductId, id); + lqw.eq(ApplyDetail::getIsCk, 1); + lqw.orderByAsc(ApplyDetail::getCkTime); + List details = applyDetailService.list(lqw); + + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(ProductStoreDetial::getGoodsId, id); + qw.eq(ProductStoreDetial::getStatus, 1); + qw.orderByAsc(ProductStoreDetial::getQualityTestDate); + List storeDetials = productStoreDetialService.list(qw); + + int size = Math.max(details.size(), storeDetials.size()); + List> maps = new ArrayList<>(); + if (size > 0) { + for (int i = 0; i < size; i++) { + Map hashMap = new HashMap(); + if (details.size() - 1 >= i) { + ApplyDetail detail = details.get(i); + hashMap.put("outTime", format.format(detail.getCkTime())); + hashMap.put("outCount", detail.getOutNum()); + hashMap.put("outPerson", applyService.getById(detail.getApplyId()).getApplyUser()); + } + if (storeDetials.size() - 1 >= i) { + ProductStoreDetial storeDetial = storeDetials.get(i); + if (storeDetial.getQualityTest() != null && storeDetial.getQualityTestDate() != null) { + hashMap.put("inPerson", userClient.userInfoById(storeDetial.getQualityTest()).getData().getRealName()); + hashMap.put("inTime", format.format(storeDetial.getQualityTestDate())); + } else { + hashMap.put("inPerson", "/"); + hashMap.put("inTime", "/"); + } + hashMap.put("inCount", storeDetial.getInNum()); + } + maps.add(hashMap); + } + } + + result.put("in", maps); + + result.put("name", goods.getName()); + result.put("brand", goods.getBrand()); + result.put("company", goods.getCompany()); + result.put("xh", goods.getXh()); + result.put("rule", goods.getRule()); + result.put("inNum", storeDetials.stream().mapToInt(ProductStoreDetial::getInNum).sum()); + result.put("outNum", details.stream().mapToInt(ApplyDetail::getOutNum).sum()); + result.put("num", goods.getNum()); + + //模板地址 + String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "goodsDetailPrint"); +// String handleUrl = "C://Users//AAA//Desktop//烁今//打印模板//委托单(模板).docx"; + + XWPFDocument doc = null; +// FileOutputStream fos = null; + try { + doc = WordExportUtil.exportWord07(url, result); +// fos = new FileOutputStream("C://Users//AAA//Desktop//shuojin//dayin//委托单.docx"); + String filename = "测试.docx"; + + response.setContentType("application/octet-stream"); + response.setHeader("content-disposition", "attachment;filename=12344.docx"); + doc.write(response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } finally { +// if (null != doc) { +//// doc.close(); +// try { +// doc.write(fos); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// if (null != fos) { +// try { +// fos.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } + if (null != doc) { + try { + doc.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + } + + private Goods getInfo(String id) { + Goods goods = goodsService.getById(id); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ApplyDetail::getProductId, goods.getId()); + lqw.eq(ApplyDetail::getIsCk, 1); + List details = applyDetailService.list(lqw); + int outNum = details.stream().mapToInt(ApplyDetail::getOutNum).sum(); + goods.setOutNum(outNum); + + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(ProductStoreDetial::getGoodsId, goods.getId()); + qw.eq(ProductStoreDetial::getStatus, 1); + List storeDetials = productStoreDetialService.list(qw); + int inNum = storeDetials.stream().mapToInt(ProductStoreDetial::getNum).sum(); + goods.setInNum(inNum); + return goods; + } + + private Map getDetail(String id) { + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + Map map = new HashMap(); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ApplyDetail::getProductId, id); + lqw.eq(ApplyDetail::getIsCk, 1); + lqw.orderByAsc(ApplyDetail::getCkTime); + List details = applyDetailService.list(lqw); + + List> mapList = new ArrayList<>(); + if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(details)) { + for (ApplyDetail detail : details) { + Map hashMap = new HashMap(); + hashMap.put("outTime", format.format(detail.getCkTime())); + hashMap.put("outCount", detail.getOutNum()); + hashMap.put("outPerson", applyService.getById(detail.getApplyId()).getApplyUser()); + mapList.add(hashMap); + } + } + map.put("out", mapList); + + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(ProductStoreDetial::getGoodsId, id); + qw.eq(ProductStoreDetial::getStatus, 1); + qw.orderByAsc(ProductStoreDetial::getQualityTestDate); + List storeDetials = productStoreDetialService.list(qw); + +// int size = Math.max(details.size(), storeDetials.size()); +// List> maps = new ArrayList<>(); +// if (size > 0) { +// for (int i = 0; i < size; i++) { +// Map hashMap = new HashMap(); +// if (details.size() - 1 >= i) { +// ApplyDetail detail = details.get(i); +// hashMap.put("outTime", format.format(detail.getCkTime())); +// hashMap.put("outCount", detail.getOutNum()); +// hashMap.put("outPerson", applyService.getById(detail.getApplyId()).getApplyUser()); +// } +// if (storeDetials.size() - 1 >= i) { +// ProductStoreDetial storeDetial = storeDetials.get(i); +// if (storeDetial.getQualityTest() != null && storeDetial.getQualityTestDate() != null) { +// hashMap.put("inPerson", userClient.userInfoById(storeDetial.getQualityTest()).getData().getRealName()); +// hashMap.put("inTime", format.format(storeDetial.getQualityTestDate())); +// } else { +// hashMap.put("inPerson", "/"); +// hashMap.put("inTime", "/"); +// } +// hashMap.put("inCount", storeDetial.getInNum()); +// } +// maps.add(hashMap); +// } +// } + + List> maps = new ArrayList<>(); + if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(storeDetials)) { + for (ProductStoreDetial storeDetial : storeDetials) { + Map hashMap = new HashMap(); + if (storeDetial.getQualityTest() != null && storeDetial.getQualityTestDate() != null) { + hashMap.put("inPerson", userClient.userInfoById(storeDetial.getQualityTest()).getData().getRealName()); + hashMap.put("inTime", format.format(storeDetial.getQualityTestDate())); + } else { + hashMap.put("inPerson", "/"); + hashMap.put("inTime", "/"); + } + hashMap.put("inCount", storeDetial.getInNum()); + maps.add(hashMap); + } + } + map.put("in", maps); + return map; + } + } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/AppleDetailMapper.xml b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/AppleDetailMapper.xml new file mode 100644 index 0000000..ccf6915 --- /dev/null +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/AppleDetailMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + \ No newline at end of file diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/ApplyDetailMapper.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/ApplyDetailMapper.java index 6b24a45..58739ca 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/ApplyDetailMapper.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/mapper/ApplyDetailMapper.java @@ -2,12 +2,19 @@ package org.springblade.lims.goods.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; import org.springblade.lims.goods.entity.Apply; import org.springblade.lims.goods.entity.ApplyDetail; +import java.util.List; + /** * 申请明细表 Mapper 接口 */ public interface ApplyDetailMapper extends BaseMapper { + List tjlist(IPage page, ApplyDetail apply); + + List listOut(@Param(value = "apply") ApplyDetail apply); } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IApplyDetailService.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IApplyDetailService.java index b764065..c6a537f 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IApplyDetailService.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IApplyDetailService.java @@ -1,8 +1,15 @@ package org.springblade.lims.goods.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; import org.springblade.lims.goods.entity.Apply; import org.springblade.lims.goods.entity.ApplyDetail; +import java.util.List; + public interface IApplyDetailService extends BaseService { + IPage tjlist(ApplyDetail apply, IPage page); + + List listOut(ApplyDetail apply); } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IGoodsService.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IGoodsService.java index c47b4c1..63634e1 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IGoodsService.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/IGoodsService.java @@ -2,8 +2,12 @@ package org.springblade.lims.goods.service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; import org.springblade.lims.goods.entity.Goods; +import java.util.List; +import java.util.Map; + public interface IGoodsService extends BaseService { IPage listByPnum(Goods goods,IPage page); } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyDetailServiceImpl.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyDetailServiceImpl.java index 20870e3..9305f3c 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyDetailServiceImpl.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyDetailServiceImpl.java @@ -1,16 +1,27 @@ package org.springblade.lims.goods.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import lombok.AllArgsConstructor; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; import org.springblade.lims.goods.entity.Apply; import org.springblade.lims.goods.entity.ApplyDetail; +import org.springblade.lims.goods.entity.Goods; import org.springblade.lims.goods.mapper.ApplyDetailMapper; import org.springblade.lims.goods.mapper.ApplyMapper; import org.springblade.lims.goods.service.IApplyDetailService; import org.springblade.lims.goods.service.IApplyService; +import org.springblade.lims.goods.service.IGoodsService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 申请表 服务实现类 */ @@ -18,4 +29,16 @@ import org.springframework.stereotype.Service; @AllArgsConstructor public class ApplyDetailServiceImpl extends BaseServiceImpl implements IApplyDetailService { + private final ApplyDetailMapper applyDetailMapper; + + @Override + public IPage tjlist(ApplyDetail apply, IPage page) { + List details = applyDetailMapper.tjlist(page, apply); + return page.setRecords(details); + } + + @Override + public List listOut(ApplyDetail apply) { + return applyDetailMapper.listOut(apply); + } } diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyServiceImpl.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyServiceImpl.java index 6ca0b5a..83d2853 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyServiceImpl.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/ApplyServiceImpl.java @@ -58,6 +58,8 @@ public class ApplyServiceImpl extends BaseServiceImpl implem queryWrapper.eq(ApplyDetail::getApplyId, id); List details = applyDetailService.list(queryWrapper); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Long aLong = Long.valueOf(id); //需要批量生成的map @@ -75,13 +77,27 @@ public class ApplyServiceImpl extends BaseServiceImpl implem map.put("count", detail.getApplyNum()); // 物品单位 map.put("unit", detail.getUnit()); + // 品牌 + map.put("brand", goodsService.getById(detail.getProductId()).getBrand()); + + // 批次号及其数量 + String[] split = detail.getBatchNum().split(":"); + + // 条件查询对应的物品详情 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ProductStoreDetial::getGoodsId, detail.getProductId()); + wrapper.eq(ProductStoreDetial::getPNum, Integer.parseInt(split[0])); + ProductStoreDetial productStoreDetial = productStoreDetialService.getOne(wrapper); + + // 过期时间 + map.put("beyondTime", format.format(productStoreDetial.getBeyondTime())); resultList.add(map); } Map result = new HashMap<>(); // 申领人 result.put("applyUser", apply.getApplyUser()); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + // 申领时间 result.put("applyTime", format.format(apply.getApplyTime())); // 审批人 diff --git a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/GoodsServiceImpl.java b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/GoodsServiceImpl.java index 11b7271..ba08fed 100644 --- a/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/GoodsServiceImpl.java +++ b/lab-service/lab-capital/src/main/java/org/springblade/lims/goods/service/impl/GoodsServiceImpl.java @@ -1,14 +1,29 @@ package org.springblade.lims.goods.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import lombok.AllArgsConstructor; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.lims.capital.entity.ProductStoreDetial; +import org.springblade.lims.capital.service.IGoodsCheckLogService; +import org.springblade.lims.capital.service.IProductStoreDetialService; +import org.springblade.lims.goods.entity.ApplyDetail; import org.springblade.lims.goods.entity.Goods; import org.springblade.lims.goods.mapper.GoodsMapper; +import org.springblade.lims.goods.service.IApplyDetailService; +import org.springblade.lims.goods.service.IApplyService; import org.springblade.lims.goods.service.IGoodsService; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import java.text.SimpleDateFormat; +import java.util.*; + /** * 物品表 服务实现类 */ @@ -17,7 +32,7 @@ import org.springframework.stereotype.Service; public class GoodsServiceImpl extends BaseServiceImpl implements IGoodsService { private final GoodsMapper goodsMapper; @Override - public IPage listByPnum(Goods goods, IPage page){ - return goodsMapper.listByPnum(goods,page); + public IPage listByPnum(Goods goods, IPage page) { + return goodsMapper.listByPnum(goods, page); } } diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java index f2410d1..1c5157b 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java @@ -28,8 +28,10 @@ import org.apache.commons.lang3.RandomUtils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springblade.common.utils.ZipCompressUtil; +import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.lims.entry.*; +import org.springblade.lims.excel.EntrustExcel; import org.springblade.lims.mapper.EntrustMapper; import org.springblade.lims.service.*; import lombok.AllArgsConstructor; @@ -64,6 +66,7 @@ import java.util.stream.Collectors; /** * 委托单 + * * @author swj * @since 2022年5月28日14:33:30 */ @@ -603,23 +606,49 @@ public class EntrustController extends BladeController { examineResult.setContent(examineBasis.getContent()); } } - String reagentId = examineResult.getReagentId(); - if (reagentId != null) { - String[] split = reagentId.split(","); +// String reagentId = examineResult.getReagentId(); +// if (reagentId != null) { +// String[] split = reagentId.split(","); +// String name = ""; +// String manufacturer = ""; +// String batchNo = ""; +// for (int i = 0; i < split.length; i++) { +// Reagent reagent = reagentService.getById(split[i]); +// if (reagent != null) { +// if (i == split.length - 1) { +// name += reagent.getName(); +// manufacturer += reagent.getManufacturer(); +// batchNo += reagent.getBatchNo(); +// } else { +// name += reagent.getName() + ","; +// manufacturer += reagent.getManufacturer() + ","; +// batchNo += reagent.getBatchNo() + ","; +// } +// } +// } +// examineResult.setReagentName(name); +// examineResult.setReagentManufacturerName(manufacturer); +// examineResult.setReagentBatchNo(batchNo); +// } + + String batchNos = examineResult.getBatchNos(); + if (batchNos != null) { + String[] split = batchNos.split(","); String name = ""; String manufacturer = ""; String batchNo = ""; for (int i = 0; i < split.length; i++) { - Reagent reagent = reagentService.getById(split[i]); + String[] split1 = split[i].split("-"); + Reagent reagent = reagentService.getById(split1[0]); if (reagent != null) { if (i == split.length - 1) { name += reagent.getName(); manufacturer += reagent.getManufacturer(); - batchNo += reagent.getBatchNo(); + batchNo += split1[1]; } else { name += reagent.getName() + ","; manufacturer += reagent.getManufacturer() + ","; - batchNo += reagent.getBatchNo() + ","; + batchNo += split1[1] + ","; } } } @@ -627,6 +656,7 @@ public class EntrustController extends BladeController { examineResult.setReagentManufacturerName(manufacturer); examineResult.setReagentBatchNo(batchNo); } + String instrumentId = examineResult.getInstrumentId(); if (instrumentId != null) { String name = ""; @@ -652,13 +682,15 @@ public class EntrustController extends BladeController { } // 1.先拿到批次号 - String batchNos = examineResult.getBatchNos(); if (batchNos != null && !"".equals(batchNos)) { String[] split3 = batchNos.split(","); Map> tempListMap = new HashMap(); for (String batch : split3) { String reagenId = batch.split("-")[0]; - String realBatch = batch.split("-")[1]; + String realBatch = ""; + if (StringUtils.isNotBlank(batch.split("-")[1])) { + realBatch = batch.split("-")[1]; + } List list = tempListMap.get(reagenId); if (CollectionUtils.isNotEmpty(list)) { list.add(realBatch); @@ -703,6 +735,7 @@ public class EntrustController extends BladeController { // 修改检测状态为通过 Examine examine = examineService.getById(id); examine.setStatus(1); + examine.setFinishTime(new Date()); examineService.updateById(examine); // 添加检测结果的校核人和校核时间 @@ -1026,7 +1059,7 @@ public class EntrustController extends BladeController { acceptance = "SDCADC-W-" + year + (entrusts.size() + 1); } } - if ("2".equals(number)) { + else if ("2".equals(number)) { if (entrusts.size() >= 0 && entrusts.size() < 9) { acceptance = "SDCADC-J-" + year + "000" + (entrusts.size() + 1); } @@ -1040,7 +1073,7 @@ public class EntrustController extends BladeController { acceptance = "SDCADC-J-" + year + (entrusts.size() + 1); } } - if ("3".equals(number)) { + else if ("3".equals(number)) { if (entrusts.size() >= 0 && entrusts.size() < 9) { acceptance = "SDCADC-Z-" + year + "000" + (entrusts.size() + 1); } @@ -1054,7 +1087,7 @@ public class EntrustController extends BladeController { acceptance = "SDCADC-Z-" + year + (entrusts.size() + 1); } } - if ("4".equals(number)) { + else if ("4".equals(number)) { if (entrusts.size() >= 0 && entrusts.size() < 9) { acceptance = "SDCADC-S-" + year + "000" + (entrusts.size() + 1); } @@ -1068,6 +1101,20 @@ public class EntrustController extends BladeController { acceptance = "SDCADC-S-" + year + (entrusts.size() + 1); } } + else if ("5".equals(number)) { + if (entrusts.size() >= 0 && entrusts.size() < 9) { + acceptance = "SDCADC-BD-" + year + "000" + (entrusts.size() + 1); + } + if (entrusts.size() >= 9 && entrusts.size() < 99) { + acceptance = "SDCADC-BD-" + year + "00" + (entrusts.size() + 1); + } + if (entrusts.size() >= 99 && entrusts.size() < 999) { + acceptance = "SDCADC-BD-" + year + "0" + (entrusts.size() + 1); + } + if (entrusts.size() >= 999 && entrusts.size() < 9999) { + acceptance = "SDCADC-BD-" + year + (entrusts.size() + 1); + } + } return acceptance; } @@ -1650,4 +1697,60 @@ public class EntrustController extends BladeController { } return R.status(contractService.updateById(contract)); } + + /** + * 委托单统计 + */ + @GetMapping("/statistics") + public R statistics(Entrust entry, Query query) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(entry.getAcceptanceNum())) { + wrapper.like(Entrust::getAcceptanceNum, entry.getAcceptanceNum()); +// wrapper.and(wq -> wq +// .like(Entrust::getAcceptanceNum, entry.getAcceptanceNum()).or() +// .like(Entrust::getAcceptanceNum, entry.getAcceptanceNum())); + } + if (entry.getStartTime() != null && entry.getEndTime() != null) { + wrapper.between(Entrust::getCreateTime, entry.getStartTime(), entry.getEndTime()); + } + wrapper.ne(Entrust::getEntrustStatus, "-1"); + wrapper.orderByDesc(Entrust::getCreateTime); + IPage page = service.page(Condition.getPage(query), wrapper); + return R.data(page); + } + + @GetMapping("/exportStatistics") + public void exportStatistics(HttpServletResponse response, Entrust entry) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(entry.getAcceptanceNum())) { + wrapper.like(Entrust::getAcceptanceNum, entry.getAcceptanceNum()); +// wrapper.and(wq -> wq +// .like(Entrust::getAcceptanceNum, entry.getAcceptanceNum()).or() +// .like(Entrust::getAcceptanceNum, entry.getAcceptanceNum())); + } + if (entry.getStartTime() != null && entry.getEndTime() != null) { + wrapper.between(Entrust::getCreateTime, entry.getStartTime(), entry.getEndTime()); + } + wrapper.ne(Entrust::getEntrustStatus, "-1"); + wrapper.orderByDesc(Entrust::getCreateTime); + List entrusts = service.list(wrapper); + List excels = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(entrusts)) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + for (Entrust entrust : entrusts) { + EntrustExcel excel = new EntrustExcel(); + excel.setAcceptanceNum(entrust.getAcceptanceNum()); + excel.setCity(entrust.getCity()); + excel.setCustomeAddress(entrust.getCustomeAddress()); + excel.setPhone(entrust.getPhone()); + excel.setSamplingDate(format.format(entrust.getSamplingDate())); + excel.setSimpleCount(entrust.getSimpleCount()); + excel.setSimpleName(entrust.getSimpleName()); + excel.setSubmittedBy(entrust.getSubmittedBy()); + excel.setTakePerson(entrust.getTakePerson()); + excels.add(excel); + } + } + ExcelUtil.export(response, "委托单统计", "委托单", excels, EntrustExcel.class); + } } diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineController.java index 2f2bd98..d5d70a5 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineController.java @@ -122,7 +122,7 @@ public class ExamineController extends BladeController { Examine examine = examineService.getById(id); Entrust entrust = service.getById(examine.getEntrustId()); // 字典获取样品处理方式 - String sampleHandling = DictBizCache.getKey(DictBizEnum.SAMPLE_HANDLING.getName(), examine.getSimpleName().split("-")[1]); + String sampleHandling = DictBizCache.getValue(DictBizEnum.SAMPLE_HANDLING.getName(), examine.getSimpleName().split("-")[1]); examine.setSampleHandling(sampleHandling); examine.setSimpleStatus(entrust.getSimpleState()); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineItemController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineItemController.java index 1dff7f5..ffd67e7 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineItemController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineItemController.java @@ -243,16 +243,16 @@ public class ExamineItemController extends BladeController { } if (CollectionUtils.isNotEmpty(reagentList)) { for (Reagent reagent : reagentList) { - List instrumentList = new ArrayList<>(); - if (reagent != null && reagent.getInstrumentId() != null && !"".equals(reagent.getInstrumentId())) { - // 根据仪器id查数据 - String[] split1 = reagent.getInstrumentId().split(","); - for (String s1 : split1) { - Instrument instrument = instrumentService.getById(s1); - instrumentList.add(instrument); - } - } - reagent.setInstrumentList(instrumentList); +// List instrumentList = new ArrayList<>(); +// if (reagent != null && reagent.getInstrumentId() != null && !"".equals(reagent.getInstrumentId())) { +// // 根据仪器id查数据 +// String[] split1 = reagent.getInstrumentId().split(","); +// for (String s1 : split1) { +// Instrument instrument = instrumentService.getById(s1); +// instrumentList.add(instrument); +// } +// } +// reagent.setInstrumentList(instrumentList); List list = JSON.parseArray(reagent.getTypeAndOperation(), TypeAndOperation.class); reagent.setOperationList(list); } diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java index 673d27e..ccc5258 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java @@ -4,13 +4,13 @@ package org.springblade.lims.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.alibaba.nacos.common.utils.CollectionUtils; -import com.alibaba.nacos.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; @@ -97,9 +97,9 @@ public class ExamineResultController extends BladeController { } else if ("3".equals(examineWay.getInputMode())) { return ktyExcel(file, examineId); } -// else if ("4".equals(examineWay.getInputMode())) { -// return pcrExcel(file, examineId); -// } + else if ("8".equals(examineWay.getInputMode())) { + return shjdExcel(file, examineId); + } else if ("5".equals(examineWay.getInputMode())) { return xnExcel(file, examineId); } else { @@ -107,6 +107,38 @@ public class ExamineResultController extends BladeController { } } + private R shjdExcel(MultipartFile file, String examineId) throws Exception { + List read = ExcelUtil.read(file, BiochemicalIdentificationExcel.class); + if (read != null && read.size() > 0) { + for (BiochemicalIdentificationExcel excel : read) { + if ("+".equals(excel.getValue())) { + excel.setResult("阳性"); + } else if ("-".equals(excel.getValue())) { + excel.setResult("阴性"); + } else if (excel.getValue() == null || "".equals(excel.getValue())) { + throw new Exception("有样品未填写的对应的结果!"); + } + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examineId); + ExamineResult result = service.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(read)); + result.setOriginRecordResult(JSON.toJSONString(read)); + result.setExamineDataArr(JSON.toJSONString(read)); + service.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examineId)); + examineResult.setOriginRecordData(JSON.toJSONString(read)); + examineResult.setOriginRecordResult(JSON.toJSONString(read)); + examineResult.setExamineDataArr(JSON.toJSONString(read)); + service.save(examineResult); + } + } + return R.data(read); + } + /** * 普通Excel解析数据 review start **/ @@ -299,7 +331,7 @@ public class ExamineResultController extends BladeController { int index = (n - 1) * 8 + m + 1; //n是列,m是行 ,我们定义index是一列列的定义 System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + m); System.out.println("-------------------"); - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (xStart <= index && index <= xEnd) { params.put(x, code); String value = FormulaTool.getResult(reg, params); @@ -474,7 +506,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { mapResult.put("originResult", code); // 直接给原始数据值,因为没有SP值 @@ -573,7 +605,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { mapResult.put("originResult", code); mapResult.put("value", code); @@ -667,7 +699,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if ((v2 - v1) != 0) { SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); @@ -766,7 +798,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if ((v2 - v1) != 0) { SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); @@ -859,7 +891,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { String PB = df.format(100 - Double.parseDouble(code) / v1 * 100); mapResult.put("originResult", code); @@ -951,7 +983,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { PI = df.format((v1 - Double.parseDouble(code)) / v1); @@ -1048,7 +1080,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { SN = df.format((Double.parseDouble(code) - v2) / (v1 - v2)); @@ -1147,7 +1179,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if ((v2 - v1) != 0) { SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); @@ -1179,6 +1211,103 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } + // 猪繁殖与呼吸综合征病毒抗体检测试剂盒(爱德士IDEXX) + else if ("1659464963116519426".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + double code3 = Double.parseDouble(excels.get(2).getCode1()); + double code4 = Double.parseDouble(excels.get(3).getCode1()); + double v1 = (code1 + code2) / 2; + double v2 = (code3 + code4) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SP = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if ((v2 - v1) != 0) { + SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); + } + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.4) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } // 猪繁殖与呼吸综合征病毒间接ELISA抗体检测试剂盒 else if ("1582988982068027393".equals(reagentId)) { for (int i = 0; i < group; i++) { @@ -1243,7 +1372,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v2 != 0) { SP = df.format((Double.parseDouble(code) / v2)); @@ -1337,7 +1466,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { SP = df.format(1 - (Double.parseDouble(code) / v1)); @@ -1433,7 +1562,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { SN = df.format(Double.parseDouble(code) / v1); @@ -1532,7 +1661,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if ((v2 - v1) != 0) { SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); @@ -1631,15 +1760,299 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v2 != 0) { - KQ = df.format(Double.parseDouble(code) / v2 * 100); + KQ = df.format((Double.parseDouble(code) - v1) / (v2 - v1) * 100); } mapResult.put("originResult", code); mapResult.put("value", KQ); mapResult.put("num", "1"); - if (Double.parseDouble(KQ) >= 20) { + if (Double.parseDouble(KQ) >= 40) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 猪伪狂犬病病毒ELISA抗体检测试剂盒---武汉科前生物股份有限公司 + else if ("1570295846749270017".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + double v1 = (code1 + code2) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SN = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) <= 0.6) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SN) > 0.7) { + mapResult.put("result", "阴性"); + } else { + mapResult.put("result", "可疑"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 牛布鲁氏菌间接ELISA抗体检测试剂盒---浙江迪恩生物科技股份有限公司 + else if ("1570297916894146562".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(2).getCode1()); + double code2 = Double.parseDouble(excels.get(3).getCode1()); + double v2 = (code1 + code2) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SP = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + SP = df.format(Double.parseDouble(code) / v2); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.2) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(牛)---洛阳莱普生信息科技有限公司 + else if ("1570664922961080322".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + double v1 = (code1 + code2) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SN = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) < 0.5) { mapResult.put("result", "阳性"); } else { mapResult.put("result", "阴性"); @@ -1661,8 +2074,8 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } - // 猪伪狂犬病病毒ELISA抗体检测试剂盒---武汉科前生物股份有限公司 - else if ("1570295846749270017".equals(reagentId)) { + // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(羊)---洛阳莱普生信息科技有限公司 + else if ("1570666622551781378".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); @@ -1725,7 +2138,7 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { SN = df.format(Double.parseDouble(code) / v1); @@ -1733,12 +2146,10 @@ public class ExamineResultController extends BladeController { mapResult.put("originResult", code); mapResult.put("value", Double.parseDouble(SN)); mapResult.put("num", "1"); - if (Double.parseDouble(SN) <= 0.6) { + if (Double.parseDouble(SN) < 0.3) { mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SN) > 0.7) { - mapResult.put("result", "阴性"); } else { - mapResult.put("result", "可疑"); + mapResult.put("result", "阴性"); } } else { mapResult.put("originResult", code); @@ -1757,14 +2168,14 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } - // 牛布鲁氏菌间接ELISA抗体检测试剂盒---浙江迪恩生物科技股份有限公司 - else if ("1570297916894146562".equals(reagentId)) { + // 口蹄疫病毒非结构蛋白3ABC阻断ELISA抗体检测试剂盒---兰州兽研生物科技有限公司 + else if ("1533624738296389636".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); - double code1 = Double.parseDouble(excels.get(2).getCode1()); - double code2 = Double.parseDouble(excels.get(3).getCode1()); - double v2 = (code1 + code2) / 2; + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + double v1 = (code1 + code2) / 2; DecimalFormat df = new DecimalFormat("#0.000"); for (int j = 0; j < excels.size(); j++) { // 行标头:前端渲染需要A、B、C.... @@ -1775,7 +2186,7 @@ public class ExamineResultController extends BladeController { Map> map2 = new HashMap<>(); - String SP = "0.00"; + String PI = "0.00"; for (int n = 1; n <= filedsLength; n++) { String code; switch (n) { @@ -1821,15 +2232,15 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { - if (v2 != 0) { - SP = df.format(Double.parseDouble(code) / v2); + if (v1 != 0) { + PI = df.format((v1 - Double.parseDouble(code)) / v1); } mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); mapResult.put("num", "1"); - if (Double.parseDouble(SP) >= 0.2) { + if (Double.parseDouble(PI) >= 0.5) { mapResult.put("result", "阳性"); } else { mapResult.put("result", "阴性"); @@ -1851,8 +2262,8 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } - // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(牛)---洛阳莱普生信息科技有限公司 - else if ("1570664922961080322".equals(reagentId)) { + // 布鲁氏菌 CELISA 抗体检测试剂盒---青岛立见生物科技有限公司 + else if ("1665968083879366657".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); @@ -1869,7 +2280,7 @@ public class ExamineResultController extends BladeController { Map> map2 = new HashMap<>(); - String SN = "0.00"; + String PI = "0.00"; for (int n = 1; n <= filedsLength; n++) { String code; switch (n) { @@ -1915,15 +2326,15 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); + PI = df.format((v1 - Double.parseDouble(code)) / v1); } mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); mapResult.put("num", "1"); - if (Double.parseDouble(SN) < 0.5) { + if (Double.parseDouble(PI) > 0.5) { mapResult.put("result", "阳性"); } else { mapResult.put("result", "阴性"); @@ -1945,8 +2356,8 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } - // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(羊)---洛阳莱普生信息科技有限公司 - else if ("1570666622551781378".equals(reagentId)) { + // 布鲁氏菌 CELISA 抗体检测试剂盒---科前生物 + else if ("1665964229817307138".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); @@ -1963,7 +2374,7 @@ public class ExamineResultController extends BladeController { Map> map2 = new HashMap<>(); - String SN = "0.00"; + String PI = "0.00"; for (int n = 1; n <= filedsLength; n++) { String code; switch (n) { @@ -2009,15 +2420,15 @@ public class ExamineResultController extends BladeController { Map mapResult = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); + PI = df.format((v1 - Double.parseDouble(code)) / v1); } mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); mapResult.put("num", "1"); - if (Double.parseDouble(SN) < 0.3) { + if (Double.parseDouble(PI) >= 0.3) { mapResult.put("result", "阳性"); } else { mapResult.put("result", "阴性"); @@ -2039,14 +2450,14 @@ public class ExamineResultController extends BladeController { map1.put("g" + (i + 1), mapList); } } - // 口蹄疫病毒非结构蛋白3ABC阻断ELISA抗体检测试剂盒---兰州兽研生物科技有限公司 - else if ("1533624738296389636".equals(reagentId)) { + // 牛结核病γ-干扰素ELISA检测试剂盒---广州悦洋生物技术有限公司 + else if ("1631222146321997826".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); - double code1 = Double.parseDouble(excels.get(0).getCode1()); - double code2 = Double.parseDouble(excels.get(1).getCode1()); - double v1 = (code1 + code2) / 2; +// double code1 = Double.parseDouble(excels.get(0).getCode1()); +// double code2 = Double.parseDouble(excels.get(1).getCode1()); +// double v1 = (code1 + code2) / 2; DecimalFormat df = new DecimalFormat("#0.000"); for (int j = 0; j < excels.size(); j++) { // 行标头:前端渲染需要A、B、C.... @@ -2057,76 +2468,145 @@ public class ExamineResultController extends BladeController { Map> map2 = new HashMap<>(); - String PI = "0.00"; + // 一行有四组数据,一组数据对应一个样品,一个样品做三次实验,有三个结果(牛型PPD,禽型PPD,PBS抗原) for (int n = 1; n <= filedsLength; n++) { + int num; String code; + String code1; + String code2; + String code3; switch (n) { case 1: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); code = examineExcel.getCode1(); + num = 0; break; case 2: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); code = examineExcel.getCode2(); + num = 0; break; case 3: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); code = examineExcel.getCode3(); + num = 0; break; case 4: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); code = examineExcel.getCode4(); + num = 1; break; case 5: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); code = examineExcel.getCode5(); + num = 1; break; case 6: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); code = examineExcel.getCode6(); + num = 1; break; case 7: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); code = examineExcel.getCode7(); + num = 2; break; case 8: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); code = examineExcel.getCode8(); + num = 2; break; case 9: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); code = examineExcel.getCode9(); + num = 2; break; case 10: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); code = examineExcel.getCode10(); + num = 3; break; case 11: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); code = examineExcel.getCode11(); + num = 3; break; case 12: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); code = examineExcel.getCode12(); + num = 3; break; default: + code1 = "0"; + code2 = "0"; + code3 = "0"; code = "0"; + num = 0; } Map mapResult = new HashMap<>(); + Map mapResult1 = new HashMap<>(); int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - if (StringUtil.isNoneBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - PI = df.format((v1 - Double.parseDouble(code)) / v1); - } + double v1 = 0; + double v2 = 0; + if (StringUtils.isNotBlank(code1) && StringUtils.isNotBlank(code2) && StringUtils.isNotBlank(code3)) { + if (j > 1 || n > 3) { + v1 = Double.parseDouble(code1) - Double.parseDouble(code3); + v2 = Double.parseDouble(code1) - Double.parseDouble(code2); mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(PI) >= 0.5) { + mapResult1.put("originResult", code); + mapResult.put("value", code); + mapResult1.put("value", df.format(v1) + "," + df.format(v2)); + int indexNum = (i * 32) + (num * 8 + j) - ((i + 1) * 2); + mapResult.put("num", split[indexNum]); + mapResult1.put("num", split[indexNum]); + if (v1 >= 0.2 && v2 >= 0.2) { mapResult.put("result", "阳性"); + mapResult1.put("result", "阳性"); } else { mapResult.put("result", "阴性"); + mapResult1.put("result", "阴性"); } } else { mapResult.put("originResult", code); + mapResult1.put("originResult", code); mapResult.put("num", ""); + mapResult1.put("num", ""); } } else { mapResult.put("originResult", ""); + mapResult1.put("originResult", ""); mapResult.put("num", ""); + mapResult1.put("num", ""); } mapResult.put("order", index + i * 96); + mapResult1.put("order", index + i * 96); map2.put(a + n, mapResult); - list.add(mapResult); + list.add(mapResult1); } mapList.add(map2); } @@ -2134,7 +2614,7 @@ public class ExamineResultController extends BladeController { } } // 牛结核病γ-干扰素ELISA检测试剂盒---武汉科前生物股份有限公司 - else if ("1570297053211455490".equals(reagentId) || "1631222146321997826".equals(reagentId)) { + else if ("1570297053211455490".equals(reagentId)) { for (int i = 0; i < group; i++) { List>> mapList = new ArrayList<>(); List excels = map.get(i + 1 + ""); @@ -2256,15 +2736,15 @@ public class ExamineResultController extends BladeController { int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 double v1 = 0; double v2 = 0; - if (StringUtil.isNoneBlank(code1) && StringUtil.isNoneBlank(code2) && StringUtil.isNoneBlank(code3)) { - if (j > 1 || n > 3) { + if (StringUtils.isNotBlank(code1) && StringUtils.isNotBlank(code2) && StringUtils.isNotBlank(code3)) { + if (j < 6 || n < 10) { v1 = Double.parseDouble(code1) - Double.parseDouble(code3); v2 = Double.parseDouble(code1) - Double.parseDouble(code2); mapResult.put("originResult", code); mapResult1.put("originResult", code); mapResult.put("value", code); mapResult1.put("value", df.format(v1) + "," + df.format(v2)); - int indexNum = (i * 32) + (num * 8 + j) - ((i + 1) * 2); + int indexNum = (i * 32) + (num * 8 + j); mapResult.put("num", split[indexNum]); mapResult1.put("num", split[indexNum]); if (v1 >= 0.2 && v2 >= 0.2) { @@ -2274,22 +2754,118 @@ public class ExamineResultController extends BladeController { mapResult.put("result", "阴性"); mapResult1.put("result", "阴性"); } - } else { + } + } else { + if (StringUtils.isNotBlank(code)) { mapResult.put("originResult", code); mapResult1.put("originResult", code); mapResult.put("num", ""); mapResult1.put("num", ""); + } else { + mapResult.put("originResult", ""); + mapResult1.put("originResult", ""); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } + } + mapResult.put("order", index + i * 96); + mapResult1.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult1); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 羊小反刍兽疫病毒 ELISA抗体检测试剂盒---真瑞生物 + else if ("1656852607882579970".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + double v1 = (code1 + code2) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SN = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) > 0.7) { + mapResult.put("result", "阴性"); + } else { + mapResult.put("result", "阳性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); } } else { mapResult.put("originResult", ""); - mapResult1.put("originResult", ""); mapResult.put("num", ""); - mapResult1.put("num", ""); } mapResult.put("order", index + i * 96); - mapResult1.put("order", index + i * 96); map2.put(a + n, mapResult); - list.add(mapResult1); + list.add(mapResult); } mapList.add(map2); } @@ -2864,7 +3440,7 @@ public class ExamineResultController extends BladeController { int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + j); System.out.println("-------------------"); - if (StringUtil.isNoneBlank(code)) { + if (StringUtils.isNotBlank(code)) { if (xStart <= index && index <= xEnd) { params.put(x, code); String value = FormulaTool.getResult(reg, params); @@ -3314,7 +3890,7 @@ public class ExamineResultController extends BladeController { ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); List read = ExcelUtil.read(file, ExamineTemplate2Excel.class); if (read != null && read.size() > 0) { - // 布鲁氏杆菌抗体检测(平板凝集) + // 布鲁氏杆菌抗体检测(虎红平板凝集) if ("2".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { for (ExamineTemplate2Excel excel : read) { if ("+".equals(excel.getValue())) { @@ -4726,7 +5302,6 @@ public class ExamineResultController extends BladeController { ExcelUtil.export(response, "结果模板", "结果模板", list, PCRExcel.class); } // 血凝 - // PCR检测 else if ("5".equals(examineWay.getInputMode())) { String experieNum = examine.getExperieNum(); List list = new ArrayList<>(); @@ -4744,6 +5319,18 @@ public class ExamineResultController extends BladeController { list.add(pcrExcel2); ExcelUtil.export(response, "结果模板", "结果模板", list, XNExcel.class); } + // 生化鉴定 + else if ("8".equals(examineWay.getInputMode())) { + String experieNum = examine.getExperieNum(); + List list = new ArrayList<>(); + String[] split = experieNum.split(","); + for (String s : split) { + BiochemicalIdentificationExcel pcrExcel = new BiochemicalIdentificationExcel(); + pcrExcel.setExperieNum(s); + list.add(pcrExcel); + } + ExcelUtil.export(response, "结果模板", "结果模板", list, BiochemicalIdentificationExcel.class); + } // 普通检测 else { List list = new ArrayList<>(8); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java index 11d04d2..66c98b8 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java @@ -129,6 +129,18 @@ public class LargeScreenController extends BladeController { if (count > 0) { rate4 = (int) (mz1 / count * 100); } + // 比对 + wrapper.clear(); + wrapper.in(Entrust::getEntrustStatus, list); + wrapper.ge(Entrust::getCreateTime, parse); + wrapper.eq(Entrust::getInvestigativeType, "5"); + int bd = entrtrustService.count(wrapper); + double bd1 = 0.00; + bd1 += bd; + int rate5 = 0; + if (count > 0) { + rate5 = (int) (bd1 / count * 100); + } Map map = new HashMap<>(); map.put("yearPlan", yearPlan); map.put("entrustCount", count); @@ -137,6 +149,7 @@ public class LargeScreenController extends BladeController { map.put("jd", rate2); map.put("zc", rate3); map.put("mz", rate4); + map.put("bd", rate5); return R.data(map); } @@ -567,19 +580,23 @@ public class LargeScreenController extends BladeController { @GetMapping("/dataAcquisition") public R dataAcquisition(String num) { String value = DictBizCache.getValue(DictBizEnum.DATA_ACQUISITION, num); - System.out.println("value:" + value); +// System.out.println("value:" + value); Map map = null; if (StringUtils.isNotBlank(value)) { map = (Map)redisUtil.get(SYS_CACHE + "::" + DATA_ACQUISTION_ID + value); } - System.out.println(map); +// System.out.println(map); if (map != null) { float wd = (float) map.get("wd"); float sd = (float) map.get("sd"); map.put("temperature", (int) (wd + 0.5)); map.put("humidity", (int) (sd + 0.5)); + } else { + map = new HashMap(); + map.put("temperature", "-"); + map.put("humidity", "-"); } // Map map = new HashMap(); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java index d51d651..1bb18cf 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java @@ -65,16 +65,16 @@ public class ReagentController extends BladeController { List reagents = page.getRecords(); if (reagents != null && reagents.size() > 0) { for (Reagent reagent : reagents) { - String instrumentId = reagent.getInstrumentId(); - if (instrumentId != null && !"".equals(instrumentId)) { - String[] split = instrumentId.split(","); - List instrumentList = new ArrayList<>(); - for (String s : split) { - Instrument instrument = instrumentService.getById(s); - instrumentList.add(instrument); - } - reagent.setInstrumentList(instrumentList); - } +// String instrumentId = reagent.getInstrumentId(); +// if (instrumentId != null && !"".equals(instrumentId)) { +// String[] split = instrumentId.split(","); +// List instrumentList = new ArrayList<>(); +// for (String s : split) { +// Instrument instrument = instrumentService.getById(s); +// instrumentList.add(instrument); +// } +// reagent.setInstrumentList(instrumentList); +// } if (reagent.getTypeAndOperation() != null && !"".equals(reagent.getTypeAndOperation())) { List list = JSON.parseArray(reagent.getTypeAndOperation(), TypeAndOperation.class); reagent.setOperationList(list); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/BiochemicalIdentificationExcel.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/BiochemicalIdentificationExcel.java new file mode 100644 index 0000000..cd53d8f --- /dev/null +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/BiochemicalIdentificationExcel.java @@ -0,0 +1,24 @@ +package org.springblade.lims.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BiochemicalIdentificationExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(20) + @ExcelProperty("检测编号") + private String experieNum; + + @ColumnWidth(20) + @ExcelProperty("+/-") + private String value; + + private String result; + +} diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/EntrustExcel.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/EntrustExcel.java new file mode 100644 index 0000000..54a8eb5 --- /dev/null +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/excel/EntrustExcel.java @@ -0,0 +1,55 @@ +package org.springblade.lims.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class EntrustExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ColumnWidth(20) + @ExcelProperty("委托单编号") + private String acceptanceNum; + + @ColumnWidth(20) + @ExcelProperty("城市") + private String city; + + @ColumnWidth(20) + @ExcelProperty("养殖场地址(受检单位地址)") + private String customeAddress; + + @ColumnWidth(20) + @ExcelProperty("畜主姓名(送检人)") + private String submittedBy; + + @ColumnWidth(20) + @ExcelProperty("联系电话(送检人)") + private String phone; + + @ColumnWidth(20) + @ExcelProperty("样品名称") + private String simpleName; + + @ColumnWidth(20) + @ExcelProperty("样品数量") + private Integer simpleCount; + + @ColumnWidth(20) + @ExcelProperty("收样日期") + private String samplingDate; + + @ColumnWidth(20) + @ExcelProperty("采样人") + private String takePerson; + +} diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java index 14ed779..96eaec9 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.swagger.models.auth.In; import lombok.NoArgsConstructor; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; @@ -377,8 +378,11 @@ public class EntrustServiceImpl extends BaseServiceImpl ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); // 检测项目名称 - reportMainBody.put("name" + i, examineItem.getName()); - + if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode())) { + reportMainBody.put("name" + i, examineWay.getName()); + } else { + reportMainBody.put("name" + i, examineItem.getName()); + } // 判断是哪种检测 // String inputMode = examineItem.getInputMode(); @@ -416,8 +420,66 @@ public class EntrustServiceImpl extends BaseServiceImpl List list = JSON.parseArray(examineResult.getExamineDataArr(), PCR2Excel.class); System.out.println("list: " + list); if (list != null && list.size() > 0) { - for (PCR2Excel excel : list) { - System.out.println("excel: " + excel); + if (examineResult.getConformityType() != null && examineResult.getConformityType() > 1) { + for (int j = 0; j < list.size() - 2; j++) { + String originalNum = ""; + PCR2Excel pcr2Excel = list.get(j); + String[] split = pcr2Excel.getExperieNum().split("-"); + int startIndex; + if (split.length == 3) { + startIndex = Integer.parseInt(split[split.length - 1]); + } else { + startIndex = Integer.parseInt(split[split.length - 2]); + } + int endIndex = Integer.parseInt(split[split.length - 1]); + for (int e = startIndex; e <= endIndex; e++) { + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(Simple::getEntrustId, id); + wrapper1.eq(Simple::getExperieNum, split[0] + "-" + split[1] + "-" + e); + Simple simple = simpleService.getOne(wrapper1); + if (simple != null) { + if (e == endIndex) { + originalNum += simple.getOriginalNum(); + } else { + originalNum += simple.getOriginalNum() + ","; + } + } + } + + ExamineResultVo resultVo = new ExamineResultVo(); + resultVo.setOriginalNum(originalNum); + resultVo.setNum(pcr2Excel.getExperieNum()); + resultVo.setIndex(i); + resultVo.setValue(pcr2Excel.getCtValue()); + resultVo.setResult(pcr2Excel.getResult()); + resultList.add(resultVo); + } + } else { + for (PCR2Excel excel : list) { + System.out.println("excel: " + excel); + ExamineResultVo resultVo = new ExamineResultVo(); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(Simple::getEntrustId, id); + wrapper1.eq(Simple::getExperieNum, excel.getExperieNum()); + Simple simple = simpleService.getOne(wrapper1); + if (simple != null) { + resultVo.setOriginalNum(simple.getOriginalNum()); + resultVo.setNum(simple.getExperieNum()); + resultVo.setIndex(i); + resultVo.setValue(excel.getCtValue()); + resultVo.setResult(excel.getResult()); + resultVo.setRecessiveNum(simple.getRecessiveNum()); + resultList.add(resultVo); + } + } + } + } + } + // XN检测 + else if ("5".equals(examineWay.getInputMode())) { + List list = JSON.parseArray(examineResult.getExamineDataArr(), XN2Excel.class); + if (list != null && list.size() > 0) { + for (XN2Excel excel : list) { ExamineResultVo resultVo = new ExamineResultVo(); LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(Simple::getEntrustId, id); @@ -425,21 +487,21 @@ public class EntrustServiceImpl extends BaseServiceImpl Simple simple = simpleService.getOne(wrapper1); if (simple != null) { resultVo.setOriginalNum(simple.getOriginalNum()); + resultVo.setRecessiveNum(simple.getRecessiveNum()); resultVo.setNum(simple.getExperieNum()); resultVo.setIndex(i); resultVo.setValue(excel.getCtValue()); resultVo.setResult(excel.getResult()); - resultVo.setRecessiveNum(simple.getRecessiveNum()); resultList.add(resultVo); } } } } // XN检测 - else if ("5".equals(examineWay.getInputMode())) { - List list = JSON.parseArray(examineResult.getExamineDataArr(), XN2Excel.class); + else if ("8".equals(examineWay.getInputMode())) { + List list = JSON.parseArray(examineResult.getExamineDataArr(), BiochemicalIdentificationExcel.class); if (list != null && list.size() > 0) { - for (XN2Excel excel : list) { + for (BiochemicalIdentificationExcel excel : list) { ExamineResultVo resultVo = new ExamineResultVo(); LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(Simple::getEntrustId, id); @@ -450,7 +512,7 @@ public class EntrustServiceImpl extends BaseServiceImpl resultVo.setRecessiveNum(simple.getRecessiveNum()); resultVo.setNum(simple.getExperieNum()); resultVo.setIndex(i); - resultVo.setValue(excel.getCtValue()); + resultVo.setValue(excel.getValue()); resultVo.setResult(excel.getResult()); resultList.add(resultVo); } @@ -572,6 +634,30 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } + // 牛结核 + else if (examineResult.getReagentId().contains("1570297053211455490") || examineResult.getReagentId().contains("1631222146321997826")) { + list = list.stream().distinct().collect(Collectors.collectingAndThen + (Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing + (ExamineDataArrVO::getNum))), ArrayList::new)); + + for (ExamineDataArrVO excel : list) { + ExamineResultVo resultVo = new ExamineResultVo(); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(Simple::getEntrustId, id); + wrapper1.eq(Simple::getExperieNum, excel.getNum()); + Simple simple = simpleService.getOne(wrapper1); + if (simple != null) { + resultVo.setOriginalNum(simple.getOriginalNum()); + resultVo.setRecessiveNum(simple.getRecessiveNum()); + resultVo.setNum(simple.getExperieNum()); + resultVo.setIndex(i); + resultVo.setValue(excel.getValue()); + resultVo.setResult(excel.getResult()); + resultList.add(resultVo); + } + } + reportMainBody.put("list", resultList); + } // 普通 else { // 判断是满版吗 @@ -718,6 +804,15 @@ public class EntrustServiceImpl extends BaseServiceImpl row.put("value" + index, value); row.put("result" + index, result); } + + for (int i = 1; i <= examineCount; i++) { + if (row.get("value" + examineCount) == null) { + row.put("value" + examineCount, "/"); + } + if (row.get("result" + examineCount) == null) { + row.put("result" + examineCount, "/"); + } + } // 将每一行加入到模板循环列表 tempResultList.add(row); @@ -971,7 +1066,11 @@ public class EntrustServiceImpl extends BaseServiceImpl instrumentName += instrument.getName() + "" + instrument.getCode() + ","; } result1.put("code", instrumentName.replace(",", "\r\n")); - result1.put("experieDate", format3.format(taskBlueprint.getCreateTime())); + + // 按照完成时间降序排列 + List examines = examineList.stream().sorted(Comparator.comparing(Examine::getFinishTime).reversed()).collect(Collectors.toList()); + result1.put("experieDate", format3.format(examines.get(0).getFinishTime())); + result1.put("remark", entrust.getRemark()); result1.put("resultList1", ItemAndAllList); // 图片路劲 @@ -1080,20 +1179,76 @@ public class EntrustServiceImpl extends BaseServiceImpl ExamineResult examineResult = examineResultService.getOne(wrapper); // json原始数据 List list = JSON.parseArray(examineResult.getExamineDataArr(), ExamineResultVo.class); + + if (examineResult.getReagentId().contains("1570297053211455490") || examineResult.getReagentId().contains("1631222146321997826")) { + list = list.stream().distinct().collect(Collectors.collectingAndThen + (Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing + (ExamineResultVo::getNum))), ArrayList::new)); + } + + int i = 0; + if (examineResult.getConformityType() != null && examineResult.getConformityType() > 1) { + i = examine.getSimpleCount() % examineResult.getConformityType(); + } + int yangNum = 0; int yinNum = 0; int keyiNum = 0; - for (ExamineResultVo vo : list) { - if (vo.getResult() != null && !"".equals(vo.getResult())) { - if (vo.getResult().contains("阳性")) { - yangNum++; - } else if ("阴性".equals(vo.getResult())) { - yinNum++; - } else if ("可疑".equals(vo.getResult())) { - keyiNum++; +// for (ExamineResultVo vo : list) { +// if (StringUtils.isNotBlank(vo.getResult())) { +// if (examineResult.getConformityType() != null && examineResult.getConformityType() > 1) { +// if (vo.getResult().contains("阳性")) { +// yangNum += examineResult.getConformityType(); +// } else if ("阴性".equals(vo.getResult())) { +// yinNum += examineResult.getConformityType(); +// } else if ("可疑".equals(vo.getResult())) { +// keyiNum += examineResult.getConformityType(); +// } +// } else { +// if (vo.getResult().contains("阳性")) { +// yangNum++; +// } else if ("阴性".equals(vo.getResult())) { +// yinNum++; +// } else if ("可疑".equals(vo.getResult())) { +// keyiNum++; +// } +// } +// } +// } + + for (int j = 0; j < list.size(); j++) { + ExamineResultVo vo = list.get(j); + if (StringUtils.isNotBlank(vo.getResult())) { + if (examineResult.getConformityType() != null && examineResult.getConformityType() > 1) { + if (i > 0 && j == list.size() - 3) { + if (vo.getResult().contains("阳性")) { + yangNum += i; + } else if ("阴性".equals(vo.getResult())) { + yinNum += i; + } else if ("可疑".equals(vo.getResult())) { + keyiNum += i; + } + } else { + if (vo.getResult().contains("阳性")) { + yangNum += examineResult.getConformityType(); + } else if ("阴性".equals(vo.getResult())) { + yinNum += examineResult.getConformityType(); + } else if ("可疑".equals(vo.getResult())) { + keyiNum += examineResult.getConformityType(); + } + } + } else { + if (vo.getResult().contains("阳性")) { + yangNum++; + } else if ("阴性".equals(vo.getResult())) { + yinNum++; + } else if ("可疑".equals(vo.getResult())) { + keyiNum++; + } } } } + String s = "共" + examine.getSimpleCount() + "份样品,"; if (yangNum == examine.getSimpleCount()) { s += "均为阳性"; @@ -1167,6 +1322,21 @@ public class EntrustServiceImpl extends BaseServiceImpl regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer() + "\r\n"; } } + +// String batchNos = examineResult.getBatchNos(); +// if (StringUtils.isNotBlank(batchNos)) { +// String[] batch = batchNos.split(","); +// for (int i = 0; i < batch.length; i++) { +// String[] split2 = batch[i].split("-"); +// Reagent reagent = reagentService.getById(split2[0]); +// if (i == (batch.length - 1)) { +// regentName += reagent.getName() + "(生产批号:" + split2[1] + ")" + reagent.getManufacturer(); +// } else { +// regentName += reagent.getName() + "(生产批号:" + split2[1] + ")" + reagent.getManufacturer() + "\r\n"; +// } +// } +// } + result.put("7", regentName); // Set set = new HashSet(); @@ -1700,6 +1870,119 @@ public class EntrustServiceImpl extends BaseServiceImpl result.put("list", resultList1); url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "XNreportPrint"); } + // 生化鉴定 + else if ("8".equals(examineWay.getInputMode())) { + List list = JSON.parseArray(examineResult.getExamineDataArr(), BiochemicalIdentificationExcel.class); + // 阴阳性数量 +// long yin = list.stream().filter((XN2Excel e) -> "阴性".equals(e.getValue())).count(); +// long yang = list.stream().filter((XN2Excel e) -> "阳性".equals(e.getValue())).count(); +// XN2Excel xn2Excel1 = new XN2Excel(); +// XN2Excel xn2Excel2 = new XN2Excel(); +// xn2Excel1.setExperieNum("阴性数量"); +// xn2Excel1.setCtValue(String.valueOf(yin)); +// xn2Excel2.setExperieNum("阳性数量"); +// xn2Excel2.setCtValue(String.valueOf(yang)); +// list.add(xn2Excel1); +// list.add(xn2Excel2); + if (list.size() > 0) { + Map> resultMap = new HashMap<>(); + int count = 0; + List everyGroupData = new ArrayList<>(); + for (int j = 0; j < list.size(); j++) { + if (count == 60 || j == list.size() - 1) { + int keyCount = (j / 60); + if (j == list.size() - 1) { + keyCount = keyCount + 1; + everyGroupData.add(list.get(j)); + } + resultMap.put(keyCount + "", everyGroupData); + everyGroupData = new ArrayList<>(); + count = 0; + } + everyGroupData.add(list.get(j)); + count++; + + } + for (int j = 1; j <= resultMap.size(); j++) { + List arrVOList = resultMap.get(String.valueOf(j)); + // 使用每一页的数据 + if (arrVOList.size() % 2 == 0) { + for (int i = 0; i < arrVOList.size() / 2; i++) { + Map map = new HashMap<>(); + map.put("num1", arrVOList.get(i).getExperieNum()); + map.put("value1", arrVOList.get(i).getValue()); + map.put("result1", arrVOList.get(i).getResult()); + map.put("num2", arrVOList.get(arrVOList.size() / 2 + i).getExperieNum()); + map.put("value2", arrVOList.get(arrVOList.size() / 2 + i).getValue()); + map.put("result2", arrVOList.get(arrVOList.size() / 2 + i).getResult()); + resultList1.add(map); + } + } else { + for (int i = 0; i < arrVOList.size() / 2 + 1; i++) { + Map map = new HashMap<>(); + map.put("num1", arrVOList.get(i).getExperieNum()); + map.put("value1", arrVOList.get(i).getValue()); + map.put("result1", arrVOList.get(i).getResult()); + if (i < arrVOList.size() / 2) { + map.put("num2", arrVOList.get(arrVOList.size() / 2 + i + 1).getExperieNum()); + map.put("value2", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue()); + map.put("result2", arrVOList.get(arrVOList.size() / 2 + i + 1).getResult()); + } + resultList1.add(map); + } + } + } +// if (list.size() % 3 == 0) { +// for (int i = 0; i < list.size() / 3; i++) { +// Map map = new HashMap<>(); +// map.put("num1", list.get(i).getExperieNum()); +// map.put("value1", list.get(i).getCtValue()); +// map.put("result1", list.get(i).getValue()); +// map.put("num2", list.get(list.size() / 3 + i).getExperieNum()); +// map.put("value2", list.get(list.size() / 3 + i).getCtValue()); +// map.put("result2", list.get(list.size() / 3 + i).getValue()); +// map.put("num3", list.get(list.size() / 3 * 2 + i).getExperieNum()); +// map.put("value3", list.get(list.size() / 3 * 2 + i).getCtValue()); +// map.put("result3", list.get(list.size() / 3 * 2 + i).getValue()); +// resultList1.add(map); +// } +// } else { +// for (int i = 0; i < list.size() / 3 + 1; i++) { +// if (list.size() % 3 == 1) { +// Map map = new HashMap<>(); +// map.put("num1", list.get(i).getExperieNum()); +// map.put("value1", list.get(i).getCtValue()); +// map.put("result1", list.get(i).getValue()); +// if (i < list.size() / 3) { +// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); +// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); +// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); +// map.put("num3", list.get(list.size() / 3 * 2 + i + 1).getExperieNum()); +// map.put("value3", list.get(list.size() / 3 * 2 + i + 1).getCtValue()); +// map.put("result3", list.get(list.size() / 3 * 2 + i + 1).getValue()); +// } +// resultList1.add(map); +// } else if (list.size() % 3 == 2) { +// Map map = new HashMap<>(); +// map.put("num1", list.get(i).getExperieNum()); +// map.put("value1", list.get(i).getCtValue()); +// map.put("result1", list.get(i).getValue()); +// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); +// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); +// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); +// if (i < list.size() / 3) { +// map.put("num3", list.get(list.size() / 3 * 2 + i + 2).getExperieNum()); +// map.put("value3", list.get(list.size() / 3 * 2 + i + 2).getCtValue()); +// map.put("result3", list.get(list.size() / 3 * 2 + i + 2).getValue()); +// } +// resultList1.add(map); +// } +// } +// } + } + result.put("list", resultList1); + url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "SHJDreportPrint"); + } // 普通和口蹄疫检测 else { DecimalFormat df = new DecimalFormat("#0.000"); @@ -2569,6 +2852,7 @@ public class EntrustServiceImpl extends BaseServiceImpl || "1570297916894146562".equals(examineResult.getReagentId()) || "1570667729797705730".equals(examineResult.getReagentId()) || "1570671477110534145".equals(examineResult.getReagentId()) + || "1659464963116519426".equals(examineResult.getReagentId()) || "1589877000410296322".equals(examineResult.getReagentId()) || "1582988982068027393".equals(examineResult.getReagentId())) { result.put("18", "S/P"); @@ -2579,11 +2863,15 @@ public class EntrustServiceImpl extends BaseServiceImpl } else if ("1570283733628678145".equals(examineResult.getReagentId()) || "1533624738296389636".equals(examineResult.getReagentId())) { result.put("18", "阻断率"); + } else if ("1665968083879366657".equals(examineResult.getReagentId()) + || "1665964229817307138".equals(examineResult.getReagentId())) { + result.put("18", "抑制率"); } else if ("1570295395605737473".equals(examineResult.getReagentId())) { result.put("18", "KQ"); } else if ("1570296117147660290".equals(examineResult.getReagentId()) || "1570295846749270017".equals(examineResult.getReagentId()) || "1570664922961080322".equals(examineResult.getReagentId()) + || "1656852607882579970".equals(examineResult.getReagentId()) || "1570666622551781378".equals(examineResult.getReagentId()) || "1570667398619656194".equals(examineResult.getReagentId())) { result.put("18", "S/N"); @@ -3147,26 +3435,35 @@ public class EntrustServiceImpl extends BaseServiceImpl * @param resultList3 */ private List> getCondition(List list, int i, DecimalFormat df, String s, String startNum, String endNum, String reagentId, List> resultList3) { - // 阴性对照OD值 - double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); - double a2 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); - // 阳性对照OD值 - double b1 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); - double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); - + double a1 = 0.00; + double a2 = 0.00; + double b1 = 0.00; + double b2 = 0.00; double c1 = 0.00; double c2 = 0.00; - if (StringUtils.isNotBlank(list.get((i * 96) + 4).getOriginResult())) { - c1 = Double.parseDouble(list.get((i * 96) + 4).getOriginResult()); - } - if (StringUtils.isNotBlank(list.get((i * 96) + 5).getOriginResult())) { - c2 = Double.parseDouble(list.get((i * 96) + 5).getOriginResult()); - } + String format = ""; + String format1 = ""; + + if (!"1570297053211455490".equals(reagentId)) { + // 阴性对照OD值 + a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); + a2 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); + // 阳性对照OD值 + b1 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); + b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); + + if (StringUtils.isNotBlank(list.get((i * 96) + 4).getOriginResult())) { + c1 = Double.parseDouble(list.get((i * 96) + 4).getOriginResult()); + } + if (StringUtils.isNotBlank(list.get((i * 96) + 5).getOriginResult())) { + c2 = Double.parseDouble(list.get((i * 96) + 5).getOriginResult()); + } - // 阴性对照平均OD值 - String format = df.format((a1 + a2) / 2); - // 阳性对照平均OD值 - String format1 = df.format((b1 + b2) / 2); + // 阴性对照平均OD值 + format = df.format((a1 + a2) / 2); + // 阳性对照平均OD值 + format1 = df.format((b1 + b2) / 2); + } Map map1 = new HashMap<>(); Map map2 = new HashMap<>(); @@ -3198,6 +3495,13 @@ public class EntrustServiceImpl extends BaseServiceImpl map2.put("2", "阳性对照OD平均值"); map2.put("3", format1); } + // 猪繁殖与呼吸综合征病毒抗体检测试剂盒(爱德士IDEXX) + else if ("1659464963116519426".equals(reagentId)) { + map1.put("2", "阴性对照OD平均值"); + map1.put("3", format); + map2.put("2", "阳性对照OD平均值"); + map2.put("3", format1); + } // 禽白血病病毒ELISA抗原检测试剂盒(哈尔滨国生生物科技股份有限公司) else if ("1589877000410296322".equals(reagentId)) { map1.put("2", "阴性对照OD值"); @@ -3307,6 +3611,13 @@ public class EntrustServiceImpl extends BaseServiceImpl map2.put("2", "阴性对照平均OD值-阳性对照平均OD值"); map2.put("3", Double.parseDouble(format) - Double.parseDouble(format1)); } + // 羊小反刍兽疫病毒 ELISA抗体检测试剂盒---真瑞生物 + else if ("1656852607882579970".equals(reagentId)) { + map1.put("2", "阳性对照OD平均值"); + map1.put("3", format1); + map2.put("2", "阴性对照平均OD值-阳性对照平均OD值"); + map2.put("3", Double.parseDouble(format) - Double.parseDouble(format1)); + } // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(羊)---洛阳莱普生信息科技有限公司 else if ("1570666622551781378".equals(reagentId)) { map1.put("2", "阳性对照OD平均值"); @@ -3328,8 +3639,8 @@ public class EntrustServiceImpl extends BaseServiceImpl map3.put("5", "成立"); resultList3.add(map3); } - // 牛结核病γ-干扰素ELISA检测试剂盒---武汉科前生物股份有限公司 - else if ("1570297053211455490".equals(reagentId) || "1631222146321997826".equals(reagentId)) { + // 牛结核病γ-干扰素ELISA检测试剂盒---广州悦洋生物技术有限公司 + else if ("1631222146321997826".equals(reagentId)) { double yin1 = Double.parseDouble(list.get((i * 96)).getOriginResult()); double yin2 = Double.parseDouble(list.get((i * 96) + 8).getOriginResult()); double yin3 = Double.parseDouble(list.get((i * 96) + 16).getOriginResult()); @@ -3341,6 +3652,35 @@ public class EntrustServiceImpl extends BaseServiceImpl map2.put("2", "阳性对照的平均值"); map2.put("3", df.format((yang1 + yang2 + yang3) / 3)); } + // 牛结核病γ-干扰素ELISA检测试剂盒---武汉科前生物股份有限公司 + else if ("1570297053211455490".equals(reagentId)) { + double yin1 = Double.parseDouble(list.get((i * 96) + 78).getOriginResult()); + double yin2 = Double.parseDouble(list.get((i * 96) + 86).getOriginResult()); + double yang1 = Double.parseDouble(list.get((i * 96) + 79).getOriginResult()); + double yang2 = Double.parseDouble(list.get((i * 96) + 87).getOriginResult()); + map1.put("2", "阴性对照的平均值"); + map1.put("3", df.format((yin1 + yin2) / 2)); + map2.put("2", "阳性对照的平均值"); + map2.put("3", df.format((yang1 + yang2) / 2)); + } + // 布鲁氏菌 CELISA 抗体检测试剂盒---青岛立见生物科技有限公司 + else if ("1665968083879366657".equals(reagentId)) { + double yin = (a1 + a2) / 2; + double yang = (b1 + b2) / 2; + map1.put("2", "阴性对照的平均值"); + map1.put("3", df.format(yin)); + map2.put("2", "阳性对照血清抑制率"); + map2.put("3", df.format((yin - yang) / yin * 100) + "%"); + } + // 布鲁氏菌 CELISA 抗体检测试剂盒---科前生物 + else if ("1665964229817307138".equals(reagentId)) { + double yin = (a1 + a2) / 2; + double yang = (b1 + b2) / 2; + map1.put("2", "阴性对照的平均值"); + map1.put("3", df.format(yin)); + map2.put("2", "阳性对照抑制率"); + map2.put("3", df.format((yin - yang) / yin * 100) + "%"); + } map1.put("5", "成立"); map2.put("5", "成立"); resultList3.add(map1); @@ -3712,12 +4052,12 @@ public class EntrustServiceImpl extends BaseServiceImpl if (examineList.size() < 6) { for (int i = 0; i < 6 - examineList.size(); i++) { Map map = new HashMap<>(); - map.put("simpleName",""); - map.put("simpleCount",""); - map.put("experieNum",""); - map.put("examineItemName",""); - map.put("examineWayName",""); - map.put("examineBasisName",""); + map.put("simpleName", ""); + map.put("simpleCount", ""); + map.put("experieNum", ""); + map.put("examineItemName", ""); + map.put("examineWayName", ""); + map.put("examineBasisName", ""); resultList.add(map); } } @@ -3808,11 +4148,11 @@ public class EntrustServiceImpl extends BaseServiceImpl String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "simpleHandlePrint"); XWPFDocument doc = null; -// FileOutputStream fos = null; + FileOutputStream fos = null; try { doc = WordExportUtil.exportWord07(url, result); -// fos = new FileOutputStream("C://Users//AAA//Desktop//烁今//打印模板//留样处理(销毁)申请表.docx"); -// String filename = "测试.docx"; + fos = new FileOutputStream("C://Users//AAA//Desktop//烁今//打印模板//留样处理(销毁)申请表.docx"); + String filename = "测试.docx"; response.setContentType("application/octet-stream"); response.setHeader("content-disposition", "attachment;filename=12344.docx"); @@ -3823,21 +4163,21 @@ public class EntrustServiceImpl extends BaseServiceImpl } catch (Exception e) { e.printStackTrace(); } finally { -// if (null != doc) { -//// doc.close(); -// try { -// doc.write(fos); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// if (null != fos) { -// try { -// fos.close(); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } + if (null != doc) { +// doc.close(); + try { + doc.write(fos); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != fos) { + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } if (null != doc) { try { doc.close();