Forráskód Böngészése

核酸混检条码打印模块

lighter 3 éve
szülő
commit
525a2742dd

+ 40 - 0
src/main/java/thyyxxk/webserver/controller/examinations/MixLabelPrintController.java

@@ -0,0 +1,40 @@
+package thyyxxk.webserver.controller.examinations;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.examinations.MixLabelPrinter;
+import thyyxxk.webserver.service.examinations.MixLabelPrintService;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("/mixLabelPrint")
+public class MixLabelPrintController {
+    private final MixLabelPrintService service;
+
+    @Autowired
+    public MixLabelPrintController(MixLabelPrintService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectMaxLabelRange")
+    public ResultVo<Map<String, String>> selectMaxLabelRange() {
+        return service.selectMaxLabelRange();
+    }
+
+    @GetMapping("/selectLabelPrinter")
+    public ResultVo<MixLabelPrinter> selectLabelPrinter(@RequestParam("label") String label) {
+        return service.selectLabelPrinter(label);
+    }
+
+    @GetMapping("/printLabel")
+    public ResultVo<MixLabelPrinter> printLabel(@RequestParam("label") String label) {
+        return service.printLabel(label);
+    }
+
+    @PostMapping("/reprintLabel")
+    public ResultVo<MixLabelPrinter> reprintLabel(@RequestBody MixLabelPrinter printer) {
+        return service.reprintLabel(printer);
+    }
+}

+ 16 - 0
src/main/java/thyyxxk/webserver/dao/his/examinations/MixLabelPrintDao.java

@@ -0,0 +1,16 @@
+package thyyxxk.webserver.dao.his.examinations;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.examinations.MixLabelPrinter;
+
+@Mapper
+public interface MixLabelPrintDao extends BaseMapper<MixLabelPrinter> {
+
+    @Select("select min(label) + ' - ' + max(label) from t_mix_label_printer")
+    String selectMaxLabelRange();
+
+    @Select("select top 1 label from t_mix_label_printer where status=0 order by label")
+    String selectMinUnprintedLabel();
+}

+ 53 - 0
src/main/java/thyyxxk/webserver/entity/examinations/MixLabelPrinter.java

@@ -0,0 +1,53 @@
+package thyyxxk.webserver.entity.examinations;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import java.util.Date;
+
+@Data
+@TableName(value = "t_mix_label_printer")
+public class MixLabelPrinter implements Serializable {
+
+	private static final long serialVersionUID =  7579493938296836947L;
+
+	/**
+	 * 标签编号
+	 */
+	@TableId(type= IdType.ASSIGN_UUID)
+	private String label;
+
+	/**
+	 * 状态:0-未打印,1-已打印
+	 */
+	private Integer status;
+
+	/**
+	 * 是否重复打印过:0-否,1-是
+	 */
+	private Integer reprint;
+
+	/**
+	 * 打印操作人
+	 */
+	private String printStaff;
+
+	/**
+	 * 打印时间
+	 */
+	private Date printDatetime;
+
+	/**
+	 * 重复打印操作人
+	 */
+	private String reprintStaff;
+
+	/**
+	 * 重复打印操作时间
+	 */
+	private Date reprintDatetime;
+
+}

+ 59 - 0
src/main/java/thyyxxk/webserver/service/examinations/MixLabelPrintService.java

@@ -0,0 +1,59 @@
+package thyyxxk.webserver.service.examinations;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.examinations.MixLabelPrintDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.examinations.MixLabelPrinter;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class MixLabelPrintService {
+    private final MixLabelPrintDao dao;
+
+    @Autowired
+    public MixLabelPrintService(MixLabelPrintDao dao) {
+        this.dao = dao;
+    }
+
+    public ResultVo<Map<String, String>> selectMaxLabelRange() {
+        Map<String, String> map = new HashMap<>();
+        map.put("range", dao.selectMaxLabelRange());
+        map.put("advise", dao.selectMinUnprintedLabel());
+        return ResultVoUtil.success(map);
+    }
+
+    public ResultVo<MixLabelPrinter> selectLabelPrinter(String label) {
+        MixLabelPrinter printer = dao.selectById(label);
+        if (null == printer) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请输入正确的起始标签!");
+        }
+        return ResultVoUtil.success(printer);
+    }
+
+    public ResultVo<MixLabelPrinter> printLabel(String label) {
+        MixLabelPrinter printer = new MixLabelPrinter();
+        printer.setLabel(label);
+        printer.setStatus(1);
+        printer.setPrintStaff(TokenUtil.getTokenUserId());
+        printer.setPrintDatetime(new Date());
+        dao.updateById(printer);
+        return ResultVoUtil.success(printer);
+    }
+
+    public ResultVo<MixLabelPrinter> reprintLabel(MixLabelPrinter printer) {
+        printer.setReprint(1);
+        printer.setReprintStaff(TokenUtil.getTokenUserId());
+        printer.setReprintDatetime(new Date());
+        dao.updateById(printer);
+        return ResultVoUtil.success(printer);
+    }
+}