输血前评估和打印模版逻辑

This commit is contained in:
jiangs 2026-06-09 11:35:55 +08:00
parent a332e4fe3a
commit e4c28c5e23
45 changed files with 1202 additions and 15 deletions

2
.idea/encodings.xml generated
View File

@ -19,6 +19,8 @@
<file url="file://$PROJECT_DIR$/blood_start/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/blood_system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/blood_system/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bloodresource/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bloodresource/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>

3
.idea/sqldialects.xml generated
View File

@ -2,6 +2,9 @@
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/sql/updatedb_blood.sql" dialect="TSQL" />
<file url="file://$PROJECT_DIR$/sql/函数/uf_Get_TRANS_PLASMA.sql" dialect="GenericSQL" />
<file url="file://$PROJECT_DIR$/sql/存储过程/sp_getnextseq_new_blood.sql" dialect="GenericSQL" />
<file url="file://$PROJECT_DIR$/sql/存储过程/sp_produce_maxvalue.sql" dialect="GenericSQL" />
<file url="PROJECT" dialect="TSQL" />
</component>
</project>

View File

@ -22,5 +22,34 @@
<artifactId>blood_system</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</dependency>
<!-- iText 7 核心库 -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
</dependency>
<!-- iText 7 布局库 -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
</dependency>
<!-- 中文转拼音 -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -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";
}

View File

@ -4,4 +4,5 @@ package com.czblood.bus.constants;
* 输血日志常量类
*/
public class BloodSysLogConstants {
public static final String LOG_TYPE_TRANSFUSE_APPLY_BEFORE = "输血前评估";
}

View File

@ -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<XkBloodBreed> bloodBreedList = bloodBankUtil.getBloodBreed();
return new Result("0","获取数据成功!",bloodBreedList);
}
}

View File

@ -0,0 +1,7 @@
package com.czblood.bus.mapper;
import java.util.Map;
public interface BloodBankMapper {
void spProduceMaxvalue(Map<String,Object> map);
}

View File

@ -0,0 +1,9 @@
package com.czblood.bus.mapper;
import com.czblood.bus.pojo.XkBloodBreed;
import java.util.List;
public interface XkBloodBreedMapper {
List<XkBloodBreed> queryList(XkBloodBreed xkBloodBreed);
}

View File

@ -6,4 +6,7 @@ import java.util.List;
public interface XkPatientInfoMapper {
List<XkPatientInfo> queryList(XkPatientInfo xkPatientInfo);
void insertXkPatientInfo(XkPatientInfo xkPatientInfo);
void deleteXkPatientInfo(String beinhos_id);
void updateXkPatientInfo(XkPatientInfo xkPatientInfo);
}

View File

@ -6,4 +6,7 @@ import java.util.List;
public interface XkTransfuseApplyBeforeMapper {
List<XkTransfuseApplyBefore> queryList(XkTransfuseApplyBefore xkTransfuseApplyBefore);
void insertXkTransfuseApplyBefore(XkTransfuseApplyBefore xkTransfuseApplyBefore);
void updateXkTransfuseApplyBefore(XkTransfuseApplyBefore xkTransfuseApplyBefore);
void deleteXkTransfuseApplyBefore(String bill_no);
}

View File

@ -6,4 +6,5 @@ import java.util.List;
public interface XkTransfuseApplyMapper {
List<XkTransfuseApply> queryList(XkTransfuseApply xkTransfuseApply);
XkTransfuseApply queryOne(String billNo);
}

View File

@ -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<XkTransfuseApplyTestitem> queryList(String bill_no);
void insertXkTransfuseApplyTestitem(XkTransfuseApplyTestitem xkTransfuseApplyTestitem);
void updateXkTransfuseApplyTestitem(XkTransfuseApplyTestitem xkTransfuseApplyTestitem);
void deleteXkTransfuseApplyTestitem(@Param("bill_no") String bill_no,@Param("sid") int sid);
}

View File

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

View File

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

View File

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

View File

@ -29,4 +29,5 @@ public class XkTransfuseApplyBefore {
private String metabolism;
private String cruor;
private String bqgy;
private String hos_id;
}

