fix(common): 统一异常处理并迁移打印功能到hiprint

- 替换所有System.out.println和printStackTrace为slf4j日志记录
- 在BeanUtils、AuditFieldUtil、DateUtils、ServletUtils等工具类中添加Logger实例
- 在Flowable相关控制器和服务中统一错误日志记录格式
- 在代码生成器中添加日志记录功能
- 将前端打印组件从Lodop迁移到hiprint打印方案
- 更新体温单打印功能使用hiprint预览打印
- 移除调试用的console.log语句
- 修复打印模板中线条元素类型定义
This commit is contained in:
2026-03-06 22:16:44 +08:00
parent 8ef334ba1b
commit b65841c0cc
58 changed files with 678 additions and 888 deletions

View File

@@ -2,6 +2,8 @@ package com.core.common.utils;
import com.core.common.core.domain.model.LoginUser; import com.core.common.core.domain.model.LoginUser;
import com.core.common.utils.SecurityUtils; import com.core.common.utils.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -14,6 +16,8 @@ import java.util.Date;
@Component @Component
public class AuditFieldUtil { public class AuditFieldUtil {
private static final Logger log = LoggerFactory.getLogger(AuditFieldUtil.class);
/** /**
* 为实体设置创建相关的审计字段 * 为实体设置创建相关的审计字段
* @param entity 实体对象 * @param entity 实体对象
@@ -65,8 +69,7 @@ public class AuditFieldUtil {
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("设置创建审计字段时发生异常: " + e.getMessage()); log.error("设置创建审计字段时发生异常", e);
e.printStackTrace();
} }
} }
@@ -110,8 +113,7 @@ public class AuditFieldUtil {
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("设置更新审计字段时发生异常: " + e.getMessage()); log.error("设置更新审计字段时发生异常", e);
e.printStackTrace();
} }
} }

View File

@@ -1,6 +1,8 @@
package com.core.common.utils; package com.core.common.utils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
@@ -17,6 +19,9 @@ import java.util.Date;
* @author system * @author system
*/ */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils { public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
private static final Logger log = LoggerFactory.getLogger(DateUtils.class);
public static String YYYY = "yyyy"; public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM"; public static String YYYY_MM = "yyyy-MM";
@@ -227,7 +232,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return endTime; return endTime;
} }
} catch (DateTimeParseException e) { } catch (DateTimeParseException e) {
e.printStackTrace(); log.warn("日期解析失败: {}", strDate, e);
} }
return null; return null;
} }
@@ -250,7 +255,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
// 检查日期是否是未来的时间 // 检查日期是否是未来的时间
return dateToCheck.isAfter(currentDate); return dateToCheck.isAfter(currentDate);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.warn("日期解析失败: {}", dateString, e);
// 解析失败或其他异常,返回 false 或根据需要处理异常 // 解析失败或其他异常,返回 false 或根据需要处理异常
return false; return false;
} }

View File

@@ -2,6 +2,8 @@ package com.core.common.utils;
import com.core.common.constant.Constants; import com.core.common.constant.Constants;
import com.core.common.core.text.Convert; import com.core.common.core.text.Convert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
@@ -24,6 +26,9 @@ import java.util.Map;
* @author system * @author system
*/ */
public class ServletUtils { public class ServletUtils {
private static final Logger log = LoggerFactory.getLogger(ServletUtils.class);
/** /**
* 获取String参数 * 获取String参数
*/ */
@@ -130,7 +135,7 @@ public class ServletUtils {
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.getWriter().print(string); response.getWriter().print(string);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("渲染响应字符串失败", e);
} }
} }

View File

@@ -1,5 +1,8 @@
package com.core.common.utils.bean; package com.core.common.utils.bean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -12,6 +15,9 @@ import java.util.regex.Pattern;
* @author system * @author system
*/ */
public class BeanUtils extends org.springframework.beans.BeanUtils { public class BeanUtils extends org.springframework.beans.BeanUtils {
private static final Logger log = LoggerFactory.getLogger(BeanUtils.class);
/** /**
* Bean方法名中属性名开始的下标 * Bean方法名中属性名开始的下标
*/ */
@@ -37,7 +43,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
try { try {
copyProperties(src, dest); copyProperties(src, dest);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Bean属性复制失败", e);
} }
} }

View File

@@ -115,7 +115,7 @@ public class FlowDefinitionController extends BaseController {
ImageIO.write(image, "png", os); ImageIO.write(image, "png", os);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("读取流程图片失败, deployId: {}", deployId, e);
} finally { } finally {
try { try {
if (os != null) { if (os != null) {
@@ -123,7 +123,7 @@ public class FlowDefinitionController extends BaseController {
os.close(); os.close();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("关闭输出流失败", e);
} }
} }

View File

@@ -211,7 +211,7 @@ public class FlowTaskController extends BaseController {
ImageIO.write(image, "png", os); ImageIO.write(image, "png", os);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("读取流程图片失败", e);
} finally { } finally {
try { try {
if (os != null) { if (os != null) {
@@ -219,7 +219,7 @@ public class FlowTaskController extends BaseController {
os.close(); os.close();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("关闭输出流失败", e);
} }
} }
} }

View File

@@ -722,7 +722,7 @@ public class FlowableUtils {
// 反射设置属性值 // 反射设置属性值
field.set(propertyDto, attribute.getValue()); field.set(propertyDto, attribute.getValue());
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); log.warn("反射设置属性值失败", e);
// 如果反射设置失败则忽略该属性 // 如果反射设置失败则忽略该属性
} }
}); });
@@ -730,7 +730,7 @@ public class FlowableUtils {
return propertyDto; return propertyDto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("解析流程属性失败", e);
return Collections.emptyList(); // 如果发生异常则返回空列表 return Collections.emptyList(); // 如果发生异常则返回空列表
} }
} }

View File

@@ -209,7 +209,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
} }
return AjaxResult.success("流程启动成功"); return AjaxResult.success("流程启动成功");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("流程启动错误", e);
return AjaxResult.error("流程启动错误"); return AjaxResult.error("流程启动错误");
} }
} }

View File

@@ -113,7 +113,7 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
runtimeService.startProcessInstanceById(procDefId, variables); runtimeService.startProcessInstanceById(procDefId, variables);
return AjaxResult.success("流程启动成功"); return AjaxResult.success("流程启动成功");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("流程启动错误, procDefId: {}", procDefId, e);
return AjaxResult.error("流程启动错误"); return AjaxResult.error("流程启动错误");
} }
} }

View File

@@ -19,6 +19,8 @@ import com.core.generator.service.IGenTableColumnService;
import com.core.generator.service.IGenTableService; import com.core.generator.service.IGenTableService;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -43,6 +45,8 @@ import java.util.Map;
@RestController @RestController
@RequestMapping("/tool/gen") @RequestMapping("/tool/gen")
public class GenController extends BaseController { public class GenController extends BaseController {
private static final Logger log = LoggerFactory.getLogger(GenController.class);
@Autowired @Autowired
private IGenTableService genTableService; private IGenTableService genTableService;
@@ -436,7 +440,7 @@ public class GenController extends BaseController {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) { try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
writer.write(str); writer.write(str);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("写入文件失败: {}", filePath, e);
} finally { } finally {
is.close(); is.close();
} }

View File

@@ -6,6 +6,8 @@ import com.core.system.domain.SysUserConfig;
import com.core.common.utils.StringUtils; import com.core.common.utils.StringUtils;
import com.core.system.mapper.SysUserConfigMapper; import com.core.system.mapper.SysUserConfigMapper;
import com.core.system.service.ISysUserConfigService; import com.core.system.service.ISysUserConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -20,6 +22,8 @@ import java.util.List;
@Service @Service
public class SysUserConfigServiceImpl extends ServiceImpl<SysUserConfigMapper, SysUserConfig> implements ISysUserConfigService public class SysUserConfigServiceImpl extends ServiceImpl<SysUserConfigMapper, SysUserConfig> implements ISysUserConfigService
{ {
private static final Logger log = LoggerFactory.getLogger(SysUserConfigServiceImpl.class);
@Autowired @Autowired
private SysUserConfigMapper sysUserConfigMapper; private SysUserConfigMapper sysUserConfigMapper;
@@ -170,8 +174,7 @@ public class SysUserConfigServiceImpl extends ServiceImpl<SysUserConfigMapper, S
} }
} catch (Exception e) { } catch (Exception e) {
// 记录错误日志以便调试 // 记录错误日志以便调试
System.err.println("保存用户配置时发生错误: " + e.getMessage()); log.error("保存用户配置时发生错误, userId: {}, configKey: {}", userId, configKey, e);
e.printStackTrace();
throw e; // 重新抛出异常让上层处理 throw e; // 重新抛出异常让上层处理
} }
} }

View File

@@ -120,7 +120,7 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
// 导出到Excel // 导出到Excel
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null); ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
} catch (IOException | IllegalAccessException e) { } catch (IOException | IllegalAccessException e) {
e.printStackTrace(); log.error("导出Excel失败", e);
return R.fail("导出Excel失败" + e.getMessage()); return R.fail("导出Excel失败" + e.getMessage());
} }

