新增预住院合并补偿

docus_webservice_1.1
tan 2 years ago
parent 59679940e6
commit 1edc6424ea

@ -52,10 +52,22 @@
<artifactId>lombok</artifactId>
<version>1.16.14</version>
</dependency>
<!-- springfox-swagger2 -->
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.0.RELEASE</version>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>

@ -0,0 +1,42 @@
package com.docus.webservice.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/*
* 1.
* 2.
* */
//Docket封装接口文档信息
@Bean
public Docket getDocket(){
//创建封面信息对象
ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
apiInfoBuilder.title("出入院患者信息后端接口说明")
.description("")
.version("v 1.0.0");
ApiInfo apiInfo = apiInfoBuilder.build();
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo)
.select()
.apis(RequestHandlerSelectors.basePackage("com.docus.webservice.controller"))
.build();
return docket;
}
}

@ -0,0 +1,21 @@
package com.docus.webservice.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
}
}

@ -1,28 +1,42 @@
package com.docus.webservice.controller;
import com.docus.webservice.service.IPcmachineService;
import com.docus.webservice.service.ITBasicService;
import com.docus.webservice.utils.HttpUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@Api(value = "检测心跳接口",tags = "检测心跳接口")
//@Api(value = "检测心跳接口",tags = "检测心跳接口")
@Api(value = "预住院合并接口",tags = "预住院病历合并至正式住院")
public class BeatController {
@Autowired
IPcmachineService pcmachineService;
@Autowired
ITBasicService itBasicService;
@ApiOperation("心跳")
@GetMapping("/beat")
public void beat(@RequestParam("code") String code, HttpServletRequest request){
String ip = HttpUtils.getIpAddr(request);
pcmachineService.beat(code,ip);
}
@ApiOperation("预住院合并")
@ApiImplicitParams({
@ApiImplicitParam(dataType = "string",name = "startDate",value = "出院日期开始时间"),
@ApiImplicitParam(dataType = "string",name = "endDate",value = "出院日期结束时间")
})
@GetMapping ("/merge")
public void merge(String startDate,String endDate){
itBasicService.mergePreRecords(startDate, endDate);
}
}

@ -206,10 +206,10 @@ public class TBasicWebService implements ITBasicWebService {
if (i <= 0) {
log.info("当前预住院没有文件!");
}else {
log.info("本次预住院合并"+i+"份报告");
log.info( tBasic1.getJzh()+"本次预住院合并"+i+"份报告");
}
} else {
log.error("");
log.error("正式住院: "+tBasic1.getJzh() + " 预住院或正式住院患者不存在!");
}
}
dateMap.put("preJzh",preJzh);
@ -579,6 +579,13 @@ public class TBasicWebService implements ITBasicWebService {
}
}
}
TBasic tBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasicMap.get("jzh")));
tBasicMap.put("patient_id",tBasic.getPatientId());
try {
itBasicService.merge(tBasicMap);
}catch (Exception e) {
log.error(e.getMessage());
}
}
}

@ -3,6 +3,11 @@ package com.docus.webservice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.docus.webservice.entity.TBasic;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -14,4 +19,5 @@ import com.docus.webservice.entity.TBasic;
*/
public interface TBasicMapper extends BaseMapper<TBasic> {
List<Map> selectByDisDateList(@Param("startDate") String startDate, @Param("endDate") String endDate, @RequestParam("size") int size, @RequestParam("current") int current);
}

@ -6,6 +6,7 @@ import com.docus.webservice.entity.TBasic;
import com.docus.webservice.entity.TBasicExtend;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
@ -23,4 +24,9 @@ public interface ITBasicService extends IService<TBasic> {
void updateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap,String preJzh);
void OutUpdateAndSub(TBasic tBasic, HashMap<String, Object> tBasicSubMap,TBasicExtend tBasicExtend);
//合并预住院病历
void mergePreRecords(String startDate,String endDate);
void merge(Map patientId);
}

