Commit b2aa9437 by huangtao

physic

parent 0b060689
...@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
@Slf4j @Slf4j
//@Auth //@Auth
...@@ -47,4 +48,17 @@ public class PhysicApplyController extends AbstractService { ...@@ -47,4 +48,17 @@ public class PhysicApplyController extends AbstractService {
PhysicApplyVO physicApplyVO= physicApplyService.getInfo(physicApplyId); PhysicApplyVO physicApplyVO= physicApplyService.getInfo(physicApplyId);
return ResponseData.ok(physicApplyVO); return ResponseData.ok(physicApplyVO);
} }
@PostMapping("/operationList")
@ApiOperation(value = "查询药品申请审核单")
public ResponseData<List<PhysicApplyVO>> operationList() {
List<PhysicApplyVO> operationList= physicApplyService.operationList();
return ResponseData.ok(operationList);
}
@PostMapping("/sign")
@ApiOperation(value = "签名")
public ResponseData<PhysicWarehouseVO> sign(@RequestParam Long physicApplyId,@RequestParam String signName) {
physicApplyService.sign(physicApplyId,signName);
return ResponseData.ok();
}
} }
...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.util.Optional; import java.util.Optional;
@Slf4j @Slf4j
...@@ -60,4 +61,17 @@ public class PhysicWarehouseController extends AbstractService { ...@@ -60,4 +61,17 @@ public class PhysicWarehouseController extends AbstractService {
PhysicWarehouseVO physicWarehouseVO =physicWarehouseService.getInfo(physicWarehouseId); PhysicWarehouseVO physicWarehouseVO =physicWarehouseService.getInfo(physicWarehouseId);
return ResponseData.ok(physicWarehouseVO); return ResponseData.ok(physicWarehouseVO);
} }
@PostMapping("/sign")
@ApiOperation(value = "签名")
public ResponseData<PhysicWarehouseVO> sign(@RequestParam Long physicWarehouseId,@RequestParam String signName) {
physicWarehouseService.sign(physicWarehouseId,signName);
return ResponseData.ok();
}
@PostMapping("/operationList")
@ApiOperation(value = "查询药品入库审核单")
public ResponseData<List<PhysicWarehouseVO>> operationList() {
List<PhysicWarehouseVO> operationList= physicWarehouseService.operationList();
return ResponseData.ok(operationList);
}
} }
...@@ -35,12 +35,14 @@ public class PhysicApply extends BaseVersionEntity{ ...@@ -35,12 +35,14 @@ public class PhysicApply extends BaseVersionEntity{
@ApiModelProperty(value = "批号") @ApiModelProperty(value = "批号")
private String batchNo; private String batchNo;
private String factoryName;
@ApiModelProperty(value = "发药部门") @ApiModelProperty(value = "发药部门")
private Long fyDeptId; private Long fyDeptId;
@ApiModelProperty(value = "领药部门") @ApiModelProperty(value = "领药部门")
private Long lyDeptId; private Long lyDeptId;
@ApiModelProperty(value = "状态 0 -待领药/待审核 1-待发药 2 -待复核 3 -完成") @ApiModelProperty(value = "状态 0 -待领药 1-待审核 2-待发药 3 -待复核 4 -完成")
private Integer status; private Integer status;
} }
package com.jmai.physic.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jmai.sys.entity.BaseVersionEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "药品专账")
@TableName("physic_bill")
public class PhysicBill extends BaseVersionEntity {
@ApiModelProperty(value = "药品名称")
private String physicName;
private String prepnSpec;
@ApiModelProperty(value = "厂家名称")
private String factoryName;
@ApiModelProperty(value = "失效时间")
private String expireDate;
@ApiModelProperty(value = "批号")
private String batchNo;
@ApiModelProperty(value = "凭证号")
private String voucherNo;
private String type;
private Integer acquireNum;
private Integer expendNum;
private Integer refId;
private Integer status;
private String ysUser;
private String shUser;
private Integer balance;
private Integer balanceAll;
}
...@@ -10,6 +10,9 @@ import lombok.Data; ...@@ -10,6 +10,9 @@ import lombok.Data;
@ApiModel(description = "药品入库信息") @ApiModel(description = "药品入库信息")
@TableName("physic_warehouse") @TableName("physic_warehouse")
public class PhysicWarehouse extends BaseVersionEntity{ public class PhysicWarehouse extends BaseVersionEntity{
private Long deptId;
@ApiModelProperty(value = "药品名称") @ApiModelProperty(value = "药品名称")
private String physicName; private String physicName;
......
package com.jmai.physic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jmai.physic.entity.PhysicBill;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PhysicBillMapper extends BaseMapper<PhysicBill> {
}
...@@ -5,9 +5,15 @@ import com.jmai.physic.dto.PhysicWarehouseCreateReq; ...@@ -5,9 +5,15 @@ import com.jmai.physic.dto.PhysicWarehouseCreateReq;
import com.jmai.physic.vo.PhysicApplyVO; import com.jmai.physic.vo.PhysicApplyVO;
import com.jmai.physic.vo.PhysicWarehouseVO; import com.jmai.physic.vo.PhysicWarehouseVO;
import java.util.List;
public interface PhysicApplyService { public interface PhysicApplyService {
PhysicApplyVO createPhysicApply(PhysicApplyCreateReq req); PhysicApplyVO createPhysicApply(PhysicApplyCreateReq req);
PhysicApplyVO getInfo(Long physicApplyId); PhysicApplyVO getInfo(Long physicApplyId);
List<PhysicApplyVO> operationList();
void sign(Long physicApplyId, String signName);
} }
package com.jmai.physic.service;
public interface PhysicBillService {
}
...@@ -3,8 +3,15 @@ package com.jmai.physic.service; ...@@ -3,8 +3,15 @@ package com.jmai.physic.service;
import com.jmai.physic.dto.PhysicWarehouseCreateReq; import com.jmai.physic.dto.PhysicWarehouseCreateReq;
import com.jmai.physic.vo.PhysicWarehouseVO; import com.jmai.physic.vo.PhysicWarehouseVO;
import java.util.List;
public interface PhysicWarehouseService { public interface PhysicWarehouseService {
PhysicWarehouseVO createPhysicWarehouse(PhysicWarehouseCreateReq req); PhysicWarehouseVO createPhysicWarehouse(PhysicWarehouseCreateReq req);
PhysicWarehouseVO getInfo(Long physicWarehouseId); PhysicWarehouseVO getInfo(Long physicWarehouseId);
void sign(Long physicWarehouseId, String signName);
List<PhysicWarehouseVO> operationList();
} }
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jmai.physic.dto.PhysicApplyCreateReq; import com.jmai.physic.dto.PhysicApplyCreateReq;
import com.jmai.physic.dto.PhysicWarehouseCreateReq; import com.jmai.physic.dto.PhysicWarehouseCreateReq;
import com.jmai.physic.entity.PhysicApply; import com.jmai.physic.entity.PhysicApply;
...@@ -12,14 +13,19 @@ import com.jmai.physic.service.PhysicWarehouseService; ...@@ -12,14 +13,19 @@ import com.jmai.physic.service.PhysicWarehouseService;
import com.jmai.physic.vo.PhysicApplyVO; import com.jmai.physic.vo.PhysicApplyVO;
import com.jmai.physic.vo.PhysicWarehouseVO; import com.jmai.physic.vo.PhysicWarehouseVO;
import com.jmai.sys.AbstractService; import com.jmai.sys.AbstractService;
import com.jmai.sys.consts.enums.RoleTypeEum;
import com.jmai.sys.ctx.SpringContextUtils; import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysDept; import com.jmai.sys.entity.SysDept;
import com.jmai.sys.entity.SysUser; import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysDeptMapper; import com.jmai.sys.mapper.SysDeptMapper;
import com.jmai.sys.mapper.SysUserMapper; import com.jmai.sys.mapper.SysUserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class PhysicApplyServiceImpl extends AbstractService implements PhysicApplyService { public class PhysicApplyServiceImpl extends AbstractService implements PhysicApplyService {
...@@ -61,4 +67,71 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -61,4 +67,71 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
vo.setPhysicApplyId(physicApplyId); vo.setPhysicApplyId(physicApplyId);
return vo; return vo;
} }
@Override
public List<PhysicApplyVO> operationList() {
Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId);
Long deptId = sysUser.getDeptId();
List<Long> roleList = sysUser.getRoleAsList();
LambdaQueryWrapper<PhysicApply> queryWrapper = new LambdaQueryWrapper<>();
List<Integer> ly_statusList=new ArrayList<>();
for (Long roleId : roleList) {
RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId);
if (RoleTypeEum.LY.equals(roleTypeEum)) {
ly_statusList.add(0);
} else if (RoleTypeEum.LY_SH.equals(roleTypeEum)) {
ly_statusList.add(1);
}
}
if(!CollectionUtils.isEmpty(ly_statusList)){
queryWrapper.and(o->{
o.eq(PhysicApply::getLyDeptId,deptId).in(PhysicApply::getStatus,ly_statusList);
});
}
List<Integer> fy_statusList=new ArrayList<>();
for (Long roleId : roleList) {
RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId);
if (RoleTypeEum.FY.equals(roleTypeEum)) {
fy_statusList.add(2);
} else if (RoleTypeEum.FY_SH.equals(roleTypeEum)) {
fy_statusList.add(3);
}
}
if(CollectionUtils.isEmpty(ly_statusList) && !CollectionUtils.isEmpty(fy_statusList)){
queryWrapper.and(o->{
o.eq(PhysicApply::getFyDeptId,deptId).in(PhysicApply::getStatus,fy_statusList);
});
}else if(!CollectionUtils.isEmpty(ly_statusList) && !CollectionUtils.isEmpty(fy_statusList)){
queryWrapper.or().and(o->{
o.eq(PhysicApply::getFyDeptId,deptId).in(PhysicApply::getStatus,fy_statusList);
});
}
List<PhysicApply> physicApplyList = physicApplyMapper.selectList(queryWrapper);
return physicApplyList.stream().map(o->{
PhysicApplyVO vo =new PhysicApplyVO();
BeanUtil.copyProperties(o,vo);
return vo;
}).collect(Collectors.toList());
}
@Override
public void sign(Long physicApplyId, String signName) {
PhysicApply physicApply = physicApplyMapper.selectById(physicApplyId);
if(physicApply.getStatus().equals(0)){
physicApply.setStatus(1);
}else if(physicApply.getStatus().equals(1)){
physicApply.setStatus(2);
}else if(physicApply.getStatus().equals(2)){
physicApply.setStatus(3);
}
else if(physicApply.getStatus().equals(3)){
physicApply.setStatus(4);
}
physicApplyMapper.updateById(physicApply);
}
} }
package com.jmai.physic.service.impl;
import com.jmai.physic.service.PhysicBillService;
import com.jmai.sys.AbstractService;
import org.springframework.stereotype.Service;
@Service
public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService {
}
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jmai.physic.dto.PhysicWarehouseCreateReq; import com.jmai.physic.dto.PhysicWarehouseCreateReq;
import com.jmai.physic.entity.PhysicWarehouse; import com.jmai.physic.entity.PhysicWarehouse;
import com.jmai.physic.mapper.PhysicWarehouseMapper; import com.jmai.physic.mapper.PhysicWarehouseMapper;
import com.jmai.physic.service.PhysicWarehouseService; import com.jmai.physic.service.PhysicWarehouseService;
import com.jmai.physic.vo.PhysicWarehouseVO; import com.jmai.physic.vo.PhysicWarehouseVO;
import com.jmai.sys.AbstractService; import com.jmai.sys.AbstractService;
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 org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class PhysicWarehouseServiceImpl extends AbstractService implements PhysicWarehouseService { public class PhysicWarehouseServiceImpl extends AbstractService implements PhysicWarehouseService {
...@@ -17,6 +26,9 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -17,6 +26,9 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
@Resource @Resource
private PhysicWarehouseMapper physicWarehouseMapper; private PhysicWarehouseMapper physicWarehouseMapper;
@Resource
private SysUserMapper sysUserMapper;
@Override @Override
public PhysicWarehouseVO createPhysicWarehouse(PhysicWarehouseCreateReq req) { public PhysicWarehouseVO createPhysicWarehouse(PhysicWarehouseCreateReq req) {
PhysicWarehouse physicWarehouse = new PhysicWarehouse(); PhysicWarehouse physicWarehouse = new PhysicWarehouse();
...@@ -35,4 +47,49 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -35,4 +47,49 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
vo.setPhysicWarehouseId(physicWarehouseId); vo.setPhysicWarehouseId(physicWarehouseId);
return vo; return vo;
} }
@Override
public void sign(Long physicWarehouseId, String signName) {
PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseId);
if(physicWarehouse.getStatus().equals(0)){
physicWarehouse.setStatus(1);
}else if(physicWarehouse.getStatus().equals(1)){
physicWarehouse.setStatus(2);
}else if(physicWarehouse.getStatus().equals(2)){
physicWarehouse.setStatus(3);
}
physicWarehouseMapper.updateById(physicWarehouse);
}
@Override
public List<PhysicWarehouseVO> operationList() {
Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId);
Long deptId = sysUser.getDeptId();
List<Long> roleList = sysUser.getRoleAsList();
LambdaQueryWrapper<PhysicWarehouse> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PhysicWarehouse::getDeptId,deptId);
List<Integer> statusList=new ArrayList<>();
for (Long roleId : roleList) {
RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId);
if(RoleTypeEum.YS.equals(roleTypeEum)){
statusList.add(0);
}else if(RoleTypeEum.FH.equals(roleTypeEum)){
statusList.add(1);
}else if(RoleTypeEum.BG.equals(roleTypeEum)){
statusList.add(2);
}
}
if(CollectionUtils.isEmpty(statusList)){
return new ArrayList<>(0);
}
queryWrapper.in(PhysicWarehouse::getStatus,statusList);
List<PhysicWarehouse> physicWarehouses = physicWarehouseMapper.selectList(queryWrapper);
return physicWarehouses.stream().map(o->{
PhysicWarehouseVO vo =new PhysicWarehouseVO();
BeanUtil.copyProperties(o,vo);
return vo;
}).collect(Collectors.toList());
}
} }
...@@ -40,6 +40,8 @@ public interface HeaderCode { ...@@ -40,6 +40,8 @@ public interface HeaderCode {
/** /**
* ip * ip
*/ */
......
...@@ -8,10 +8,10 @@ public enum RoleTypeEum { ...@@ -8,10 +8,10 @@ public enum RoleTypeEum {
YS(1, "验收人"), YS(1, "验收人"),
FH(2, "复核人"), FH(2, "复核人"),
BG(3, "保管人"), BG(3, "保管人"),
LY(4, "领药/执行人"), LY(4, "领药人"),
QL(5,"请领人"), LY_SH(5,"领药审核人"),
FY(6,"发药人"), FY(6,"发药人"),
SH(7,"审核人"), FY_SH(7,"发药复核人"),
DP(8,"调配人"), DP(8,"调配人"),
JS(9,"接收人"), JS(9,"接收人"),
TH(10,"退回人"), TH(10,"退回人"),
......
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