diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 7540f20..3f4e73d 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -19,6 +19,8 @@
+
+
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 5ed6355..c738a70 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -2,6 +2,9 @@
+
+
+
\ No newline at end of file
diff --git a/blood_bus/pom.xml b/blood_bus/pom.xml
index 5c0420d..8538a61 100644
--- a/blood_bus/pom.xml
+++ b/blood_bus/pom.xml
@@ -22,5 +22,34 @@
blood_system
1.0
+
+ net.sf.jasperreports
+ jasperreports
+
+
+ com.lowagie
+ itext
+
+
+
+ com.itextpdf
+ kernel
+
+
+
+
+ com.itextpdf
+ layout
+
+
+
+
+ com.belerweb
+ pinyin4j
+
+
+ org.apache.pdfbox
+ pdfbox
+
diff --git a/blood_bus/src/main/java/com/czblood/bus/constants/BloodInterfaceTypeConstants.java b/blood_bus/src/main/java/com/czblood/bus/constants/BloodInterfaceTypeConstants.java
index 1366209..bd3e120 100644
--- a/blood_bus/src/main/java/com/czblood/bus/constants/BloodInterfaceTypeConstants.java
+++ b/blood_bus/src/main/java/com/czblood/bus/constants/BloodInterfaceTypeConstants.java
@@ -13,4 +13,8 @@ public class BloodInterfaceTypeConstants {
* 获取患者信息
*/
public static final String GET_PATIENT_INFO = "GET_PATIENT_INFO";
+ /**
+ * 输血前评估
+ */
+ public static final String BEFORE_ASSESS = "BEFORE_ASSESS";
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/constants/BloodSysLogConstants.java b/blood_bus/src/main/java/com/czblood/bus/constants/BloodSysLogConstants.java
index 4428554..cfaf832 100644
--- a/blood_bus/src/main/java/com/czblood/bus/constants/BloodSysLogConstants.java
+++ b/blood_bus/src/main/java/com/czblood/bus/constants/BloodSysLogConstants.java
@@ -4,4 +4,5 @@ package com.czblood.bus.constants;
* 输血日志常量类
*/
public class BloodSysLogConstants {
+ public static final String LOG_TYPE_TRANSFUSE_APPLY_BEFORE = "输血前评估";
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/controller/BloodCommonController.java b/blood_bus/src/main/java/com/czblood/bus/controller/BloodCommonController.java
index f64b15e..fc8790f 100644
--- a/blood_bus/src/main/java/com/czblood/bus/controller/BloodCommonController.java
+++ b/blood_bus/src/main/java/com/czblood/bus/controller/BloodCommonController.java
@@ -1,7 +1,7 @@
package com.czblood.bus.controller;
-import com.czblood.bus.cache.OptionCache;
import com.czblood.bus.mapper.XkProTransfuseProjectMapper;
+import com.czblood.bus.pojo.XkBloodBreed;
import com.czblood.bus.pojo.XkDmzd;
import com.czblood.bus.pojo.XkProTransfuseProject;
import com.czblood.bus.utils.BloodBankUtil;
@@ -59,4 +59,12 @@ public class BloodCommonController {
String parameterValue = bloodBankUtil.getParameterValue(parameterCode);
return new Result("0","获取参数成功!",parameterValue);
}
+
+ @ApiOperation("获取有效的血液品种")
+ @GetMapping("/getBloodBreed")
+ public Result getBloodBreed(){
+ List bloodBreedList = bloodBankUtil.getBloodBreed();
+ return new Result("0","获取数据成功!",bloodBreedList);
+
+ }
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/BloodBankMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/BloodBankMapper.java
new file mode 100644
index 0000000..45f14be
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/BloodBankMapper.java
@@ -0,0 +1,7 @@
+package com.czblood.bus.mapper;
+
+import java.util.Map;
+
+public interface BloodBankMapper {
+ void spProduceMaxvalue(Map map);
+}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/XkBloodBreedMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/XkBloodBreedMapper.java
new file mode 100644
index 0000000..edb36be
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/XkBloodBreedMapper.java
@@ -0,0 +1,9 @@
+package com.czblood.bus.mapper;
+
+import com.czblood.bus.pojo.XkBloodBreed;
+
+import java.util.List;
+
+public interface XkBloodBreedMapper {
+ List queryList(XkBloodBreed xkBloodBreed);
+}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/XkPatientInfoMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/XkPatientInfoMapper.java
index c816b96..0d34951 100644
--- a/blood_bus/src/main/java/com/czblood/bus/mapper/XkPatientInfoMapper.java
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/XkPatientInfoMapper.java
@@ -6,4 +6,7 @@ import java.util.List;
public interface XkPatientInfoMapper {
List queryList(XkPatientInfo xkPatientInfo);
+ void insertXkPatientInfo(XkPatientInfo xkPatientInfo);
+ void deleteXkPatientInfo(String beinhos_id);
+ void updateXkPatientInfo(XkPatientInfo xkPatientInfo);
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyBeforeMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyBeforeMapper.java
index 7ca5f6b..4f5cba2 100644
--- a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyBeforeMapper.java
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyBeforeMapper.java
@@ -6,4 +6,7 @@ import java.util.List;
public interface XkTransfuseApplyBeforeMapper {
List queryList(XkTransfuseApplyBefore xkTransfuseApplyBefore);
+ void insertXkTransfuseApplyBefore(XkTransfuseApplyBefore xkTransfuseApplyBefore);
+ void updateXkTransfuseApplyBefore(XkTransfuseApplyBefore xkTransfuseApplyBefore);
+ void deleteXkTransfuseApplyBefore(String bill_no);
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyMapper.java
index c8cf5d9..59894cb 100644
--- a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyMapper.java
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyMapper.java
@@ -6,4 +6,5 @@ import java.util.List;
public interface XkTransfuseApplyMapper {
List queryList(XkTransfuseApply xkTransfuseApply);
+ XkTransfuseApply queryOne(String billNo);
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyTestitemMapper.java b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyTestitemMapper.java
index 6a877aa..a64816c 100644
--- a/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyTestitemMapper.java
+++ b/blood_bus/src/main/java/com/czblood/bus/mapper/XkTransfuseApplyTestitemMapper.java
@@ -1,9 +1,13 @@
package com.czblood.bus.mapper;
import com.czblood.bus.pojo.XkTransfuseApplyTestitem;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface XkTransfuseApplyTestitemMapper {
List queryList(String bill_no);
+ void insertXkTransfuseApplyTestitem(XkTransfuseApplyTestitem xkTransfuseApplyTestitem);
+ void updateXkTransfuseApplyTestitem(XkTransfuseApplyTestitem xkTransfuseApplyTestitem);
+ void deleteXkTransfuseApplyTestitem(@Param("bill_no") String bill_no,@Param("sid") int sid);
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/pojo/XkBloodBreed.java b/blood_bus/src/main/java/com/czblood/bus/pojo/XkBloodBreed.java
new file mode 100644
index 0000000..c3d72bd
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/pojo/XkBloodBreed.java
@@ -0,0 +1,37 @@
+package com.czblood.bus.pojo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class XkBloodBreed {
+ private String breed_code;
+ private String breed_name;
+ private String blood_kind;
+ private String breed_yard;
+ private String breed_liquid;
+ private String store_condition;
+ private String start_validity;
+ private Integer period_validity;
+ private String validity_unit;
+ private BigDecimal trans_num;
+ private String unit;
+ private BigDecimal price;
+ private BigDecimal rh_price;
+ private String hos_bloodbreed;
+ private String Is_match;
+ private Integer operate_sequence;
+ private String autocode_sign;
+ private Date last_modified;
+ private String use_sign;
+ private BigDecimal apply_upper_limit;
+ private String bloodstation_breedcode;
+ private String station_breed_code;
+ private String station_breed_name;
+}
diff --git a/blood_bus/src/main/java/com/czblood/bus/pojo/XkPatientInfo.java b/blood_bus/src/main/java/com/czblood/bus/pojo/XkPatientInfo.java
index 0de4111..54f8caa 100644
--- a/blood_bus/src/main/java/com/czblood/bus/pojo/XkPatientInfo.java
+++ b/blood_bus/src/main/java/com/czblood/bus/pojo/XkPatientInfo.java
@@ -1,5 +1,8 @@
package com.czblood.bus.pojo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -9,23 +12,42 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
+@ApiModel("病人信息")
public class XkPatientInfo {
+ @ApiModelProperty("医疗机构ID")
private String hos_id;
+ @ApiModelProperty("住院号")
private String beinhos_id;
+ @ApiModelProperty("病人姓名")
private String patient_name;
+ @ApiModelProperty("病人性别")
private String patient_sex;
+ @ApiModelProperty("病人年龄")
private String age;
+ @ApiModelProperty("病人生日")
private Date patient_birthday;
+ @ApiModelProperty("病人属地")
private String apanage;
+ @ApiModelProperty("来源标志")
private String out_sign;
+ @ApiModelProperty("病人ABO血型")
private String abo;
+ @ApiModelProperty("病人RH血型")
private String rh;
+ @ApiModelProperty("输血史")
private String transfuse_history;
+ @ApiModelProperty("输血反应史")
private String reaction_history;
+ @ApiModelProperty("妊娠史")
private String gestation_history;
+ @ApiModelProperty("分娩史")
private String parturition_history;
+ @ApiModelProperty("配型史")
private String match_history;
+ @ApiModelProperty("器官移植史")
private String transplant_history;
+ @ApiModelProperty("最后修改时间")
private Date last_modified;
+ @ApiModelProperty("住院次数")
private String times;
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApply.java b/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApply.java
index f593c05..c0e95ee 100644
--- a/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApply.java
+++ b/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApply.java
@@ -1,5 +1,7 @@
package com.czblood.bus.pojo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -10,12 +12,19 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
+@ApiModel("输血申请信息")
public class XkTransfuseApply {
+ @ApiModelProperty("单据号")
private String bill_no;
+ @ApiModelProperty("医疗机构ID")
private String hos_id;
+ @ApiModelProperty("住院号")
private String beinhos_id;
+ @ApiModelProperty("病人唯一号")
private String beinhos_number;
+ @ApiModelProperty("病区代码")
private String zone_id;
+ @ApiModelProperty("床号")
private String patient_bed;
private String casehistory_id;
private String transfuse_history;
@@ -39,12 +48,16 @@ public class XkTransfuseApply {
private Date gather_date;
private String abo_type;
private String rh_type;
+ @ApiModelProperty("审核标志")
private String check_sign;
private String check_explain;
+ @ApiModelProperty("状态")
private String bill_stasus;
private String bill_type;
private String apply_medic;
+ @ApiModelProperty("诊断")
private String diagnoses;
+ @ApiModelProperty("输血目的")
private String intent;
private String apply_type;
private Date use1_date;
@@ -75,10 +88,12 @@ public class XkTransfuseApply {
private BigDecimal Use3_Num;
private String Dept_Type;
private String use_type;
+ @ApiModelProperty("单病种")
private String Ill_Code;
private String Ops_Name;
private String isemergency;
private String Valid_Flag;
private String notice_yn;
private String his_SerialNo;
+ private String assess_bill_no;
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApplyBefore.java b/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApplyBefore.java
index dd198b4..59cd663 100644
--- a/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApplyBefore.java
+++ b/blood_bus/src/main/java/com/czblood/bus/pojo/XkTransfuseApplyBefore.java
@@ -29,4 +29,5 @@ public class XkTransfuseApplyBefore {
private String metabolism;
private String cruor;
private String bqgy;
+ private String hos_id;
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/pojo/inter/BeforeAssessRequest.java b/blood_bus/src/main/java/com/czblood/bus/pojo/inter/BeforeAssessRequest.java
new file mode 100644
index 0000000..aee6189
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/pojo/inter/BeforeAssessRequest.java
@@ -0,0 +1,26 @@
+package com.czblood.bus.pojo.inter;
+
+import cn.hutool.json.JSONUtil;
+import com.czblood.bus.constants.BloodInterfaceTypeConstants;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 输血前评估
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BeforeAssessRequest implements BloodInterfaceType{
+ private final String method = BloodInterfaceTypeConstants.BEFORE_ASSESS;
+ /**
+ * 单据编号
+ */
+ private String billNo;
+
+ @Override
+ public String serializationJson() {
+ return JSONUtil.toJsonStr(this);
+ }
+}
diff --git a/blood_bus/src/main/java/com/czblood/bus/utils/BloodBankUtil.java b/blood_bus/src/main/java/com/czblood/bus/utils/BloodBankUtil.java
index 344c14f..21705a5 100644
--- a/blood_bus/src/main/java/com/czblood/bus/utils/BloodBankUtil.java
+++ b/blood_bus/src/main/java/com/czblood/bus/utils/BloodBankUtil.java
@@ -1,18 +1,25 @@
package com.czblood.bus.utils;
+import cn.hutool.core.date.DateUtil;
import com.czblood.bus.cache.DmzdCache;
import com.czblood.bus.cache.OptionCache;
+import com.czblood.bus.mapper.BloodBankMapper;
+import com.czblood.bus.mapper.XkBloodBreedMapper;
import com.czblood.bus.mapper.XkDmzdMapper;
import com.czblood.bus.mapper.XkParameterMapper;
+import com.czblood.bus.pojo.XkBloodBreed;
import com.czblood.bus.pojo.XkDmzd;
import com.czblood.bus.pojo.XkParameter;
import com.czblood.common.core.domain.Result;
+import com.czblood.system.util.CommonUtil;
import org.springframework.data.redis.connection.ReactiveSubscription;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
@Component
@@ -22,6 +29,12 @@ public class BloodBankUtil {
XkDmzdMapper xkDmzdMapper;
@Resource
XkParameterMapper xkParameterMapper;
+ @Resource
+ BloodBankMapper bloodBankMapper;
+ @Resource
+ CommonUtil commonUtil;
+ @Resource
+ XkBloodBreedMapper xkBloodBreedMapper;
/**
@@ -76,4 +89,31 @@ public class BloodBankUtil {
}
+ public String getMaxValue(){
+ Map map = new HashMap<>();
+ bloodBankMapper.spProduceMaxvalue(map);
+ return isBank(map.get("returncode"));
+ }
+
+
+ public static String isBank(Object param){
+ String s = String.valueOf(param);
+ if(s.equals("null")){
+ return "";
+ }else{
+ return s;
+ }
+ }
+
+ public String produceBillNo(String type){
+ String formatDate = DateUtil.format(commonUtil.getCurrentTimeDate(), "yyyyMMdd");
+ return type + formatDate + getMaxValue();
+ }
+
+ public List getBloodBreed(){
+ XkBloodBreed xkBloodBreed = new XkBloodBreed();
+ return xkBloodBreedMapper.queryList(xkBloodBreed);
+ }
+
+
}
diff --git a/blood_bus/src/main/java/com/czblood/bus/utils/BloodInterfaceUtil.java b/blood_bus/src/main/java/com/czblood/bus/utils/BloodInterfaceUtil.java
index 36aaab0..0a873be 100644
--- a/blood_bus/src/main/java/com/czblood/bus/utils/BloodInterfaceUtil.java
+++ b/blood_bus/src/main/java/com/czblood/bus/utils/BloodInterfaceUtil.java
@@ -27,6 +27,12 @@ public class BloodInterfaceUtil {
* @return
*/
private static Result invokeHttp(String jsonStr){
+ String openInterface = RuoYiConfig.getOpenInterface();
+ if(openInterface != null){
+ if(openInterface.equals("0")){
+ return new Result("0","接口未开启!");
+ }
+ }
String interfaceUrl = RuoYiConfig.getInterfaceUrl();
if(interfaceUrl == null || "".equals(interfaceUrl)) return new Result("-1","没有配置接口地址,请检查interfaceUrl配置项!!!");
String retMsg = "";
diff --git a/blood_bus/src/main/java/com/czblood/bus/utils/JasperReportUtil.java b/blood_bus/src/main/java/com/czblood/bus/utils/JasperReportUtil.java
new file mode 100644
index 0000000..09f5f8f
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/utils/JasperReportUtil.java
@@ -0,0 +1,435 @@
+package com.czblood.bus.utils;
+
+import com.czlis.common.config.RuoYiConfig;
+import lombok.extern.slf4j.Slf4j;
+import net.sf.jasperreports.engine.*;
+import net.sf.jasperreports.engine.JasperPrint;
+import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
+import net.sf.jasperreports.engine.export.JRPdfExporter;
+import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
+import net.sf.jasperreports.engine.util.JRLoader;
+import net.sf.jasperreports.engine.util.JRSaver;
+import net.sf.jasperreports.export.SimpleExporterInput;
+import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
+import net.sf.jasperreports.export.SimplePrintServiceExporterConfiguration;
+import org.springframework.stereotype.Component;
+
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.print.attribute.standard.OrientationRequested;
+import java.io.File;
+import java.io.FileInputStream;
+import java.sql.Connection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * JasperReports 打印/导出工具类
+ */
+@Component
+@Slf4j
+public class JasperReportUtil {
+ /**打印模板默认子文件夹*/
+ private static final String templates="templates";
+ /**
+ * 核心打印/导出方法
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ * @param dataList 循环体数据(List集合,每条数据对应detail区域一行)
+ * @param pdfType 打印方式(pdfType为true导出PDF)
+ * @param exportPath PDF导出路径(pdfType为PDF时必传)
+ * @param printtimes 打印次数(可为null,默认1次)
+ * @param papersize 纸张尺寸(可为null,默认使用模板纸张)
+ * @param Orientation 纸张方向(false直打,true横打)
+ * @param showDialog 打印前是否预览(false直接打印,true预览)
+ * @param connection 数据源,推荐使用DataSource注入对象传递当前库连接对象
+ * @throws Exception Jasper相关异常
+ */
+ public static void printbase(
+ String printerName,
+ String templateName,
+ Map parameters,
+ List> dataList,
+ boolean pdfType,
+ String exportPath,
+ Integer printtimes,
+ String papersize,
+ boolean Orientation,
+ boolean showDialog,
+ Connection connection
+ ) throws Exception {
+ // 1. 在 printbase 中获取配置路径并初始化目录
+ String templateDir = getTemplateDir(); // 获取配置路径
+ String templatePath = templateDir + File.separator+templates+File.separator;
+ initTemplateDir(templateDir); // 初始化目录(不存在则创建)
+ // 在 printbase 方法开头添加
+ if (pdfType && (exportPath == null || exportPath.trim().isEmpty())) {
+ throw new IllegalArgumentException("导出PDF时,exportPath不能为空");
+ }
+ // 2. 加载并编译模板(支持jrxml和jasper)
+ JasperReport jasperReport;
+ try {
+ jasperReport = loadTemplate(templateName,templatePath);
+ } catch (Exception e) {
+ log.error("打印模板创建错误:{}",e);
+ throw new RuntimeException(e);
+ }
+ // 3. 处理循环数据(转换为Jasper数据源)
+ JRDataSource dataSource;
+ if (dataList == null || dataList.isEmpty()) {
+ dataSource=new JREmptyDataSource();
+ }else {
+ dataSource = new JRBeanCollectionDataSource(dataList);
+ }
+ // 4. 填充报表(参数+循环数据)
+ Map safeParams = parameters != null ? parameters : new HashMap<>();
+ JasperPrint jasperPrint=null;
+ if (connection != null) {
+ jasperPrint = JasperFillManager.fillReport(jasperReport, safeParams,connection);
+ }else {
+ jasperPrint = JasperFillManager.fillReport(jasperReport, safeParams, dataSource);
+ }
+ // 5. 根据打印方式执行操作
+ if (pdfType==false) {
+ // 5.1 直接打印到指定打印机
+ printToPrinter(jasperPrint, printerName,printtimes,papersize,Orientation,showDialog);
+ } else{
+ // 5.2 导出为PDF
+ exportToPdf(jasperPrint, exportPath);
+ }
+ }
+
+ /**
+ * 加载并编译模板(从物理路径 D:\template 加载)
+ */
+ private static JasperReport loadTemplate(String templateName,String templatePath) throws Exception {
+ // 物理路径模板文件(支持 jrxml 和 jasper)
+ String jrxmlPath = templatePath + templateName + ".jrxml";
+ String jasperPath = templatePath + templateName + ".jasper";
+
+ compileAndSave(templateName,templatePath);
+ // 1. 优先加载已编译的 jasper 文件
+ File jasperFile = new File(jasperPath);
+ if (jasperFile.exists() && jasperFile.isFile()) {
+ try (FileInputStream fis = new FileInputStream(jasperFile)) {
+ return (JasperReport) JRLoader.loadObject(fis);
+ }
+ }
+
+ // 2. 无 jasper 文件则编译 jrxml
+ File jrxmlFile = new File(jrxmlPath);
+ if (!jrxmlFile.exists() || !jrxmlFile.isFile()) {
+ throw new JRException("模板文件不存在:" + jrxmlPath);
+ }
+ try (FileInputStream fis = new FileInputStream(jrxmlFile)) {
+ return JasperCompileManager.compileReport(fis);
+ }
+ }
+
+
+ /**
+ * 直接打印到指定打印机
+ */
+ private static void printToPrinter(JasperPrint jasperPrint, String printerName,Integer printtimes,String papersize,boolean isLandscape,boolean showDialog) throws JRException {
+ // 查找目标打印机
+ PrintService printService = findPrintService(printerName);
+ if (printService == null) {
+ throw new JRException("未找到指定打印机:" + (printerName == null ? "默认打印机" : printerName));
+ }
+ if (printtimes != null && printtimes <= 0) {
+ throw new IllegalArgumentException("打印次数必须为正整数(printtimes=" + printtimes + ")");
+ }
+ // 配置打印参数(跳过打印对话框,直接打印)
+ JRPrintServiceExporter exporter = new JRPrintServiceExporter();
+ SimplePrintServiceExporterConfiguration config = new SimplePrintServiceExporterConfiguration();
+ config.setPrintService(printService); // 指定打印机
+ config.setDisplayPrintDialog(showDialog); // 不显示打印对话框
+ config.setDisplayPageDialog(false); // 不显示页面设置对话框
+ PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
+ if (printtimes == null) printtimes=1;
+ attributes.add(new Copies(printtimes)); // 打印份数
+ // 修正:只有当papersize不为null时设置纸张大小
+ if (papersize != null) {
+ MediaSizeName mediaSize = getMediaSize(papersize);
+ if (mediaSize != null) { // 额外检查,确保mediaSize有效
+ attributes.add(mediaSize);
+ } else {
+ log.warn("无效的纸张尺寸: {}", papersize);
+ }
+ }
+ // 可选:设置打印方向(横向)
+ if(isLandscape)attributes.add(OrientationRequested.LANDSCAPE);
+ config.setPrintRequestAttributeSet(attributes);
+ // 执行打印
+ exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
+ exporter.setConfiguration(config);
+ exporter.exportReport();
+ }
+
+ /**
+ * 导出为PDF文件
+ */
+ private static void exportToPdf(JasperPrint jasperPrint, String exportPath) throws JRException {
+ // exportToPdf 方法中添加
+ File exportFile = new File(exportPath);
+ File parentDir = exportFile.getParentFile();
+ if (parentDir != null && !parentDir.exists()) {
+ parentDir.mkdirs(); // 创建父目录
+ }
+ JRPdfExporter exporter = new JRPdfExporter();
+ exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
+ exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(exportPath));
+ exporter.exportReport();
+ }
+
+ /**
+ * 根据打印机名称查找打印机(支持模糊匹配)
+ */
+ private static PrintService findPrintService(String printerName) {
+ // 获取所有可用打印机
+ PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
+ if (printServices == null || printServices.length == 0) {
+ return PrintServiceLookup.lookupDefaultPrintService(); // 替代 return null
+ }
+
+ // 1. 打印机名称为null时,返回默认打印机
+ if (printerName == null || printerName.trim().isEmpty()) {
+ return PrintServiceLookup.lookupDefaultPrintService();
+ }
+
+ // 2. 模糊匹配打印机名称(包含关键字即可)
+ for (PrintService service : printServices) {
+ if (service.getName().contains(printerName)) {
+ return service;
+ }
+ }
+ // findPrintService 方法末尾修改
+ return PrintServiceLookup.lookupDefaultPrintService(); // 替代 return null
+ }
+ // ------------------------------ 简化调用的重载方法(可选)------------------------------
+
+ /**
+ * 重载:导出PDF(简化参数,无需传入打印机名称)
+ */
+ public static void exportToPdf(
+ String templateName,
+ Map parameters,
+ List> dataList,
+ String exportPath
+ ) throws Exception {
+ printbase(null, templateName, parameters, dataList, true, exportPath,null,null,false,false,null);
+ }
+ public static void exportToPdf(
+ String templateName,
+ Map parameters,
+ Connection connection,
+ String exportPath
+ ) throws Exception {
+ printbase(null, templateName, parameters,null, true, exportPath,null,null,false,false,connection);
+ }
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ * @param dataList 循环体数据(List集合,每条数据对应detail区域一行)
+ * @param connection 数据源,推荐使用DataSource注入对象传递当前库连接对象
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ Map parameters,
+ List> dataList,
+ Connection connection
+ ) throws Exception {
+ printbase(printerName, templateName, parameters, dataList, false, null,null,null,false,false,connection);
+ }
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ * @param connection 数据源,推荐使用DataSource注入对象传递当前库连接对象
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ Map parameters,
+ Connection connection
+ ) throws Exception {
+ printbase(printerName, templateName, parameters, null, false, null,null,null,false,false,connection);
+ }
+
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ * @param dataList 循环体数据(List集合,每条数据对应detail区域一行)
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ Map parameters,
+ List> dataList
+ ) throws Exception {
+ printbase(printerName, templateName, parameters, dataList, false, null,null,null,false,false,null);
+ }
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param dataList 循环体数据(List集合,每条数据对应detail区域一行)
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ List> dataList
+ ) throws Exception {
+ print(printerName, templateName, null, dataList);
+ }
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param connection 数据源,推荐使用DataSource注入对象传递当前库连接对象
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ Connection connection
+ ) throws Exception {
+ print(printerName, templateName, null, connection);
+ }
+ /**
+ * 重载:直接打印(简化参数)
+ * @param printerName 打印机名称(可为null,null时使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ */
+ public static void print(
+ String printerName,
+ String templateName,
+ Map parameters
+ ) throws Exception {
+ List> dataList =null;
+ print(printerName, templateName, parameters, dataList );
+ }
+ /**
+ * 重载:直接打印(使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ * @param connection 数据源,推荐使用DataSource注入对象传递当前库连接对象
+ */
+ public static void print(
+ String templateName,
+ Map parameters,
+ Connection connection
+ ) throws Exception {
+ List> dataList =null;
+ print(null, templateName, parameters, dataList,connection);
+ }
+ /**
+ * 重载:直接打印(使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param parameters 非循环字段集合(报表参数,如标题、日期等)
+ */
+ public static void print(
+ String templateName,
+ Map parameters
+ ) throws Exception {
+ List> dataList =null;
+ print(null, templateName, parameters, dataList);
+ }
+ /**
+ * 重载:直接打印(使用默认打印机)
+ * @param templateName 模板名称(支持jrxml或jasper,放在YML配置的物理路径下,如D:\ruoyi)
+ * @param dataList 循环体数据(List集合,每条数据对应detail区域一行)
+ */
+ public static void print(
+ String templateName,
+ List> dataList
+ ) throws Exception {
+ print(null, templateName, null, dataList);
+ }
+ // 预定义字符串到 MediaSizeName 的映射
+ private static final Map SIZE_MAP = new HashMap<>();
+ static {
+ SIZE_MAP.put("A0", MediaSizeName.ISO_A0);
+ SIZE_MAP.put("A1", MediaSizeName.ISO_A1);
+ SIZE_MAP.put("A2", MediaSizeName.ISO_A2);
+ SIZE_MAP.put("A3", MediaSizeName.ISO_A3);
+ SIZE_MAP.put("A4", MediaSizeName.ISO_A4);
+ SIZE_MAP.put("A5", MediaSizeName.ISO_A5);
+ SIZE_MAP.put("A6", MediaSizeName.ISO_A6);
+ SIZE_MAP.put("B5", MediaSizeName.ISO_B5);
+ SIZE_MAP.put("B4", MediaSizeName.ISO_B4);
+ SIZE_MAP.put("B6", MediaSizeName.ISO_B6);
+ // 可添加更多映射(如 US Letter、Legal 等)
+ }
+ public static MediaSizeName getMediaSize(String sizeStr) {
+ if (sizeStr == null) return null;
+ return SIZE_MAP.get(sizeStr.toUpperCase());
+ }
+ /**
+ * 编译jrxml并保存到resources/templates同级目录
+ * @param jrxmlFileName 模板文件名(不带扩展名,如"barcode")
+ * @throws Exception 编译或IO异常
+ */
+ /**
+ * 编译 jrxml 并保存到物理模板目录(D:\template)
+ */
+ public static void compileAndSave(String jrxmlFileName,String templatePath) throws Exception {
+ String jrxmlPath = templatePath + jrxmlFileName + ".jrxml";
+ String jasperPath = templatePath + jrxmlFileName + ".jasper";
+
+ // 判断是否需要编译(jrxml 存在且比 jasper 新)
+ File jrxmlFile = new File(jrxmlPath);
+ File jasperFile = new File(jasperPath);
+ // 仅当 jrxml 存在且比 jasper 新(或 jasper 不存在)时才编译
+ if (jrxmlFile.exists() && (!jasperFile.exists() || jrxmlFile.lastModified() > jasperFile.lastModified())) {
+ try (FileInputStream fis = new FileInputStream(jrxmlFile)) {
+ JasperReport jasperReport = JasperCompileManager.compileReport(fis);
+ JRSaver.saveObject(jasperReport, jasperFile);
+ log.info("jrxml 编译成功,保存至:{}", jasperPath);
+ }
+ }
+ }
+// ------------------------------ 路径相关方法 ------------------------------
+
+ /**
+ * 从配置中获取模板目录路径(在 printbase 中调用)
+ */
+ private static String getTemplateDir() {
+ String dir = RuoYiConfig.getProfile();
+ if (dir == null || dir.trim().isEmpty()) {
+ throw new IllegalStateException("配置文件中未设置有效的 profile 路径,请检查 application.yml");
+ }
+ return dir.trim();
+ }
+
+ /**
+ * 初始化模板目录(不存在则创建)
+ */
+ private static void initTemplateDir(String templateDir) {
+ File dir = new File(templateDir);
+ if (!dir.exists()) {
+ boolean created = dir.mkdirs();
+ if (created) {
+ log.info("模板目录初始化成功:{}", templateDir);
+ } else {
+ log.error("模板目录创建失败,请检查路径权限:{}", templateDir);
+ }
+ }
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/blood_bus/src/main/java/com/czblood/bus/utils/ReportUtil.java b/blood_bus/src/main/java/com/czblood/bus/utils/ReportUtil.java
new file mode 100644
index 0000000..1daeafe
--- /dev/null
+++ b/blood_bus/src/main/java/com/czblood/bus/utils/ReportUtil.java
@@ -0,0 +1,7 @@
+package com.czblood.bus.utils;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class ReportUtil {
+}
diff --git a/blood_bus/src/main/resources/mapper/BloodBankMapper.xml b/blood_bus/src/main/resources/mapper/BloodBankMapper.xml
new file mode 100644
index 0000000..513a22b
--- /dev/null
+++ b/blood_bus/src/main/resources/mapper/BloodBankMapper.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkBloodBreedMapper.xml b/blood_bus/src/main/resources/mapper/XkBloodBreedMapper.xml
new file mode 100644
index 0000000..ab096ce
--- /dev/null
+++ b/blood_bus/src/main/resources/mapper/XkBloodBreedMapper.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkDmzdMapper.xml b/blood_bus/src/main/resources/mapper/XkDmzdMapper.xml
index c9ea06a..ddcfb16 100644
--- a/blood_bus/src/main/resources/mapper/XkDmzdMapper.xml
+++ b/blood_bus/src/main/resources/mapper/XkDmzdMapper.xml
@@ -3,6 +3,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkPatientInfoMapper.xml b/blood_bus/src/main/resources/mapper/XkPatientInfoMapper.xml
index acae812..5c01f44 100644
--- a/blood_bus/src/main/resources/mapper/XkPatientInfoMapper.xml
+++ b/blood_bus/src/main/resources/mapper/XkPatientInfoMapper.xml
@@ -8,4 +8,72 @@
and beinhos_id = #{beinhos_id}
+
+
+ insert into xk_patient_info(
+ patient_sex,
+ age,
+ patient_birthday,
+ apanage,
+ out_sign,
+ abo,
+ rh,
+ transfuse_history,
+ reaction_history,
+ gestation_history,
+ parturition_history,
+ match_history,
+ transplant_history,
+ last_modified,
+ times,
+ beinhos_id,patient_name,hos_id
+ )
+ values(
+ #{patient_sex},
+ #{age},
+ #{patient_birthday},
+ #{apanage},
+ #{out_sign},
+ #{abo},
+ #{rh},
+ #{transfuse_history},
+ #{reaction_history},
+ #{gestation_history},
+ #{parturition_history},
+ #{match_history},
+ #{transplant_history},
+ #{transplant_history},
+ #{times},
+ #{beinhos_id},#{patient_name},#{hos_id}
+ )
+
+
+
+
+ update xk_patient_info
+
+ patient_sex = #{patient_sex},
+ age = #{age},
+ patient_birthday = #{patient_birthday},
+ apanage = #{apanage},
+ out_sign = #{out_sign},
+ abo = #{abo},
+ rh = #{rh},
+ transfuse_history = #{transfuse_history},
+ reaction_history = #{reaction_history},
+ gestation_history = #{gestation_history},
+ parturition_history = #{parturition_history},
+ match_history = #{match_history},
+ transplant_history = #{transplant_history},
+ last_modified = #{last_modified},
+ times = #{times},
+ hos_id = #{hosid}
+
+ where beinhos_id = #{beinhos_id}
+
+
+
+
+ delete from xk_patient_info where beinhos_id = #{beinhos_id}
+
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkTransfuseApplyBeforeMapper.xml b/blood_bus/src/main/resources/mapper/XkTransfuseApplyBeforeMapper.xml
index e3bfa92..a9f9b17 100644
--- a/blood_bus/src/main/resources/mapper/XkTransfuseApplyBeforeMapper.xml
+++ b/blood_bus/src/main/resources/mapper/XkTransfuseApplyBeforeMapper.xml
@@ -10,4 +10,76 @@
+
+
+ insert into xk_transfuse_apply_before(
+ dept_id,
+ zone_id,
+ agreement_ink,
+ blood_loss,
+ assess_data,
+ assess_person,
+ blood_breed,
+ blood_num,
+ unit,
+ intent,
+ diagnoses,
+ patient_bed,
+ anemia,
+ metabolism,
+ cruor,
+ bqgy,
+ hos_id,
+ bill_no, beinhos_id
+ )
+ values(
+ #{dept_id},
+ #{zone_id},
+ #{agreement_ink},
+ #{blood_loss},
+ #{assess_data},
+ #{assess_person},
+ #{blood_breed},
+ #{blood_num},
+ #{unit},
+ #{intent},
+ #{diagnoses},
+ #{patient_bed},
+ #{anemia},
+ #{metabolism},
+ #{cruor},
+ #{bqgy},
+ #{hos_id},
+ #{bill_no}, #{beinhos_id}
+ )
+
+
+
+
+ update xk_transfuse_apply_before
+
+ dept_id = #{dept_id},
+ zone_id = #{zone_id},
+ agreement_ink = #{agreement_ink},
+ blood_loss = #{blood_loss},
+ assess_data = #{assess_data},
+ assess_person = #{assess_person},
+ blood_breed = #{blood_breed},
+ blood_num = #{blood_num},
+ unit = #{unit},
+ intent = #{intent},
+ diagnoses = #{diagnoses},
+ patient_bed = #{patient_bed},
+ anemia = #{anemia},
+ metabolism = #{metabolism},
+ cruor = #{cruor},
+ bqgy = #{bqgy},
+ hos_id = #{hos_id}
+
+ where bill_no = #{bill_no}
+
+
+
+ delete from xk_transfuse_apply_before where bill_no = #{bill_no}
+
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkTransfuseApplyMapper.xml b/blood_bus/src/main/resources/mapper/XkTransfuseApplyMapper.xml
index 09376aa..0a5a1ea 100644
--- a/blood_bus/src/main/resources/mapper/XkTransfuseApplyMapper.xml
+++ b/blood_bus/src/main/resources/mapper/XkTransfuseApplyMapper.xml
@@ -7,6 +7,11 @@
and bill_no = #{bill_no}
and beinhos_id = #{beinhos_id}
+ and assess_bill_no = #{assess_bill_no}
+
+
\ No newline at end of file
diff --git a/blood_bus/src/main/resources/mapper/XkTransfuseApplyTestitemMapper.xml b/blood_bus/src/main/resources/mapper/XkTransfuseApplyTestitemMapper.xml
index d684e9a..9b62c3d 100644
--- a/blood_bus/src/main/resources/mapper/XkTransfuseApplyTestitemMapper.xml
+++ b/blood_bus/src/main/resources/mapper/XkTransfuseApplyTestitemMapper.xml
@@ -5,4 +5,38 @@
+
+
+ insert into xk_transfuse_apply_testitem(
+ item_name,
+ item_result,
+ Item_unit,
+ test_date,
+ upload_flag,
+ bill_no,sid
+ )values (
+ #{item_name},
+ #{item_result},
+ #{Item_unit},
+ #{test_date},
+ #{upload_flag},
+ #{bill_no},#{sid}
+ )
+
+
+
+ update xk_transfuse_apply_testitem set
+ item_result=#{item_result},
+ Item_unit=#{Item_unit},
+ test_date=#{test_date},
+ upload_flag=#{upload_flag},
+ item_name=#{item_name}
+ where bill_no=#{bill_no}
+ and sid=#{sid}
+
+
+
+ delete from xk_transfuse_apply_testitem where bill_no=#{bill_no}
+ and sid=#{sid}
+
\ No newline at end of file
diff --git a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/controller/TransfuseApplyBeforeController.java b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/controller/TransfuseApplyBeforeController.java
index 9d77370..0f00b0c 100644
--- a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/controller/TransfuseApplyBeforeController.java
+++ b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/controller/TransfuseApplyBeforeController.java
@@ -1,9 +1,12 @@
package com.czblood.busDoctor.controller;
+import com.czblood.bus.constants.BloodSysLogConstants;
import com.czblood.bus.pojo.XkTransfuseApplyBefore;
import com.czblood.busDoctor.pojo.TransfuseApplyBeforeDTO;
import com.czblood.busDoctor.service.TransfuseApplyBeforeService;
+import com.czblood.common.annotation.Log;
import com.czblood.common.core.domain.Result;
+import com.czblood.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -32,9 +35,30 @@ public class TransfuseApplyBeforeController {
return transfuseApplyBeforeService.getPatInfo(patNo);
}
+ @Log(title = BloodSysLogConstants.LOG_TYPE_TRANSFUSE_APPLY_BEFORE, businessType = BusinessType.INSERT)
@ApiOperation("保存信息")
@PostMapping("/save")
public Result save(@RequestBody TransfuseApplyBeforeDTO transfuseApplyBeforeDTO){
return transfuseApplyBeforeService.save(transfuseApplyBeforeDTO);
}
+
+ @Log(title = BloodSysLogConstants.LOG_TYPE_TRANSFUSE_APPLY_BEFORE, businessType = BusinessType.UPDATE)
+ @ApiOperation("修改信息")
+ @PostMapping("/update")
+ public Result update(@RequestBody TransfuseApplyBeforeDTO transfuseApplyBeforeDTO){
+ return transfuseApplyBeforeService.update(transfuseApplyBeforeDTO);
+ }
+
+ @Log(title = BloodSysLogConstants.LOG_TYPE_TRANSFUSE_APPLY_BEFORE, businessType = BusinessType.DELETE)
+ @ApiOperation("删除信息")
+ @GetMapping("/delete")
+ public Result delete(String billNo){
+ return transfuseApplyBeforeService.delete(billNo);
+ }
+
+ @ApiOperation("打印输血前评估单")
+ @GetMapping("/print")
+ public Result print(String billNo){
+ return transfuseApplyBeforeService.print(billNo);
+ }
}
diff --git a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/pojo/TransfuseApplyBeforeDTO.java b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/pojo/TransfuseApplyBeforeDTO.java
index 1f0bfdd..3a5cfcc 100644
--- a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/pojo/TransfuseApplyBeforeDTO.java
+++ b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/pojo/TransfuseApplyBeforeDTO.java
@@ -1,6 +1,7 @@
package com.czblood.busDoctor.pojo;
import com.czblood.bus.pojo.*;
+import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -15,9 +16,9 @@ public class TransfuseApplyBeforeDTO {
@ApiModelProperty(value = "病人信息")
private XkPatientInfo xkPatientInfo;
@ApiModelProperty(value = "输血评估信息")
- private List xkTransfuseApplyBefore;
+ private List xkTransfuseApplyBeforeList;
@ApiModelProperty(value = "输血前lis检查项目")
- private XkTransfuseApplyTestitem xkTransfuseApplyTestitem;
+ private List xkTransfuseApplyTestitemList;
@ApiModelProperty(value = "输血前申请信息")
private XkTransfuseApply xkTransfuseApply;
}
diff --git a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/TransfuseApplyBeforeService.java b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/TransfuseApplyBeforeService.java
index 6135d31..856c87d 100644
--- a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/TransfuseApplyBeforeService.java
+++ b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/TransfuseApplyBeforeService.java
@@ -10,4 +10,10 @@ public interface TransfuseApplyBeforeService {
Result getPatInfo(String patNo);
Result save(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO);
+
+ Result update(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO);
+
+ Result delete(String billNo);
+
+ Result print(String billNo);
}
diff --git a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/impl/TransfuseApplyBeforeServiceImpl.java b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/impl/TransfuseApplyBeforeServiceImpl.java
index 6ffe8fc..0be87fd 100644
--- a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/impl/TransfuseApplyBeforeServiceImpl.java
+++ b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/service/impl/TransfuseApplyBeforeServiceImpl.java
@@ -1,21 +1,28 @@
package com.czblood.busDoctor.service.impl;
+import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.czblood.bus.mapper.XkPatientInfoMapper;
import com.czblood.bus.mapper.XkTransfuseApplyBeforeMapper;
+import com.czblood.bus.mapper.XkTransfuseApplyMapper;
import com.czblood.bus.pojo.XkPatientInfo;
import com.czblood.bus.pojo.XkTransfuseApply;
import com.czblood.bus.pojo.XkTransfuseApplyBefore;
import com.czblood.bus.pojo.XkTransfuseApplyTestitem;
+import com.czblood.bus.pojo.inter.BeforeAssessRequest;
import com.czblood.bus.pojo.inter.GetPatientInfoRequest;
import com.czblood.bus.pojo.inter.GetTestResultRequest;
+import com.czblood.bus.utils.BloodBankUtil;
import com.czblood.bus.utils.BloodInterfaceUtil;
import com.czblood.busDoctor.pojo.TransfuseApplyBeforeDTO;
import com.czblood.busDoctor.service.TransfuseApplyBeforeService;
+import com.czblood.busDoctor.utils.TransfuseApplyBeforeUtil;
import com.czblood.common.core.domain.Result;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
@Service
@@ -25,6 +32,12 @@ public class TransfuseApplyBeforeServiceImpl implements TransfuseApplyBeforeServ
XkPatientInfoMapper xkPatientInfoMapper;
@Resource
XkTransfuseApplyBeforeMapper xkTransfuseApplyBeforeMapper;
+ @Resource
+ BloodBankUtil bloodBankUtil;
+ @Resource
+ TransfuseApplyBeforeUtil transfuseApplyBeforeUtil;
+ @Resource
+ XkTransfuseApplyMapper xkTransfuseApplyMapper;
@Override
public Result queryList(XkTransfuseApplyBefore xkTransfuseApplyBefore) {
@@ -37,7 +50,7 @@ public class TransfuseApplyBeforeServiceImpl implements TransfuseApplyBeforeServ
List xkTransfuseApplyBeforeList = xkTransfuseApplyBeforeMapper.queryList(xkTransfuseApplyBefore);
TransfuseApplyBeforeDTO transfuseApplyBeforeDTO = new TransfuseApplyBeforeDTO();
if(xkPatientInfoList.size() > 0) transfuseApplyBeforeDTO.setXkPatientInfo(xkPatientInfoList.get(0));
- transfuseApplyBeforeDTO.setXkTransfuseApplyBefore(xkTransfuseApplyBeforeList);
+ transfuseApplyBeforeDTO.setXkTransfuseApplyBeforeList(xkTransfuseApplyBeforeList);
return new Result("0","获取数据成功!", transfuseApplyBeforeDTO);
}
@@ -50,7 +63,7 @@ public class TransfuseApplyBeforeServiceImpl implements TransfuseApplyBeforeServ
if(!result.getCode().equals("0")) return result;
XkTransfuseApply xkTransfuseApply = JSONUtil.parseObj(result.getData()).toBean(XkTransfuseApply.class);
XkPatientInfo xkPatientInfo = JSONUtil.parseObj(result.getData()).toBean(XkPatientInfo.class);
- if(xkPatientInfo == null){
+ if(xkPatientInfo.getBeinhos_id() == null){
XkPatientInfo xkPatientInfoOne = new XkPatientInfo();
xkPatientInfoOne.setBeinhos_id(patNo);
List xkPatientInfoList = xkPatientInfoMapper.queryList(xkPatientInfoOne);
@@ -61,16 +74,74 @@ public class TransfuseApplyBeforeServiceImpl implements TransfuseApplyBeforeServ
getTestResultRequest.setBeinhos_id(patNo);
Result result1 = BloodInterfaceUtil.invokeBloodInterface(getTestResultRequest);
if(!result1.getCode().equals("0")) return result1;
- XkTransfuseApplyTestitem xkTransfuseApplyTestitem = JSONUtil.parseObj(result.getData()).toBean(XkTransfuseApplyTestitem.class);
+ List xkTransfuseApplyTestitemList = JSONUtil.toList((JSONArray) result.getData(), XkTransfuseApplyTestitem.class);
TransfuseApplyBeforeDTO transfuseApplyBeforeDTO = new TransfuseApplyBeforeDTO();
transfuseApplyBeforeDTO.setXkPatientInfo(xkPatientInfo);
- transfuseApplyBeforeDTO.setXkTransfuseApplyTestitem(xkTransfuseApplyTestitem);
+ transfuseApplyBeforeDTO.setXkTransfuseApplyTestitemList(xkTransfuseApplyTestitemList);
transfuseApplyBeforeDTO.setXkTransfuseApply(xkTransfuseApply);
return new Result("0","获取数据成功!", transfuseApplyBeforeDTO);
}
@Override
public Result save(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO) {
+ String billNo = bloodBankUtil.produceBillNo("PJD");
+ List xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
+ if(xkTransfuseApplyBeforeList.size() > 0){
+ XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
+ xkTransfuseApplyBefore.setBill_no(billNo);
+ }
+ List xkTransfuseApplyTestitemList = transfuseApplyBeforeDTO.getXkTransfuseApplyTestitemList();
+ for (XkTransfuseApplyTestitem xkTransfuseApplyTestitem : xkTransfuseApplyTestitemList) {
+ xkTransfuseApplyTestitem.setBill_no(billNo);
+ }
+
+
+ //保存数据
+ transfuseApplyBeforeUtil.saveTransfuseApplyBeforeDTO(transfuseApplyBeforeDTO);
+
+ //调用接口
+ BeforeAssessRequest beforeAssessRequest = new BeforeAssessRequest();
+ beforeAssessRequest.setBillNo(billNo);
+ Result result = BloodInterfaceUtil.invokeBloodInterface(beforeAssessRequest);
+ if(!result.getCode().equals("0")) return result;
+
+ return new Result("0","保存成功!");
+ }
+
+ @Override
+ public Result update(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO) {
+ String billNo = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList().get(0).getBill_no();
+ if(billNo == null || billNo.equals("")) return new Result("-1","没有对应的单据号,无法修改!");
+ Result result = canModify(billNo);
+ if(!result.getCode().equals("0")) return result;
+ transfuseApplyBeforeUtil.updateTransfuseApplyBeforeDTO(transfuseApplyBeforeDTO);
+ return new Result("0","修改成功!");
+ }
+
+ @Transactional
+ @Override
+ public Result delete(String billNo) {
+ Result result = canModify(billNo);
+ if(!result.getCode().equals("0")) return result;
+ xkTransfuseApplyBeforeMapper.deleteXkTransfuseApplyBefore(billNo);
+ return new Result("0","删除成功!");
+ }
+
+ @Override
+ public Result print(String billNo) {
return null;
}
+
+ public Result canModify(String billNo){
+ XkTransfuseApply xkTransfuseApply = new XkTransfuseApply();
+ xkTransfuseApply.setAssess_bill_no(billNo);
+ List xkTransfuseApplyList = xkTransfuseApplyMapper.queryList(xkTransfuseApply);
+ if(xkTransfuseApplyList.size() > 0){
+ for (XkTransfuseApply transfuseApply : xkTransfuseApplyList) {
+ String checkSign = transfuseApply.getCheck_sign();
+ if(checkSign.equals("Y")) return new Result("-1","该评估单对应的申请单已审核,无法修改或删除!");
+ }
+ }
+ return new Result("0","可以修改!");
+ }
}
diff --git a/blood_bus_doctor/src/main/java/com/czblood/busDoctor/utils/TransfuseApplyBeforeUtil.java b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/utils/TransfuseApplyBeforeUtil.java
new file mode 100644
index 0000000..418799d
--- /dev/null
+++ b/blood_bus_doctor/src/main/java/com/czblood/busDoctor/utils/TransfuseApplyBeforeUtil.java
@@ -0,0 +1,57 @@
+package com.czblood.busDoctor.utils;
+
+import com.czblood.bus.mapper.XkPatientInfoMapper;
+import com.czblood.bus.mapper.XkTransfuseApplyBeforeMapper;
+import com.czblood.bus.mapper.XkTransfuseApplyTestitemMapper;
+import com.czblood.bus.pojo.XkPatientInfo;
+import com.czblood.bus.pojo.XkTransfuseApplyBefore;
+import com.czblood.bus.pojo.XkTransfuseApplyTestitem;
+import com.czblood.busDoctor.pojo.TransfuseApplyBeforeDTO;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Component
+public class TransfuseApplyBeforeUtil {
+
+ @Resource
+ XkPatientInfoMapper xkPatientInfoMapper;
+ @Resource
+ XkTransfuseApplyBeforeMapper xkTransfuseApplyBeforeMapper;
+ @Resource
+ XkTransfuseApplyTestitemMapper xkTransfuseApplyTestitemMapper;
+
+ @Transactional
+ public void saveTransfuseApplyBeforeDTO(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO){
+ XkPatientInfo xkPatientInfo = transfuseApplyBeforeDTO.getXkPatientInfo();
+ xkPatientInfoMapper.insertXkPatientInfo(xkPatientInfo);
+ List xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
+ if(xkTransfuseApplyBeforeList.size() > 0){
+ XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
+ xkTransfuseApplyBeforeMapper.insertXkTransfuseApplyBefore(xkTransfuseApplyBefore);
+ }
+ List xkTransfuseApplyTestitemList = transfuseApplyBeforeDTO.getXkTransfuseApplyTestitemList();
+ for (XkTransfuseApplyTestitem xkTransfuseApplyTestitem : xkTransfuseApplyTestitemList) {
+ xkTransfuseApplyTestitemMapper.insertXkTransfuseApplyTestitem(xkTransfuseApplyTestitem);
+ }
+
+ }
+
+ @Transactional
+ public void updateTransfuseApplyBeforeDTO(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO){
+ XkPatientInfo xkPatientInfo = transfuseApplyBeforeDTO.getXkPatientInfo();
+ xkPatientInfoMapper.updateXkPatientInfo(xkPatientInfo);
+ List xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
+ if(xkTransfuseApplyBeforeList.size() > 0){
+ XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
+ xkTransfuseApplyBeforeMapper.updateXkTransfuseApplyBefore(xkTransfuseApplyBefore);
+ }
+ List xkTransfuseApplyTestitemList = transfuseApplyBeforeDTO.getXkTransfuseApplyTestitemList();
+ for (XkTransfuseApplyTestitem xkTransfuseApplyTestitem : xkTransfuseApplyTestitemList) {
+ xkTransfuseApplyTestitemMapper.updateXkTransfuseApplyTestitem(xkTransfuseApplyTestitem);
+ }
+
+ }
+}
diff --git a/blood_common/src/main/java/com/czblood/common/config/RuoYiConfig.java b/blood_common/src/main/java/com/czblood/common/config/RuoYiConfig.java
index b81ddd0..cf64f57 100644
--- a/blood_common/src/main/java/com/czblood/common/config/RuoYiConfig.java
+++ b/blood_common/src/main/java/com/czblood/common/config/RuoYiConfig.java
@@ -65,9 +65,9 @@ public class RuoYiConfig {
private static String interfaceUrl;
/**
- * 门诊条码打印机名称
+ * 是否开启接口
*/
- private static String mzPrintName;
+ private static String openInterface;
public String getCompay() {
return compay;
@@ -187,11 +187,11 @@ public class RuoYiConfig {
return getProfile() + "/upload";
}
- public static String getMzPrintName() {
- return mzPrintName;
+ public static String getOpenInterface() {
+ return openInterface;
}
- public void setMzPrintName(String mzPrintName) {
- RuoYiConfig.mzPrintName = mzPrintName;
+ public void setOpenInterface(String mzPrintName) {
+ RuoYiConfig.openInterface = mzPrintName;
}
}
diff --git a/blood_start/pom.xml b/blood_start/pom.xml
index 38806cc..454c3cd 100644
--- a/blood_start/pom.xml
+++ b/blood_start/pom.xml
@@ -42,6 +42,11 @@
blood_bus_report
1.0
+
+ com.czblood
+ bloodresource
+ 1.0
+
org.springframework.boot
spring-boot-starter-test
@@ -99,6 +104,7 @@
blood_bus_bloodbank-1.0.jar
blood_bus_nurse-1.0.jar
blood_bus_report-1.0.jar
+ bloodresource-1.0.jar
diff --git a/blood_start/src/main/resources/application.yml b/blood_start/src/main/resources/application.yml
index 5d077cb..b02de0b 100644
--- a/blood_start/src/main/resources/application.yml
+++ b/blood_start/src/main/resources/application.yml
@@ -19,6 +19,7 @@ czblood:
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
+ openInterface: 0
# 开发环境配置
server:
diff --git a/bloodresource/pom.xml b/bloodresource/pom.xml
new file mode 100644
index 0000000..1ca7038
--- /dev/null
+++ b/bloodresource/pom.xml
@@ -0,0 +1,21 @@
+
+ 4.0.0
+
+ com.czblood
+ blood
+ 1.0
+
+
+ bloodresource
+ jar
+
+ bloodresource
+
+
+ UTF-8
+
+
+
+
+
diff --git a/bloodresource/src/main/resources/jasperreports_extension.properties b/bloodresource/src/main/resources/jasperreports_extension.properties
new file mode 100644
index 0000000..b5931af
--- /dev/null
+++ b/bloodresource/src/main/resources/jasperreports_extension.properties
@@ -0,0 +1,2 @@
+net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
+net.sf.jasperreports.extension.simple.font.families.lobstertwo=stsong/fonts.xml
\ No newline at end of file
diff --git a/bloodresource/src/main/resources/stsong/fonts.xml b/bloodresource/src/main/resources/stsong/fonts.xml
new file mode 100644
index 0000000..a8e1f1d
--- /dev/null
+++ b/bloodresource/src/main/resources/stsong/fonts.xml
@@ -0,0 +1,15 @@
+
+
+
+ stsong/stsong.ttf
+ stsong/stsong.ttf
+ stsong/stsong.ttf
+ stsong/stsong.ttf
+ Identity-H
+ true
+
+ '华文宋体',Arial,Helvetica,sans-serif
+ '华文宋体',Arial,Helvetica,sans-serif
+
+
+
\ No newline at end of file
diff --git a/bloodresource/src/main/resources/stsong/stsong.ttf b/bloodresource/src/main/resources/stsong/stsong.ttf
new file mode 100644
index 0000000..6f84fd6
Binary files /dev/null and b/bloodresource/src/main/resources/stsong/stsong.ttf differ
diff --git a/pom.xml b/pom.xml
index 25504fc..09a3b09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,7 @@
blood_bus_nurse
blood_bus_bloodbank
blood_bus_report
+ bloodresource
diff --git a/sql/updatedb_blood.sql b/sql/updatedb_blood.sql
index 27026e6..894ab21 100644
--- a/sql/updatedb_blood.sql
+++ b/sql/updatedb_blood.sql
@@ -29,4 +29,37 @@ if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_
alter table sys_user add yljg varchar(10);
update sys_user set yljg = '602' where user_name = 'admin'
end
-go
\ No newline at end of file
+go
+
+
+IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'UQ_xk_patient_info' AND type = 'UQ')
+ BEGIN
+ ALTER TABLE xk_patient_info ADD CONSTRAINT UQ_xk_patient_info UNIQUE(beinhos_id);
+ END
+GO
+
+if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'xk_transfuse_apply_before' AND COLUMN_NAME = 'hos_id')
+ begin
+ alter table xk_transfuse_apply_before add hos_id varchar(10)
+ end
+go
+
+
+IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_transfuse_apply_before' AND type = 'PK' )
+ BEGIN
+ ALTER TABLE xk_transfuse_apply_before ADD CONSTRAINT PK_xk_transfuse_apply_before PRIMARY KEY CLUSTERED (bill_no);
+ END
+GO
+
+
+IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_transfuse_apply_testitem' AND type = 'PK' )
+ BEGIN
+ ALTER TABLE xk_transfuse_apply_testitem ADD CONSTRAINT PK_xk_transfuse_apply_testitem PRIMARY KEY CLUSTERED (bill_no,sid);
+ END
+GO
+
+if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'xk_transfuse_apply' AND COLUMN_NAME = 'assess_bill_no')
+ BEGIN
+ alter table xk_transfuse_apply add assess_bill_no varchar(30)
+ END
+GO
\ No newline at end of file
diff --git a/sql/函数/uf_Get_TRANS_PLASMA.sql b/sql/函数/uf_Get_TRANS_PLASMA.sql
new file mode 100644
index 0000000..0e63e4c
--- /dev/null
+++ b/sql/函数/uf_Get_TRANS_PLASMA.sql
@@ -0,0 +1,21 @@
+
+
+create FUNCTION [dbo].[uf_Get_TRANS_PLASMA]()
+RETURNS NVARCHAR(4000)
+AS
+BEGIN
+ declare @parameter_value nvarchar(100)
+ select @parameter_value = parameter_value from xk_parameter where parameter_code = 'TRANS_PLASMA'
+ if(@parameter_value = null or @parameter_value = '')
+ begin
+ return '200'
+ END
+ else
+ begin
+ return @parameter_value
+ end
+ return '200'
+END
+GO
+
+
diff --git a/sql/存储过程/sp_getnextseq_new_blood.sql b/sql/存储过程/sp_getnextseq_new_blood.sql
new file mode 100644
index 0000000..5f4ab58
--- /dev/null
+++ b/sql/存储过程/sp_getnextseq_new_blood.sql
@@ -0,0 +1,51 @@
+
+
+CREATE PROCEDURE [dbo].[sp_getnextseq_new_blood]
+ @seqid VARCHAR(20),
+ @retcode int output
+as
+declare @GUID varchar(50)
+begin
+ set @retcode=-1
+ if @seqid = ''
+ begin
+ return -1
+ end
+
+ if @seqid = 'blood'
+ begin
+ set @GUID=newid()
+ begin tran
+ INSERT INTO xk_seq_billno([guid]) VALUES (@GUID) ;
+ if @@error = 0
+ begin
+ Commit tran
+ SELECT @retcode=id FROM xk_seq_billno (nolock) WHERE [guid] =@GUID
+ end
+ else
+ begin
+ RollBack tran
+ set @retcode=-1
+ RETURN -1
+ END
+ begin tran
+ DELETE xk_seq_billno WHERE [guid] =@GUID;
+ if @@error = 0
+ begin
+ Commit tran
+ end
+ else
+ begin
+ RollBack tran
+ END
+ RETURN 0
+ end
+ --if @seqid = 'ICD'
+ --begin
+ --end
+end
+
+
+GO
+
+
diff --git a/sql/存储过程/sp_produce_maxvalue.sql b/sql/存储过程/sp_produce_maxvalue.sql
new file mode 100644
index 0000000..5eaf4b1
--- /dev/null
+++ b/sql/存储过程/sp_produce_maxvalue.sql
@@ -0,0 +1,18 @@
+
+CREATE PROCEDURE [dbo].[sp_produce_maxvalue]
+ @returncode int output
+as
+declare @seqid varchar(50)
+declare @retmaxValue int
+begin
+ set @seqid = 'blood'
+ exec [dbo].[sp_getnextseq_new_blood] @seqid = @seqid,@retcode = @retmaxValue output ;
+ set @returncode = @retmaxValue
+ print @returncode
+end
+
+
+
+GO
+
+