Commit 90d78660 authored by zhangch's avatar zhangch

撤床相关接口、建床相关接口优化

parent 5b7dc191
...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
...@@ -47,6 +49,8 @@ public class ChSrvRemoveBed { ...@@ -47,6 +49,8 @@ public class ChSrvRemoveBed {
/** /**
* 出生年月日 * 出生年月日
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date birthday; private Date birthday;
/** /**
* 手机号 * 手机号
...@@ -63,6 +67,8 @@ public class ChSrvRemoveBed { ...@@ -63,6 +67,8 @@ public class ChSrvRemoveBed {
/** /**
* 建床日期 * 建床日期
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date buildBedTime; private Date buildBedTime;
/** /**
* 专区 * 专区
...@@ -79,6 +85,8 @@ public class ChSrvRemoveBed { ...@@ -79,6 +85,8 @@ public class ChSrvRemoveBed {
/** /**
* 撤床日期 * 撤床日期
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date removeBedTime; private Date removeBedTime;
/** /**
* 在床天数 * 在床天数
...@@ -111,6 +119,8 @@ public class ChSrvRemoveBed { ...@@ -111,6 +119,8 @@ public class ChSrvRemoveBed {
/** /**
* 首次操作时间 * 首次操作时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date fcd; private Date fcd;
/** /**
* 首次操作人 * 首次操作人
...@@ -119,6 +129,8 @@ public class ChSrvRemoveBed { ...@@ -119,6 +129,8 @@ public class ChSrvRemoveBed {
/** /**
* 末次操作时间 * 末次操作时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date lcd; private Date lcd;
/** /**
* 末次操作人 * 末次操作人
......
package com.hungraim.ltc.pojo.vo.governance;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed;
import lombok.Data;
import java.util.List;
@Data
public class RemoveBedDetailVo extends ChSrvRemoveBed {
/**
* 撤床附件
*/
private List<ChFndAttach> fileDataList;
}
...@@ -3,10 +3,7 @@ package com.hungraim.ltc.governance.controller; ...@@ -3,10 +3,7 @@ package com.hungraim.ltc.governance.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.CrvService; import com.hungraim.ltc.governance.service.*;
import com.hungraim.ltc.governance.service.DisableInfoServie;
import com.hungraim.ltc.governance.service.IBuildBedService;
import com.hungraim.ltc.governance.service.SrvSendService;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo; import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan; import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
...@@ -42,6 +39,8 @@ public class BuildBedController { ...@@ -42,6 +39,8 @@ public class BuildBedController {
private CrvService crvService; private CrvService crvService;
@Autowired @Autowired
private DisableInfoServie disableInfoServie; private DisableInfoServie disableInfoServie;
@Autowired
private IRemoveBedService removeBedService;
/** /**
* 建床管理列表 * 建床管理列表
...@@ -54,7 +53,7 @@ public class BuildBedController { ...@@ -54,7 +53,7 @@ public class BuildBedController {
/** /**
* 建床管理新增 * 建床管理新增
*/ */
@PostMapping("/addBuild") @PostMapping("/addOrUpdateBuildBed")
public Result<Boolean> buildBed(BuildBedDetailVo buildBedDetailVo) { public Result<Boolean> buildBed(BuildBedDetailVo buildBedDetailVo) {
if (StringUtils.isBlank(buildBedDetailVo.getRealName())) { if (StringUtils.isBlank(buildBedDetailVo.getRealName())) {
//姓名 //姓名
...@@ -89,6 +88,39 @@ public class BuildBedController { ...@@ -89,6 +88,39 @@ public class BuildBedController {
} }
/** /**
* 撤床新增或修改
*/
@PostMapping("/addOrUpdateRemoveBed")
public Result<Boolean> addOrUpdateRemoveBed(RemoveBedDetailVo removeBedDetailVo) {
if (StringUtils.isBlank(removeBedDetailVo.getRealName())) {
//姓名
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(removeBedDetailVo.getGender())) {
//性别
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (removeBedDetailVo.getRating() == null || removeBedDetailVo.getRating() < 1 || removeBedDetailVo.getRating() > 5) {
//护理需求等级
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(removeBedDetailVo.getChanghuNo())) {
//长护号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(removeBedDetailVo.getTel()) || StringUtils.isBlank(removeBedDetailVo.getSpecialZone()) || StringUtils.isBlank(removeBedDetailVo.getBedNumber()) ||removeBedDetailVo.getBedDays() == null ||removeBedDetailVo.getRemoveBedReason() == null ||removeBedDetailVo.getBuildBedTime() == null ||removeBedDetailVo.getRemoveBedTime() == null || StringUtils.isBlank(removeBedDetailVo.getDiagnosis()) || StringUtils.isBlank(removeBedDetailVo.getBedConstruction()) || StringUtils.isBlank(removeBedDetailVo.getNursingProcess()) || StringUtils.isBlank(removeBedDetailVo.getRemoveBedProposal())) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (removeBedDetailVo.getGuaranteeMode() == null || removeBedDetailVo.getGuaranteeMode() < 1 || removeBedDetailVo.getGuaranteeMode() > 3) {
//保障方式
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
removeBedService.saveOrUpdateRemoveBed(removeBedDetailVo);
return Result.success();
}
/**
* 查询建床详情 * 查询建床详情
* *
* @param buildBedId 建床详情id * @param buildBedId 建床详情id
...@@ -100,6 +132,19 @@ public class BuildBedController { ...@@ -100,6 +132,19 @@ public class BuildBedController {
return Result.success(buildBedDetailVo); return Result.success(buildBedDetailVo);
} }
/**
* 查询撤床详情
*
* @param buildBedId 建床详情id
* @return 返回撤床详情
*/
@GetMapping("getRemoveBedDetail")
public Result<RemoveBedDetailVo> getRemoveBedDetail(Integer buildBedId) {
RemoveBedDetailVo removeBedDetailVo = removeBedService.getRemoveBedDetail(buildBedId);
return Result.success(removeBedDetailVo);
}
/** /**
* 功能描述: 服务分配信息检索条件查询 * 功能描述: 服务分配信息检索条件查询
*/ */
...@@ -211,7 +256,7 @@ public class BuildBedController { ...@@ -211,7 +256,7 @@ public class BuildBedController {
*/ */
@GetMapping("/buildBedSearchByRealName") @GetMapping("/buildBedSearchByRealName")
public Result<IPage<SearchDisableSimpleVo>> buildBedSearchByRealName(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Integer srvOrganId, String realName) { public Result<IPage<SearchDisableSimpleVo>> buildBedSearchByRealName(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Integer srvOrganId, String realName) {
if (StringUtils.isBlank(realName) || null == srvOrganId) { if (null == srvOrganId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
IPage<SearchDisableSimpleVo> searchDisableSimpleVoIPage = sendService.buildBedSearchByRealName(pageNum, pageSize, srvOrganId, realName); IPage<SearchDisableSimpleVo> searchDisableSimpleVoIPage = sendService.buildBedSearchByRealName(pageNum, pageSize, srvOrganId, realName);
......
...@@ -69,8 +69,8 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> { ...@@ -69,8 +69,8 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> {
@Select("SELECT max(srv_send_id) id from CH_SRV_SEND") @Select("SELECT max(srv_send_id) id from CH_SRV_SEND")
Long selectMaxId(); Long selectMaxId();
@Select("SELECT " + @Select("<script> SELECT " +
"t2.DISAB_INFO_ID," + "DISTINCT t2.DISAB_INFO_ID," +
"t2.REAL_NAME," + "t2.REAL_NAME," +
"t2.CERTI_CODE certifNum," + "t2.CERTI_CODE certifNum," +
"t2.BIRTHDAY," + "t2.BIRTHDAY," +
...@@ -78,12 +78,12 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> { ...@@ -78,12 +78,12 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> {
"t2.TEL," + "t2.TEL," +
"t2.DISE_TYPE_S " + "t2.DISE_TYPE_S " +
" FROM " + " FROM " +
"CH_SRV_SEND t1" + "CH_DISABLE_INFO t2" +
" LEFT JOIN CH_DISABLE_INFO t2 ON t1.DISAB_INFO_ID = t2.DISAB_INFO_ID " + " INNER JOIN CH_SRV_SEND t1 ON t1.DISAB_INFO_ID = t2.DISAB_INFO_ID " +
" LEFT JOIN CH_SRV_BUILD_BED t3 ON t2.DISAB_INFO_ID = t3.DISAB_INFO_ID " + " LEFT JOIN CH_SRV_BUILD_BED t3 ON t2.DISAB_INFO_ID = t3.DISAB_INFO_ID " +
" WHERE " + " WHERE " +
"t3.BUILD_BED_ID IS NOT NULL AND " + "t3.BUILD_BED_ID IS NULL AND " +
"t1.SRV_ORGAN_ID = #{srvOrganId} " + "t1.SRV_ORGAN_ID = #{srvOrganId} " +
" AND t2.REAL_NAME LIKE CONCAT( '%', CONCAT( #{realName}, '%' ) )") " <when test='realName != null and realName != \"\"'> AND t2.REAL_NAME LIKE CONCAT( '%', CONCAT( #{realName}, '%' ) )</when></script>")
IPage<SearchDisableSimpleVo> buildBedSearchByRealName(Page<SearchDisableSimpleVo> page, Integer srvOrganId, String realName); IPage<SearchDisableSimpleVo> buildBedSearchByRealName(Page<SearchDisableSimpleVo> page, Integer srvOrganId, String realName);
} }
...@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.service; ...@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed; import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed;
import com.hungraim.ltc.pojo.vo.governance.RemoveBedDetailVo;
/** /**
* @author jiaguokai * @author jiaguokai
...@@ -9,4 +10,8 @@ import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed; ...@@ -9,4 +10,8 @@ import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed;
public interface IRemoveBedService extends IService<ChSrvRemoveBed> { public interface IRemoveBedService extends IService<ChSrvRemoveBed> {
Integer removeOne(ChSrvRemoveBed removeBed); Integer removeOne(ChSrvRemoveBed removeBed);
void saveOrUpdateRemoveBed(RemoveBedDetailVo removeBedDetailVo);
RemoveBedDetailVo getRemoveBedDetail(Integer buildBedId);
} }
...@@ -45,7 +45,6 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB ...@@ -45,7 +45,6 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB
public void saveOrUpdateBuildBed(BuildBedDetailVo buildBedDetailVo) { public void saveOrUpdateBuildBed(BuildBedDetailVo buildBedDetailVo) {
ChSrvBuildBed chSrvBuildBed = new ChSrvBuildBed(); ChSrvBuildBed chSrvBuildBed = new ChSrvBuildBed();
BeanUtils.copyProperties(buildBedDetailVo, chSrvBuildBed); BeanUtils.copyProperties(buildBedDetailVo, chSrvBuildBed);
List<ChFndAttach> fileDataList = buildBedDetailVo.getFileDataList();
chSrvBuildBed.setStatus(0); // 状态(0已建床,1已撤床) chSrvBuildBed.setStatus(0); // 状态(0已建床,1已撤床)
chSrvBuildBed.setAccountStatus(0); // 结算状态(0,未结算;1,结算中;2,已结算) chSrvBuildBed.setAccountStatus(0); // 结算状态(0,未结算;1,结算中;2,已结算)
this.saveOrUpdate(chSrvBuildBed); this.saveOrUpdate(chSrvBuildBed);
......
package com.hungraim.ltc.governance.service.impl; package com.hungraim.ltc.governance.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hungraim.ltc.governance.dao.BuildBedMapper; import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.governance.dao.RemoveBedMapper; import com.hungraim.ltc.governance.dao.RemoveBedMapper;
import com.hungraim.ltc.governance.service.IBuildBedService;
import com.hungraim.ltc.governance.service.IRemoveBedService; import com.hungraim.ltc.governance.service.IRemoveBedService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.governance.ChSrvBuildBed;
import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed; import com.hungraim.ltc.pojo.entity.governance.ChSrvRemoveBed;
import com.hungraim.ltc.pojo.vo.governance.RemoveBedDetailVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import java.util.List;
/** /**
* @author jiaguokai * @author jiaguokai
*/ */
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor
public class RemoveBedServiceImpl extends ServiceImpl<RemoveBedMapper, ChSrvRemoveBed> implements IRemoveBedService { public class RemoveBedServiceImpl extends ServiceImpl<RemoveBedMapper, ChSrvRemoveBed> implements IRemoveBedService {
@Resource
private RemoveBedMapper removeBedMapper;
@Resource
private BuildBedMapper buildBedMapper;
private final AttachFeignService attachFeignService;
private final IBuildBedService buildBedService;
@Override @Override
public Integer removeOne(ChSrvRemoveBed removeBed) { public Integer removeOne(ChSrvRemoveBed removeBed) {
return null; return null;
} }
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateRemoveBed(RemoveBedDetailVo removeBedDetailVo) {
// 添加撤床记录
ChSrvRemoveBed chSrvRemoveBed = new ChSrvRemoveBed();
BeanUtils.copyProperties(removeBedDetailVo, chSrvRemoveBed);
chSrvRemoveBed.setStatus(0); // 状态(0有效,1失效)
this.saveOrUpdate(chSrvRemoveBed);
removeBedDetailVo.setRemoveBedId(chSrvRemoveBed.getRemoveBedId());
this.updateAttachs(removeBedDetailVo);
// 变更建床记录为已撤床
Integer buildBedId = chSrvRemoveBed.getBuildBedId();
ChSrvBuildBed srvBuildBed = buildBedService.getById(buildBedId);
srvBuildBed.setStatus(1); // 状态(0已建床,1已撤床)
srvBuildBed.setAccountStatus(1); // 结算状态(0,未结算;1,结算中;2,已结算)
buildBedService.updateById(srvBuildBed);
}
@Override
public RemoveBedDetailVo getRemoveBedDetail(Integer buildBedId) {
List<ChSrvRemoveBed> list = this.list(new LambdaQueryWrapper<ChSrvRemoveBed>().eq(ChSrvRemoveBed::getBuildBedId, buildBedId).eq(ChSrvRemoveBed::getStatus, 0));
if (list != null && list.size() > 0) {
ChSrvRemoveBed chSrvRemoveBed = list.get(0);
RemoveBedDetailVo removeBedDetailVo = new RemoveBedDetailVo();
BeanUtils.copyProperties(chSrvRemoveBed, removeBedDetailVo);
try {
Result<List<ChFndAttach>> result = attachFeignService.selectAttachs(chSrvRemoveBed.getRemoveBedId().longValue(), AttachType.REMOVE_BED.getUploadType());
if (ResultCode.SUCCESS.getCode().equals(result.getCode())) {
removeBedDetailVo.setFileDataList(result.getData());
} else {
log.error("请求获取建床附件失败:{}", result.getMsg());
}
} catch (Exception e) {
e.printStackTrace();
log.error("请求获取建床附件失败:{}", e.getMessage());
}
return removeBedDetailVo;
}
return null;
}
/**
* 调用feign api来修改附件数据
*
* @param removeBedDetailVo 撤床详情封装对象
*/
private void updateAttachs(RemoveBedDetailVo removeBedDetailVo) {
// zhangch 20210525 新增附件修改逻辑
List<ChFndAttach> fileDataList = removeBedDetailVo.getFileDataList();
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setCtrlId(removeBedDetailVo.getRemoveBedId().longValue());
attachUpdateVo.setAttachType(AttachType.REMOVE_BED.getUploadType());
attachUpdateVo.setChFndAttachs(fileDataList);
attachFeignService.updateAttachs(attachUpdateVo);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment