初始化
commit
814c40bd68
@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.8.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>springbootDemo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>springbootDemo</name>
|
||||
<description>springbootDemo</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<skipTests>true</skipTests>
|
||||
<mybatisPlus.version>3.4.1</mybatisPlus.version>
|
||||
<alibabadruid.version>1.2.1</alibabadruid.version>
|
||||
<knife4j.version>2.0.9</knife4j.version>
|
||||
<fastjson.version>2.0.11</fastjson.version>
|
||||
<commons-pool2.version>2.6.0</commons-pool2.version>
|
||||
<itext.version>2.1.7</itext.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis-plus-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisPlus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>${mybatisPlus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.28</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--druid监控-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${alibabadruid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
<!-- swaggerui相关依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<!-- Jackson Json处理工具包 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- spring2.X集成redis所需common-pool2-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>${commons-pool2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.lowagie</groupId>
|
||||
<artifactId>itext</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
|
||||
<artifactId>com.lowagie.text</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>wsjz-releases</id>
|
||||
<name>Releases Repository</name>
|
||||
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>wsjz-snapshots</id>
|
||||
<name>Snapshot Repository</name>
|
||||
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
package com.example;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.example.duplicate.infrastructure.dao")
|
||||
@Slf4j
|
||||
public class SpringbootDemoApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringbootDemoApplication.class, args);
|
||||
log.info("------------------启动完成----------------------");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.example.aother.annotation.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class Knife4jConfiguration {
|
||||
/**
|
||||
* 需要配置controller层包名
|
||||
*/
|
||||
String controllerPackagePath = "com.example";
|
||||
@Bean(value = "defaultApi2")
|
||||
public Docket defaultApi2() {
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
tokenPar.name("token")
|
||||
.description("用户token")
|
||||
.defaultValue("")
|
||||
.modelRef(new ModelRef("string"))
|
||||
.parameterType("header")
|
||||
.required(false)
|
||||
.build();
|
||||
pars.add(tokenPar.build());
|
||||
//添加head参数end
|
||||
|
||||
Docket docket=new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
//.title("swagger-bootstrap-ui-demo RESTful APIs")
|
||||
.description("# swagger-bootstrap-ui-demo RESTful APIs")
|
||||
.termsOfServiceUrl("www.codeleader.top")
|
||||
.version("1.0")
|
||||
.build())
|
||||
.globalOperationParameters(pars)
|
||||
//分组名称
|
||||
.groupName("2.X版本")
|
||||
.select()
|
||||
//这里指定Controller扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage(controllerPackagePath))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
return docket;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.example.aother.annotation.config;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class MybatisPlusConfig{
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
paginationInnerInterceptor.setDbType(DbType.MYSQL);
|
||||
paginationInnerInterceptor.setOverflow(true);
|
||||
interceptor.addInnerInterceptor(paginationInnerInterceptor);
|
||||
OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor = new OptimisticLockerInnerInterceptor();
|
||||
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.example.aother.annotation.exception;
|
||||
|
||||
public class Package {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.example.aother.common;
|
||||
|
||||
public class Package {
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.example.duplicate.controller;
|
||||
|
||||
|
||||
import com.example.duplicate.controller.param.PageRequest;
|
||||
import com.example.duplicate.controller.vo.PageBasic;
|
||||
import com.example.duplicate.controller.vo.RcvBasic;
|
||||
import com.example.duplicate.service.RcvBasicService;
|
||||
import com.example.utils.CommonResult;
|
||||
import com.example.utils.PageResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @ClassName RcvBasicController
|
||||
* @Description 示踪接口查询
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 12:21
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rcv/basic")
|
||||
@Api(value = "示踪接口", tags = "示踪接口")
|
||||
@Slf4j
|
||||
public class RcvBasicController {
|
||||
|
||||
@Autowired
|
||||
private RcvBasicService rcvBasicService;
|
||||
|
||||
@ApiOperation("签收接口")
|
||||
@PostMapping("/Sign")
|
||||
public CommonResult<?> Sign(String patientId) {
|
||||
return rcvBasicService.Sign(patientId);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@PostMapping("/pageAll")
|
||||
public CommonResult<PageResult<PageBasic>> pageAll(@RequestBody PageRequest pageRequest) {
|
||||
return rcvBasicService.pageAll(pageRequest);
|
||||
}
|
||||
|
||||
@ApiOperation("修改签收状态")
|
||||
@PostMapping("/UpdateSign")
|
||||
public CommonResult<?> UpdateSign(@RequestParam @ApiParam(required = false, name = "patientId", value = "患者patientId")String patientId,
|
||||
@RequestParam @ApiParam(required = false, name = "revoveryState", value = "签收状态")String revoveryState) {
|
||||
return rcvBasicService.UpdateSign(patientId,revoveryState);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.example.duplicate.controller.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName AddEmr
|
||||
* @Description 新增到2.0数码影像
|
||||
* @Author linjj
|
||||
* @Date 2025/6/22 14:51
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AddEmr {
|
||||
@ApiModelProperty(value = "住院次数")
|
||||
private Integer admissTimes;
|
||||
@ApiModelProperty(value = "住院号")
|
||||
private String inpatientNo;
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
@ApiModelProperty(value = "出院日期")
|
||||
private Date disDate;
|
||||
@ApiModelProperty(value = "主治医师")
|
||||
private String attending;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.example.duplicate.controller.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName SginBasic
|
||||
* @Description 签收实体类
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 19:24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class SginBasicDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "病案主键")
|
||||
private String patientId;
|
||||
|
||||
@ApiModelProperty(value = "住院次数")
|
||||
private Integer admissTimes;
|
||||
|
||||
@ApiModelProperty(value = "出院日期")
|
||||
private Date disDate;
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "住院医师")
|
||||
private String attendingName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "床位号")
|
||||
private String bedNumber;
|
||||
|
||||
@ApiModelProperty(value = "回收时间")
|
||||
private Date revoveryTime;
|
||||
|
||||
@ApiModelProperty(value = "回收状态")
|
||||
private String revoveryState;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.example.duplicate.controller.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName PageBasic
|
||||
* @Description 返回实体
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 21:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PageBasic {
|
||||
|
||||
@ApiModelProperty(value = "病案主键")
|
||||
private String patientId;
|
||||
|
||||
@ApiModelProperty(value = "住院次数")
|
||||
private Integer admissTimes;
|
||||
|
||||
@ApiModelProperty(value = "出院日期")
|
||||
private Date disDate;
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "住院医师")
|
||||
private String attendingName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "床位号")
|
||||
private String bedNumber;
|
||||
|
||||
@ApiModelProperty(value = "出院天数")
|
||||
private Integer outNum;
|
||||
@ApiModelProperty(value = "回收时间")
|
||||
private Date revoveryTime;
|
||||
|
||||
@ApiModelProperty(value = "回收状态")
|
||||
private String revoveryState;
|
||||
|
||||
// 格式化 disDate
|
||||
public String getFormattedDisDate() {
|
||||
if (disDate != null) {
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return formatter.format(disDate);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化 revoveryTime
|
||||
public String getFormattedRevoveryTime() {
|
||||
if (revoveryTime != null) {
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return formatter.format(revoveryTime);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.example.duplicate.controller.vo;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 患者信息表
|
||||
*
|
||||
* @author AutoGenerator
|
||||
* @since 2023-09-13
|
||||
*/
|
||||
@Data
|
||||
public class RcvBasic {
|
||||
|
||||
@ApiModelProperty(value = "病案主键")
|
||||
private String patientId;
|
||||
|
||||
@ApiModelProperty(value = "住院次数")
|
||||
private Integer admissTimes;
|
||||
|
||||
@ApiModelProperty(value = "出院日期")
|
||||
private Date disDate;
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "住院医师")
|
||||
private String attendingName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "床位号")
|
||||
private String bedNumber;
|
||||
|
||||
@ApiModelProperty(value = "出院天数")
|
||||
private String outNum;
|
||||
@ApiModelProperty(value = "回收时间")
|
||||
private Date revoveryTime;
|
||||
|
||||
@ApiModelProperty(value = "回收状态")
|
||||
private String revoveryState;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.example.duplicate.infrastructure;
|
||||
|
||||
public class Package {
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.example.duplicate.controller.param.PageRequest;
|
||||
import com.example.duplicate.controller.param.SginBasicDto;
|
||||
import com.example.duplicate.controller.vo.PageBasic;
|
||||
import com.example.duplicate.controller.vo.RcvBasic;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @InterfaceName BasicMapper
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 13:23
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface BasicMapper {
|
||||
|
||||
List<PageBasic> getPageAll(PageRequest pageRequest);
|
||||
|
||||
Boolean addBasic(SginBasicDto sginBasicDto);
|
||||
|
||||
List<String> getIDByPatientId(String patientId);
|
||||
|
||||
Boolean UpdateState(@Param("patientId") String patientId, @Param("revoveryState") String revoveryState);
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.example.duplicate.service;
|
||||
|
||||
import com.example.duplicate.controller.param.PageRequest;
|
||||
import com.example.duplicate.controller.vo.PageBasic;
|
||||
import com.example.duplicate.controller.vo.RcvBasic;
|
||||
import com.example.utils.CommonResult;
|
||||
import com.example.utils.PageResult;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
||||
/**
|
||||
* @InterfaceName RcvBasicService
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 12:24
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface RcvBasicService {
|
||||
|
||||
CommonResult<?> Sign(String patientId);
|
||||
|
||||
CommonResult<PageResult<PageBasic>> pageAll(PageRequest pageRequest);
|
||||
|
||||
CommonResult<?> UpdateSign(String patientId,String revoveryState);
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package com.example.duplicate.service.impl;
|
||||
|
||||
import com.example.duplicate.controller.param.PageRequest;
|
||||
import com.example.duplicate.controller.param.SginBasicDto;
|
||||
import com.example.duplicate.controller.vo.PageBasic;
|
||||
import com.example.duplicate.controller.vo.RcvBasic;
|
||||
|
||||
import com.example.duplicate.infrastructure.dao.BasicMapper;
|
||||
import com.example.duplicate.service.RcvBasicService;
|
||||
import com.example.utils.CommonResult;
|
||||
import com.example.utils.PageResult;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName RcvBasicServiceImpl
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 12:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RcvBasicServiceImpl implements RcvBasicService {
|
||||
@Autowired
|
||||
private BasicMapper basicMapper;
|
||||
@Override
|
||||
public CommonResult<?> Sign(String patientId) {
|
||||
try {
|
||||
if (StringUtils.isBlank(patientId)){
|
||||
return CommonResult.failed("病案号不能为空!");
|
||||
}
|
||||
//查询是否已经存在数据,存在数据不在新增,直接返回已经签收
|
||||
List<String> idByPatientId = basicMapper.getIDByPatientId(patientId);
|
||||
if (!CollectionUtils.isEmpty(idByPatientId)) {
|
||||
return CommonResult.failed("病案ID【" + patientId + "】已签收过,不能重复签收");
|
||||
}
|
||||
SginBasicDto sginBasicDto=new SginBasicDto();
|
||||
// SQL Server连接信息
|
||||
String url = "jdbc:sqlserver://10.1.1.21:1433;databaseName=trasen;encrypt=false;useUnicode=true;characterEncoding=utf-8";
|
||||
String username = "SZJK";
|
||||
String password = "SZJK";
|
||||
// String url = "jdbc:sqlserver://127.0.0.1:1433;databaseName=trasen;encrypt=false;useUnicode=true;characterEncoding=utf-8";
|
||||
// String username = "sa";
|
||||
// String password = "admin123";
|
||||
|
||||
// SQL语句根据patientId查询患者基础信息
|
||||
String selectQuery = "SELECT * FROM dbo.V_sz_cybrxx WHERE 病案号='" + patientId + "'";
|
||||
log.info("查询语句为:"+selectQuery);
|
||||
|
||||
// 1. 加载SQL Server JDBC驱动
|
||||
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||
|
||||
// 2. 建立数据库连接
|
||||
Connection connection = DriverManager.getConnection(url, username, password);
|
||||
|
||||
// 3. 创建Statement对象用于执行SQL语句
|
||||
Statement statement = connection.createStatement();
|
||||
// 4. 执行查询操作
|
||||
ResultSet resultSet = statement.executeQuery(selectQuery);
|
||||
// 5. 处理查询结果并映射到RcvBasicVO对象
|
||||
while (resultSet.next()) {
|
||||
sginBasicDto.setPatientId(resultSet.getString("病案号"));
|
||||
sginBasicDto.setAdmissTimes(resultSet.getInt("住院次数"));
|
||||
sginBasicDto.setDisDate(resultSet.getDate("出院日期"));
|
||||
sginBasicDto.setName(resultSet.getString("姓名"));
|
||||
String sex = resultSet.getString("性别");
|
||||
if (sex.equals("1")){
|
||||
sginBasicDto.setSex("男");
|
||||
}
|
||||
if (sex.equals("2")){
|
||||
sginBasicDto.setSex("女");
|
||||
}
|
||||
if (sex.equals("3")){
|
||||
sginBasicDto.setSex("不详");
|
||||
}
|
||||
sginBasicDto.setBedNumber(resultSet.getString("床位号"));
|
||||
sginBasicDto.setAttendingName(resultSet.getString("责任人"));
|
||||
sginBasicDto.setRevoveryState("已签收");
|
||||
sginBasicDto.setRevoveryTime(new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
// 6. 关闭资源
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
connection.close();
|
||||
//先插入数据到2.0中
|
||||
if (!getObjectCommonResult(sginBasicDto)){
|
||||
log.error("传送到病案数码系统失败");
|
||||
return CommonResult.failed("传送到病案数码系统失败,请联系管理员");
|
||||
}
|
||||
//插入数据
|
||||
if (!basicMapper.addBasic(sginBasicDto)){
|
||||
log.error("签收失败");
|
||||
return CommonResult.failed("签收失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("签收失败: " + e,e.getMessage());
|
||||
return CommonResult.failed("签收失败: " + e.getMessage());
|
||||
}
|
||||
return CommonResult.success("签收完成");
|
||||
}
|
||||
|
||||
private Boolean getObjectCommonResult(SginBasicDto sginBasicDto) {
|
||||
// SQL Server连接信息
|
||||
// String url = "jdbc:sqlserver://127.0.0.1:1433;databaseName=gm_record;encrypt=false;useUnicode=true;characterEncoding=utf-8";
|
||||
// String username = "sa";
|
||||
// String password = "admin123";
|
||||
String url = "jdbc:sqlserver://10.1.1.147:1433;databaseName=csssemrrcord;encrypt=false;useUnicode=true;characterEncoding=utf-8";
|
||||
String username = "sa";
|
||||
String password = "xjgs+docus911";
|
||||
// 插入语句
|
||||
String insertQuery = "INSERT INTO commomtable (patient_id,admiss_times, inpatient_no, name, sex, dis_date, attending) VALUES (replace(newid(), '-', ''),?, ?, ?, ?, ?, ?);";
|
||||
log.info("执行的SQL语句为: " + insertQuery);
|
||||
try {
|
||||
// 1. 加载SQL Server JDBC驱动
|
||||
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||
|
||||
// 2. 建立数据库连接
|
||||
Connection connection = DriverManager.getConnection(url, username, password);
|
||||
|
||||
// 3. 创建PreparedStatement对象用于执行SQL语句
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(insertQuery);
|
||||
|
||||
// 4. 设置参数
|
||||
preparedStatement.setInt(1, sginBasicDto.getAdmissTimes());
|
||||
preparedStatement.setString(2, sginBasicDto.getPatientId());
|
||||
preparedStatement.setString(3, sginBasicDto.getName());
|
||||
preparedStatement.setString(4, sginBasicDto.getSex());
|
||||
preparedStatement.setDate(5, new java.sql.Date(sginBasicDto.getDisDate().getTime()));
|
||||
preparedStatement.setString(6, sginBasicDto.getAttendingName());
|
||||
|
||||
// 5. 执行插入操作
|
||||
preparedStatement.executeUpdate();
|
||||
|
||||
// 6. 关闭资源
|
||||
preparedStatement.close();
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
log.error("传送到病案数码系统失败: " + e,e.getMessage());
|
||||
return false;
|
||||
}
|
||||
log.info("插入2.0中成功");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<PageBasic>>pageAll(PageRequest pageRequest) {
|
||||
PageResult<PageBasic> pageResult = null;
|
||||
try {
|
||||
// 设置分页参数
|
||||
PageHelper.startPage(pageRequest.getPage(), pageRequest.getSize());
|
||||
List<PageBasic> pageAll = basicMapper.getPageAll(pageRequest);
|
||||
pageResult = new PageResult<>(pageAll);
|
||||
} catch (Exception e) {
|
||||
log.error("系统异常: " + e.getMessage());
|
||||
return CommonResult.failed("系统异常");
|
||||
}
|
||||
return CommonResult.success(pageResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<?> UpdateSign(String patientId,String revoveryState) {
|
||||
if (revoveryState.equals("已签收")){
|
||||
basicMapper.UpdateState(patientId,"未签收");
|
||||
return CommonResult.success("取消签收成功");
|
||||
}
|
||||
if (revoveryState.equals("未签收")){
|
||||
basicMapper.UpdateState(patientId,"已签收");
|
||||
return CommonResult.success("签收成功");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package com.example.utils;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author docus
|
||||
* @date 2020/3/28 16:23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("响应")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CommonResult<T> {
|
||||
@ApiModelProperty("响应码")
|
||||
private Integer code;
|
||||
@ApiModelProperty("响应消息")
|
||||
private String msg;
|
||||
@ApiModelProperty("响应实体")
|
||||
private T data;
|
||||
|
||||
public CommonResult(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T data) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param message 提示信息
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> success(T data, String message) {
|
||||
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
* @param errorCode 错误码
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(IErrorCode errorCode) {
|
||||
return new CommonResult<T>(errorCode.getCode(), errorCode.getMessage(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
* @param errorCode 错误码
|
||||
* @param message 提示信息
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(IErrorCode errorCode, String message) {
|
||||
return new CommonResult<T>(errorCode.getCode(), message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
* @param message 提示信息
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> failed(String message) {
|
||||
return new CommonResult<T>(ResultCode.FAILED.getCode(), message, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> failed() {
|
||||
return failed(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败返回结果
|
||||
*
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed() {
|
||||
return failed(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*
|
||||
* @param message 提示信息
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> validateFailed(String message) {
|
||||
return new CommonResult<T>(ResultCode.VALIDATE_FAILED.getCode(), message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> unauthorized(T data) {
|
||||
return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重防及重复请求
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> preventreplay(T data) {
|
||||
return new CommonResult<T>(ResultCode.PREVENT_REPLAY.getCode(), ResultCode.PREVENT_REPLAY.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未授权返回结果
|
||||
*
|
||||
* @param data 获取的数据
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonResult<T> forbidden(T data) {
|
||||
return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.example.utils;
|
||||
|
||||
/**
|
||||
* @Description 封装API的错误码
|
||||
* @Author JacksonTu
|
||||
* @Date 2020/3/28 16:26
|
||||
*/
|
||||
public interface IErrorCode {
|
||||
Integer getCode();
|
||||
|
||||
String getMessage();
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.example.utils;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class Md5Util {
|
||||
public static String encrypt(String dataStr) {
|
||||
try {
|
||||
MessageDigest m = MessageDigest.getInstance("MD5");
|
||||
m.update(dataStr.getBytes("UTF8"));
|
||||
byte[] s = m.digest();
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
result.append(Integer.toHexString((0x000000FF & s[i]) | 0xFFFFFF00).substring(6));
|
||||
}
|
||||
return result.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.example.utils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageSerializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PageResult
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2025/6/20 12:37
|
||||
* @Version 1.0
|
||||
*/
|
||||
@ApiModel(
|
||||
value = "PageResult对象",
|
||||
description = "分页管理"
|
||||
)
|
||||
public class PageResult<T> extends PageSerializable<T> {
|
||||
|
||||
@ApiModelProperty("页码")
|
||||
private int pageNum;
|
||||
@ApiModelProperty("每页的条数")
|
||||
private int pageSize;
|
||||
@ApiModelProperty("总页数")
|
||||
private int pageCount;
|
||||
|
||||
public PageResult() {
|
||||
}
|
||||
|
||||
public PageResult(List<T> list) {
|
||||
super(list);
|
||||
if (list instanceof Page) {
|
||||
Page page = (Page)list;
|
||||
this.pageNum = page.getPageNum();
|
||||
this.pageSize = page.getPageSize();
|
||||
this.pageCount = page.getPages();
|
||||
} else {
|
||||
this.pageNum = 1;
|
||||
this.pageSize = list.size();
|
||||
this.pageCount = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PageResult(List<T> list, long total, int pageNum, int pageSize) {
|
||||
this.setTotal(total);
|
||||
this.pageNum = pageNum;
|
||||
this.pageSize = pageSize;
|
||||
this.pageCount = (int)((total + (long)pageSize - 1L) / (long)pageSize);
|
||||
this.setList(list);
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return this.pageNum;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return this.pageSize;
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
return this.pageCount;
|
||||
}
|
||||
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.example.utils;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 枚举一些常用API操作码
|
||||
* @Author JacksonTu
|
||||
* @Date 2020/3/28 16:26
|
||||
*/
|
||||
public enum ResultCode implements IErrorCode {
|
||||
|
||||
SUCCESS(0, "操作成功"),
|
||||
FAILED(500, "操作失败"),
|
||||
VALIDATE_FAILED(404, "参数检验失败"),
|
||||
UNAUTHORIZED(401, "暂未登录或token已经过期"),
|
||||
FORBIDDEN(403, "没有相关权限"),
|
||||
PREVENT_REPLAY(405,"重复请求"),
|
||||
NOT_EXIST(601,"数据不存在"),
|
||||
NOT_ENABLE(600,"数据未启用");
|
||||
|
||||
|
||||
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
private ResultCode(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.example.duplicate.infrastructure.dao.BasicMapper">
|
||||
<insert id="addBasic">
|
||||
INSERT INTO basic (patientId,admissTimes,disDate,name,sex, bedNumber,attendingName,revoveryState,revoveryTime)
|
||||
values (#{patientId},#{admissTimes},#{disDate},#{name},#{sex},#{bedNumber},#{attendingName},#{revoveryState}, #{revoveryTime})
|
||||
</insert>
|
||||
<update id="UpdateState">
|
||||
update basic set revoveryState=#{revoveryState}, revoveryTime=NOW() where patientId=#{patientId}
|
||||
</update>
|
||||
<select id="getPageAll" resultType="com.example.duplicate.controller.vo.PageBasic">
|
||||
select *,DATEDIFF(NOW(), disDate) as outNum from basic
|
||||
<where>
|
||||
1=1
|
||||
<if test="patientId != null and patientId!=''">
|
||||
AND patientId=#{patientId}
|
||||
</if>
|
||||
<if test="name != null and name!=''">
|
||||
AND name=#{name}
|
||||
</if>
|
||||
</where>
|
||||
order by disDate DESC
|
||||
</select>
|
||||
<select id="getIDByPatientId" resultType="java.lang.String">
|
||||
select patientId from basic where patientId=#{patientId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,16 @@
|
||||
package com.example;
|
||||
|
||||
import com.example.utils.Md5Util;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = com.example.SpringbootDemoApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class DemoApplicationTests {
|
||||
|
||||
}
|
Loading…
Reference in New Issue