View File

@@ -101,7 +101,7 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
// 导出到Excel // 导出到Excel
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null); ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
} catch (IOException | IllegalAccessException e) { } catch (IOException | IllegalAccessException e) {
e.printStackTrace(); log.error("导出Excel失败", e);
return R.fail("导出Excel失败" + e.getMessage()); return R.fail("导出Excel失败" + e.getMessage());
} }
return R.ok(null, "导出Excel成功"); return R.ok(null, "导出Excel成功");

View File

@@ -42,6 +42,8 @@ import com.openhis.workflow.domain.DeviceDispense;
import com.openhis.workflow.domain.InventoryItem; import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.service.IDeviceDispenseService; import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IInventoryItemService; import com.openhis.workflow.service.IInventoryItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -59,6 +61,8 @@ import java.util.stream.Collectors;
@Service @Service
public class CommonServiceImpl implements ICommonService { public class CommonServiceImpl implements ICommonService {
private static final Logger log = LoggerFactory.getLogger(CommonServiceImpl.class);
@Resource @Resource
private AssignSeqUtil assignSeqUtil; private AssignSeqUtil assignSeqUtil;
@@ -410,7 +414,7 @@ public class CommonServiceImpl implements ICommonService {
try { try {
BeanUtils.copyProperties(contract, metadata); BeanUtils.copyProperties(contract, metadata);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.warn("Bean复制失败", e);
} }
return metadata; return metadata;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));

View File

@@ -121,4 +121,13 @@ public interface IDiagTreatMAppService {
* @return 校验结果 * @return 校验结果
*/ */
R<?> validateActivityEdit(Long activityId); R<?> validateActivityEdit(Long activityId);
/**
* 批量设置划价标记
*
* @param ids 诊疗目录ID列表
* @param pricingFlag 划价标记1:允许, 0:不允许)
* @return 结果
*/
R<?> updatePricingFlag(List<Long> ids, Integer pricingFlag);
} }

View File

@@ -626,6 +626,39 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
return R.ok(); return R.ok();
} }
/**
* 批量设置划价标记
*
* @param ids 诊疗目录ID列表
* @param pricingFlag 划价标记1:允许, 0:不允许)
* @return 结果
*/
@Override
public R<?> updatePricingFlag(List<Long> ids, Integer pricingFlag) {
if (ids == null || ids.isEmpty()) {
return R.fail(null, "请选择要设置的诊疗项目");
}
List<ActivityDefinition> activityDefinitionList = new CopyOnWriteArrayList<>();
// 取得更新值
for (Long id : ids) {
ActivityDefinition activityDefinition = new ActivityDefinition();
activityDefinition.setId(id);
activityDefinition.setPricingFlag(pricingFlag);
activityDefinitionList.add(activityDefinition);
}
// 插入操作记录
operationRecordService.addIdsOperationRecord(DbOpType.UPDATE.getCode(),
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
// 更新诊疗信息
return activityDefinitionService.updateBatchById(activityDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"划价标记"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/** /**
* 导入信息校验 * 导入信息校验
* *

View File

@@ -176,4 +176,16 @@ public class DiagnosisTreatmentController {
public R<?> getClinicItems(@RequestParam(required = false) Long orgId) { public R<?> getClinicItems(@RequestParam(required = false) Long orgId) {
return diagTreatMAppService.getClinicItems(orgId); return diagTreatMAppService.getClinicItems(orgId);
} }
/**
* 批量设置划价标记
*
* @param ids 诊疗目录ID列表
* @param pricingFlag 划价标记1:允许, 0:不允许)
* @return 结果
*/
@PutMapping("/pricing-flag")
public R<?> updatePricingFlag(@RequestBody List<Long> ids, @RequestParam Integer pricingFlag) {
return diagTreatMAppService.updatePricingFlag(ids, pricingFlag);
}
} }

View File

@@ -25,6 +25,8 @@ import com.openhis.workflow.service.IActivityDefinitionService;
import com.openhis.workflow.service.IDeviceDispenseService; import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService; import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IServiceRequestService; import com.openhis.workflow.service.IServiceRequestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -40,6 +42,8 @@ import java.util.stream.Collectors;
@Component @Component
public class AdviceUtils { public class AdviceUtils {
private static final Logger log = LoggerFactory.getLogger(AdviceUtils.class);
@Resource @Resource
AssignSeqUtil assignSeqUtil; AssignSeqUtil assignSeqUtil;
@@ -396,7 +400,7 @@ public class AdviceUtils {
iChargeItemService.updateById(mainChargeItem); iChargeItemService.updateById(mainChargeItem);
} }
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); log.error("JSON处理失败", e);
} }
} }

View File

@@ -560,13 +560,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
System.out.println("回复信息:" + JSON.toJSONString(response)); System.out.println("回复信息:" + JSON.toJSONString(response));
resultString = EntityUtils.toString(response.getEntity(), "utf-8"); resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Http请求异常, url: {}", url, e);
throw new ServiceException("Http请求异常请稍后再试。"); throw new ServiceException("Http请求异常请稍后再试。");
} finally { } finally {
try { try {
response.close(); response.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("关闭响应失败", e);
} }
} }
return resultString; return resultString;
@@ -596,13 +596,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8"); resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Http请求异常, url: {}", url, e);
throw new ServiceException("Http请求异常请稍后再试。"); throw new ServiceException("Http请求异常请稍后再试。");
} finally { } finally {
try { try {
response.close(); response.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("关闭响应失败", e);
} }
} }
return resultString; return resultString;

View File