View File

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

View File

@ -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<String, Object> 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<XkBloodBreed> getBloodBreed(){
XkBloodBreed xkBloodBreed = new XkBloodBreed();
return xkBloodBreedMapper.queryList(xkBloodBreed);
}
}

View File

@ -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 = "";

View File

@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, MediaSizeName> 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);
}
}
}
}

View File

@ -0,0 +1,7 @@
package com.czblood.bus.utils;
import org.springframework.stereotype.Component;
@Component
public class ReportUtil {
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.BloodBankMapper">
<select id="spProduceMaxvalue" parameterType="map" statementType="CALLABLE" useCache="false">
{call sp_produce_maxvalue(#{returncode,mode=OUT,jdbcType=INTEGER})}
</select>
</mapper>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkBloodBreedMapper">
<select id="queryList" resultType="com.czblood.bus.pojo.XkBloodBreed">
select * from xk_blood_breed where use_sign = 'Y'
<if test="breed_code != null and breed_code != ''">and breed_code = #{breed_code}</if>
</select>
</mapper>

View File

@ -3,6 +3,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkDmzdMapper">
<select id="queryList" resultType="com.czblood.bus.pojo.XkDmzd">
select * from xk_dmzd where wordbook_sign=#{wordbook_sign}
select * from xk_dmzd where wordbook_sign=#{wordbook_sign} and use_sign = 'Y'
</select>
</mapper>

View File

@ -8,4 +8,72 @@
<if test="beinhos_id != null and beinhos_id != ''">and beinhos_id = #{beinhos_id}</if>
</where>
</select>
<insert id="insertXkPatientInfo">
insert into xk_patient_info(
<if test="patient_sex != null and patient_sex != ''">patient_sex,</if>
<if test="age != null and age != ''">age,</if>
<if test="patient_birthday != null ">patient_birthday,</if>
<if test="apanage != null and apanage != ''">apanage,</if>
<if test="out_sign != null and out_sign != ''">out_sign,</if>
<if test="abo != null and abo != ''">abo,</if>
<if test="rh != null and rh != ''">rh,</if>
<if test="transfuse_history != null and transfuse_history != ''">transfuse_history,</if>
<if test="reaction_history != null and reaction_history != ''">reaction_history,</if>
<if test="gestation_history != null and gestation_history != ''">gestation_history,</if>
<if test="parturition_history != null and parturition_history != ''">parturition_history,</if>
<if test="match_history != null and match_history != ''">match_history,</if>
<if test="transplant_history != null and transplant_history != ''">transplant_history,</if>
<if test="last_modified != null ">last_modified,</if>
<if test="times != null and times !=''">times,</if>
beinhos_id,patient_name,hos_id
)
values(
<if test="patient_sex != null and patient_sex != ''">#{patient_sex},</if>
<if test="age != null and age != ''">#{age},</if>
<if test="patient_birthday != null ">#{patient_birthday},</if>
<if test="apanage != null and apanage != ''">#{apanage},</if>
<if test="out_sign != null and out_sign != ''">#{out_sign},</if>
<if test="abo != null and abo != ''">#{abo},</if>
<if test="rh != null and rh != ''">#{rh},</if>
<if test="transfuse_history != null and transfuse_history != ''">#{transfuse_history},</if>
<if test="reaction_history != null and reaction_history != ''">#{reaction_history},</if>
<if test="gestation_history != null and gestation_history != ''">#{gestation_history},</if>
<if test="parturition_history != null and parturition_history != ''">#{parturition_history},</if>
<if test="match_history != null and match_history != ''">#{match_history},</if>
<if test="transplant_history != null and transplant_history != ''">#{transplant_history},</if>
<if test="last_modified != null ">#{transplant_history},</if>
<if test="times != null and times !=''">#{times},</if>
#{beinhos_id},#{patient_name},#{hos_id}
)
</insert>
<update id="updateXkPatientInfo">
update xk_patient_info
<set>
<if test="patient_sex != null and patient_sex != ''">patient_sex = #{patient_sex},</if>
<if test="age != null and age != ''">age = #{age},</if>
<if test="patient_birthday != null ">patient_birthday = #{patient_birthday},</if>
<if test="apanage != null and apanage != ''">apanage = #{apanage},</if>
<if test="out_sign != null and out_sign != ''">out_sign = #{out_sign},</if>
<if test="abo != null and abo != ''">abo = #{abo},</if>
<if test="rh != null and rh != ''">rh = #{rh},</if>
<if test="transfuse_history != null and transfuse_history != ''">transfuse_history = #{transfuse_history},</if>
<if test="reaction_history != null and reaction_history != ''">reaction_history = #{reaction_history},</if>
<if test="gestation_history != null and gestation_history != ''">gestation_history = #{gestation_history},</if>
<if test="parturition_history != null and parturition_history != ''">parturition_history = #{parturition_history},</if>
<if test="match_history != null and match_history != ''">match_history = #{match_history},</if>
<if test="transplant_history != null and transplant_history != ''">transplant_history = #{transplant_history},</if>
<if test="last_modified != null">last_modified = #{last_modified},</if>
<if test="times != null and times != ''">times = #{times},</if>
hos_id = #{hosid}
</set>
where beinhos_id = #{beinhos_id}
</update>
<delete id="deleteXkPatientInfo">
delete from xk_patient_info where beinhos_id = #{beinhos_id}
</delete>
</mapper>

View File

@ -10,4 +10,76 @@
</where>
</select>
<insert id="insertXkTransfuseApplyBefore">
insert into xk_transfuse_apply_before(
<if test="dept_id != null and dept_id !=''">dept_id,</if>
<if test="zone_id != null and zone_id !=''">zone_id,</if>
<if test="agreement_ink != null and agreement_ink !=''">agreement_ink,</if>
<if test="blood_loss != null ">blood_loss,</if>
<if test="assess_data != null ">assess_data,</if>
<if test="assess_person != null and assess_person != '' ">assess_person,</if>
<if test="blood_breed != null and blood_breed != '' ">blood_breed,</if>
<if test="blood_num != null ">blood_num,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="intent != null and intent != ''">intent,</if>
<if test="diagnoses != null and diagnoses != ''">diagnoses,</if>
<if test="patient_bed != null and patient_bed != ''">patient_bed,</if>
<if test="anemia != null and anemia != ''">anemia,</if>
<if test="metabolism != null and metabolism != ''">metabolism,</if>
<if test="cruor != null and cruor != ''">cruor,</if>
<if test="bqgy != null and bqgy != ''">bqgy,</if>
<if test="hos_id != null and hos_id != ''">hos_id,</if>
bill_no, beinhos_id
)
values(
<if test="dept_id != null and dept_id !=''">#{dept_id},</if>
<if test="zone_id != null and zone_id !=''">#{zone_id},</if>
<if test="agreement_ink != null and agreement_ink !=''">#{agreement_ink},</if>
<if test="blood_loss != null ">#{blood_loss},</if>
<if test="assess_data != null ">#{assess_data},</if>
<if test="assess_person != null and assess_person != '' ">#{assess_person},</if>
<if test="blood_breed != null and blood_breed != '' ">#{blood_breed},</if>
<if test="blood_num != null ">#{blood_num},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="intent != null and intent != ''">#{intent},</if>
<if test="diagnoses != null and diagnoses != ''">#{diagnoses},</if>
<if test="patient_bed != null and patient_bed != ''">#{patient_bed},</if>
<if test="anemia != null and anemia != ''">#{anemia},</if>
<if test="metabolism != null and metabolism != ''">#{metabolism},</if>
<if test="cruor != null and cruor != ''">#{cruor},</if>
<if test="bqgy != null and bqgy != ''">#{bqgy},</if>
<if test="hos_id != null and hos_id != ''">#{hos_id},</if>
#{bill_no}, #{beinhos_id}
)
</insert>
<update id="updateXkTransfuseApplyBefore">
update xk_transfuse_apply_before
<set>
<if test="dept_id != null and dept_id !=''">dept_id = #{dept_id},</if>
<if test="zone_id != null and zone_id !=''">zone_id = #{zone_id},</if>
<if test="agreement_ink != null and agreement_ink !=''">agreement_ink = #{agreement_ink},</if>
<if test="blood_loss != null ">blood_loss = #{blood_loss},</if>
<if test="assess_data != null ">assess_data = #{assess_data},</if>
<if test="assess_person != null and assess_person != ''">assess_person = #{assess_person},</if>
<if test="blood_breed != null and blood_breed != ''">blood_breed = #{blood_breed},</if>
<if test="blood_num != null ">blood_num = #{blood_num},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
<if test="intent != null and intent != ''">intent = #{intent},</if>
<if test="diagnoses != null and diagnoses != ''">diagnoses = #{diagnoses},</if>
<if test="patient_bed != null and patient_bed != ''">patient_bed = #{patient_bed},</if>
<if test="anemia != null and anemia != ''">anemia = #{anemia},</if>
<if test="metabolism != null and metabolism != ''">metabolism = #{metabolism},</if>
<if test="cruor != null and cruor != ''">cruor = #{cruor},</if>
<if test="bqgy != null and bqgy != ''">bqgy = #{bqgy},</if>
hos_id = #{hos_id}
</set>
where bill_no = #{bill_no}
</update>
<delete id="deleteXkTransfuseApplyBefore">
delete from xk_transfuse_apply_before where bill_no = #{bill_no}
</delete>
</mapper>

View File

@ -7,6 +7,11 @@
<where>
<if test="bill_no != null and bill_no != ''">and bill_no = #{bill_no}</if>
<if test="beinhos_id != null and beinhos_id != ''">and beinhos_id = #{beinhos_id}</if>
<if test="assess_bill_no != null and assess_bill_no != ''">and assess_bill_no = #{assess_bill_no}</if>
</where>
</select>
<select id="queryOne" resultType="com.czblood.bus.pojo.XkTransfuseApply">
select * from xk_transfuse_apply where bill_no = #{bill_no}
</select>
</mapper>

View File

@ -5,4 +5,38 @@
<select id="queryList" resultType="com.czblood.bus.pojo.XkTransfuseApplyTestitem">
select * from xk_transfuse_apply_testitem where bill_no = #{bill_no}
</select>
<insert id="insertXkTransfuseApplyTestitem">
insert into xk_transfuse_apply_testitem(
<if test="item_name != null and item_name != ''">item_name,</if>
<if test="item_result != null and item_result != ''">item_result,</if>
<if test="Item_unit != null and Item_unit != ''">Item_unit,</if>
<if test="test_date != null">test_date,</if>
<if test="upload_flag != null and upload_flag != ''">upload_flag,</if>
bill_no,sid
)values (
<if test="item_name != null and item_name != ''">#{item_name},</if>
<if test="item_result != null and item_result != ''">#{item_result},</if>
<if test="Item_unit != null and Item_unit != ''">#{Item_unit},</if>
<if test="test_date != null ">#{test_date},</if>
<if test="upload_flag != null and upload_flag != ''">#{upload_flag},</if>
#{bill_no},#{sid}
)
</insert>
<update id="updateXkTransfuseApplyTestitem">
update xk_transfuse_apply_testitem set
<if test="item_result != null and item_result != ''">item_result=#{item_result},</if>
<if test="Item_unit != null and Item_unit != ''">Item_unit=#{Item_unit},</if>
<if test="test_date != null">test_date=#{test_date},</if>
<if test="upload_flag != null and upload_flag != ''">upload_flag=#{upload_flag},</if>
item_name=#{item_name}
where bill_no=#{bill_no}
<if test="sid != null">and sid=#{sid}</if>
</update>
<delete id="deleteXkTransfuseApplyTestitem">
delete from xk_transfuse_apply_testitem where bill_no=#{bill_no}
<if test="sid != null">and sid=#{sid}</if>
</delete>
</mapper>

View File

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

View File

@ -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> xkTransfuseApplyBefore;
private List<XkTransfuseApplyBefore> xkTransfuseApplyBeforeList;
@ApiModelProperty(value = "输血前lis检查项目")
private XkTransfuseApplyTestitem xkTransfuseApplyTestitem;
private List<XkTransfuseApplyTestitem> xkTransfuseApplyTestitemList;
@ApiModelProperty(value = "输血前申请信息")
private XkTransfuseApply xkTransfuseApply;
}

View File

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

View File

@ -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<XkTransfuseApplyBefore> 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<XkPatientInfo> 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<XkTransfuseApplyTestitem> 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<XkTransfuseApplyBefore> xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
if(xkTransfuseApplyBeforeList.size() > 0){
XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
xkTransfuseApplyBefore.setBill_no(billNo);
}
List<XkTransfuseApplyTestitem> 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<XkTransfuseApply> 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","可以修改!");
}
}

