2022年9月14日

pull/1/head
litao 4 years ago
parent b07ae8eb93
commit c086675451
  1. 4
      lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/listener/TaskEventListener.java
  2. 4
      lab-service-api/lab-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java
  3. 2
      lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Reagent.java
  4. 8
      lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/RepairApplication.java
  5. 107
      lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ScrapApplication.java
  6. 23
      lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/feign/ILimsClient.java
  7. 7
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java
  8. 6
      lab-service/lab-file/pom.xml
  9. 3
      lab-service/lab-file/src/main/java/org/springblade/file/controller/EquipVerificationController.java
  10. 10
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java
  11. 188
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  12. 32
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/InstrumentController.java
  13. 64
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java
  14. 11
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/RepairApplicationController.java
  15. 34
      lab-service/lab-lims/src/main/java/org/springblade/lims/excel/ReagentExcel.java
  16. 29
      lab-service/lab-lims/src/main/java/org/springblade/lims/feign/LimsClient.java
  17. 2
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/IEntrtrustService.java
  18. 680
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  19. 8
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java

@ -224,8 +224,8 @@ public class TaskEventListener implements TaskListener, ApplicationContextAware
// result.setOriginRecord(jsonString); // result.setOriginRecord(jsonString);
if (!isAutoRun) { if (!isAutoRun) {
if (name.equals("simpleStatus")) { result.setSimpleStatus(value); } if (name.equals("simpleStatus")) { result.setSimpleStatus(value); }
if (name.equals("temperature")) { result.setTemperature(value); } // if (name.equals("temperature")) { result.setTemperature(value); }
if (name.equals("humidity")) { result.setHumidity(value); } // if (name.equals("humidity")) { result.setHumidity(value); }
if (name.equals("disposal")) { result.setDisposal(value); } if (name.equals("disposal")) { result.setDisposal(value); }
if (name.equals("instrumentId")) { result.setInstrumentId(value); } if (name.equals("instrumentId")) { result.setInstrumentId(value); }
if (name.equals("reagentId")) { result.setReagentId(value); } if (name.equals("reagentId")) { result.setReagentId(value); }

@ -61,6 +61,10 @@ public enum DictBizEnum {
* 是否留样 * 是否留样
*/ */
SIMPLE_STATUS("simple_status"), SIMPLE_STATUS("simple_status"),
/**
* 是否留样
*/
SIMPLE_NAME_TWO("simpleNameTwo"),
; ;

@ -52,7 +52,7 @@ public class Reagent extends BaseEntity implements Serializable {
// 操作步骤 // 操作步骤
private String operationSteps; private String operationSteps;
// 操作步骤 // 结果判定方法
private String resultDeterminationMethod; private String resultDeterminationMethod;
// 仪器设备id // 仪器设备id
private String instrumentId; private String instrumentId;

@ -101,4 +101,12 @@ public class RepairApplication extends BaseEntity implements Serializable {
// 备注 // 备注
private String remark; private String remark;
// 开始时间
@TableField(exist = false)
private Date startTime;
// 结束时间
@TableField(exist = false)
private Date endTime;
} }

@ -0,0 +1,107 @@
package org.springblade.lims.entry;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serializable;
import java.util.Date;
/**
* @author swj
*/
@Data
@SuppressWarnings("all")
@TableName("t_scrap_application")
public class ScrapApplication extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
// 仪器/设备id
private Long instrumentId;
// 仪器/设备编号
private String code;
// 仪器/设备名称
private String name;
// 仪器/设备类型
private String type;
// 购置时间
private Date purchaseTime;
// 处理情况
private String handling;
// 金额
private Double money;
// 报废原因及技术状况
private String reasonAndState;
// 申请人
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long equipmentId;
// 申请人姓名
private String equipmentName;
// 确认日期
private Date applyDate;
// 部门负责人
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long applyDeptUser;
// 部门负责人姓名
private String applyDeptUserName;
// 审核意见
private String reviewComments;
// 审核时间
private Date reviewDate;
// 业务室id
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long businessOfficeId;
// 业务室姓名
private String businessOfficeName;
// 审批意见
private String approvalComments;
// 审批时间
private Date approvalDate;
// 中心主任id
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long centerDirectorId;
// 中心主任姓名
private String centerDirectorName;
// 维修记录
private String maintenanceRecord;
// 维修人
private String maintainer;
// 维修时间
private Date maintainerDate;
// 总工时
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double workingHours;
// 人工费
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double laborCost;
// 材料费
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double materialCost;
// 总计费
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double totalCost;
// 用户意见
private String userComments;
// 验收人id
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long acceptedBy;
// 验收人姓名
private String acceptedName;
// 验收时间
private Date acceptedDate;
// 备注
private String remark;
// 开始时间
@TableField(exist = false)
private Date startTime;
// 结束时间
@TableField(exist = false)
private Date endTime;
}

@ -0,0 +1,23 @@
package org.springblade.lims.feign;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* lims Feign接口类
*
* @author Chill
*/
@FeignClient(
value = LauncherConstant.APPLICATION_LIMS_NAME
)
public interface ILimsClient {
String API_PREFIX = "/client/lims";
String UPDATE_INSTRUMENT_STATUS = API_PREFIX + "/updateStatus";
@PostMapping(UPDATE_INSTRUMENT_STATUS)
R updateStatus(String instrumentId);
}

@ -7,11 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.sun.xml.internal.ws.resources.UtilMessages;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import oracle.jdbc.proxy.annotation.Post;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -23,11 +21,9 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.lims.capital.entity.*; import org.springblade.lims.capital.entity.*;
import org.springblade.lims.capital.excel.GoodsExcel; import org.springblade.lims.capital.excel.GoodsExcel;
import org.springblade.lims.capital.excel.ProductExcel;
import org.springblade.lims.capital.service.IGoodsCheckLogService; import org.springblade.lims.capital.service.IGoodsCheckLogService;
import org.springblade.lims.capital.service.IProductClassService; import org.springblade.lims.capital.service.IProductClassService;
import org.springblade.lims.capital.service.IProductStoreDetialService; import org.springblade.lims.capital.service.IProductStoreDetialService;
import org.springblade.lims.common.OrderUtils;
import org.springblade.lims.goods.entity.ApplyDetail; import org.springblade.lims.goods.entity.ApplyDetail;
import org.springblade.lims.goods.entity.Goods; import org.springblade.lims.goods.entity.Goods;
import org.springblade.lims.goods.entity.InAndOutRecord; import org.springblade.lims.goods.entity.InAndOutRecord;
@ -41,16 +37,13 @@ import org.springblade.system.cache.DictBizCache;
import org.springblade.system.enums.DictBizEnum; import org.springblade.system.enums.DictBizEnum;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.transaction.reactive.AbstractReactiveTransactionManager;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;

@ -46,6 +46,12 @@
<artifactId>lab-user-api</artifactId> <artifactId>lab-user-api</artifactId>
<version>${bladex.project.version}</version> <version>${bladex.project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>lab-lims-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -31,6 +31,7 @@ import org.springblade.file.entity.EquipVerification;
import org.springblade.file.service.IEquipVerificationService; import org.springblade.file.service.IEquipVerificationService;
import org.springblade.file.vo.EquipVerificationVO; import org.springblade.file.vo.EquipVerificationVO;
import org.springblade.file.wrapper.EquipVerificationWrapper; import org.springblade.file.wrapper.EquipVerificationWrapper;
import org.springblade.lims.feign.ILimsClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
@ -49,6 +50,7 @@ public class EquipVerificationController extends BladeController {
private final IEquipVerificationService equipVerificationService; private final IEquipVerificationService equipVerificationService;
private final ILimsClient limsClient;
/** /**
* 详情 * 详情
*/ */
@ -110,6 +112,7 @@ public class EquipVerificationController extends BladeController {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入equipVerification") @ApiOperation(value = "新增或修改", notes = "传入equipVerification")
public R submit(@Valid @RequestBody EquipVerification equipVerification) { public R submit(@Valid @RequestBody EquipVerification equipVerification) {
limsClient.updateStatus(equipVerification.getInstrumentId());
return R.status(equipVerificationService.saveOrUpdate(equipVerification)); return R.status(equipVerificationService.saveOrUpdate(equipVerification));
} }

@ -1620,5 +1620,11 @@ public class EntrustController extends BladeController {
return entrust; return entrust;
} }
/**
} * 25.打印维修单
*/
@GetMapping("/repairPrint")
public void repairPrint(String id, HttpServletResponse response) {
service.repairPrint(id, response);
}
}

@ -87,17 +87,13 @@ public class ExamineResultController extends BladeController {
ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId());
if ("2".equals(examineItem.getInputMode())) { if ("2".equals(examineItem.getInputMode())) {
return blsExcel(file, examineId); return blsExcel(file, examineId);
} } else if ("3".equals(examineItem.getInputMode())) {
else if ("3".equals(examineItem.getInputMode())) {
return ktyExcel(file, examineId); return ktyExcel(file, examineId);
} } else if ("4".equals(examineItem.getInputMode())) {
else if ("4".equals(examineItem.getInputMode())) {
return pcrExcel(file, examineId); return pcrExcel(file, examineId);
} } else if ("5".equals(examineItem.getInputMode())) {
else if ("5".equals(examineItem.getInputMode())) {
return xnExcel(file, examineId); return xnExcel(file, examineId);
} } else {
else {
return ptExcel(file, examineId); return ptExcel(file, examineId);
} }
} }
@ -137,6 +133,7 @@ public class ExamineResultController extends BladeController {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
// 按照公式计算实验数据并返回 // 按照公式计算实验数据并返回
Map<String, List<Map<String, Map<String, Object>>>> map1 = new HashMap<>(); Map<String, List<Map<String, Map<String, Object>>>> map1 = new HashMap<>();
for (int i = 0; i < group; i++) { for (int i = 0; i < group; i++) {
List<Map<String, Map<String, Object>>> mapList = new ArrayList<>(); List<Map<String, Map<String, Object>>> mapList = new ArrayList<>();
List<ExamineExcel> excels = map.get(i + 1 + ""); List<ExamineExcel> excels = map.get(i + 1 + "");
@ -186,7 +183,8 @@ public class ExamineResultController extends BladeController {
map3.put("value", SP); map3.put("value", SP);
// int b = (i * 90) + j - 6; // int b = (i * 90) + j - 6;
int b = (i * 96) + j; int b = (i * 96) + j;
map3.put("num", split[b - ((i + 1) * 6)]); // map3.put("num", split[b - ((i + 1) * 6)]);
map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
map3.put("result", "阳性"); map3.put("result", "阳性");
@ -195,6 +193,14 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 1, map3); map2.put(a + 1, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j;
map3.put("order", b + 1);
map3.put("num", "");
map2.put(a + 1, map3);
list.add(map3);
} }
} else { } else {
if (excels.get(j).getCode1() != null) { if (excels.get(j).getCode1() != null) {
@ -206,9 +212,10 @@ public class ExamineResultController extends BladeController {
list.add(map3); list.add(map3);
} else { } else {
Map<String, Object> map3 = new HashMap<>(); Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", " "); map3.put("originResult", "");
int b = (i * 96) + j; int b = (i * 96) + j;
map3.put("order", b + 1); map3.put("order", b + 1);
map3.put("num", "");
map2.put(a + 1, map3); map2.put(a + 1, map3);
list.add(map3); list.add(map3);
} }
@ -222,7 +229,7 @@ public class ExamineResultController extends BladeController {
map3.put("value", SP); map3.put("value", SP);
// int b = (i * 90) + j + 2 + (u * 8); // int b = (i * 90) + j + 2 + (u * 8);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -232,6 +239,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 2, map3); map2.put(a + 2, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 2, map3);
list.add(map3);
} }
if (excels.get(j).getCode3() != null) { if (excels.get(j).getCode3() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -241,7 +257,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode3()); map3.put("originResult", excels.get(j).getCode3());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -251,6 +267,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 3, map3); map2.put(a + 3, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 3, map3);
list.add(map3);
} }
if (excels.get(j).getCode4() != null) { if (excels.get(j).getCode4() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -260,7 +285,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode4()); map3.put("originResult", excels.get(j).getCode4());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -270,6 +295,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 4, map3); map2.put(a + 4, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 4, map3);
list.add(map3);
} }
if (excels.get(j).getCode5() != null) { if (excels.get(j).getCode5() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -279,7 +313,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode5()); map3.put("originResult", excels.get(j).getCode5());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -289,6 +323,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 5, map3); map2.put(a + 5, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 5, map3);
list.add(map3);
} }
if (excels.get(j).getCode6() != null) { if (excels.get(j).getCode6() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -298,7 +341,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode6()); map3.put("originResult", excels.get(j).getCode6());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -308,6 +351,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 6, map3); map2.put(a + 6, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 6, map3);
list.add(map3);
} }
if (excels.get(j).getCode7() != null) { if (excels.get(j).getCode7() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -317,7 +369,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode7()); map3.put("originResult", excels.get(j).getCode7());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -327,6 +379,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 7, map3); map2.put(a + 7, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 7, map3);
list.add(map3);
} }
if (excels.get(j).getCode8() != null) { if (excels.get(j).getCode8() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -336,7 +397,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode8()); map3.put("originResult", excels.get(j).getCode8());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -346,6 +407,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 8, map3); map2.put(a + 8, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 8, map3);
list.add(map3);
} }
if (excels.get(j).getCode9() != null) { if (excels.get(j).getCode9() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -355,7 +425,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode9()); map3.put("originResult", excels.get(j).getCode9());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -365,6 +435,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 9, map3); map2.put(a + 9, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 9, map3);
list.add(map3);
} }
if (excels.get(j).getCode10() != null) { if (excels.get(j).getCode10() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -374,7 +453,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode10()); map3.put("originResult", excels.get(j).getCode10());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -384,6 +463,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 10, map3); map2.put(a + 10, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 10, map3);
list.add(map3);
} }
if (excels.get(j).getCode11() != null) { if (excels.get(j).getCode11() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -393,7 +481,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode11()); map3.put("originResult", excels.get(j).getCode11());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -403,6 +491,15 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 11, map3); map2.put(a + 11, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 11, map3);
list.add(map3);
} }
if (excels.get(j).getCode12() != null) { if (excels.get(j).getCode12() != null) {
if ((v2 - v1) != 0) { if ((v2 - v1) != 0) {
@ -412,7 +509,7 @@ public class ExamineResultController extends BladeController {
map3.put("originResult", excels.get(j).getCode12()); map3.put("originResult", excels.get(j).getCode12());
map3.put("value", SP); map3.put("value", SP);
int b = (i * 96) + j + (u * 8); int b = (i * 96) + j + (u * 8);
map3.put("num", split[b - ((i + 1) * 6)]); map3.put("num", "1");
map3.put("order", b + 1); map3.put("order", b + 1);
u++; u++;
if (Double.parseDouble(SP) >= 0.4) { if (Double.parseDouble(SP) >= 0.4) {
@ -422,12 +519,41 @@ public class ExamineResultController extends BladeController {
} }
map2.put(a + 12, map3); map2.put(a + 12, map3);
list.add(map3); list.add(map3);
} else {
Map<String, Object> map3 = new HashMap<>();
map3.put("originResult", "");
int b = (i * 96) + j + (u * 8);
map3.put("num", "");
map3.put("order", b + 1);
u++;
map2.put(a + 12, map3);
list.add(map3);
} }
mapList.add(map2); mapList.add(map2);
} }
map1.put("g" + (i + 1), mapList); map1.put("g" + (i + 1), mapList);
} }
Collections.sort(list, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
Integer id1 = (Integer) o1.get("order");
Integer id2 = (Integer) o2.get("order");
// 升序
return id1.compareTo(id2);
}
});
int numIndex = 0;
for (Map<String, Object> stringObjectMap : list) {
String num = (String) stringObjectMap.get("num");
if (num != null && !"".equals(num)) {
num = split[numIndex];
stringObjectMap.put("num", num);
numIndex++;
}
}
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ExamineResult::getExamineId, examineId); wrapper.eq(ExamineResult::getExamineId, examineId);
ExamineResult result = service.getOne(wrapper); ExamineResult result = service.getOne(wrapper);
@ -593,14 +719,16 @@ public class ExamineResultController extends BladeController {
if (result != null) { if (result != null) {
result.setOriginRecordData(JSON.toJSONString(mapList)); result.setOriginRecordData(JSON.toJSONString(mapList));
result.setOriginRecordResult(JSON.toJSONString(mapList)); result.setOriginRecordResult(JSON.toJSONString(mapList));
result.setExamineDataArr(JSON.toJSONString(list)); // result.setExamineDataArr(JSON.toJSONString(list));
result.setExamineDataArr(JSON.toJSONString(resultList));
service.updateById(result); service.updateById(result);
} else { } else {
ExamineResult examineResult = new ExamineResult(); ExamineResult examineResult = new ExamineResult();
examineResult.setExamineId(Long.valueOf(examine.getId())); examineResult.setExamineId(Long.valueOf(examine.getId()));
examineResult.setOriginRecordData(JSON.toJSONString(mapList)); examineResult.setOriginRecordData(JSON.toJSONString(mapList));
examineResult.setOriginRecordResult(JSON.toJSONString(mapList)); examineResult.setOriginRecordResult(JSON.toJSONString(mapList));
examineResult.setExamineDataArr(JSON.toJSONString(list)); // examineResult.setExamineDataArr(JSON.toJSONString(list));
examineResult.setExamineDataArr(JSON.toJSONString(resultList));
service.save(examineResult); service.save(examineResult);
} }
return R.data(mapList); return R.data(mapList);
@ -633,7 +761,7 @@ public class ExamineResultController extends BladeController {
Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); Double avg1 = calcCurrGroupContrastAvg(rowInGroup1);
for (int row = 0; row < rowInGroup1.size(); row++) { for (int row = 0; row < rowInGroup1.size(); row++) {
// 行标头:前端渲染需要A、B、C.... // 行标头:前端渲染需要A、B、C....
String a = String.valueOf((char)(row + 65)); String a = String.valueOf((char) (row + 65));
// 每一个位置的值: A1、B2... // 每一个位置的值: A1、B2...
Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>(); Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>();
int u = 1; int u = 1;
@ -659,7 +787,7 @@ public class ExamineResultController extends BladeController {
Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); Double avg2 = calcCurrGroupContrastAvg(rowInGroup2);
for (int row = 0; row < rowInGroup2.size(); row++) { for (int row = 0; row < rowInGroup2.size(); row++) {
// 行标头:前端渲染需要A、B、C.... // 行标头:前端渲染需要A、B、C....
String a = String.valueOf((char)(row + 65)); String a = String.valueOf((char) (row + 65));
// 每一个位置的值: A1、B2... // 每一个位置的值: A1、B2...
Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>(); Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>();
int u = 1; int u = 1;
@ -712,8 +840,7 @@ public class ExamineResultController extends BladeController {
result.setOriginRecordResult(JSON.toJSONString(resultMap)); result.setOriginRecordResult(JSON.toJSONString(resultMap));
result.setExamineDataArr(JSON.toJSONString(allDatas)); result.setExamineDataArr(JSON.toJSONString(allDatas));
service.updateById(result); service.updateById(result);
} } else {
else {
ExamineResult examineResult = new ExamineResult(); ExamineResult examineResult = new ExamineResult();
examineResult.setExamineId(Long.valueOf(examine.getId())); examineResult.setExamineId(Long.valueOf(examine.getId()));
examineResult.setOriginRecordData(JSON.toJSONString(allData)); examineResult.setOriginRecordData(JSON.toJSONString(allData));
@ -752,7 +879,7 @@ public class ExamineResultController extends BladeController {
Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); Double avg1 = calcCurrGroupContrastAvg(rowInGroup1);
for (int row = 0; row < rowInGroup1.size(); row++) { for (int row = 0; row < rowInGroup1.size(); row++) {
// 行标头:前端渲染需要A、B、C.... // 行标头:前端渲染需要A、B、C....
String a = String.valueOf((char)(row + 65)); String a = String.valueOf((char) (row + 65));
// 每一个位置的值: A1、B2... // 每一个位置的值: A1、B2...
Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>(); Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>();
int u = 1; int u = 1;
@ -778,7 +905,7 @@ public class ExamineResultController extends BladeController {
Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); Double avg2 = calcCurrGroupContrastAvg(rowInGroup2);
for (int row = 0; row < rowInGroup2.size(); row++) { for (int row = 0; row < rowInGroup2.size(); row++) {
// 行标头:前端渲染需要A、B、C.... // 行标头:前端渲染需要A、B、C....
String a = String.valueOf((char)(row + 65)); String a = String.valueOf((char) (row + 65));
// 每一个位置的值: A1、B2... // 每一个位置的值: A1、B2...
Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>(); Map<String, Map<String, Object>> allPosDatasInAGroup = new HashMap<>();
int u = 1; int u = 1;
@ -829,8 +956,7 @@ public class ExamineResultController extends BladeController {
result.setOriginRecordResult(JSON.toJSONString(resultMap)); result.setOriginRecordResult(JSON.toJSONString(resultMap));
result.setExamineDataArr(JSON.toJSONString(allDatas)); result.setExamineDataArr(JSON.toJSONString(allDatas));
service.updateById(result); service.updateById(result);
} } else {
else {
ExamineResult examineResult = new ExamineResult(); ExamineResult examineResult = new ExamineResult();
examineResult.setExamineId(Long.valueOf(examine.getId())); examineResult.setExamineId(Long.valueOf(examine.getId()));
examineResult.setOriginRecordData(JSON.toJSONString(allData)); examineResult.setOriginRecordData(JSON.toJSONString(allData));

@ -54,24 +54,29 @@ public class InstrumentController extends BladeController {
public R<IPage<Instrument>> list(Instrument entry, Query query) { public R<IPage<Instrument>> list(Instrument entry, Query query) {
LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>();
// 仪器类型 // 仪器类型
if (entry.getType() != null && !"".equals(entry.getType())) { // if (entry.getType() != null && !"".equals(entry.getType())) {
wrapper.eq(Instrument::getType, entry.getType()); // wrapper.eq(Instrument::getType, entry.getType());
} // }
// 保管人 // 保管人
if (entry.getSaveById() != null) { // if (entry.getSaveById() != null) {
wrapper.eq(Instrument::getSaveById, entry.getSaveById()); // wrapper.eq(Instrument::getSaveById, entry.getSaveById());
} // }
// 模糊查询 // 模糊查询
if (entry.getStatus() != null) {
wrapper.eq(Instrument::getStatus, entry.getStatus());
}
if (entry.getName() != null && !"".equals(entry.getName())) { if (entry.getName() != null && !"".equals(entry.getName())) {
wrapper.like(Instrument::getName, entry.getName()).or(); wrapper.and(wq -> wq
wrapper.like(Instrument::getCode, entry.getName()).or(); .like(Instrument::getName, entry.getName()).or()
wrapper.like(Instrument::getStoragePlace, entry.getName()).or(); .like(Instrument::getCode, entry.getName()).or()
wrapper.like(Instrument::getManufacturerBrand, entry.getName()); .like(Instrument::getStoragePlace, entry.getName()).or()
.like(Instrument::getManufacturerBrand, entry.getName())
);
} }
// 时间范围搜索 // 时间范围搜索
if (entry.getStartTime() != null && entry.getEndTime() != null) { // if (entry.getStartTime() != null && entry.getEndTime() != null) {
wrapper.ge(Instrument::getPurchaseTime, entry.getStartTime()).le(Instrument::getPurchaseTime, entry.getEndTime()); // wrapper.ge(Instrument::getPurchaseTime, entry.getStartTime()).le(Instrument::getPurchaseTime, entry.getEndTime());
} // }
wrapper.orderByDesc(Instrument::getCreateTime); wrapper.orderByDesc(Instrument::getCreateTime);
IPage<Instrument> page = service.page(Condition.getPage(query), wrapper); IPage<Instrument> page = service.page(Condition.getPage(query), wrapper);
return R.data(page); return R.data(page);
@ -107,6 +112,7 @@ public class InstrumentController extends BladeController {
String name = userClient.userInfoById(entry.getSaveById()).getData().getName(); String name = userClient.userInfoById(entry.getSaveById()).getData().getName();
entry.setSaveByName(name); entry.setSaveByName(name);
} }
entry.setStatus(0);
return service.save(entry); return service.save(entry);
} }

@ -11,19 +11,28 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.lims.entry.*; import org.springblade.lims.entry.*;
import org.springblade.lims.excel.ExamineExcel;
import org.springblade.lims.excel.ReagentExcel;
import org.springblade.lims.service.IETaskService; import org.springblade.lims.service.IETaskService;
import org.springblade.lims.service.IInstrumentService; import org.springblade.lims.service.IInstrumentService;
import org.springblade.lims.service.IReagentService; import org.springblade.lims.service.IReagentService;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.enums.DictBizEnum;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -130,4 +139,59 @@ public class ReagentController extends BladeController {
return service.list(wrapper); return service.list(wrapper);
} }
/**
* excle批量导入试剂
*/
@PostMapping("inExcle")
public R inExcle(MultipartFile file) throws Exception {
List<ReagentExcel> excelList = ExcelUtil.read(file, ReagentExcel.class);
List<Reagent> list = service.list();
List<Reagent> reagentList = new ArrayList<>();
if (excelList != null && excelList.size() > 0) {
for (ReagentExcel reagentExcel : excelList) {
// 重名校验
for (Reagent reagent : list) {
if (reagentExcel.getName().equals(reagent.getName())) {
throw new Exception("名称重复: " + reagentExcel.getName());
}
}
Reagent reagent = new Reagent();
reagent.setName(reagentExcel.getName());
reagent.setManufacturer(reagentExcel.getManufacturer());
reagent.setResultDeterminationMethod(reagentExcel.getResultDeterminationMethod());
// 字典查询试剂样品类型
String type = DictBizCache.getKey(DictBizEnum.SIMPLE_NAME_TWO.getName(), reagentExcel.getSimpleType());
List<TypeAndOperation> operationList = new ArrayList<>();
TypeAndOperation typeAndOperation = new TypeAndOperation();
typeAndOperation.setType(type);
typeAndOperation.setOperation(reagentExcel.getOperationSteps());
operationList.add(typeAndOperation);
reagent.setTypeAndOperation(JSON.toJSONString(operationList));
reagentList.add(reagent);
}
}
return R.status(service.saveBatch(reagentList));
}
/**
* excle模板下载
*/
@GetMapping("downExcle")
public void exportInOrder(HttpServletResponse response) {
List<ReagentExcel> list = new ArrayList<>();
ReagentExcel excel1 = new ReagentExcel();
excel1.setName("a试剂");
excel1.setManufacturer("a厂家");
excel1.setSimpleType("全血");
excel1.setOperationSteps("全血的操作步骤");
excel1.setResultDeterminationMethod("全血的结果判定");
ReagentExcel excel2 = new ReagentExcel();
excel2.setName("b试剂");
excel2.setManufacturer("a厂家");
excel2.setSimpleType("血清");
excel2.setOperationSteps("血清的操作步骤");
excel2.setResultDeterminationMethod("血清的结果判定");
ExcelUtil.export(response, "试剂导入模板", "试剂数据", list, ReagentExcel.class);
}
} }

@ -50,9 +50,14 @@ public class RepairApplicationController extends BladeController {
wrapper.eq(RepairApplication::getStatus, repairApplication.getStatus()); wrapper.eq(RepairApplication::getStatus, repairApplication.getStatus());
} }
if (repairApplication.getName() != null && !"".equals(repairApplication.getName())) { if (repairApplication.getName() != null && !"".equals(repairApplication.getName())) {
wrapper.like(RepairApplication::getCode, repairApplication.getName()).or(); wrapper.and(qw -> qw
wrapper.like(RepairApplication::getName, repairApplication.getName()).or(); .like(RepairApplication::getCode, repairApplication.getName()).or()
wrapper.like(RepairApplication::getType, repairApplication.getName()); .like(RepairApplication::getName, repairApplication.getName()).or()
.like(RepairApplication::getType, repairApplication.getName())
);
}
if (repairApplication.getStartTime() != null && repairApplication.getEndTime() != null) {
wrapper.between(RepairApplication::getCreateTime, repairApplication.getStartTime(), repairApplication.getEndTime());
} }
wrapper.orderByDesc(RepairApplication::getCreateTime); wrapper.orderByDesc(RepairApplication::getCreateTime);
IPage<RepairApplication> page = repairApplicationService.page(Condition.getPage(query), wrapper); IPage<RepairApplication> page = repairApplicationService.page(Condition.getPage(query), wrapper);

@ -0,0 +1,34 @@
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 ReagentExcel implements Serializable {
private static final long serialVersionUID = 1L;
@ColumnWidth(20)
@ExcelProperty("试剂名称")
private String name;
@ColumnWidth(20)
@ExcelProperty("生产厂家")
private String manufacturer;
@ColumnWidth(20)
@ExcelProperty("样品类型")
private String simpleType;
@ColumnWidth(20)
@ExcelProperty("操作步骤")
private String operationSteps;
@ColumnWidth(20)
@ExcelProperty("结果判定方法")
private String resultDeterminationMethod;
}

@ -0,0 +1,29 @@
package org.springblade.lims.feign;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.lims.entry.Instrument;
import org.springblade.lims.service.IInstrumentService;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户服务Feign实现类
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
public class LimsClient implements ILimsClient {
private final IInstrumentService instrumentService;
@Override
public R updateStatus(String instrumentId) {
Instrument instrument = new Instrument();
instrument.setId(Long.valueOf(instrumentId));
instrument.setStatus(1);
return R.status(instrumentService.updateById(instrument));
}
}

@ -37,4 +37,6 @@ public interface IEntrtrustService extends BaseService<Entrust> {
void simpleReceivePrint(String id, HttpServletResponse response); void simpleReceivePrint(String id, HttpServletResponse response);
void examineReportPrint(String id, HttpServletResponse response); void examineReportPrint(String id, HttpServletResponse response);
void repairPrint(String id, HttpServletResponse response);
} }

@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.common.utils.ZipCompressUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.lims.entry.*; import org.springblade.lims.entry.*;
import org.springblade.lims.excel.ExamineTemplate2Excel; import org.springblade.lims.excel.ExamineTemplate2Excel;
@ -29,6 +31,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -88,6 +91,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
private EntrustCustomerServiceImpl customerService; private EntrustCustomerServiceImpl customerService;
@Autowired @Autowired
private IContractService contractService; private IContractService contractService;
@Autowired
private IRepairApplicationService repairApplicationService;
@Value("${handleUrl}") @Value("${handleUrl}")
private String handleUrl; private String handleUrl;
@ -158,22 +163,34 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Value("${simpleReceivePrint}") @Value("${simpleReceivePrint}")
private String simpleReceivePrint; private String simpleReceivePrint;
List<Map<String, Object>> resultList2 = new ArrayList<>(); @Value("${repairPrint}")
private String repairPrint;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Entrust addEntrust(Entrust entrust) { public Entrust addEntrust(Entrust entrust) {
// 如果是追加检测项目
if (entrust.getOperatType() != null && "1".equals(entrust.getOperatType())) {
entrust.setEntrustStatus("2.1");
this.updateById(entrust);
return entrust;
}
long id = RandomUtils.nextLong(); long id = RandomUtils.nextLong();
// 送检单位、采样单位之类的,如果没有就新增 // 送检单位、采样单位之类的,如果没有就新增
addIfNull(entrust); addIfNull(entrust);
// 新增或修改 检测集合
addOrUpdateExamines(entrust.getExamines(), entrust, id);
// 如果是修改
if (entrust.getOperatType() != null && "1".equals(entrust.getOperatType())) {
LambdaQueryWrapper<Examine> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Examine::getEntrustId, entrust.getId());
List<Examine> examines = examineService.list(wrapper);
if (examines.size() < entrust.getExamines().size()) {
entrust.setEntrustStatus("2.1");
}
this.updateById(entrust);
return entrust;
}
// 样品关联数据入库 // 样品关联数据入库
entrust = addSimpleRel(entrust, id); entrust = addSimpleRel(entrust, id);
@ -183,8 +200,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 委托单入库/修改 // 委托单入库/修改
addOrUpdateEntrust(entrust, id); addOrUpdateEntrust(entrust, id);
// 新增或修改 检测集合
addOrUpdateExamines(entrust.getExamines(), entrust);
return entrust; return entrust;
} }
@ -348,17 +363,38 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 根据检测的数量判断用按个模板 // 根据检测的数量判断用按个模板
switch (examineCount) { switch (examineCount) {
case 1: currTemplate = print1; break; case 1:
case 2: currTemplate = print2; break; currTemplate = print1;
case 3: currTemplate = print3; break; break;
case 4: currTemplate = print4; break; case 2:
case 5: currTemplate = print5; break; currTemplate = print2;
case 6: currTemplate = print6; break; break;
case 7: currTemplate = print7; break; case 3:
case 8: currTemplate = print8; break; currTemplate = print3;
case 9: currTemplate = print9; break; break;
case 10: currTemplate = print10; break; case 4:
default: currTemplate = print10; currTemplate = print4;
break;
case 5:
currTemplate = print5;
break;
case 6:
currTemplate = print6;
break;
case 7:
currTemplate = print7;
break;
case 8:
currTemplate = print8;
break;
case 9:
currTemplate = print9;
break;
case 10:
currTemplate = print10;
break;
default:
currTemplate = print10;
} }
List<ExamineResultVo> resultList = new ArrayList<>(); List<ExamineResultVo> resultList = new ArrayList<>();
@ -423,7 +459,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
List<XN2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), XN2Excel.class); List<XN2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), XN2Excel.class);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (XN2Excel excel : list) { for (XN2Excel excel : list) {
ExamineResultVo resultVo = new ExamineResultVo(); LambdaQueryWrapper<Simple> wrapper1 = new LambdaQueryWrapper<>(); ExamineResultVo resultVo = new ExamineResultVo();
LambdaQueryWrapper<Simple> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(Simple::getEntrustId, id); wrapper1.eq(Simple::getEntrustId, id);
wrapper1.eq(Simple::getExperieNum, excel.getExperieNum()); wrapper1.eq(Simple::getExperieNum, excel.getExperieNum());
Simple simple = simpleService.getOne(wrapper1); Simple simple = simpleService.getOne(wrapper1);
@ -915,7 +952,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
public void reportPrint(String examineId, HttpServletResponse response) { public void reportPrint(String examineId, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> resultList1 = new ArrayList<>(); List<Map<String, Object>> resultList1 = new ArrayList<>();
List<Map<String, Object>> resultList2 = new ArrayList<>();
String url = ""; String url = "";
// 检测数据 // 检测数据
Examine examine = examineService.getById(examineId); Examine examine = examineService.getById(examineId);
@ -972,19 +1009,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
String batchNos = examineResult.getBatchNos(); String batchNos = examineResult.getBatchNos();
String[] split3 = batchNos.split(","); String[] split3 = batchNos.split(",");
Map<String, List<String>> tempListMap = new HashMap(); Map<String, List<String>> tempListMap = new HashMap();
for (String batch : split3) { for (String batch : split3) {
String reagentId = batch.split("-")[0]; String reagentId = batch.split("-")[0];
String realBatch = batch.split("-")[1]; String realBatch = batch.split("-")[1];
List<String> list = tempListMap.get(reagentId); List<String> list = tempListMap.get(reagentId);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list.add(realBatch); list.add(realBatch);
} else { } else {
List<String> temp = new ArrayList<>(); List<String> temp = new ArrayList<>();
temp.add(realBatch); temp.add(realBatch);
tempListMap.put(reagentId, temp); tempListMap.put(reagentId, temp);
} }
} }
String resultBatchStr = ""; String resultBatchStr = "";
// 遍历处理批号 // 遍历处理批号
Set<String> strings = tempListMap.keySet(); Set<String> strings = tempListMap.keySet();
for (String reagentId : strings) { for (String reagentId : strings) {
@ -1351,8 +1388,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("10", "10"); map.put("10", "10");
map.put("11", "11"); map.put("11", "11");
map.put("12", "12"); map.put("12", "12");
} map.put("13", "1");
else { map.put("14", "2");
map.put("15", "3");
map.put("16", "4");
map.put("17", "5");
map.put("18", "6");
map.put("19", "7");
map.put("20", "8");
map.put("21", "9");
map.put("22", "10");
map.put("23", "11");
map.put("24", "12");
} else {
if (j == 1) { if (j == 1) {
map.put("0", "A"); map.put("0", "A");
} }
@ -1377,29 +1425,39 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (j == 8) { if (j == 8) {
map.put("0", "H"); map.put("0", "H");
} }
map.put("1", list.get(start + (8 * x + j) - 1).getValue()); for (int k = 1; k <= 12; k++) {
x++; map.put(k + "", list.get(start + (8 * x + j) - 1).getValue());
map.put("2", list.get(start + (8 * x + j) - 1).getValue()); String num = list.get(start + (8 * x + j) - 1).getNum();
x++; if (num != null && !"".equals(num) && num.split("-").length == 3) {
map.put("3", list.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", num.split("-")[2]);
x++; } else {
map.put("4", list.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", " ");
x++; }
map.put("5", list.get(start + (8 * x + j) - 1).getValue()); x++;
x++; }
map.put("6", list.get(start + (8 * x + j) - 1).getValue()); // map.put("1", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("7", list.get(start + (8 * x + j) - 1).getValue()); // map.put("2", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("8", list.get(start + (8 * x + j) - 1).getValue()); // map.put("3", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("9", list.get(start + (8 * x + j) - 1).getValue()); // map.put("4", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("10", list.get(start + (8 * x + j) - 1).getValue()); // map.put("5", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("11", list.get(start + (8 * x + j) - 1).getValue()); // map.put("6", list.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("12", list.get(start + (8 * x + j) - 1).getValue()); // map.put("7", list.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("8", list.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("9", list.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("10", list.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("11", list.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("12", list.get(start + (8 * x + j) - 1).getValue());
} }
resultList2.add(map); resultList2.add(map);
} }
@ -1517,8 +1575,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("10", "10"); map.put("10", "10");
map.put("11", "11"); map.put("11", "11");
map.put("12", "12"); map.put("12", "12");
} map.put("13", "1");
else { map.put("14", "2");
map.put("15", "3");
map.put("16", "4");
map.put("17", "5");
map.put("18", "6");
map.put("19", "7");
map.put("20", "8");
map.put("21", "9");
map.put("22", "10");
map.put("23", "11");
map.put("24", "12");
} else {
if (j == 1) { if (j == 1) {
map.put("0", "A"); map.put("0", "A");
} }
@ -1543,29 +1612,39 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (j == 8) { if (j == 8) {
map.put("0", "H"); map.put("0", "H");
} }
map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue()); for (int k = 1; k <= 12; k++) {
x++; map.put(k + "", arrVOList.get(start + (8 * x + j) - 1).getValue());
map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue()); String num = arrVOList.get(start + (8 * x + j) - 1).getNum();
x++; if (num != null && !"".equals(num) && num.split("-").length == 3) {
map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", num.split("-")[2]);
x++; } else {
map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", " ");
x++; }
map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue()); x++;
x++; }
map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue());
} }
resultList2.add(map); resultList2.add(map);
} }
@ -1683,8 +1762,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("10", "10"); map.put("10", "10");
map.put("11", "11"); map.put("11", "11");
map.put("12", "12"); map.put("12", "12");
} map.put("13", "1");
else { map.put("14", "2");
map.put("15", "3");
map.put("16", "4");
map.put("17", "5");
map.put("18", "6");
map.put("19", "7");
map.put("20", "8");
map.put("21", "9");
map.put("22", "10");
map.put("23", "11");
map.put("24", "12");
} else {
if (j == 1) { if (j == 1) {
map.put("0", "A"); map.put("0", "A");
} }
@ -1709,29 +1799,39 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (j == 8) { if (j == 8) {
map.put("0", "H"); map.put("0", "H");
} }
map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue()); for (int k = 1; k <= 12; k++) {
x++; map.put(k + "", arrVOList.get(start + (8 * x + j) - 1).getValue());
map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue()); String num = arrVOList.get(start + (8 * x + j) - 1).getNum();
x++; if (num != null && !"".equals(num) && num.split("-").length == 3) {
map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", num.split("-")[2]);
x++; } else {
map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue()); map.put((k + 12) + "", " ");
x++; }
map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue()); x++;
x++; }
map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue());
x++; // x++;
map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue()); // map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue());
// x++;
// map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue());
} }
resultList2.add(map); resultList2.add(map);
} }
@ -1747,21 +1847,24 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); double a1 = Double.parseDouble(list.get(i * 96).getOriginResult());
double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult());
String format = df.format((a1 + b1) / 2); String format = df.format((a1 + b1) / 2);
list.get(i * 96).setNum("阴性对照平均OD值"); ExamineDataArrVO arrVO = new ExamineDataArrVO();
list.get(i * 96).setValue(format); arrVO.setNum("阴性对照平均OD值");
list.get(i * 96).setResult(" "); arrVO.setValue(format);
list1.add(list.get(i * 96)); arrVO.setResult(" ");
list1.add(arrVO);
double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult());
double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult());
String format1 = df.format((a2 + b2) / 2); String format1 = df.format((a2 + b2) / 2);
list.get((i * 96) + 1).setNum("阳性对照平均OD值"); ExamineDataArrVO arrVO1 = new ExamineDataArrVO();
list.get((i * 96) + 1).setValue(format1); arrVO1.setNum("阳性对照平均OD值");
list.get((i * 96) + 1).setResult(" "); arrVO1.setValue(format1);
list1.add(list.get((i * 96) + 1)); arrVO1.setResult(" ");
list1.add(arrVO1);
for (int j = 0; j < 96; j++) { for (int j = 0; j < 96; j++) {
if (j > 5) { ExamineDataArrVO vo = list.get((i * 96) + j);
list1.add(list.get((i * 96) + j)); if (vo.getNum() != null && !"".equals(vo.getNum())) {
list1.add(vo);
} }
} }
} }
@ -1770,24 +1873,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); double a1 = Double.parseDouble(list.get(i * 96).getOriginResult());
double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult());
String format = df.format((a1 + b1) / 2); String format = df.format((a1 + b1) / 2);
list.get(i * 96).setNum("阴性对照平均OD值"); ExamineDataArrVO arrVO = new ExamineDataArrVO();
list.get(i * 96).setValue(format); arrVO.setNum("阴性对照平均OD值");
list.get(i * 96).setResult(" "); arrVO.setValue(format);
list1.add(list.get(i * 96)); arrVO.setResult(" ");
list1.add(arrVO);
double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult());
double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult());
String format1 = df.format((a2 + b2) / 2); String format1 = df.format((a2 + b2) / 2);
list.get((i * 96) + 1).setNum("阳性对照平均OD值"); ExamineDataArrVO arrVO1 = new ExamineDataArrVO();
list.get((i * 96) + 1).setValue(format1); arrVO1.setNum("阳性对照平均OD值");
list.get((i * 96) + 1).setResult(" "); arrVO1.setValue(format1);
list1.add(list.get((i * 96) + 1)); arrVO1.setResult(" ");
list1.add(arrVO1);
for (int j = 0; j < 96; j++) { for (int j = 0; j < 96; j++) {
if ((i * 96) + j > list.size() - 1) { if ((i * 96) + j > list.size() - 1) {
break; break;
} }
if (j > 5) { ExamineDataArrVO vo = list.get((i * 96) + j);
list1.add(list.get((i * 96) + j)); if (vo.getNum() != null && !"".equals(vo.getNum())) {
list1.add(vo);
} }
} }
} }
@ -1810,7 +1916,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("result3", list1.get(list1.size() / 3 * 2 + i).getResult()); map.put("result3", list1.get(list1.size() / 3 * 2 + i).getResult());
resultList1.add(map); resultList1.add(map);
} }
} else { }
else {
for (int i = 0; i < list1.size() / 3 + 1; i++) { for (int i = 0; i < list1.size() / 3 + 1; i++) {
if (list1.size() % 3 == 1) { if (list1.size() % 3 == 1) {
@ -1847,7 +1954,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
result.put("list1", resultList1); result.put("list1", resultList1);
} }
url = reportPrint; url = reportPrint;
// 原始酶标板数据
if (list.size() % 96 != 0) { if (list.size() % 96 != 0) {
for (int i = 0; i < (list.size() / 96 + 1); i++) { for (int i = 0; i < (list.size() / 96 + 1); i++) {
int start = i * 96; int start = i * 96;
@ -1871,6 +1978,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("10", "10"); map.put("10", "10");
map.put("11", "11"); map.put("11", "11");
map.put("12", "12"); map.put("12", "12");
map.put("13", "1");
map.put("14", "2");
map.put("15", "3");
map.put("16", "4");
map.put("17", "5");
map.put("18", "6");
map.put("19", "7");
map.put("20", "8");
map.put("21", "9");
map.put("22", "10");
map.put("23", "11");
map.put("24", "12");
} else { } else {
if (j == 1) { if (j == 1) {
map.put("0", "A"); map.put("0", "A");
@ -1896,53 +2015,71 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (j == 8) { if (j == 8) {
map.put("0", "H"); map.put("0", "H");
} }
if (list.size() - 1 >= start + (8 * x + j) - 1) { for (int k = 1; k <= 12; k++) {
map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult()); if (list.size() - 1 >= start + (8 * x + j) - 1) {
} map.put(k + "", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; String num = list.get(start + (8 * x + j) - 1).getNum();
if (list.size() - 1 >= start + (8 * x + j) - 1) { if (num != null && !"".equals(num) && num.split("-").length == 3) {
map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult()); map.put((k + 12) + "", num.split("-")[2]);
} } else {
x++; map.put((k + 12) + "", " ");
if (list.size() - 1 >= start + (8 * x + j) - 1) { }
map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult()); }
} x++;
x++; }
if (list.size() - 1 >= start + (8 * x + j) - 1) { // if (list.size() - 1 >= start + (8 * x + j) - 1) {
map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult());
} // String num = list.get(start + (8 * x + j) - 1).getNum();
x++; // if (num != null && !"".equals(num) && num.split("-").length == 3) {
if (list.size() - 1 >= start + (8 * x + j) - 1) { // map.put("13", num.split("-")[2]);
map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult()); // } else {
} // map.put("13", " ");
x++; // }
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
x++; // map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult());
if (list.size() - 1 >= start + (8 * x + j) - 1) { // }
map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult()); // x++;
} // if (list.size() - 1 >= start + (8 * x + j) - 1) {
// map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult());
// }
// x++;
// if (list.size() - 1 >= start + (8 * x + j) - 1) {
// map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult());
// }
// x++;
// if (list.size() - 1 >= start + (8 * x + j) - 1) {
// map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult());
// }
// x++;
// if (list.size() - 1 >= start + (8 * x + j) - 1) {
// map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult());
// }
// x++;
// if (list.size() - 1 >= start + (8 * x + j) - 1) {
// map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult());
// }
} }
resultList2.add(map); resultList2.add(map);
} }
@ -1970,6 +2107,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("10", "10"); map.put("10", "10");
map.put("11", "11"); map.put("11", "11");
map.put("12", "12"); map.put("12", "12");
map.put("13", "1");
map.put("14", "2");
map.put("15", "3");
map.put("16", "4");
map.put("17", "5");
map.put("18", "6");
map.put("19", "7");
map.put("20", "8");
map.put("21", "9");
map.put("22", "10");
map.put("23", "11");
map.put("24", "12");
} else { } else {
if (j == 1) { if (j == 1) {
map.put("0", "A"); map.put("0", "A");
@ -1995,29 +2144,39 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (j == 8) { if (j == 8) {
map.put("0", "H"); map.put("0", "H");
} }
map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult()); for (int k = 1; k <= 12; k++) {
x++; map.put(k + "", list.get(start + (8 * x + j) - 1).getOriginResult());
map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult()); String num = list.get(start + (8 * x + j) - 1).getNum();
x++; if (num != null && !"".equals(num) && num.split("-").length == 3) {
map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult()); map.put((k + 12) + "", num.split("-")[2]);
x++; } else {
map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult()); map.put((k + 12) + "", " ");
x++; }
map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult()); x++;
x++; }
map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult());
x++; // x++;
map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult()); // map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult());
// x++;
// map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult());
// x++;
// map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult());
// x++;
// map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult());
// x++;
// map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult());
// x++;
// map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult());
} }
resultList2.add(map); resultList2.add(map);
} }
@ -2778,8 +2937,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
} }
} }
} } else {
else {
for (int i = 0; i < list.size() / 96 + 1; i++) { for (int i = 0; i < list.size() / 96 + 1; i++) {
double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); double a1 = Double.parseDouble(list.get(i * 96).getOriginResult());
double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult());
@ -2873,6 +3031,108 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
} }
@Override
public void repairPrint(String id, HttpServletResponse response) {
String dateStamp = new java.text.SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
String srcPathName = "C://Users//AAA//Desktop//shuojin//" + dateStamp;
String outputFile = "C://Users//AAA//Desktop//shuojin//" + dateStamp + ".zip";
File file = new File(srcPathName);
//如果文件夹不存在,创建文件夹
if(!file.exists()){
file.mkdir();
}
XWPFDocument doc = null;
FileOutputStream fos = null;
String[] repairIds = id.split(",");
for (String repairId : repairIds) {
Map<String, Object> result = new HashMap<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
RepairApplication repair = repairApplicationService.getById(repairId);
result.put("1", repair.getCode());
result.put("2", repair.getApplyRepairDept());
result.put("3", repair.getName());
result.put("4", repair.getCode());
result.put("5", repair.getManufacturer());
result.put("6", repair.getVersion());
result.put("7", format.format(repair.getProductionDate()));
result.put("8", format.format(repair.getEnableDate()));
result.put("9", repair.getFaultPhenomenon());
result.put("10", repair.getApplyUserName());
result.put("11", repair.getApplyDeptUserName());
result.put("12", format.format(repair.getApplyDate()));
result.put("13", repair.getReviewComments());
result.put("14", repair.getBusinessOfficeName());
result.put("15", format.format(repair.getReviewDate()));
result.put("16", repair.getApprovalComments());
result.put("17", repair.getCenterDirectorName());
result.put("18", format.format(repair.getApplyDate()));
result.put("19", repair.getMaintenanceRecord());
result.put("20", repair.getMaintainer());
result.put("21", format.format(repair.getMaintainerDate()));
result.put("22", repair.getWorkingHours());
result.put("23", repair.getLaborCost());
result.put("24", repair.getMaterialCost());
result.put("25", repair.getTotalCost());
result.put("26", repair.getAcceptedName());
result.put("27", format.format(repair.getAcceptedDate()));
result.put("28", repair.getRemark());
result.put("29", repair.getUserComments());
try {
doc = WordExportUtil.exportWord07(repairPrint, result);
fos = new FileOutputStream(srcPathName + "//" + repair.getName() + "报修申请表.docx");
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != doc) {
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();
}
}
}
}
ZipCompressUtil.compress(srcPathName, outputFile);
// 返回文件流给前端
response.setContentType("application/x-msdownload;");
response.setHeader("Content-disposition", "attachment;filename=" + dateStamp + ".zip");
//注:如果返回content-length的时候,先复制一下输入流,此时记录文件长度,返回复制之后的文件流
File file1 = new File(outputFile);
try {
InputStream stream = new FileInputStream(file1);
ServletOutputStream out = response.getOutputStream();
byte buff[] = new byte[1024];
int length = 0;
while ((length = stream.read(buff)) > 0) {
out.write(buff,0,length);
}
stream.close();
out.close();
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/** /**
* 根据网络图片URL转成字节数组弃用 * 根据网络图片URL转成字节数组弃用
*/ */
@ -2993,7 +3253,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 委托单内容补充 // 委托单内容补充
entrust.setSimpleName(simpleName.toString()); entrust.setSimpleName(simpleName.toString());
entrust.setSimpleCount(simpleCount); entrust.setSimpleCount(simpleCount);
String originalNum = "01-" + fullByZero(simpleCount); String originalNum = "01-" + fullByZero(simpleCount);
entrust.setIsDeleted(0); entrust.setIsDeleted(0);
entrust.setCreateUser(null); entrust.setCreateUser(null);
@ -3053,7 +3313,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
/** /**
* 新增或修改检验集合 * 新增或修改检验集合
*/ */
private void addOrUpdateExamines(List<Examine> examines, Entrust entrust) { private void addOrUpdateExamines(List<Examine> examines, Entrust entrust, Long id) {
if (CollectionUtils.isNotEmpty(examines)) { if (CollectionUtils.isNotEmpty(examines)) {
List<Examine> saveList = new ArrayList<>(); List<Examine> saveList = new ArrayList<>();
List<Examine> updateList = new ArrayList<>(); List<Examine> updateList = new ArrayList<>();
@ -3067,7 +3327,11 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
examine.setSimpleCount(0); examine.setSimpleCount(0);
examine.setExperieNum(""); examine.setExperieNum("");
examine.setExamineOrder(i + 1); examine.setExamineOrder(i + 1);
examine.setEntrustId(entrust.getId()); if (entrust.getId() != null) {
examine.setEntrustId(entrust.getId());
} else {
examine.setEntrustId(id);
}
examine.setAcceptanceNum(entrust.getAcceptanceNum()); examine.setAcceptanceNum(entrust.getAcceptanceNum());
examine.setCreateTime(new Date()); examine.setCreateTime(new Date());
examine.setUpdateTime(new Date()); examine.setUpdateTime(new Date());
@ -3086,11 +3350,13 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
private void addUseCount(int type, Long elementId) { private void addUseCount(int type, Long elementId) {
System.out.println("type:" + type); System.out.println("type:" + type);
System.out.println("elementId: " + elementId); System.out.println("elementId: " + elementId);
if (elementId == null) { return; } if (elementId == null) {
return;
}
if (type == 1) { if (type == 1) {
ExamineItem examineItem = examineItemService.getById(elementId); ExamineItem examineItem = examineItemService.getById(elementId);
Integer useCount = examineItem.getUseCount(); Integer useCount = examineItem.getUseCount();
examineItem.setUseCount(++ useCount); examineItem.setUseCount(++useCount);
examineItemService.updateById(examineItem); examineItemService.updateById(examineItem);
} }
if (type == 2) { if (type == 2) {

@ -84,6 +84,13 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
} }
} }
List<Examine> examines = eTask.getExamines(); List<Examine> examines = eTask.getExamines();
String simpleCurrPlace = "";
for (Examine examine : examines) {
if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) {
simpleCurrPlace = examine.getSimpleCurrPlace();
break;
}
}
for (Examine examine : examines) { for (Examine examine : examines) {
if (!"".equals(examine.getExperieNum())) { if (!"".equals(examine.getExperieNum())) {
continue; continue;
@ -112,6 +119,7 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
examine.setIsFinished("-1"); examine.setIsFinished("-1");
examine.setDemandCompletionTime(taskBlueprint.getDemandCompletionTime()); examine.setDemandCompletionTime(taskBlueprint.getDemandCompletionTime());
examine.setDeptId(eTask.getDeptId()); examine.setDeptId(eTask.getDeptId());
examine.setSimpleCurrPlace(simpleCurrPlace);
} }
examineService.updateBatchById(examines); examineService.updateBatchById(examines);
} }

Loading…
Cancel
Save