@@ -7,6 +7,8 @@ import com.openhis.common.annotation.Dict;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@@ -20,6 +22,8 @@ import java.util.List;
@Component @Component
public class DictAspect { public class DictAspect {
private static final Logger log = LoggerFactory.getLogger(DictAspect.class);
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; // 使用 JdbcTemplate 执行 SQL private JdbcTemplate jdbcTemplate; // 使用 JdbcTemplate 执行 SQL
@@ -99,15 +103,15 @@ public class DictAspect {
// 查询字典值 // 查询字典值
String dictLabel = queryDictLabel(dictTable, dictCode, dictText, deleteFlag, fieldValue.toString()); String dictLabel = queryDictLabel(dictTable, dictCode, dictText, deleteFlag, fieldValue.toString());
if (dictLabel != null) { if (dictLabel != null) {
try {
// 动态生成 _dictText 字段名 // 动态生成 _dictText 字段名
String textFieldName = field.getName() + "_dictText"; String textFieldName = field.getName() + "_dictText";
try {
Field textField = dto.getClass().getDeclaredField(textFieldName); Field textField = dto.getClass().getDeclaredField(textFieldName);
textField.setAccessible(true); textField.setAccessible(true);
textField.set(dto, dictLabel); // 设置 _dictText 字段的值 textField.set(dto, dictLabel); // 设置 _dictText 字段的值
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
// 如果 _dictText 字段不存在,忽略错误 // 如果 _dictText 字段不存在,忽略错误
e.printStackTrace(); log.debug("字段 {} 不存在,跳过字典翻译", textFieldName);
} }
} }
} else { } else {

View File

@@ -5,6 +5,8 @@ import com.core.common.utils.DateUtils;
import com.core.common.utils.SecurityUtils; import com.core.common.utils.SecurityUtils;
import com.core.framework.config.TenantContext; import com.core.framework.config.TenantContext;
import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.CommonConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -21,6 +23,8 @@ import java.util.Map;
*/ */
public class HisQueryUtils { public class HisQueryUtils {
private static final Logger log = LoggerFactory.getLogger(HisQueryUtils.class);
/** /**
* 条件查询构造器 * 条件查询构造器
* *
@@ -72,7 +76,7 @@ public class HisQueryUtils {
queryWrapper.ge(dbFieldName, startDate); // 大于等于 STime queryWrapper.ge(dbFieldName, startDate); // 大于等于 STime
queryWrapper.le(dbFieldName, endDate); // 小于等于 ETime queryWrapper.le(dbFieldName, endDate); // 小于等于 ETime
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); log.warn("日期解析失败: startValue={}, endValue={}", startValue, endValue, e);
} }
} }
} }
@@ -100,7 +104,7 @@ public class HisQueryUtils {
queryWrapper.eq(fieldName, value); queryWrapper.eq(fieldName, value);
} }
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); log.warn("反射获取字段值失败: field={}", field.getName(), e);
} }
} }
currentClass = currentClass.getSuperclass(); currentClass = currentClass.getSuperclass();

View File

@@ -1,5 +1,7 @@
package com.openhis.common.utils; package com.openhis.common.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.*; import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -16,6 +18,8 @@ import java.util.concurrent.TimeUnit;
@Component @Component
public class RedisUtil { public class RedisUtil {
private static final Logger log = LoggerFactory.getLogger(RedisUtil.class);
@Autowired @Autowired
private RedisTemplate<Object, Object> redisTemplate; private RedisTemplate<Object, Object> redisTemplate;
@Autowired @Autowired
@@ -35,7 +39,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -60,7 +64,7 @@ public class RedisUtil {
try { try {
return redisTemplate.hasKey(key); return redisTemplate.hasKey(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -104,7 +108,7 @@ public class RedisUtil {
redisTemplate.opsForValue().set(key, value); redisTemplate.opsForValue().set(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
@@ -127,7 +131,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -194,7 +198,7 @@ public class RedisUtil {
redisTemplate.opsForHash().putAll(key, map); redisTemplate.opsForHash().putAll(key, map);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -215,7 +219,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -233,7 +237,7 @@ public class RedisUtil {
redisTemplate.opsForHash().put(key, item, value); redisTemplate.opsForHash().put(key, item, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -255,7 +259,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -316,7 +320,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForSet().members(key); return redisTemplate.opsForSet().members(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return null; return null;
} }
} }
@@ -332,7 +336,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForSet().isMember(key, value); return redisTemplate.opsForSet().isMember(key, value);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -348,7 +352,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForSet().add(key, values); return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -369,7 +373,7 @@ public class RedisUtil {
} }
return count; return count;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -384,7 +388,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForSet().size(key); return redisTemplate.opsForSet().size(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -401,7 +405,7 @@ public class RedisUtil {
Long count = redisTemplate.opsForSet().remove(key, values); Long count = redisTemplate.opsForSet().remove(key, values);
return count; return count;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -419,7 +423,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForList().range(key, start, end); return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return null; return null;
} }
} }
@@ -434,7 +438,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForList().size(key); return redisTemplate.opsForList().size(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -450,7 +454,7 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForList().index(key, index); return redisTemplate.opsForList().index(key, index);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return null; return null;
} }
} }
@@ -468,7 +472,7 @@ public class RedisUtil {
redisTemplate.opsForList().rightPush(key, value); redisTemplate.opsForList().rightPush(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -489,7 +493,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -507,7 +511,7 @@ public class RedisUtil {
redisTemplate.opsForList().rightPushAll(key, value); redisTemplate.opsForList().rightPushAll(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -528,7 +532,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -546,7 +550,7 @@ public class RedisUtil {
redisTemplate.opsForList().set(key, index, value); redisTemplate.opsForList().set(key, index, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis expire操作失败, key: {}", key, e);
return false; return false;
} }
} }
@@ -564,7 +568,7 @@ public class RedisUtil {
Long remove = redisTemplate.opsForList().remove(key, count, value); Long remove = redisTemplate.opsForList().remove(key, count, value);
return remove; return remove;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Redis操作失败, key: {}", key, e);
return 0; return 0;
} }
} }
@@ -590,7 +594,7 @@ public class RedisUtil {
return binaryKeys; return binaryKeys;
}); });
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); log.error("Redis scan操作失败, keyPrefix: {}", keyPrefix, e);
} }
return null; return null;
@@ -605,7 +609,7 @@ public class RedisUtil {
Set<String> keys = keys(keyPrefix); Set<String> keys = keys(keyPrefix);
redisTemplate.delete(keys); redisTemplate.delete(keys);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); log.error("Redis删除操作失败, keyPrefix: {}", keyPrefix, e);
} }
} }

View File

@@ -7,9 +7,6 @@ import request from '@/utils/request';
* @returns {Promise} 请求结果 * @returns {Promise} 请求结果
*/ */
export function getPatientList(query) { export function getPatientList(query) {
// 打印日志便于调试
console.log('调用患者查询API参数:', query);
// 直接复用门诊挂号模块完全相同的实现方式 // 直接复用门诊挂号模块完全相同的实现方式
// 不做额外的参数处理直接将query传递给后端 // 不做额外的参数处理直接将query传递给后端
return request({ return request({

View File

@@ -61,7 +61,8 @@
</div> </div>
</template> </template>
<script> <script>
import {getLodop} from '../../../plugins/print/LodopFuncs' // 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
export default { export default {
data() { data() {
@@ -73,23 +74,35 @@ export default {
} }
} }
}, },
mounted() { mounted() {},
},
methods: { methods: {
printTest() { /**
const LODOP = getLodop() * 使用 hiprint 执行打印
LODOP.PRINT_INIT('') */
LODOP.ADD_PRINT_TABLE(100, 40, 750, 900, document.getElementById('div2').innerHTML) async printTest() {
LODOP.SET_PRINT_STYLEA(0, 'Horient', 3) try {
LODOP.ADD_PRINT_HTM(20, 40, '100%', 100, document.getElementById('div1').innerHTML) // 构建打印数据
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1) const shiftRecordItems = (this.printData.shiftRecordItems || []).map(item => ({
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1) typeDisplay: item.typeDisplay || '',
// LODOP.SET_PRINT_PAGESIZE(2, '', '', ''); // 设置横向打印 bedName: item.bedName || '',
LODOP.ADD_PRINT_HTM(1080, 500, 300, 100, '总页数:<span><span tdata="pageNO">第##页</span>/ <span tdata="pageCount">共##页</span></span>') patientName: item.patientName || '',
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1) mainSuit: item.mainSuit || '',
LODOP.SET_PRINT_STYLEA(0, 'Horient', 1) previousHistory: item.previousHistory || '',
// LODOP.PREVIEW(); // 打印预览 diagnosis: item.diagnosis || '',
LODOP.PRINT() // 直接打印 content: item.content || ''
}))
const printData = {
date: this.printData.date ? this.printData.date.substring(0, 10) : '',
initiatorName: this.printData.initiator ? this.printData.initiator.name : '',
heirName: this.printData.heir ? this.printData.heir.name : '',
shiftRecordItems: shiftRecordItems
}
// 使用 hiprint 打印
await simplePrint(PRINT_TEMPLATE.CHANGE_SHIFT_BILL, printData)
} catch (error) {
console.error('护理交接班打印失败:', error)
}
} }
} }
} }

View File

@@ -86,7 +86,8 @@
</div> </div>
</template> </template>
<script> <script>
import {getLodop} from '../../../plugins/print/LodopFuncs' // 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
export default { export default {
@@ -98,33 +99,47 @@ export default {
printData: { printData: {
type: Object, type: Object,
default() { default() {
return { return {}
}
} }
} }
}, },
data() { data() {
return { return {}
}
},
mounted() {
}, },
mounted() {},
methods: { methods: {
printTest() { /**
const LODOP = getLodop() * 使用 hiprint 执行打印
LODOP.PRINT_INIT('') */
LODOP.ADD_PRINT_TABLE(120, 35, 750, 900, document.getElementById('exeSheet' + this.printData.id).innerHTML) async printTest() {
LODOP.SET_PRINT_STYLEA(0, 'Horient', 3) try {
LODOP.ADD_PRINT_HTM(20, 40, '100%', 100, document.getElementById('exeSheetTitle' + this.printData.id).innerHTML) // 构建打印数据
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1) const recordData = (this.printData.recordData || []).map(item => ({
LODOP.SET_PRINT_STYLEA(0, 'LinkedItem', 1) moTime: item.moTime || '',
// LODOP.SET_PRINT_PAGESIZE(2, '', '', ''); // 设置横向打印 orderName: item.orderName || '',
LODOP.ADD_PRINT_HTM(1080, 500, 300, 100, '总页数:<span><span tdata="pageNO">第##页</span>/ <span tdata="pageCount">共##页</span></span>') flag: item.flag || '',
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1) remark: item.remark || '',
LODOP.SET_PRINT_STYLEA(0, 'Horient', 1) doseOnceUnit: item.doseOnce <= 0 ? '' : (item.doseOnce + item.doseUnit),
LODOP.SET_SHOW_MODE('LANDSCAPE_DEFROTATED', 1)// 横向时的正向显示 usageName: item.usageName || '',
LODOP.PREVIEW() // 打印预览 frequency: item.frequency || '',
// LODOP.PRINT(); // 直接打印 moDocName: item.moDocName || '',
occurrence: item.occurrence || '',
performName: item.performName || ''
}))
const printData = {
hospitalName: this.userStore.hospitalName,
bedName: this.printData.patientInfo ? this.printData.patientInfo.encounterLocationName : '',
patientName: this.printData.patientInfo ? this.printData.patientInfo.name : '',
patientAge: this.printData.patientInfo ? this.printData.patientInfo.patientAge : '',
diag: this.printData.patientInfo ? this.printData.patientInfo.diag : '',
recordData: recordData
}
// 使用 hiprint 打印
await simplePrint(PRINT_TEMPLATE.EXE_ORDER_SHEET, printData)
} catch (error) {
console.error('医嘱执行单打印失败:', error)
}
} }
} }
} }

View File

@@ -46,8 +46,9 @@
</div> </div>
</template> </template>
<script> <script>
// import QRCode from 'qrcodejs2' // 迁移到 hiprint
import {getLodop} from '../../../plugins/print/LodopFuncs' import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
import moment from 'moment'
export default { export default {
name: 'VuePrintNb', name: 'VuePrintNb',
@@ -55,8 +56,7 @@ export default {
printData: { printData: {
type: Object, type: Object,
default() { default() {
return { return {}
}
} }
} }
}, },
@@ -66,72 +66,46 @@ export default {
qrCode: '' qrCode: ''
} }
}, },
mounted() { mounted() {},
// console.log('mounted方法');
// this.initBarCode();
},
methods: { methods: {
// initBarCode() { /**
// this.$nextTick(() => { * 使用 hiprint 执行打印
// if (this.lastId !== this.printData.patient.hisId) { * @param {string} printerName 打印机名称
// new QRCode(this.getId(this.printData.id), { */
// text: this.printData.patient.hisId, async print(printerName) {
// width: 50,
// height: 50,
// colorDark: '#000000',
// colorLight: '#ffffff',
// correctLevel: QRCode.CorrectLevel.H
// });
// }
// this.lastId = this.printData.patient.hisId;
// });
// },
//
// getId(id) {
// return 'qrcode' + id;
// },
print(printerName) {
const LODOP = getLodop()
const printer = this.getPrinter(LODOP, printerName)
if (printer === null) {
this.openMesBox('6', '没有找到打印机【' + printerName + '】')
return
}
console.log(this.printData, 'printData') console.log(this.printData, 'printData')
this.qrCode = this.printData.orderDetail[0].comboNo + this.printData.orderDetail[0].executionSeq try {
LODOP.PRINT_INIT() // 构建打印数据
LODOP.SET_PRINTER_INDEX(printer)// 指定打印机 const orderDetail = this.printData.orderDetail || []
this.setPrint(LODOP) const qrCode = orderDetail[0] ? (orderDetail[0].comboNo + orderDetail[0].executionSeq) : ''
LODOP.SET_PRINT_PAGESIZE(0, 1070, 800, '')
LODOP.PREVIEW() // 打印预览 // 转换药品明细数据
// LODOP.PRINT(); // 直接打印 const formattedOrderDetail = orderDetail.map(item => ({
}, orderName: item.orderName,
setPrint(LODOP) { doseOnceUnit: (item.doseOnce || '') + (item.doseUnit || ''),
LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', document.getElementById(this.printData.id + 'div1').innerHTML) flag: item.flag || '',
LODOP.ADD_PRINT_HTM(82, 0, '100%', '100%', document.getElementById(this.printData.id + 'div2').innerHTML) frequency: item.frequency || '',
LODOP.ADD_PRINT_HTM(265, 10, '100%', '100%', document.getElementById(this.printData.id + 'div3').innerHTML) usageName: item.usageName || ''
LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1) }))
// 设置二维码 qrcode 条码128B等
// LODOP.ADD_PRINT_BARCODE(Top,Left,Width,Height,BarCodeType,BarCodeValue); const printData = {
LODOP.ADD_PRINT_BARCODE(0, 300, 75, 75, 'qrcode', this.qrCode)// 设置条码位置、宽高、字体、值 hisNo: this.printData.patient ? this.printData.patient.hisNo : '',
LODOP.SET_PRINT_STYLEA(0, 'FontSize', 18)// 设置上面这个条码下方的文字字体大小 name: this.printData.patient ? this.printData.patient.name : '',
// LODOP.SET_PRINT_STYLEA(0,"Color","#FF0000");//设置当前条码以及条码下方字体的颜色 sexName: this.printData.patient ? this.printData.patient.sexName : '',
LODOP.SET_PRINT_STYLEA(0, 'Angle', 180)// 设置旋转角度 patientAge: this.printData.patient ? this.printData.patient.patientAge : '',
LODOP.SET_PRINT_STYLEA(0, 'ShowBarText', 0)// 设置是否显示下方的文字 priority: this.printData.priority || '',
LODOP.SET_PRINT_STYLEA(0, 'AlignJustify', 2)// 设置条码下方的文字相对于条码本身居中 qrCode: qrCode,
// LODOP.SET_PRINT_STYLEA(0,"AlignJustify",1);//设置条码下方的文字相对于条码本身居左 orderDetail: formattedOrderDetail,
// LODOP.SET_PRINT_STYLEA(0,"AlignJustify",3);//设置条码下方的文字相对于条码本身居右 printDate: moment().format('YYYY-MM-DD HH:mm')
// LODOP.SET_PRINT_STYLEA(0,"GroundColor","#0080FF");//设置条码的背景色 }
}, // 使用 hiprint 打印
// 获取打印机 await simplePrint(PRINT_TEMPLATE.INJECT_LABEL, printData, printerName)
getPrinter(LODOP, name) { } catch (error) {
const listCount = LODOP.GET_PRINTER_COUNT() // 当前打印设备数量 console.error('输液标签打印失败:', error)
for (let i = 0; i < listCount; i++) { if (this.openMesBox) {
if (LODOP.GET_PRINTER_NAME(i) === name) { this.openMesBox('6', '打印失败: ' + (error.message || '未知错误'))
return name
} }
} }
return null
} }
} }
} }

