增加日志相关

This commit is contained in:
Euni4U 2025-04-02 17:43:16 +08:00
parent b654c0317f
commit fb5d37caf5
19 changed files with 482 additions and 6 deletions

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo.*;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectapplylog.InspectApplylogDO;
import cn.iocoder.yudao.module.inspect.service.inspectapplylog.InspectApplylogService;
@Tag(name = "管理后台 - 创建检验单日志记录")
@RestController
@RequestMapping("/inspect/applylog")
@Validated
public class InspectApplylogController {
@Resource
private InspectApplylogService applylogService;
@PostMapping("/create")
@Operation(summary = "创建创建检验单日志记录")
@PreAuthorize("@ss.hasPermission('inspect:applylog:create')")
public CommonResult<Integer> createApplylog(@Valid @RequestBody InspectApplylogSaveReqVO createReqVO) {
return success(applylogService.createApplylog(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新创建检验单日志记录")
@PreAuthorize("@ss.hasPermission('inspect:applylog:update')")
public CommonResult<Boolean> updateApplylog(@Valid @RequestBody InspectApplylogSaveReqVO updateReqVO) {
applylogService.updateApplylog(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除创建检验单日志记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('inspect:applylog:delete')")
public CommonResult<Boolean> deleteApplylog(@RequestParam("id") Integer id) {
applylogService.deleteApplylog(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得创建检验单日志记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('inspect:applylog:query')")
public CommonResult<InspectApplylogRespVO> getApplylog(@RequestParam("id") Integer id) {
InspectApplylogDO applylog = applylogService.getApplylog(id);
return success(BeanUtils.toBean(applylog, InspectApplylogRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得创建检验单日志记录分页")
@PreAuthorize("@ss.hasPermission('inspect:applylog:query')")
public CommonResult<PageResult<InspectApplylogRespVO>> getApplylogPage(@Valid InspectApplylogPageReqVO pageReqVO) {
PageResult<InspectApplylogDO> pageResult = applylogService.getApplylogPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, InspectApplylogRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出创建检验单日志记录 Excel")
@PreAuthorize("@ss.hasPermission('inspect:applylog:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportApplylogExcel(@Valid InspectApplylogPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<InspectApplylogDO> list = applylogService.getApplylogPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "创建检验单日志记录.xls", "数据", InspectApplylogRespVO.class,
BeanUtils.toBean(list, InspectApplylogRespVO.class));
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 创建检验单日志记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InspectApplylogPageReqVO extends PageParam {
@Schema(description = "记录时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] time;
@Schema(description = "体检编号")
private String medicalsn;
@Schema(description = "身份证")
private String idcard;
@Schema(description = "检验单参数json")
private String json;
@Schema(description = "返回值")
private String backnumber;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 创建检验单日志记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class InspectApplylogRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26532")
@ExcelProperty("主键")
private Integer id;
@Schema(description = "记录时间")
@ExcelProperty("记录时间")
private LocalDateTime time;
@Schema(description = "体检编号")
@ExcelProperty("体检编号")
private String medicalsn;
@Schema(description = "身份证")
@ExcelProperty("身份证")
private String idcard;
@Schema(description = "检验单参数json")
@ExcelProperty("检验单参数json")
private String json;
@Schema(description = "返回值")
@ExcelProperty("返回值")
private String backnumber;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 创建检验单日志记录新增/修改 Request VO")
@Data
public class InspectApplylogSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26532")
private Integer id;
@Schema(description = "记录时间")
private LocalDateTime time;
@Schema(description = "体检编号")
private String medicalsn;
@Schema(description = "身份证")
private String idcard;
@Schema(description = "检验单参数json")
private String json;
@Schema(description = "返回值")
private String backnumber;
}

View File

@ -403,6 +403,21 @@ public class InspectPatientController {
//获取患者信息
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
if (patientDO != null) {
String checkBarCode1, checkBarCode2, checkBarCode3;
// 检查是否已打印
if (patientDO.getIsprint() != null && patientDO.getIsprint().equals(1)) {
// 如果已打印使用数据库中已存在的条码
checkBarCode1 = patientDO.getXcgcode();
checkBarCode2 = patientDO.getNcgcode();
checkBarCode3 = patientDO.getShqx();
} else {
// 如果未打印生成新的条码
checkBarCode1 = DateUtils.generateUniqueCode();
checkBarCode2 = DateUtils.generateUniqueCode();
checkBarCode3 = DateUtils.generateUniqueCode();
}
// 创建 ObjectMapper 实例
ObjectMapper objectMapper = new ObjectMapper();
@ -418,19 +433,18 @@ public class InspectPatientController {
patient.put("barCodeStatus", 3);
List<Map<String, String>> billingItemList = new ArrayList<>();
String checkBarCode1 = DateUtils.generateUniqueCode();
Map<String, String> item1 = new HashMap<>();
item1.put("groupCode", "XCG");
item1.put("checkBarCode", checkBarCode1);
billingItemList.add(item1);
String checkBarCode2 = DateUtils.generateUniqueCode();
Map<String, String> item2 = new HashMap<>();
item2.put("groupCode", "NCG");
item2.put("checkBarCode", checkBarCode2);
billingItemList.add(item2);
String checkBarCode3 = DateUtils.generateUniqueCode();
Map<String, String> item3 = new HashMap<>();
item3.put("groupCode", "SHQX");
item3.put("checkBarCode", checkBarCode3);
@ -448,7 +462,7 @@ public class InspectPatientController {
ConfigDO headconfig = configService.getConfigByKey("url.head");
String headurl = headconfig.getValue();
String response = HttpUtils.postJson(url, jsonRequestBody);
//String response = HttpUtils.postJson(url, jsonRequestBody);
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
updateReqVO.setMedicalSn(patientDO.getMedicalSn());
updateReqVO.setHospitalNo("121526004609160793");//乌兰察布第四医院 暂时写死
@ -939,8 +953,9 @@ public class InspectPatientController {
}
list.add(inspectPatientitemsSaveReqVO);
patientitemsService.updatePatientitemInfo(list);
if(dataMap.get("personimg") != null|| dataMap.get("personimg") != "")
if(dataMap.get("personimg")!=null)
{
String headurl = dataMap.get("personimg").toString();
String base64 = HttpUtils.getImageAsBase64(headurl);
if(base64!=null|| base64!="")
@ -1168,4 +1183,11 @@ public class InspectPatientController {
}
return out;
}
@PutMapping("/updatePrintStatus")
@Operation(summary = "更新打印状态")
public CommonResult<Boolean> updatePrintStatus(@RequestParam("medicalSn") String medicalSn) {
patientService.isprintupdate(medicalSn);
return success(true);
}
}

View File

@ -59,4 +59,7 @@ public class InspectPatientInfoVO {
@Schema(description = "中医详情")
private String features;
@Schema(description = "是否打印导检单")
private Integer isprint;
}

View File

@ -117,4 +117,7 @@ public class InspectPatientPageReqVO extends PageParam {
@Schema(description = "中医详情")
private String features;
@Schema(description = "是否打印导检单")
private Integer isprint;
}

View File

@ -56,6 +56,9 @@ public class InspectPatientReportVO {
@Schema(description = "中医详情")
private String features;
@Schema(description = "是否打印导检单")
private Integer isprint;
@Schema(description = "检查数据列表")
private List<InspectPatientReportDataVO> data;

View File

@ -135,4 +135,7 @@ public class InspectPatientRespVO {
@Schema(description = "中医详情")
private String features;
@Schema(description = "是否打印导检单")
private Integer isprint;
}

View File

@ -110,4 +110,7 @@ public class InspectPatientSaveReqVO {
@Schema(description = "中医详情")
private String features;
@Schema(description = "是否打印导检单")
private Integer isprint;
}

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.inspect.dal.dataobject.inspectapplylog;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 创建检验单日志记录 DO
*
* @author 赖浩
*/
@TableName("tb_applylog")
@KeySequence("tb_applylog_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InspectApplylogDO extends BaseDO {
/**
* 主键
*/
@TableId
private Integer id;
/**
* 记录时间
*/
private LocalDateTime time;
/**
* 体检编号
*/
private String medicalsn;
/**
* 身份证
*/
private String idcard;
/**
* 检验单参数json
*/
private String json;
/**
* 返回值
*/
private String backnumber;
}

View File

@ -113,6 +113,11 @@ public class InspectPatientDO {
*/
@TableField("headPicUrl")
private String headPicUrl;
/**
* 是否打印
*/
@TableField("isprint")
private Integer isprint;
/**
* 汇总分析结果
*/
@ -185,6 +190,7 @@ public class InspectPatientDO {
/**
* 中医详情
*/
@Schema(description = "features")
@TableField("features")
private String features;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.inspect.dal.mysql.inspectapplylog;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectapplylog.InspectApplylogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo.*;
/**
* 创建检验单日志记录 Mapper
*
* @author 赖浩
*/
@Mapper
public interface InspectApplylogMapper extends BaseMapperX<InspectApplylogDO> {
default PageResult<InspectApplylogDO> selectPage(InspectApplylogPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InspectApplylogDO>()
.betweenIfPresent(InspectApplylogDO::getTime, reqVO.getTime())
.eqIfPresent(InspectApplylogDO::getMedicalsn, reqVO.getMedicalsn())
.eqIfPresent(InspectApplylogDO::getIdcard, reqVO.getIdcard())
.eqIfPresent(InspectApplylogDO::getJson, reqVO.getJson())
.eqIfPresent(InspectApplylogDO::getBacknumber, reqVO.getBacknumber())
.orderByDesc(InspectApplylogDO::getId));
}
}

View File

@ -41,6 +41,7 @@ public interface InspectPatientMapper extends BaseMapperX<InspectPatientDO> {
.eqIfPresent(InspectPatientDO::getAuditor, reqVO.getAuditor())
.eqIfPresent(InspectPatientDO::getAuditStatus, reqVO.getAuditStatus())
.eqIfPresent(InspectPatientDO::getInspectionOpinion, reqVO.getInspectionOpinion())
.eqIfPresent(InspectPatientDO::getIsprint, reqVO.getIsprint())
.betweenIfPresent(InspectPatientDO::getAuditorTime, reqVO.getAuditorTime())
.orderByDesc(InspectPatientDO::getId);
if (reqVO.getInspectionStatus() != null) {

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.inspect.service.inspectapplylog;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo.*;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectapplylog.InspectApplylogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 创建检验单日志记录 Service 接口
*
* @author 赖浩
*/
public interface InspectApplylogService {
/**
* 创建创建检验单日志记录
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createApplylog(@Valid InspectApplylogSaveReqVO createReqVO);
/**
* 更新创建检验单日志记录
*
* @param updateReqVO 更新信息
*/
void updateApplylog(@Valid InspectApplylogSaveReqVO updateReqVO);
/**
* 删除创建检验单日志记录
*
* @param id 编号
*/
void deleteApplylog(Integer id);
/**
* 获得创建检验单日志记录
*
* @param id 编号
* @return 创建检验单日志记录
*/
InspectApplylogDO getApplylog(Integer id);
/**
* 获得创建检验单日志记录分页
*
* @param pageReqVO 分页查询
* @return 创建检验单日志记录分页
*/
PageResult<InspectApplylogDO> getApplylogPage(InspectApplylogPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.inspect.service.inspectapplylog;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectapplylog.vo.*;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectapplylog.InspectApplylogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.inspect.dal.mysql.inspectapplylog.InspectApplylogMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.inspect.enums.ErrorCodeConstants.*;
/**
* 创建检验单日志记录 Service 实现类
*
* @author 赖浩
*/
@Service
@Validated
public class InspectApplylogServiceImpl implements InspectApplylogService {
@Resource
private InspectApplylogMapper applylogMapper;
@Override
public Integer createApplylog(InspectApplylogSaveReqVO createReqVO) {
// 插入
InspectApplylogDO applylog = BeanUtils.toBean(createReqVO, InspectApplylogDO.class);
applylogMapper.insert(applylog);
// 返回
return applylog.getId();
}
@Override
public void updateApplylog(InspectApplylogSaveReqVO updateReqVO) {
// 校验存在
validateApplylogExists(updateReqVO.getId());
// 更新
InspectApplylogDO updateObj = BeanUtils.toBean(updateReqVO, InspectApplylogDO.class);
applylogMapper.updateById(updateObj);
}
@Override
public void deleteApplylog(Integer id) {
// 校验存在
validateApplylogExists(id);
// 删除
applylogMapper.deleteById(id);
}
private void validateApplylogExists(Integer id) {
if (applylogMapper.selectById(id) == null) {
throw exception(APPLYLOG_NOT_EXISTS);
}
}
@Override
public InspectApplylogDO getApplylog(Integer id) {
return applylogMapper.selectById(id);
}
@Override
public PageResult<InspectApplylogDO> getApplylogPage(InspectApplylogPageReqVO pageReqVO) {
return applylogMapper.selectPage(pageReqVO);
}
}

View File

@ -45,6 +45,10 @@ public interface InspectPatientService {
* 更新中医体质详情
* */
void medicalSnfeaturesupdate(InspectPatientSaveReqVO updateReqVO);
/*
* 更新打印状态
* */
void isprintupdate(String medicalSn);
/**
* 删除患者信息

View File

@ -108,6 +108,13 @@ public class InspectPatientServiceImpl implements InspectPatientService {
patientMapper.update(null, updateWrapper);
}
@Override
public void isprintupdate(String medicalSn) {
LambdaUpdateWrapper<InspectPatientDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(InspectPatientDO::getMedicalSn, medicalSn)
.set(InspectPatientDO::getIsprint, 1); // 1 表示已打印
patientMapper.update(null, updateWrapper);
}
@Override
public void deletePatient(Integer id) {
// 校验存在
validatePatientExists(id);

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.inspect.dal.mysql.inspectapplylog.InspectApplylogMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>