医院耗材管理系统开发_9

近期的工作是在出入库时填写出入库记录。
首先是科室库出库记录的第一层

ReagentOutBill outBill = new ReagentOutBill();
    Date timeNow = new Date();

    Long time1 = new Date().getTime();
    Random ne2 = new Random();//实例化一个random的对象ne
    int x2 = ne2.nextInt(999 - 100 + 1) + 100;//为变量赋随机值100-999
    String random_order2 = String.valueOf(x2);
    String billCode = time1 + random_order2;

    String creater =stockMapper.findhead(name);

    outBill.setBillCode(billCode);
    outBill.setBillType("2");
    outBill.setBillDate(timeNow);
    outBill.setBillStatus(true);
    outBill.setBillCreator(creater);
    outBill.setBranchName(name);
    outBill.setUpdateTime(timeNow);
    outBill.setCreateTime(timeNow);
    outBill.setApplicationDate(timeNow);
    outBill.setApplicationUser(stock.getapplier());
    outBillMapper.insert(outBill);

首先创建一个ReagentOutBill 类型的outBill ,通过date方法获取当前世界,然后根据时间和随机数生成一个随机的编号。
根据库名找到科室账号的使用者

<select id="findhead" resultType="java.lang.String">
select head
from reagent_branch
where branch_name = #{name,jdbcType=VARCHAR}

依次填入记录编号,类型等数据,然后使用outBillMapper.insert(outBill)写入。

<insert id="insert" parameterType="jp.co.nss.hrm.backend.model.ReagentOutBill">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  SELECT LAST_INSERT_ID()
</selectKey>
insert into reagent_out_bill (bill_code, bill_type, bill_date, 
  bill_status, bill_creator, remark, 
  branch_name, application_date, application_user, 
  create_time, create_by, update_time, 
  update_by, delete_flag, delete_time, 
  delete_by)
values (#{billCode,jdbcType=VARCHAR}, #{billType,jdbcType=VARCHAR}, #{billDate,jdbcType=DATE}, 
  #{billStatus,jdbcType=BIT}, #{billCreator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
  #{branchName,jdbcType=VARCHAR}, #{applicationDate,jdbcType=DATE}, #{applicationUser,jdbcType=VARCHAR}, 
  #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
  #{updateBy,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=TINYINT}, #{deleteTime,jdbcType=TIMESTAMP}, 
  #{deleteBy,jdbcType=VARCHAR})
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值