View File

@@ -60,7 +60,8 @@
</div> </div>
</template> </template>
<script> <script>
import {getLodop} from '../../../plugins/print/LodopFuncs' // 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
export default { export default {
@@ -76,18 +77,38 @@ export default {
} }
} }
}, },
mounted() { mounted() {},
},
methods: { methods: {
printTest() { /**
const LODOP = getLodop() * 使用 hiprint 执行打印
LODOP.PRINT_INIT('') */
LODOP.ADD_PRINT_TABLE(100, 35, 700, 900, document.getElementById('div2').innerHTML) async printTest() {
LODOP.ADD_PRINT_HTM(20, 40, '100%', 100, document.getElementById('div1').innerHTML) try {
LODOP.SET_PRINT_PAGESIZE(0, '148mm', '210mm', '') // 设置横向打印 // 构建打印数据
// LODOP.SET_SHOW_MODE('LANDSCAPE_DEFROTATED', 1);// 横向时的正向显示 const recordData = (this.printData.recordData || []).map(item => ({
LODOP.PREVIEW() // 打印预览 moTime: item.moTime ? item.moTime.substring(0, 16) : '',
// LODOP.PRINT(); // 直接打印 orderName: item.orderName || '',
flag: item.flag || '',
doseOnceUnit: (item.doseOnce || '') + (item.doseUnit || ''),
freqName: item.freqName || '',
usageName: item.usageName || ''
}))
const printData = {
hospitalName: this.userStore.hospitalName,
encounterLocationName: this.printData.patientInfo ? this.printData.patientInfo.encounterLocationName : '',
name: this.printData.patientInfo ? this.printData.patientInfo.name : '',
sexName: this.printData.patientInfo ? this.printData.patientInfo.sexName : '',
patientAge: this.printData.patientInfo ? this.printData.patientInfo.patientAge : '',
hisNo: this.printData.patientInfo ? this.printData.patientInfo.hisNo : '',
deptName: this.printData.patientInfo ? this.printData.patientInfo.deptName : '',
recordData: recordData
}
// 使用 hiprint 打印(复用医嘱执行单模板)
await simplePrint(PRINT_TEMPLATE.EXE_ORDER_SHEET, printData)
} catch (error) {
console.error('输液执行单打印失败:', error)
}
} }
} }
} }

View File

@@ -5,6 +5,8 @@
<script setup> <script setup>
import Graphics from '../../../views/inpatientNurse/tprChart/index'; import Graphics from '../../../views/inpatientNurse/tprChart/index';
import data from '../../../action/nurseStation/temperatureSheet/datas'; import data from '../../../action/nurseStation/temperatureSheet/datas';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const printData = ref({}); const printData = ref({});
const resInfo = ref({}); const resInfo = ref({});
@@ -75,7 +77,9 @@ function setTime(num) {
} }
} }
function printPage() { function printPage() {
window.print(); // 使用 hiprint 预览打印
const printDom = document.querySelector('.tpr-chart-container') || document.body;
previewPrint(printDom);
} }
// 获取每周数据 // 获取每周数据
async function getData(curWeekInfo) { async function getData(curWeekInfo) {

View File

@@ -117,7 +117,8 @@
</div> </div>
</template> </template>
<script> <script>
import {getLodop} from '../../../plugins/print/LodopFuncs' // 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
export default { export default {
name: 'VuePrintNb', name: 'VuePrintNb',
@@ -143,37 +144,38 @@ export default {
else if (pressure.bloodPressureShrinkOne === null) return '' else if (pressure.bloodPressureShrinkOne === null) return ''
return pressure.bloodPressureShrinkOne + '/' + pressure.bloodPressureDiastoleOne return pressure.bloodPressureShrinkOne + '/' + pressure.bloodPressureDiastoleOne
}, },
printTriage(printerName) { /**
* 使用 hiprint 执行打印
* @param {string} printerName 打印机名称
*/
async printTriage(printerName) {
console.log(this.printData, 'printData') console.log(this.printData, 'printData')
const LODOP = getLodop() try {
const printer = this.getPrinter(LODOP, printerName) // 构建打印数据
if (printer === null) { const printData = {
this.openMesBox('6', '没有找到打印机【' + printerName + '】') hisId: this.printData.hisId,
return triageLevel: this.printData.triageLevel,
dept: this.printData.dept,
patientName: this.printData.patientName,
sex: this.printData.sex,
age: this.printData.age,
temperature: this.printData.observation ? this.printData.observation.temperature : '',
sphygmus: this.printData.observation ? this.printData.observation.sphygmus : '',
breath: this.printData.observation ? this.printData.observation.breath : '',
bloodPressure: this.getBloodPressure(this.printData.observation),
bloodOxygen: this.printData.observation ? this.printData.observation.bloodOxygen : '',
triageTime: this.printData.triageTime,
tel: this.printData.tel,
greenText: this.printData.greenText || ''
} }
LODOP.PRINT_INIT() // 使用 hiprint 打印
LODOP.SET_PRINTER_INDEX(printer) // 指定打印机 await simplePrint(PRINT_TEMPLATE.TRIAGE_TICKET, printData, printerName)
this.setPrint(LODOP) } catch (error) {
LODOP.SET_PRINT_PAGESIZE(0, '100mm', '140mm', '') console.error('分诊条打印失败:', error)
// LODOP.PREVIEW(); // 打印预览 if (this.openMesBox) {
LODOP.PRINT() // 直接打印 this.openMesBox('6', '打印失败: ' + (error.message || '未知错误'))
},
setPrint(LODOP) {
LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', document.getElementById('div1').innerHTML)
LODOP.ADD_PRINT_BARCODE(40, 100, 100, 100, 'qrcode', this.printData.hisId) // 设置条码位置、宽高、字体、值
LODOP.ADD_PRINT_HTM(200, 0, '100%', '100%', document.getElementById('div2').innerHTML)
LODOP.ADD_PRINT_HTM(230, 10, '100%', '100%', document.getElementById('div3').innerHTML)
LODOP.ADD_PRINT_HTM(295, 10, '100%', '100%', document.getElementById('div4').innerHTML)
},
// 获取打印机
getPrinter(LODOP, name) {
const listCount = LODOP.GET_PRINTER_COUNT() // 当前打印设备数量
for (let i = 0; i < listCount; i++) {
if (LODOP.GET_PRINTER_NAME(i) === name) {
return name
} }
} }
return null
} }
} }
} }

