|
@@ -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);
|
|
|
+ }
|
|
|
+}
|