Commit dfd9ffd2 by huangtao

physic

parent 683dc8d8
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BillDTO {
private String physicName;
@ApiModelProperty(value = "药品类型")
private String physicSpec;
@ApiModelProperty(value = "失效时间")
private String expireDate;
@ApiModelProperty(value = "批号")
private String batchNo;
@ApiModelProperty(value = "数量")
private Integer physicNum;
private Integer type;
@ApiModelProperty(value = "厂家名称")
private String factoryName;
}
...@@ -10,22 +10,30 @@ import lombok.Data; ...@@ -10,22 +10,30 @@ import lombok.Data;
@ApiModel(description = "药品专账") @ApiModel(description = "药品专账")
@TableName("physic_bill") @TableName("physic_bill")
public class PhysicBill extends BaseVersionEntity { public class PhysicBill extends BaseVersionEntity {
@ApiModelProperty(value = "药品名称") @ApiModelProperty(value = "药品名称")
private String physicName; private String physicName;
private String prepnSpec; @ApiModelProperty(value = "药品类型")
private String physicType;
private String physicSpec;
private String unit;
@ApiModelProperty(value = "批号")
private String batchNo;
@ApiModelProperty(value = "厂家名称") @ApiModelProperty(value = "厂家名称")
private String factoryName; private String factoryName;
@ApiModelProperty(value = "失效时间") @ApiModelProperty(value = "失效时间")
private String expireDate; private String expireDate;
@ApiModelProperty(value = "批号")
private String batchNo;
@ApiModelProperty(value = "凭证号") @ApiModelProperty(value = "凭证号")
private String voucherNo; private String voucherNo;
private String type; private Integer type;
private Integer acquireNum; private Integer acquireNum;
......
...@@ -3,8 +3,13 @@ package com.jmai.physic.mapper; ...@@ -3,8 +3,13 @@ package com.jmai.physic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jmai.physic.entity.PhysicBill; import com.jmai.physic.entity.PhysicBill;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface PhysicBillMapper extends BaseMapper<PhysicBill> { public interface PhysicBillMapper extends BaseMapper<PhysicBill> {
Integer selectSumByBatchNo(@Param("name") String name,@Param("spec") String spec,@Param("factoryName") String factoryName,@Param("batchNo") String batchNo );
Integer selectSumByName(@Param("name") String name,@Param("spec") String spec,@Param("factoryName") String factoryName);
} }
package com.jmai.physic.service; package com.jmai.physic.service;
import com.jmai.physic.dto.BillDTO;
public interface PhysicBillService { public interface PhysicBillService {
void createBill(BillDTO billDTO);
} }
...@@ -83,7 +83,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -83,7 +83,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId); RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId);
if (RoleTypeEum.LY.equals(roleTypeEum)) { if (RoleTypeEum.LY.equals(roleTypeEum)) {
ly_statusList.add(0); ly_statusList.add(0);
} else if (RoleTypeEum.LY_SH.equals(roleTypeEum)) { } else if (RoleTypeEum.SH.equals(roleTypeEum)) {
ly_statusList.add(1); ly_statusList.add(1);
} }
} }
...@@ -97,7 +97,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -97,7 +97,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId); RoleTypeEum roleTypeEum = RoleTypeEum.getEnum(roleId);
if (RoleTypeEum.FY.equals(roleTypeEum)) { if (RoleTypeEum.FY.equals(roleTypeEum)) {
fy_statusList.add(2); fy_statusList.add(2);
} else if (RoleTypeEum.FY_SH.equals(roleTypeEum)) { } else if (RoleTypeEum.FH.equals(roleTypeEum)) {
fy_statusList.add(3); fy_statusList.add(3);
} }
} }
......
package com.jmai.physic.service.impl; package com.jmai.physic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.jmai.physic.dto.BillDTO;
import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.mapper.PhysicBillMapper;
import com.jmai.physic.service.PhysicBillService; import com.jmai.physic.service.PhysicBillService;
import com.jmai.sys.AbstractService; import com.jmai.sys.AbstractService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service @Service
public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService { public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService {
@Resource
private PhysicBillMapper physicBillMapper;
@Override
public void createBill(BillDTO billDTO) {
PhysicBill bill = new PhysicBill();
BeanUtil.copyProperties(billDTO,bill);
bill.setType(billDTO.getType());
if(billDTO.getType()==1){
bill.setAcquireNum(billDTO.getPhysicNum());
}else if(billDTO.getType()==2){
bill.setExpendNum(billDTO.getPhysicNum());
}
Integer batchNoSum = physicBillMapper.selectSumByBatchNo(billDTO.getPhysicName(), billDTO.getPhysicSpec(), billDTO.getFactoryName(), billDTO.getBatchNo());
Integer sum = physicBillMapper.selectSumByName(billDTO.getPhysicName(), billDTO.getPhysicSpec(), billDTO.getFactoryName());
bill.setStatus(0);
bill.setBalance(batchNoSum+billDTO.getPhysicNum());
bill.setBalanceAll(sum+billDTO.getPhysicNum());
physicBillMapper.insert(bill);
}
} }
<?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.jmai.physic.mapper.PhysicBillMapper">
<select id="selectSumByBatchNo" resultType="java.lang.Integer">
select (IFNULL(sum(expend_num),0) - IFNULL(sum(acquire_num),0)) from physic_bill where physic_name=#{name} and physic_spec=#{spec} and batch_no=#{batchNo} and factory_name =#{factoryName}
</select>
<select id="selectSumByName" resultType="java.lang.Integer">
select (IFNULL(sum(expend_num),0) - IFNULL(sum(acquire_num),0)) from physic_bill where physic_name=#{name} and physic_spec=#{spec} and factory_name =#{factoryName}
</select>
</mapper>
...@@ -9,19 +9,18 @@ public enum RoleTypeEum { ...@@ -9,19 +9,18 @@ public enum RoleTypeEum {
FH(2, "复核人"), FH(2, "复核人"),
BG(3, "保管人"), BG(3, "保管人"),
LY(4, "领药人"), LY(4, "领药人"),
LY_SH(5,"领药审核人"), SH(5,"审核人"),
FY(6,"发药人"), FY(6,"发药人"),
FY_SH(7,"发药复核人"), DP(7,"调配人"),
DP(8,"调配人"), JS(8,"接收人"),
JS(9,"接收人"), TH(9,"退回人"),
TH(10,"退回人"), CZ(10,"操作人"),
CZ(11,"操作人"), XH(11,"销毁人"),
XH(12,"销毁人"), JD(12,"监督人"),
JD(13,"监督人"), YXBZR(13,"药学部主任"),
YXBZR(14,"药学部主任"), YWKKZ(14,"医务科科长"),
YWKKZ(15,"医务科科长"), BWKKZ(15,"保卫科科长"),
BWKKZ(16,"保卫科科长"), ZGYZ(16,"主管院长");
ZGYZ(17,"主管院长");
private long code; private long code;
......
This diff could not be displayed because it is too large.
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