View File

@@ -27,7 +27,8 @@
</template> </template>
<script> <script>
import QRCode from 'qrcodejs2' import QRCode from 'qrcodejs2'
import {getLodop} from '../../../plugins/print/LodopFuncs' // 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
export default { export default {
name: 'WristPrint', name: 'WristPrint',
@@ -67,33 +68,31 @@ export default {
clear() { clear() {
document.getElementById('qrcode').innerHTML = '' document.getElementById('qrcode').innerHTML = ''
}, },
execPrint(preview, printerName) { /**
const LODOP = getLodop() * 使用 hiprint 执行打印
const printer = this.getPrinter(LODOP, printerName) * @param {boolean} preview 是否预览hiprint暂不支持预览参数保留兼容性
if (printer === null) { * @param {string} printerName 打印机名称
this.openMesBox('6', '没有找到打印机【' + printerName + '】') */
return async execPrint(preview, printerName) {
try {
// 构建打印数据
const printData = {
patientName: this.printData.patientName,
hisId: this.printData.hisId,
gender: this.printData.gender ? this.printData.gender.display : '',
dept: this.printData.dept,
bedName: this.printData.bedName,
triageLevel: this.printData.triageLevel,
checkInWardTime: this.printData.checkInWardTime
} }
LODOP.PRINT_INIT('') // 使用 hiprint 打印
LODOP.ADD_PRINT_HTM(30, 100, '100%', 100, document.getElementById('div1').innerHTML) await simplePrint(PRINT_TEMPLATE.WRIST_BAND, printData, printerName)
LODOP.ADD_PRINT_HTM(30, 20, '100%', 40, document.getElementById('qrcode').innerHTML) } catch (error) {
LODOP.SET_PRINT_PAGESIZE(2, '25mm', '270mm', '') // 设置横向打印 console.error('腕带打印失败:', error)
if (preview) { if (this.openMesBox) {
LODOP.PREVIEW() // 打印预览 this.openMesBox('6', '打印失败: ' + (error.message || '未知错误'))
return
}
// LODOP.PREVIEW(); // 打印预览
LODOP.PRINT() // 直接打印
},
// 获取打印机
getPrinter(LODOP, name) {
const listCount = LODOP.GET_PRINTER_COUNT() // 当前打印设备数量
for (let i = 0; i < listCount; i++) {
if (LODOP.GET_PRINTER_NAME(i) === name) {
return name
} }
} }
return null
} }
} }
} }

View File

@@ -9,7 +9,6 @@
@close="cancel" @close="cancel"
@opened=" @opened="
() => { () => {
console.log(123);
traceNoTempRef.focus(); traceNoTempRef.focus();
} }
" "

File diff suppressed because one or more lines are too long

View File

@@ -24,18 +24,18 @@
{"options": {"left": 10, "top": 50, "height": 10, "width": 80, "title": "病人类型:", "fontSize": 9, "field": "personType"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 50, "height": 10, "width": 80, "title": "病人类型:", "fontSize": 9, "field": "personType"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 100, "top": 50, "height": 10, "width": 120, "title": "门诊号:", "fontSize": 9, "field": "busNo"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 100, "top": 50, "height": 10, "width": 120, "title": "门诊号:", "fontSize": 9, "field": "busNo"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 10, "top": 62, "height": 10, "width": 150, "title": "收费时间:", "fontSize": 9, "field": "chargeTime"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 62, "height": 10, "width": 150, "title": "收费时间:", "fontSize": 9, "field": "chargeTime"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 0, "top": 76, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "solid", "borderColor": "#000000"}, "printElementType": {"title": "线", "type": "line"}}, {"options": {"left": 0, "top": 76, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "solid", "borderColor": "#000000"}, "printElementType": {"title": "线", "type": "hline"}},
{"options": {"left": 10, "top": 82, "height": 10, "width": 80, "title": "收费项目", "fontSize": 9, "fontWeight": "bold"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 82, "height": 10, "width": 80, "title": "收费项目", "fontSize": 9, "fontWeight": "bold"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 100, "top": 82, "height": 10, "width": 40, "title": "数量", "fontSize": 9, "fontWeight": "bold", "textAlign": "center"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 100, "top": 82, "height": 10, "width": 40, "title": "数量", "fontSize": 9, "fontWeight": "bold", "textAlign": "center"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 145, "top": 82, "height": 10, "width": 80, "title": "金额", "fontSize": 9, "fontWeight": "bold", "textAlign": "right"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 145, "top": 82, "height": 10, "width": 80, "title": "金额", "fontSize": 9, "fontWeight": "bold", "textAlign": "right"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 0, "top": 94, "height": 40, "width": 226.5, "field": "chargeItem", "textAlign": "center", "fontSize": 8, "columns": [[{"title": "收费项目", "width": 95, "field": "chargeItemName"}, {"title": "数量", "width": 40, "field": "quantityValue"}, {"title": "金额", "width": 50, "field": "totalPrice"}]]}, "printElementType": {"title": "表格", "type": "table"}}, {"options": {"left": 0, "top": 94, "height": 40, "width": 226.5, "field": "chargeItem", "textAlign": "center", "fontSize": 8, "columns": [[{"title": "收费项目", "width": 95, "field": "chargeItemName"}, {"title": "数量", "width": 40, "field": "quantityValue"}, {"title": "金额", "width": 50, "field": "totalPrice"}]]}, "printElementType": {"title": "表格", "type": "table"}},
{"options": {"left": 0, "top": 136, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "solid", "borderColor": "#000000"}, "printElementType": {"title": "线", "type": "line"}}, {"options": {"left": 0, "top": 136, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "solid", "borderColor": "#000000"}, "printElementType": {"title": "线", "type": "hline"}},
{"options": {"left": 10, "top": 142, "height": 10, "width": 80, "title": "合计:", "fontSize": 9, "field": "FULAMT_OWNPAY_AMT"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 142, "height": 10, "width": 80, "title": "合计:", "fontSize": 9, "field": "FULAMT_OWNPAY_AMT"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 100, "top": 142, "height": 10, "width": 120, "title": "现金:", "fontSize": 9, "textAlign": "right", "field": "SELF_CASH_PAY"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 100, "top": 142, "height": 10, "width": 120, "title": "现金:", "fontSize": 9, "textAlign": "right", "field": "SELF_CASH_PAY"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 10, "top": 154, "height": 10, "width": 100, "title": "微信:", "fontSize": 9, "field": "SELF_VX_PAY"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 154, "height": 10, "width": 100, "title": "微信:", "fontSize": 9, "field": "SELF_VX_PAY"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 120, "top": 154, "height": 10, "width": 100, "title": "支付宝:", "fontSize": 9, "textAlign": "right", "field": "SELF_ALI_PAY"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 120, "top": 154, "height": 10, "width": 100, "title": "支付宝:", "fontSize": 9, "textAlign": "right", "field": "SELF_ALI_PAY"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 10, "top": 166, "height": 10, "width": 150, "title": "医保账户:", "fontSize": 9, "field": "SELF_YB_ZH_PAY"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 10, "top": 166, "height": 10, "width": 150, "title": "医保账户:", "fontSize": 9, "field": "SELF_YB_ZH_PAY"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 0, "top": 180, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "dashed", "borderColor": "#CCCCCC"}, "printElementType": {"title": "线", "type": "line"}}, {"options": {"left": 0, "top": 180, "height": 2, "width": 226.5, "borderWidth": 1, "borderStyle": "dashed", "borderColor": "#CCCCCC"}, "printElementType": {"title": "线", "type": "hline"}},
{"options": {"left": 0, "top": 186, "height": 12, "width": 226.5, "title": "门诊手术计费流程", "fontWeight": "bold", "textAlign": "center", "fontSize": 10, "color": "#0066CC"}, "printElementType": {"title": "文本", "type": "text"}}, {"options": {"left": 0, "top": 186, "height": 12, "width": 226.5, "title": "门诊手术计费流程", "fontWeight": "bold", "textAlign": "center", "fontSize": 10, "color": "#0066CC"}, "printElementType": {"title": "文本", "type": "text"}},
{"options": {"left": 10, "top": 200, "height": 85, "width": 206.5, "field": "surgeryFlowImage", "fit": "contain"}, "printElementType": {"title": "图片", "type": "image"}}, {"options": {"left": 10, "top": 200, "height": 85, "width": 206.5, "field": "surgeryFlowImage", "fit": "contain"}, "printElementType": {"title": "图片", "type": "image"}},
{"options": {"left": 0, "top": 288, "height": 10, "width": 226.5, "title": "请妥善保管,有疑问请咨询服务台", "fontSize": 8, "textAlign": "center", "color": "#666666"}, "printElementType": {"title": "文本", "type": "text"}} {"options": {"left": 0, "top": 288, "height": 10, "width": 226.5, "title": "请妥善保管,有疑问请咨询服务台", "fontSize": 8, "textAlign": "center", "color": "#666666"}, "printElementType": {"title": "文本", "type": "text"}}

