Commit 90b819ae by huangtao

销毁审批

parent 3735cd08
Showing with 319 additions and 32 deletions
...@@ -4,9 +4,14 @@ package com.jmai.physic.controller; ...@@ -4,9 +4,14 @@ package com.jmai.physic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicCheckQueryReq; import com.jmai.physic.dto.PhysicCheckQueryReq;
import com.jmai.physic.dto.PhysicDestroyCheckCreateReq; import com.jmai.physic.dto.PhysicDestroyCheckCreateReq;
import com.jmai.physic.dto.PhysicDestroyCheckSignReq;
import com.jmai.physic.dto.PhysicDestroySignReq;
import com.jmai.physic.entity.PhysicDestroy;
import com.jmai.physic.entity.PhysicDestroyCheck; import com.jmai.physic.entity.PhysicDestroyCheck;
import com.jmai.physic.service.PhysicDestroyCheckService; import com.jmai.physic.service.PhysicDestroyCheckService;
import com.jmai.physic.vo.PhysicDestroyCheckVO; import com.jmai.physic.vo.PhysicDestroyCheckVO;
import com.jmai.physic.vo.PhysicDestroyNumVO;
import com.jmai.physic.vo.PhysicDestroyVO;
import com.jmai.sys.aop.Auth; import com.jmai.sys.aop.Auth;
import com.jmai.sys.dto.ResponseData; import com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -21,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
@Slf4j @Slf4j
@Auth @Auth
...@@ -45,4 +51,18 @@ public class PhysicDestroyCheckController { ...@@ -45,4 +51,18 @@ public class PhysicDestroyCheckController {
return physicDestroyCheckService.listPage(req); return physicDestroyCheckService.listPage(req);
} }
@PostMapping("/sign")
@ApiOperation(value = "签名")
public ResponseData<PhysicDestroyCheck> sign(@RequestBody PhysicDestroyCheckSignReq physicDestroyCheckSignReq) {
PhysicDestroyCheck check = physicDestroyCheckService.sign(physicDestroyCheckSignReq);
return ResponseData.ok(check);
}
@PostMapping("/listDestroy")
@ApiOperation(value = "销毁数量列表")
public ResponseData<List<PhysicDestroyNumVO>> listDestroy() {
List<PhysicDestroyNumVO> physicDestroyNumVOS = physicDestroyCheckService.listDestroy();
return ResponseData.ok(physicDestroyNumVOS);
}
} }
...@@ -52,6 +52,4 @@ public class PhysicDestroyController { ...@@ -52,6 +52,4 @@ public class PhysicDestroyController {
PhysicDestroy physicDestroy = physicDestroyService.sign(physicDestroySignReq); PhysicDestroy physicDestroy = physicDestroyService.sign(physicDestroySignReq);
return ResponseData.ok(physicDestroy); return ResponseData.ok(physicDestroy);
} }
} }
...@@ -7,7 +7,9 @@ import com.jmai.physic.entity.PhysicRecord; ...@@ -7,7 +7,9 @@ import com.jmai.physic.entity.PhysicRecord;
import com.jmai.physic.entity.PhysicStorageAmpoule; import com.jmai.physic.entity.PhysicStorageAmpoule;
import com.jmai.physic.service.PhysicStorageAmpouleService; import com.jmai.physic.service.PhysicStorageAmpouleService;
import com.jmai.physic.vo.PhysicStorageAmpouleVO; import com.jmai.physic.vo.PhysicStorageAmpouleVO;
import com.jmai.sys.AbstractService;
import com.jmai.sys.aop.Auth; import com.jmai.sys.aop.Auth;
import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.dto.ResponseData; import com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -28,7 +30,7 @@ import javax.validation.Valid; ...@@ -28,7 +30,7 @@ import javax.validation.Valid;
@RequestMapping("/physicStorageAmpoule") @RequestMapping("/physicStorageAmpoule")
@Api(tags = "药品空安瓿登记-药库") @Api(tags = "药品空安瓿登记-药库")
@ApiImplicitParams({@ApiImplicitParam(paramType = "header", name = "Access-Token", value = "凭证", required = true, dataType = "string")}) @ApiImplicitParams({@ApiImplicitParam(paramType = "header", name = "Access-Token", value = "凭证", required = true, dataType = "string")})
public class PhysicStorageAmpouleController { public class PhysicStorageAmpouleController extends AbstractService {
@Resource @Resource
private PhysicStorageAmpouleService physicStorageAmpouleService; private PhysicStorageAmpouleService physicStorageAmpouleService;
...@@ -37,7 +39,8 @@ public class PhysicStorageAmpouleController { ...@@ -37,7 +39,8 @@ public class PhysicStorageAmpouleController {
@PostMapping("/create") @PostMapping("/create")
@ApiOperation(value = "创建") @ApiOperation(value = "创建")
public ResponseData create(@RequestBody @Valid PhysicStorageAmpouleCreateReq req) { public ResponseData create(@RequestBody @Valid PhysicStorageAmpouleCreateReq req) {
physicStorageAmpouleService.create(req); Long userId = SpringContextUtils.getUserId();
execWithLock("physicStorageAmpoule:"+userId, () -> physicStorageAmpouleService.create(req));
return ResponseData.ok(); return ResponseData.ok();
} }
......
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicDestroyCheckSignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药品销毁id")
private Long physicDestroyCheckId;
}
...@@ -10,10 +10,11 @@ import java.util.List; ...@@ -10,10 +10,11 @@ import java.util.List;
public class PhysicStorageAmpouleCreateReq { public class PhysicStorageAmpouleCreateReq {
@ApiModelProperty(value = "1-回收 2-移至销毁")
private Integer type; private Integer type;
private Integer deptId; @ApiModelProperty(value = "移交部门")
private Integer transferDeptId;
private String remark; private String remark;
...@@ -38,6 +39,9 @@ public class PhysicStorageAmpouleCreateReq { ...@@ -38,6 +39,9 @@ public class PhysicStorageAmpouleCreateReq {
@ApiModelProperty(value = "批号") @ApiModelProperty(value = "批号")
private String batchNo; private String batchNo;
@ApiModelProperty(value = "厂家")
private String factoryName;
} }
} }
...@@ -20,7 +20,7 @@ public class PhysicAmpoule extends BaseVersionEntity { ...@@ -20,7 +20,7 @@ public class PhysicAmpoule extends BaseVersionEntity {
private Integer physicNum; private Integer physicNum;
@ApiModelProperty(value = "规格") @ApiModelProperty(value = "规格")
private String physiSpec; private String physicSpec;
@ApiModelProperty(value = "批号") @ApiModelProperty(value = "批号")
private String batchNo; private String batchNo;
......
...@@ -12,11 +12,17 @@ import lombok.Data; ...@@ -12,11 +12,17 @@ import lombok.Data;
@TableName("physic_destroy_check") @TableName("physic_destroy_check")
public class PhysicDestroyCheck extends BaseVersionEntity { public class PhysicDestroyCheck extends BaseVersionEntity {
private String applyName; private String applyName;
private String applyDeptId; private Long applyDeptId;
private String applyTitle; private String applyTitle;
private String applyReason; private String applyReason;
private String images; private String images;
private Integer destroyNum; private Integer destroyNum;
@ApiModelProperty(value = "状态 0-审批中 1-已销毁 ") @ApiModelProperty(value = "状态 0-审批中 1-已销毁 ")
private Integer status; private Integer status;
private String xhUser;
private String jdUser;
private String yxbzrUser;
private String ywkkzUser;
private String bwkkzUser;
private String zgyzUser;
} }
...@@ -19,7 +19,7 @@ public class PhysicDestroyCheckDetail extends BaseVersionEntity { ...@@ -19,7 +19,7 @@ public class PhysicDestroyCheckDetail extends BaseVersionEntity {
private Integer physicNum; private Integer physicNum;
@ApiModelProperty(value = "规格") @ApiModelProperty(value = "规格")
private String physiSpec; private String physicSpec;
@ApiModelProperty(value = "批号") @ApiModelProperty(value = "批号")
private String batchNo; private String batchNo;
......
...@@ -31,13 +31,23 @@ public class PhysicStorageAmpoule extends BaseVersionEntity { ...@@ -31,13 +31,23 @@ public class PhysicStorageAmpoule extends BaseVersionEntity {
private String physicType; private String physicType;
@ApiModelProperty(value = "1-接收 2-销毁") @ApiModelProperty(value = "收入")
private Integer acquireNum;
@ApiModelProperty(value = "发出")
private Integer expendNum;
@ApiModelProperty(value = "1-接收 2-移至销毁")
private Integer type; private Integer type;
private String orderNo; @ApiModelProperty(value = "1-待销毁 2-已销毁")
private Integer destroyStatus;
private Long deptId; private String orderNo;
@ApiModelProperty(value = "移交部门")
private Long transferDeptId;
@ApiModelProperty(value = "接收部门")
private Long acceptDeptId;
private Integer recycleReceiptNum; private Integer recycleReceiptNum;
......
...@@ -5,11 +5,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,11 +5,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicAmpouleQueryReq; import com.jmai.physic.dto.PhysicAmpouleQueryReq;
import com.jmai.physic.entity.PhysicStorageAmpoule; import com.jmai.physic.entity.PhysicStorageAmpoule;
import com.jmai.physic.vo.PhysicDestroyNumVO;
import com.jmai.physic.vo.PhysicStorageAmpouleVO; import com.jmai.physic.vo.PhysicStorageAmpouleVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface PhysicStorageAmpouleMapper extends BaseMapper<PhysicStorageAmpoule> { public interface PhysicStorageAmpouleMapper extends BaseMapper<PhysicStorageAmpoule> {
Page<PhysicStorageAmpouleVO> selectAmpoulePage(Page<PhysicStorageAmpouleVO> page, @Param("req") PhysicAmpouleQueryReq req); Page<PhysicStorageAmpouleVO> selectAmpoulePage(Page<PhysicStorageAmpouleVO> page, @Param("req") PhysicAmpouleQueryReq req);
Integer selectCurrentSumByBatchNo(@Param("name") String name,@Param("spec") String spec,@Param("factoryName") String factoryName,@Param("batchNo") String batchNo,@Param("deptId") Long deptId );
Integer selectCurrentSumByName(@Param("name") String name,@Param("spec") String spec,@Param("factoryName") String factoryName,@Param("deptId")Long deptId);
List<PhysicDestroyNumVO> selectDestroy();
} }
...@@ -3,14 +3,26 @@ package com.jmai.physic.service; ...@@ -3,14 +3,26 @@ package com.jmai.physic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicCheckQueryReq; import com.jmai.physic.dto.PhysicCheckQueryReq;
import com.jmai.physic.dto.PhysicDestroyCheckCreateReq; import com.jmai.physic.dto.PhysicDestroyCheckCreateReq;
import com.jmai.physic.dto.PhysicDestroyCheckSignReq;
import com.jmai.physic.entity.PhysicDestroy;
import com.jmai.physic.entity.PhysicDestroyCheck; import com.jmai.physic.entity.PhysicDestroyCheck;
import com.jmai.physic.vo.PhysicDestroyCheckVO; import com.jmai.physic.vo.PhysicDestroyCheckVO;
import com.jmai.physic.vo.PhysicDestroyNumVO;
import com.jmai.sys.dto.ResponseData;
import com.jmai.sys.service.BaseService; import com.jmai.sys.service.BaseService;
import java.util.List;
public interface PhysicDestroyCheckService extends BaseService<PhysicDestroyCheck> { public interface PhysicDestroyCheckService extends BaseService<PhysicDestroyCheck> {
void create(PhysicDestroyCheckCreateReq req); void create(PhysicDestroyCheckCreateReq req);
Page<PhysicDestroyCheckVO> listPage(PhysicCheckQueryReq req); Page<PhysicDestroyCheckVO> listPage(PhysicCheckQueryReq req);
PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq);
PhysicDestroyCheck getInfo(Long id);
List<PhysicDestroyNumVO> listDestroy();
} }
...@@ -54,7 +54,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA ...@@ -54,7 +54,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
ampoule.setPhysicName(physic.getPhysicName()); ampoule.setPhysicName(physic.getPhysicName());
ampoule.setBatchNo(physic.getBatchNo()); ampoule.setBatchNo(physic.getBatchNo());
ampoule.setPhysicNum(physic.getPhysicNum()); ampoule.setPhysicNum(physic.getPhysicNum());
ampoule.setPhysiSpec(physic.getPhysicSpec()); ampoule.setPhysicSpec(physic.getPhysicSpec());
ampoule.setPhysicType(physic.getPhysicType()); ampoule.setPhysicType(physic.getPhysicType());
physicAmpouleMapper.insert(ampoule); physicAmpouleMapper.insert(ampoule);
} }
......
package com.jmai.physic.service.impl; package com.jmai.physic.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicCheckQueryReq; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.dto.PhysicDestroyCheckCreateReq; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.entity.PhysicDestroy; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicDestroyCheck; import com.jmai.physic.entity.*;
import com.jmai.physic.entity.PhysicDestroyCheckDetail;
import com.jmai.physic.mapper.PhysicDestroyCheckMapper; import com.jmai.physic.mapper.PhysicDestroyCheckMapper;
import com.jmai.physic.mapper.PhysicStorageAmpouleMapper;
import com.jmai.physic.service.PhysicBillService;
import com.jmai.physic.service.PhysicDestroyCheckDetailService; import com.jmai.physic.service.PhysicDestroyCheckDetailService;
import com.jmai.physic.service.PhysicDestroyCheckService; import com.jmai.physic.service.PhysicDestroyCheckService;
import com.jmai.physic.vo.PhysicDestroyCheckVO; import com.jmai.physic.vo.PhysicDestroyCheckVO;
import com.jmai.physic.vo.PhysicDestroyNumVO;
import com.jmai.sys.consts.enums.RoleTypeEum;
import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysUserMapper;
import com.jmai.sys.service.impl.BaseServiceImpl; import com.jmai.sys.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static com.jmai.sys.AbstractService.buildEmptyPage; import static com.jmai.sys.AbstractService.buildEmptyPage;
...@@ -29,6 +40,19 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -29,6 +40,19 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
@Resource @Resource
private PhysicDestroyCheckMapper physicDestroyCheckMapper; private PhysicDestroyCheckMapper physicDestroyCheckMapper;
@Resource
private CloudsignService cloudsignService;
@Resource
private PhysicBillService physicBillService;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private PhysicStorageAmpouleMapper physicStorageAmpouleMapper;
@Transactional @Transactional
@Override @Override
public void create(PhysicDestroyCheckCreateReq req) { public void create(PhysicDestroyCheckCreateReq req) {
...@@ -46,6 +70,107 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -46,6 +70,107 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
Page<PhysicDestroyCheckVO> page = buildEmptyPage(req); Page<PhysicDestroyCheckVO> page = buildEmptyPage(req);
Page<PhysicDestroyCheckVO> checkPage = physicDestroyCheckMapper.selectCheckPage(page, req); Page<PhysicDestroyCheckVO> checkPage = physicDestroyCheckMapper.selectCheckPage(page, req);
for (PhysicDestroyCheckVO checkVO : checkPage.getRecords()) {
List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, checkVO.getId()));
checkVO.setDestroyCheckDetailList(list);
}
return checkPage; return checkPage;
} }
@Override
public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) {
Boolean f = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getEncryptedToken(), physicDestroyCheckSignReq.getRelBizNo(), physicDestroyCheckSignReq.getBase64SourceData());
PhysicDestroyCheck physicDestroyCheck = physicDestroyCheckMapper.selectById(physicDestroyCheckSignReq.getPhysicDestroyCheckId());
SysUser sysUser = sysUserMapper.selectById(userId);
if(physicDestroyCheck.getStatus().equals(0)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.XH)){
throw new ServiceException("需要销毁人权限才可进行签名");
}
physicDestroyCheck.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);
physicDestroyCheck.setXhUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(1)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.JD)){
throw new ServiceException("需要监督人权限才可进行签名");
}
physicDestroyCheck.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);
physicDestroyCheck.setJdUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(2)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.YXBZR)) {
throw new ServiceException("需要药学部主任权限才可进行签名");
}
physicDestroyCheck.setStatus(3);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicDestroyCheck.setYxbzrUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(3)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.YWKKZ)){
throw new ServiceException("需要医务科科长权限才可进行签名");
}
physicDestroyCheck.setStatus(4);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);
physicDestroyCheck.setYwkkzUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(4)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BWKKZ)){
throw new ServiceException("需要保卫科科长权限才可进行签名");
}
physicDestroyCheck.setStatus(5);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);
physicDestroyCheck.setBwkkzUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(5)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) {
throw new ServiceException("需要主管院长权限才可进行签名");
}
physicDestroyCheck.setStatus(6);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
}
if(f){
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroyCheck,billDTO);
billDTO.setType(7);
billDTO.setDeptId(physicDestroyCheck.getApplyDeptId());
billDTO.setRefId(physicDestroyCheck.getId());
physicBillService.createBill(billDTO);
//创建销毁
List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId()));
for (PhysicDestroyCheckDetail physicDestroyCheckDetail : list) {
PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule();
ampoule.setPhysicName(physicDestroyCheckDetail.getPhysicName());
ampoule.setBatchNo(ampoule.getBatchNo());
ampoule.setAcceptDeptId(sysUser.getDeptId());
ampoule.setPhysicNum(physicDestroyCheckDetail.getPhysicNum());
ampoule.setPhysicSpec(physicDestroyCheckDetail.getPhysicSpec());
ampoule.setExpendNum(physicDestroyCheckDetail.getPhysicNum());
ampoule.setType(2);
ampoule.setDestroyStatus(1);
Integer batchNoSum = physicStorageAmpouleMapper.selectCurrentSumByBatchNo(physicDestroyCheckDetail.getPhysicName(), physicDestroyCheckDetail.getPhysicSpec(), physicDestroyCheckDetail.getFactoryName(), physicDestroyCheckDetail.getBatchNo(), sysUser.getDeptId());
Integer physicSum = physicStorageAmpouleMapper.selectCurrentSumByName(physicDestroyCheckDetail.getPhysicName(), physicDestroyCheckDetail.getPhysicSpec(), physicDestroyCheckDetail.getFactoryName(), sysUser.getDeptId());
ampoule.setBatchBalance(batchNoSum - physicDestroyCheckDetail.getPhysicNum());
ampoule.setPhysicNum(physicSum - physicDestroyCheckDetail.getPhysicNum());
physicStorageAmpouleMapper.insert(ampoule);
}
}
physicDestroyCheckMapper.updateById(physicDestroyCheck);
return getInfo(physicDestroyCheck.getId());
}
@Override
public PhysicDestroyCheck getInfo(Long id) {
PhysicDestroyCheck check = physicDestroyCheckMapper.selectById(id);
return check;
}
@Override
public List<PhysicDestroyNumVO> listDestroy() {
List<PhysicDestroyNumVO> list= physicStorageAmpouleMapper.selectDestroy();
return list;
}
} }
...@@ -43,16 +43,44 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -43,16 +43,44 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
@Transactional @Transactional
@Override @Override
public void create(PhysicStorageAmpouleCreateReq req) { public void create(PhysicStorageAmpouleCreateReq req) {
for (PhysicStorageAmpouleCreateReq.Physic physic : req.getPhysicList()) { Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId);
PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule();
BeanUtil.copyProperties(req,ampoule); if(req.getType()==1) {
ampoule.setPhysicName(physic.getPhysicName()); for (PhysicStorageAmpouleCreateReq.Physic physic : req.getPhysicList()) {
ampoule.setBatchNo(physic.getBatchNo()); PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule();
ampoule.setPhysicNum(physic.getPhysicNum()); BeanUtil.copyProperties(req, ampoule);
ampoule.setPhysicSpec(physic.getPhysicSpec()); ampoule.setPhysicName(physic.getPhysicName());
ampoule.setPhysicType(physic.getPhysicType()); ampoule.setBatchNo(physic.getBatchNo());
physicStorageAmpouleMapper.insert(ampoule); ampoule.setAcceptDeptId(sysUser.getDeptId());
ampoule.setPhysicNum(physic.getPhysicNum());
ampoule.setPhysicSpec(physic.getPhysicSpec());
ampoule.setPhysicType(physic.getPhysicType());
ampoule.setAcquireNum(physic.getPhysicNum());
Integer batchNoSum = physicStorageAmpouleMapper.selectCurrentSumByBatchNo(physic.getPhysicName(), physic.getPhysicSpec(), physic.getFactoryName(), physic.getBatchNo(), sysUser.getDeptId());
Integer physicSum = physicStorageAmpouleMapper.selectCurrentSumByName(physic.getPhysicName(), physic.getPhysicSpec(), physic.getFactoryName(), sysUser.getDeptId());
ampoule.setBatchBalance(batchNoSum+physic.getPhysicNum());
ampoule.setPhysicNum(physicSum+physic.getPhysicNum());
physicStorageAmpouleMapper.insert(ampoule);
}
}if(req.getType()==2) {
for (PhysicStorageAmpouleCreateReq.Physic physic : req.getPhysicList()) {
PhysicStorageAmpoule ampoule = new PhysicStorageAmpoule();
BeanUtil.copyProperties(req, ampoule);
ampoule.setPhysicName(physic.getPhysicName());
ampoule.setBatchNo(physic.getBatchNo());
ampoule.setTransferDeptId(sysUser.getDeptId());
ampoule.setAcceptDeptId(sysUser.getDeptId());
ampoule.setPhysicNum(physic.getPhysicNum());
ampoule.setPhysicSpec(physic.getPhysicSpec());
ampoule.setPhysicType(physic.getPhysicType());
ampoule.setAcquireNum(physic.getPhysicNum());
Integer batchNoSum = physicStorageAmpouleMapper.selectCurrentSumByBatchNo(physic.getPhysicName(), physic.getPhysicSpec(), physic.getFactoryName(), physic.getBatchNo(), sysUser.getDeptId());
Integer physicSum = physicStorageAmpouleMapper.selectCurrentSumByName(physic.getPhysicName(), physic.getPhysicSpec(), physic.getFactoryName(), sysUser.getDeptId());
ampoule.setBatchBalance(batchNoSum-physic.getPhysicNum());
ampoule.setPhysicNum(physicSum-physic.getPhysicNum());
physicStorageAmpouleMapper.insert(ampoule);
}
} }
} }
...@@ -71,6 +99,9 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -71,6 +99,9 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData());
PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId()); PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId());
if(ampoule.getType()==2 && ampoule.getDestroyStatus()==1){
throw new ServiceException("已销毁记录不需要签名");
}
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if(ampoule.getStatus().equals(0)){ if(ampoule.getStatus().equals(0)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.JS)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.JS)){
...@@ -92,7 +123,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -92,7 +123,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(ampoule,billDTO); BeanUtil.copyProperties(ampoule,billDTO);
billDTO.setType(ampoule.getType().equals("1")?5:7); billDTO.setType(ampoule.getType().equals("1")?5:7);
billDTO.setDeptId(ampoule.getDeptId()); billDTO.setDeptId(ampoule.getAcceptDeptId());
billDTO.setRefId(ampoule.getId()); billDTO.setRefId(ampoule.getId());
physicBillService.createBill(billDTO); physicBillService.createBill(billDTO);
} }
......
package com.jmai.physic.vo; package com.jmai.physic.vo;
import com.jmai.physic.entity.PhysicDestroyCheck; import com.jmai.physic.entity.PhysicDestroyCheck;
import com.jmai.physic.entity.PhysicDestroyCheckDetail;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class PhysicDestroyCheckVO extends PhysicDestroyCheck { public class PhysicDestroyCheckVO extends PhysicDestroyCheck {
private String createName; private String createName;
private List<PhysicDestroyCheckDetail> destroyCheckDetailList;
} }
package com.jmai.physic.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicDestroyNumVO {
@ApiModelProperty(value = "药品名称")
private String physicName;
@ApiModelProperty(value = "规格")
private String physicSpec;
@ApiModelProperty(value = "批号")
private String batchNo;
private String factoryName;
private String unit;
private String remark;
@ApiModelProperty(value = "销毁数量")
private Integer destroyNum;
}
...@@ -6,4 +6,5 @@ import lombok.Data; ...@@ -6,4 +6,5 @@ import lombok.Data;
@Data @Data
public class PhysicStorageAmpouleVO extends PhysicStorageAmpoule { public class PhysicStorageAmpouleVO extends PhysicStorageAmpoule {
private String createName; private String createName;
private String deptName;
} }
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
<select id="selectAmpoulePage" resultType="com.jmai.physic.vo.PhysicStorageAmpouleVO"> <select id="selectAmpoulePage" resultType="com.jmai.physic.vo.PhysicStorageAmpouleVO">
select a.*,b.name as createName from physic_storage_ampoule a left join sys_user b on a.create_by =b.id select a.*,b.name as createName,(select dept_name from sys_dept d where d.id = a.transfer_dept_id) as deptName
from
physic_storage_ampoule
a left join sys_user b on a.create_by =b.id
where where
a.del_flag = 0 a.del_flag = 0
<if test="req.dateTime != null "> <if test="req.dateTime != null ">
...@@ -14,8 +17,25 @@ ...@@ -14,8 +17,25 @@
and a.physic_name LIKE CONCAT('%', #{req.physicName}, '%') and a.physic_name LIKE CONCAT('%', #{req.physicName}, '%')
</if> </if>
<if test="req.deptId!=null"> <if test="req.deptId!=null">
and a.dept_id = #{req.deptId} and a.transfer_dept_id = #{req.deptId}
</if> </if>
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="selectCurrentSumByBatchNo" resultType="java.lang.Integer">
select (IFNULL(sum(acquire_num),0) - IFNULL(sum(expend_num),0)) from physic_storage_ampoule where
physic_name=#{name} and physic_spec=#{spec} and batch_no=#{batchNo} and factory_name =#{factoryName} and accept_dept_id =#{deptId}
</select>
<select id="selectCurrentSumByName" resultType="java.lang.Integer">
select (IFNULL(sum(acquire_num),0) - IFNULL(sum(expend_num),0)) from physic_storage_ampoule where
physic_name=#{name} and physic_spec=#{spec} and factory_name =#{factoryName} and accept_dept_id =#{deptId}
</select>
<select id="selectDestroy" resultType="com.jmai.physic.vo.PhysicDestroyNumVO">
select physic_name,physic_spec,batch_no,factory_name,unit,remark from physic_storage_ampoule
where type =2 and destroy_status =0
gropu by physic_name,physic_spec,batch_no,factory_name,accept_dept_id
</select>
</mapper> </mapper>
...@@ -283,7 +283,7 @@ public class UserServiceImpl extends AbstractService implements UserService { ...@@ -283,7 +283,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
.eq(ObjectUtil.isNotEmpty(req.getKeyword()), SysUser::getMobile, req.getKeyword()) .eq(ObjectUtil.isNotEmpty(req.getKeyword()), SysUser::getMobile, req.getKeyword())
// 过滤非系统管理员 // 过滤非系统管理员
.ne(!SpringContextUtils.isPlatformAdmin(), SysUser::getType, PLATFORM_ADMIN.getCode()) .ne(!SpringContextUtils.isPlatformAdmin(), SysUser::getType, PLATFORM_ADMIN.getCode())
.eq(ObjectUtil.isNotEmpty(req.getStatus()), SysUser::getStatus, req.getStatus()); .eq(ObjectUtil.isNotEmpty(req.getStatus()), SysUser::getStatus, req.getStatus()).orderByDesc(SysUser::getCreateTime);
} }
@Override @Override
......
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 sign in to comment