View File

@ -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<XkTransfuseApplyBefore> xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
if(xkTransfuseApplyBeforeList.size() > 0){
XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
xkTransfuseApplyBeforeMapper.insertXkTransfuseApplyBefore(xkTransfuseApplyBefore);
}
List<XkTransfuseApplyTestitem> xkTransfuseApplyTestitemList = transfuseApplyBeforeDTO.getXkTransfuseApplyTestitemList();
for (XkTransfuseApplyTestitem xkTransfuseApplyTestitem : xkTransfuseApplyTestitemList) {
xkTransfuseApplyTestitemMapper.insertXkTransfuseApplyTestitem(xkTransfuseApplyTestitem);
}
}
@Transactional
public void updateTransfuseApplyBeforeDTO(TransfuseApplyBeforeDTO transfuseApplyBeforeDTO){
XkPatientInfo xkPatientInfo = transfuseApplyBeforeDTO.getXkPatientInfo();
xkPatientInfoMapper.updateXkPatientInfo(xkPatientInfo);
List<XkTransfuseApplyBefore> xkTransfuseApplyBeforeList = transfuseApplyBeforeDTO.getXkTransfuseApplyBeforeList();
if(xkTransfuseApplyBeforeList.size() > 0){
XkTransfuseApplyBefore xkTransfuseApplyBefore = xkTransfuseApplyBeforeList.get(0);
xkTransfuseApplyBeforeMapper.updateXkTransfuseApplyBefore(xkTransfuseApplyBefore);
}
List<XkTransfuseApplyTestitem> xkTransfuseApplyTestitemList = transfuseApplyBeforeDTO.getXkTransfuseApplyTestitemList();
for (XkTransfuseApplyTestitem xkTransfuseApplyTestitem : xkTransfuseApplyTestitemList) {
xkTransfuseApplyTestitemMapper.updateXkTransfuseApplyTestitem(xkTransfuseApplyTestitem);
}
}
}