View File

@@ -1,4 +1,4 @@
处方签 Prescription.json 1处方签 Prescription.json
处置单 Disposal.json 处置单 Disposal.json
门诊日结 DailyOutpatientSettlement.json 门诊日结 DailyOutpatientSettlement.json
门诊挂号 OutpatientRegistration.json 门诊挂号 OutpatientRegistration.json

View File

@@ -3,7 +3,7 @@ import {createApp} from 'vue';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
// 导入 hiprint 并挂载到全局 window 对象 // 导入 hiprint 并挂载到全局 window 对象
import {hiprint, autoConnect, disAutoConnect} from 'vue-plugin-hiprint'; import {hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint';
import ElementPlus, {ElDialog, ElMessage} from 'element-plus'; import ElementPlus, {ElDialog, ElMessage} from 'element-plus';
import zhCn from 'element-plus/es/locale/lang/zh-cn'; import zhCn from 'element-plus/es/locale/lang/zh-cn';
@@ -52,9 +52,9 @@ import {registerComponents} from './template';
window.hiprint = hiprint; window.hiprint = hiprint;
// 初始化 hiprint 并连接本地客户端 // 初始化 hiprint,使用默认元素类型提供器(支持 table、text、image 等元素)
hiprint.init({ hiprint.init({
providers: [] providers: [new defaultElementTypeProvider()]
}); });
// 延迟连接,确保 hiwebSocket 已初始化 // 延迟连接,确保 hiwebSocket 已初始化

View File

@@ -1,6 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue'; import {ref} from 'vue';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const userStore = useUserStore(); const userStore = useUserStore();
@@ -99,10 +101,14 @@ const signatures = ref<Signatures>({
}, {} as Record<string, string>), }, {} as Record<string, string>),
}); });
// 5. 打印功能:控制打印范围+样式 // 5. 打印功能:使用 hiprint
const handlePrint = () => { const handlePrint = () => {
// 1. 触发浏览器打印 const printDom = document.querySelector('.medical-record');
if (printDom) {
previewPrint(printDom);
} else {
window.print(); window.print();
}
}; };
// 暴露接口 // 暴露接口

View File

@@ -233,6 +233,8 @@
import {onMounted, reactive, ref} from 'vue'; import {onMounted, reactive, ref} from 'vue';
import intOperRecordSheet from '../views/hospitalRecord/components/intOperRecordSheet.vue'; import intOperRecordSheet from '../views/hospitalRecord/components/intOperRecordSheet.vue';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const userStore = useUserStore(); const userStore = useUserStore();
const isShowprintDom = ref(false); const isShowprintDom = ref(false);
@@ -393,11 +395,16 @@ const setFormData = (data) => {
} }
}; };
// 打印功能 // 打印功能 - 使用 hiprint
const handlePrint = () => { const handlePrint = () => {
formRef.value.validate((valid) => { formRef.value.validate((valid) => {
if (valid) { if (valid) {
const printDom = document.querySelector('.form-container');
if (printDom) {
previewPrint(printDom);
} else {
window.print(); window.print();
}
} else { } else {
ElMessageBox.warning('请先完善表单信息再打印'); ElMessageBox.warning('请先完善表单信息再打印');
} }

View File

@@ -214,6 +214,8 @@
<script setup> <script setup>
import {onMounted, reactive, ref} from 'vue'; import {onMounted, reactive, ref} from 'vue';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const userStore = useUserStore(); const userStore = useUserStore();
// 医院名称 // 医院名称
@@ -346,11 +348,16 @@ const setFormData = (data) => {
} }
}; };
// 打印功能 // 打印功能 - 使用 hiprint
const handlePrint = () => { const handlePrint = () => {
formRef.value.validate((valid) => { formRef.value.validate((valid) => {
if (valid) { if (valid) {
const printDom = document.querySelector('.form-container');
if (printDom) {
previewPrint(printDom);
} else {
window.print(); window.print();
}
} else { } else {
ElMessageBox.warning('请先完善表单信息再打印'); ElMessageBox.warning('请先完善表单信息再打印');
} }

View File

@@ -96,6 +96,8 @@ import {
} from 'element-plus'; } from 'element-plus';
import {patientInfo} from '../views/doctorstation/components/store/patient'; import {patientInfo} from '../views/doctorstation/components/store/patient';
import useUserStore from '../store/modules/user'; import useUserStore from '../store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
defineOptions({ defineOptions({
name: 'tySurgicalRecord' name: 'tySurgicalRecord'
@@ -165,12 +167,16 @@ const submit = () => {
}); });
}; };
// 打印功能 // 打印功能 - 使用 hiprint
const handlePrint = () => { const handlePrint = () => {
formRef.value.validate((valid) => { formRef.value.validate((valid) => {
if (valid) { if (valid) {
// window.print(); const printDom = document.querySelector('.form-container');
ElMessage.warning('打印功能待实现'); if (printDom) {
previewPrint(printDom);
} else {
ElMessage.warning('未找到打印内容');
}
} else { } else {
ElMessage.warning('请先完善表单信息再打印'); ElMessage.warning('请先完善表单信息再打印');
} }

View File

@@ -351,11 +351,6 @@ async function handleAdd() {
const tenantId = userStore?.tenantId const tenantId = userStore?.tenantId
const tenantName = userStore?.tenantName const tenantName = userStore?.tenantName
console.log('当前用户信息:', userStore)
console.log('当前用户租户ID:', tenantId)
console.log('当前用户租户名称:', tenantName)
console.log('租户选项列表:', tenantOptions.value)
// 检查租户ID是否存在如果不存在则尝试从租户名称匹配 // 检查租户ID是否存在如果不存在则尝试从租户名称匹配
let matchedTenantId = null let matchedTenantId = null
if (tenantId) { if (tenantId) {
@@ -368,7 +363,6 @@ async function handleAdd() {
) )
if (matchedTenant) { if (matchedTenant) {
matchedTenantId = matchedTenant.id matchedTenantId = matchedTenant.id
console.log('通过租户名称匹配到租户ID:', matchedTenantId)
} }
} }

View File

@@ -406,11 +406,17 @@ function openSaveImplementDepartment(row) {
function deleteSelectedRows(row) { function deleteSelectedRows(row) {
proxy.$modal.confirm('是否删除选中数据').then(() => { proxy.$modal.confirm('是否删除选中数据').then(() => {
if (row.id) { if (row.id) {
deleteImplementDepartment({ orgLocId: row.id }).then((res) => {}); deleteImplementDepartment({ orgLocId: row.id }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('删除成功');
}
}).catch(() => {
proxy.$modal.msgError('删除失败');
});
} else { } else {
catagoryList.value.pop(); catagoryList.value.pop();
}
proxy.$modal.msgSuccess('删除成功'); proxy.$modal.msgSuccess('删除成功');
}
data.isAdding = false; data.isAdding = false;
getList(); getList();
}); });

View File

@@ -113,4 +113,14 @@ export function getDiseaseTreatmentByYbNo (ybNo) {
}); });
} }
// 批量设置划价标记
export function updatePricingFlag (ids, pricingFlag) {
return request ({
url: '/data-dictionary/diagnosis-treatment/pricing-flag',
method: 'put',
data: ids,
params: { pricingFlag },
});
}

View File

@@ -95,6 +95,28 @@
> >
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Check"
:disabled="multiple"
@click="handlePricingFlag(1)"
>允许划价</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Close"
:disabled="multiple"
@click="handlePricingFlag(0)"
>禁止划价</el-button
>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleImport">导入</el-button> <el-button type="info" plain icon="Upload" @click="handleImport">导入</el-button>
</el-col> </el-col>
@@ -301,6 +323,7 @@ import {
startDiseaseTreatment, startDiseaseTreatment,
stopDiseaseTreatment, stopDiseaseTreatment,
validateActivityEdit, validateActivityEdit,
updatePricingFlag,
} from './components/diagnosistreatment'; } from './components/diagnosistreatment';
import diagnosisTreatmentDialog from './components/diagnosisTreatmentDialog'; import diagnosisTreatmentDialog from './components/diagnosisTreatmentDialog';
import DiagTreYbDialog from './components/diagTreYbDialog'; import DiagTreYbDialog from './components/diagTreYbDialog';
@@ -429,6 +452,22 @@ function handleClose() {
}) })
.catch(() => {}); .catch(() => {});
} }
/** 批量设置划价标记 */
function handlePricingFlag(pricingFlag) {
const selectedIds = ids.value;
const flagText = pricingFlag === 1 ? '允许划价' : '禁止划价';
proxy.$modal
.confirm(`是否确认将选中的诊疗项目设置为"${flagText}"`)
.then(function () {
return updatePricingFlag(selectedIds, pricingFlag);
})
.then(() => {
getList();
proxy.$modal.msgSuccess(`批量设置${flagText}成功`);
})
.catch(() => {});
}
/** 导出按钮操作 */ /** 导出按钮操作 */
function handleExport() { function handleExport() {
proxy.download( proxy.download(

View File

@@ -147,7 +147,7 @@ export function wxPay (data) {
*/ */
export function WxPayResult (data) { export function WxPayResult (data) {
return request ({ return request ({
url: '/three-part/pay/pay-query'+data.paymentId, url: '/three-part/pay/pay-query/' + data.paymentId,
method: 'get', method: 'get',
}); });
} }

View File

@@ -613,7 +613,7 @@ async function submit() {
return sum + (Number(item.amount) || 0); return sum + (Number(item.amount) || 0);
}, 0) }, 0)
.toFixed(2); .toFixed(2);
if (parseFloat(amount) < formData.totalAmount.toFixed(2)) { if (parseFloat(amount) < parseFloat(formData.totalAmount.toFixed(2))) {
proxy.$modal.msgError('请输入正确的结算金额'); proxy.$modal.msgError('请输入正确的结算金额');
return; return;
} }
@@ -639,8 +639,14 @@ async function submit() {
if (userStore.fixmedinsCode == 'H22010200672' && props.consumablesIdList.length > 0) { if (userStore.fixmedinsCode == 'H22010200672' && props.consumablesIdList.length > 0) {
dispenseMedicalConsumables(props.consumablesIdList); dispenseMedicalConsumables(props.consumablesIdList);
} }
} else {
proxy.$modal.msgError(res.msg || '收费失败');
} }
}) })
.catch((error) => {
console.error('收费失败:', error);
proxy.$modal.msgError(error.message || '收费失败,请重试');
})
.finally(() => { .finally(() => {
dialogLoading.value = false; dialogLoading.value = false;
}); });

