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

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

View File

@@ -101,7 +101,7 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
// 导出到Excel
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
} catch (IOException | IllegalAccessException e) {
e.printStackTrace();
log.error("导出Excel失败", e);
return R.fail("导出Excel失败" + e.getMessage());
}
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.service.IDeviceDispenseService;
import com.openhis.workflow.service.IInventoryItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -59,6 +61,8 @@ import java.util.stream.Collectors;
@Service
public class CommonServiceImpl implements ICommonService {
private static final Logger log = LoggerFactory.getLogger(CommonServiceImpl.class);
@Resource
private AssignSeqUtil assignSeqUtil;
@@ -410,7 +414,7 @@ public class CommonServiceImpl implements ICommonService {
try {
BeanUtils.copyProperties(contract, metadata);
} catch (Exception e) {
e.printStackTrace();
log.warn("Bean复制失败", e);
}
return metadata;
}).collect(Collectors.toList()));

View File

@@ -121,4 +121,13 @@ public interface IDiagTreatMAppService {
* @return 校验结果
*/
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();
}
/**
* 批量设置划价标记
*
* @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) {
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.IDeviceRequestService;
import com.openhis.workflow.service.IServiceRequestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -40,6 +42,8 @@ import java.util.stream.Collectors;
@Component
public class AdviceUtils {
private static final Logger log = LoggerFactory.getLogger(AdviceUtils.class);
@Resource
AssignSeqUtil assignSeqUtil;
@@ -396,7 +400,7 @@ public class AdviceUtils {
iChargeItemService.updateById(mainChargeItem);
}
} 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));
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
log.error("Http请求异常, url: {}", url, e);
throw new ServiceException("Http请求异常请稍后再试。");
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
log.error("关闭响应失败", e);
}
}
return resultString;
@@ -596,13 +596,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
log.error("Http请求异常, url: {}", url, e);
throw new ServiceException("Http请求异常请稍后再试。");
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
log.error("关闭响应失败", e);
}
}
return resultString;