@ -13,6 +13,7 @@ import com.docus.webservice.handler.TBasicWebService;
import com.docus.webservice.mapper.TBasicExtendMapper;
import com.docus.webservice.mapper.TBasicMapper;
import com.docus.webservice.mapper.TBasicSubMapper;
import com.docus.webservice.mapper.TScanAssortMapper;
import com.docus.webservice.utils.ResultUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
@ -26,6 +27,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -47,8 +50,10 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
@Autowired
private TBasicExtendMapper tBasicExtendMapper;
@Autowired
private TScanAssortMapper tScanAssortMapper;
private Logger log = LogManager.getLogger(ServiceImpl.class);
private Logger log = LogManager.getLogger(TBasicServiceImpl.class);
/**
*
@ -114,10 +119,10 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
LambdaUpdateWrapper<TBasic> eq = Wrappers.<TBasic>lambdaUpdate()
.set(TBasic::getDisDate, null == tBasic.getDisDate() ? null : tBasic.getDisDate())
.set(TBasic::getWardPalce, tBasic.getWardPalce()).set(TBasic::getAdmissDays, tBasic.getAdmissDays())
.set(TBasic::getAdmissDept,tBasic.getAdmissDept()).set(TBasic ::getAdmissDeptName,tBasic.getAdmissDeptName())
.set(TBasic::getIsDead,tBasic.getIsDead()).set(TBasic::getName,tBasic.getName())
.set(TBasic::getInpatientNo,tBasic.getInpatientNo()).set(TBasic::getDisDept,tBasic.getDisDept())
.set(TBasic::getDisDeptName,tBasic.getDisDeptName()).eq(TBasic::getJzh, tBasic.getJzh());
.set(TBasic::getAdmissDept, tBasic.getAdmissDept()).set(TBasic::getAdmissDeptName, tBasic.getAdmissDeptName())
.set(TBasic::getIsDead, tBasic.getIsDead()).set(TBasic::getName, tBasic.getName())
.set(TBasic::getInpatientNo, tBasic.getInpatientNo()).set(TBasic::getDisDept, tBasic.getDisDept())
.set(TBasic::getDisDeptName, tBasic.getDisDeptName()).eq(TBasic::getJzh, tBasic.getJzh());
int update1 = tBasicMapper.update(tBasic, eq);
if (tBasicExtend.getClaimPolicyCode() != null || tBasicExtend.getMioSettleTypeCode() != null) {
tBasicExtend.setPatientId(selectTBasic.getPatientId());
@ -157,6 +162,59 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
}
}
@Override
public void mergePreRecords(String startDate, String endDate) {
log.info("预住院病历合并补偿开始---时间为----" + startDate + "----" + endDate);
//页码
int startrow;
//每页10条数据
int endrow = 10;
List<Map> patientIds;
endDate = endDate + " 23:59:59";
for (startrow = 0; ; startrow += 10) {
patientIds = tBasicMapper.selectByDisDateList(startDate, endDate, startrow, endrow);
if (null == patientIds || patientIds.size() <= 0) {
log.info("本次预住院病历合并结束!");
break;
}
for (Map patientId : patientIds) {
try {
merge(patientId);
} catch (Exception e) {
log.error(e.getMessage());
continue;
}
}
}
}
@Override
public void merge(Map patientId) throws RuntimeException {
TBasicExtend tBasicExtend;
TBasic tBasic;
log.info(patientId.get("inpatient_no") + ":合并预住院病历开始");
try {
tBasicExtend = tBasicExtendMapper.selectOne(new QueryWrapper<TBasicExtend>().eq("patient_id", patientId.get("patient_id")));
if (null != tBasicExtend.getPreJzh()) {
tBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasicExtend.getPreJzh()));
//将预住院患者病历文件patient_id改为正式住院的patient_id合并病历
int i = tScanAssortMapper.updateByPatientId(String.valueOf(patientId.get("patient_id")), tBasic.getPatientId());
if (i <= 0) {
log.info("当前预住院没有文件!");
} else {
log.info(patientId.get("inpatient_no") + ":本次预住院合并" + i + "份报告");
}
}else {
log.info(patientId.get("inpatient_no")+":未查询到预住院信息!");
}
} catch (Exception e) {
throw new RuntimeException("预住院文件合并出错!--" + e.getMessage());
}
}
/**
*
*
@ -179,7 +237,7 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
// throw new RuntimeException("数据库执行出错,请重试");
// }
} else {
updateAndSub(tBasic, tBasicSubMap,preJzh);
updateAndSub(tBasic, tBasicSubMap, preJzh);
}
if (null != preJzh && !preJzh.equals("")) {
TBasic tbasic1 = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("jzh", tBasic.getJzh()));
@ -230,8 +288,8 @@ public class TBasicServiceImpl extends ServiceImpl<TBasicMapper, TBasic> impleme
}
}
} else {
log.info("住院修改:患者"+tBasic.getJzh()+"不存在!\n新增患者"+tBasic.getJzh());
savaAndSub(tBasic,tBasicSubMap,preJzh);
log.info("住院修改:患者" + tBasic.getJzh() + "不存在!\n新增患者" + tBasic.getJzh());
savaAndSub(tBasic, tBasicSubMap, preJzh);
}
}
}

@ -54,4 +54,11 @@
</set>
where id=#{pcmachine.id}
</update>
<select id="selectByDisDateList" resultType="java.util.Map">
select inpatient_no,admiss_date,dis_date,admiss_times,jzh,patient_id
from docus_medicalrecord.t_basic
where dis_date between #{startDate} and #{endDate}
order by dis_date
limit #{size},#{current}
</select>
</mapper>
Loading…
Cancel
Save