View File

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

View File

@ -42,6 +42,11 @@
<artifactId>blood_bus_report</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.czblood</groupId>
<artifactId>bloodresource</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@ -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
</Class-Path>
</manifestEntries>
</archive>

View File

@ -19,6 +19,7 @@ czblood:
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
openInterface: 0
# 开发环境配置
server:

21
bloodresource/pom.xml Normal file
View File

@ -0,0 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.czblood</groupId>
<artifactId>blood</artifactId>
<version>1.0</version>
</parent>
<artifactId>bloodresource</artifactId>
<packaging>jar</packaging>
<name>bloodresource</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
</dependencies>
</project>

View File

@ -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

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="华文宋体">
<normal>stsong/stsong.ttf</normal>
<bold>stsong/stsong.ttf</bold>
<italic>stsong/stsong.ttf</italic>
<boldItalic>stsong/stsong.ttf</boldItalic>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html">'华文宋体',Arial,Helvetica,sans-serif</export>
<export key="net.sf.jasperreports.xhtml">'华文宋体',Arial,Helvetica,sans-serif</export>
</exportFonts>
</fontFamily>
</fontFamilies>

Binary file not shown.

View File

@ -17,6 +17,7 @@
<module>blood_bus_nurse</module>
<module>blood_bus_bloodbank</module>
<module>blood_bus_report</module>
<module>bloodresource</module>
</modules>
<properties>

View File

@ -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
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

View File

@ -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

View File

@ -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

View File

@ -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