View File

@@ -497,14 +497,14 @@
handleColor( handleColor(
[1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9],
[ [
'default', 'info',
'success', 'success',
'default', 'info',
'info', 'info',
'success', 'success',
'info', 'info',
'warning', 'warning',
'error', 'danger',
'info', 'info',
], ],
scope.row.statusEnum scope.row.statusEnum

View File

@@ -352,6 +352,8 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icons-vue' import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icons-vue'
import { queryConsultationListPage, cancelConsultation, saveConsultation } from './api' import { queryConsultationListPage, cancelConsultation, saveConsultation } from './api'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
const loading = ref(false) const loading = ref(false)
const saving = ref(false) const saving = ref(false)
@@ -477,12 +479,28 @@ const handleCurrentChange = (val) => {
loadData() loadData()
} }
const handlePrint = () => { const handlePrint = async () => {
if (!currentRow.value) { if (!currentRow.value) {
ElMessage.warning('请先选择一条记录') ElMessage.warning('请先选择一条记录')
return return
} }
window.print() try {
// 构建打印数据
const printData = {
patientName: currentRow.value.patientName || '',
gender: currentRow.value.genderText || '',
age: currentRow.value.age || '',
deptName: currentRow.value.department || '',
diagnosis: currentRow.value.provisionalDiagnosis || '',
consultationReason: currentRow.value.consultationPurpose || '',
applyTime: currentRow.value.applyTime || '',
applyDoctor: currentRow.value.requestingPhysician || ''
}
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printData)
} catch (error) {
console.error('会诊申请单打印失败:', error)
ElMessage.error('打印失败')
}
} }
const handleRowChange = (row) => { const handleRowChange = (row) => {

View File

@@ -211,6 +211,8 @@ import { computed, ref, onMounted, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
import { import {
getPendingConfirmationList, getPendingConfirmationList,
confirmConsultation, confirmConsultation,
@@ -498,12 +500,28 @@ const handleSign = async () => {
} }
} }
const handlePrint = () => { const handlePrint = async () => {
if (!currentRow.value) { if (!currentRow.value) {
ElMessage.warning('请先选择会诊申请') ElMessage.warning('请先选择会诊申请')
return return
} }
window.print() try {
// 构建打印数据
const printData = {
patientName: formData.value.patientName || '',
gender: formData.value.genderText || '',
age: formData.value.age || '',
deptName: formData.value.applyDept || '',
diagnosis: formData.value.provisionalDiagnosis || '',
consultationReason: formData.value.consultationPurpose || '',
applyTime: formData.value.applyTime || '',
applyDoctor: formData.value.applyDoctor || ''
}
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printData)
} catch (error) {
console.error('会诊确认单打印失败:', error)
ElMessage.error('打印失败')
}
} }
const handleRefresh = async () => { const handleRefresh = async () => {

View File

@@ -501,6 +501,8 @@ import {
getInspectionItemList getInspectionItemList
} from '../api' } from '../api'
import useUserStore from '@/store/modules/user.js' import useUserStore from '@/store/modules/user.js'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE, previewPrint } from '@/utils/printUtils.js'
import {storeToRefs} from 'pinia' import {storeToRefs} from 'pinia'
// Props // Props
@@ -1366,8 +1368,6 @@ function handleSelectionChange(selection) {
// 打印申请单 // 打印申请单
function handlePrint(row) { function handlePrint(row) {
// console.log('打印申请单:', row)
// 切换到申请单TAB // 切换到申请单TAB
leftActiveTab.value = 'application' leftActiveTab.value = 'application'
@@ -1376,64 +1376,14 @@ function handlePrint(row) {
// 等待DOM更新后执行打印 // 等待DOM更新后执行打印
setTimeout(() => { setTimeout(() => {
// 添加打印样式 // 使用 hiprint 的 previewPrint 方法
const printStyle = document.createElement('style') const printDom = document.querySelector('.application-form')
printStyle.innerHTML = ` if (printDom) {
@media print { previewPrint(printDom)
body * {
visibility: hidden;
}
.application-form,
.application-form * {
visibility: visible;
}
.application-form {
position: absolute;
left: 0;
top: 0;
width: 100%;
max-width: none;
box-shadow: none;
border: none;
margin: 0;
padding: 20px;
}
.el-tabs__header {
display: none;
}
.el-tabs__content {
padding: 0;
}
.section-header,
.pagination-container,
.inspection-selector,
.selected-items-area,
.actions {
display: none !important;
}
.application-form .el-input__inner,
.application-form .el-select .el-input__inner,
.application-form .el-textarea__inner {
border: 1px solid #ddd !important;
background: white !important;
}
.application-form .el-checkbox__input.is-checked .el-checkbox__inner {
background-color: #409eff;
border-color: #409eff;
}
}
`
document.head.appendChild(printStyle)
// 执行打印
window.print()
// 移除打印样式
setTimeout(() => {
document.head.removeChild(printStyle)
}, 1000)
ElMessage.success('正在准备打印...') ElMessage.success('正在准备打印...')
} else {
ElMessage.warning('未找到打印内容')
}
}, 100) }, 100)
} }

View File

@@ -1348,6 +1348,8 @@
<script setup> <script setup>
import {computed, reactive, ref} from 'vue'; import {computed, reactive, ref} from 'vue';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const userStore = useUserStore(); const userStore = useUserStore();
const bodyRef = ref(); const bodyRef = ref();
@@ -1390,32 +1392,11 @@ const closePrintPreview = () => {
showPrintPreview.value = false; showPrintPreview.value = false;
}; };
// 处理打印逻辑 // 处理打印逻辑 - 使用 hiprint
const handlePrint = () => { const handlePrint = () => {
if (!printContentRef.value) return; if (!printContentRef.value) return;
// 使用 hiprint 预览打印
// 创建打印窗口 previewPrint(printContentRef.value);
const printWindow = window.open('', '_blank');
// 复制打印内容到新窗口
printWindow.document.write(`
<html>
<head>
<title>打印预览</title>
<style>
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; padding: 20px; }
* { box-sizing: border-box; }
</style>
</head>
<body>
${printContentRef.value.innerHTML}
</body>
</html>
`);
printWindow.document.close();
// 执行打印
printWindow.print();
// 关闭打印窗口(可选)
printWindow.close();
}; };
const getDom = () => { const getDom = () => {

View File

@@ -172,7 +172,9 @@ import {computed, onMounted, ref} from 'vue';
import {ElMessage} from 'element-plus'; import {ElMessage} from 'element-plus';
import {patientInfoList} from '../../components/store/patient.js'; import {patientInfoList} from '../../components/store/patient.js';
import {getSinglePatient} from '../store/patient.js'; // 导入获取单选患者信息的方法 import {getSinglePatient} from '../store/patient.js'; // 导入获取单选患者信息的方法
import {formatDateStr} from '@/utils/index'; import {formatDateStr} from '@/utils';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
// 响应式数据 // 响应式数据
const loading = ref(false); const loading = ref(false);
@@ -433,39 +435,16 @@ function handlePrint() {
printDialogVisible.value = true; printDialogVisible.value = true;
} }
// 执行打印 // 执行打印 - 使用 hiprint
function doPrint() { function doPrint() {
try { try {
// 获取要打印的内容 // 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML; const printContent = document.getElementById('print-content');
if (printContent) {
// 创建临时窗口 previewPrint(printContent);
const printWindow = window.open('', '_blank'); } else {
ElMessage.warning('未找到打印内容');
// 写入内容 }
printWindow.document.write(`
<html>
<head>
<title>预交金清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
} catch (e) { } catch (e) {
ElMessage.error('打印失败'); ElMessage.error('打印失败');
console.error('Print error:', e); console.error('Print error:', e);

View File

@@ -495,38 +495,16 @@ function handlePrint() {
printDialogVisible.value = true; printDialogVisible.value = true;
} }
// 执行打印 // 执行打印 - 使用 hiprint
function doPrint() { function doPrint() {
try { try {
// 获取要打印的内容 // 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML; const printContent = document.getElementById('print-content');
if (printContent) {
// 创建临时窗口 previewPrint(printContent);
const printWindow = window.open('', '_blank'); } else {
ElMessage.warning('未找到打印内容');
// 写入内容 }
printWindow.document.write(`
<html>
<head>
<title>费用明细清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
} catch (e) { } catch (e) {
ElMessage.error('打印失败'); ElMessage.error('打印失败');
console.error('Print error:', e); console.error('Print error:', e);

View File

@@ -345,6 +345,8 @@ import moment from 'moment';
import {ElMessage} from 'element-plus'; import {ElMessage} from 'element-plus';
import {patientInfoList} from '../../components/store/patient.js'; import {patientInfoList} from '../../components/store/patient.js';
import {formatDateStr} from '@/utils/index'; import {formatDateStr} from '@/utils/index';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
import {getCostDetail} from './api.js'; import {getCostDetail} from './api.js';
import {getOrgList} from '../../../basicmanage/ward/components/api.js'; import {getOrgList} from '../../../basicmanage/ward/components/api.js';
import {User} from '@element-plus/icons-vue'; import {User} from '@element-plus/icons-vue';
@@ -627,39 +629,16 @@ function handlePrint() {
printDialogVisible.value = true; printDialogVisible.value = true;
} }
// 执行打印 // 执行打印 - 使用 hiprint
function doPrint() { function doPrint() {
try { try {
// 获取要打印的内容 // 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML; const printContent = document.getElementById('print-content');
if (printContent) {
// 创建临时窗口 previewPrint(printContent);
const printWindow = window.open('', '_blank'); } else {
ElMessage.warning('未找到打印内容');
// 写入内容 }
printWindow.document.write(`
<html>
<head>
<title>费用明细清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
} catch (e) { } catch (e) {
ElMessage.error('打印失败'); ElMessage.error('打印失败');
console.error('Print error:', e); console.error('Print error:', e);

View File

@@ -147,6 +147,8 @@ import {formatDateStr} from '@/utils';
import moment from 'moment'; import moment from 'moment';
import {getVitalSignsInfo, listPatient} from './components/api'; import {getVitalSignsInfo, listPatient} from './components/api';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
// import { getSignsCharts } from '@/api/signsManagement' // import { getSignsCharts } from '@/api/signsManagement'
// import { date } from 'jszip/lib/defaults' // import { date } from 'jszip/lib/defaults'
const userStore = useUserStore(); const userStore = useUserStore();
@@ -452,65 +454,23 @@ function dateDiff(start, end) {
return '0'; return '0';
} }
} }
// 打印体温单 // 打印体温单 - 使用 hiprint
function printTW() { function printTW() {
// this.$print(this.$refs.print); const element = printRef.value;
printRef.value.focus(); if (element) {
printRef.value.contentWindow.print(); previewPrint(element);
// this.$refs.refTemp.printPage(); } else {
console.error('未找到可打印的内容');
}
} }
// 打印体温单 // 打印体温单 - 使用 hiprint
function printPage() { function printPage() {
const element = printRef.value; const element = printRef.value;
if (element) {
if (!element) { previewPrint(element);
} else {
console.error('未找到可打印的内容'); console.error('未找到可打印的内容');
return;
} }
// 创建一个克隆元素用于打印,避免修改原 DOM
const clone = element.cloneNode(true);
// 设置宽度为 A4780px ≈ 210mm高度自适应
clone.style.transform = 'scale(0.7)';
clone.style.transformOrigin = 'top left';
clone.style.width = 'calc(210mm * 1.11)';
clone.style.height = 'calc(297mm * 1.11)';
clone.style.marginLeft = '50px';
// 插入到 body 中以便 html2pdf 渲染
document.body.appendChild(clone);
// 设置 html2pdf 配置
const opt = {
margin: 0,
filename: '体温单.pdf',
image: { type: 'jpeg', quality: 1 },
html2canvas: { scale: 2, useCORS: true }, // 启用跨域资源支持
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
pagebreak: { mode: ['avoid-all'] },
onclone: (clonedDoc) => {
const chart = clonedDoc.getElementById(clone.id);
if (chart) {
chart.style.width = '210mm'; // 强制 A4 宽度
chart.style.margin = '0 auto';
}
},
};
// 导出为 PDF 并打印
html2pdf()
.from(clone)
.set(opt)
.toPdf()
.get('pdf')
.then(function (pdf) {
pdf.autoPrint(); // 自动打印
window.open(pdf.output('bloburl'), '_blank'); // 在新窗口打开 PDF以便用户确认
})
.finally(() => {
document.body.removeChild(clone); // 清理临时元素
});
} }
// 转化时间 // 转化时间
function formatDateTo(dateStr) { function formatDateTo(dateStr) {

View File

@@ -1017,7 +1017,12 @@ function submitAudit() {
proxy.$modal.msgSuccess('提交审批成功'); proxy.$modal.msgSuccess('提交审批成功');
emit('refresh'); emit('refresh');
visible.value = false; visible.value = false;
} else {
proxy.$modal.msgError(res.msg || '提交审批失败');
} }
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
}); });
} }
} }

View File

@@ -942,10 +942,17 @@ function handleSubmitApproval() {
proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存'); proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存');
} else { } else {
submitApproval(receiptHeaderForm.busNo).then((response) => { submitApproval(receiptHeaderForm.busNo).then((response) => {
if (response.code == 200) {
proxy.$modal.msgSuccess('提交审批成功'); proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value); tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYCK(); store.clearCurrentDataLYCK();
router.replace({ path: 'requisitionManagementList' }); router.replace({ path: 'requisitionManagementList' });
} else {
proxy.$modal.msgError(response.msg || '提交审批失败');
}
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
}); });
} }
} }

View File

@@ -1015,11 +1015,18 @@ function handleSubmitApproval() {
proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存'); proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存');
} else { } else {
submitTHApproval(receiptHeaderForm.busNo).then((response) => { submitTHApproval(receiptHeaderForm.busNo).then((response) => {
if (response.code == 200) {
proxy.$modal.msgSuccess('提交审批成功'); proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value); tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYTK(); store.clearCurrentDataLYTK();
// 跳转到审核页面 // 跳转到审核页面
router.replace({ path: 'requisitionInventoryManagement' }); router.replace({ path: 'requisitionInventoryManagement' });
} else {
proxy.$modal.msgError(response.msg || '提交审批失败');
}
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
}); });
} }
} }

View File

@@ -244,7 +244,6 @@ const loading = ref(false);
const getList = () => { const getList = () => {
loading.value = true; loading.value = true;
getRegisteInfoPage(queryParams.value).then((res) => { getRegisteInfoPage(queryParams.value).then((res) => {
console.log(res);
treatHospitalizedData.value = res.data.records; treatHospitalizedData.value = res.data.records;
total.value = res.data.total; total.value = res.data.total;
loading.value = false; loading.value = false;