作业十一

在这里插入图片描述
DrugManagerMapper

package com.ping.pharmacy.drugManager.mapper;

import com.ping.pojo.Allocating;
import com.ping.pojo.Drug;
import com.ping.pojo.DrugReportedloss;

public interface DrugManagerMapper {
    //    登录

    //    退出登录

    //    修改密码
    public Boolean changePassword(String userName, String oldUserPwd, String newUserPwd);


    //    添加药品信息
    public Boolean addDrugInfo(Drug drug);

    //    修改药品信息
    public Boolean updateDrugInfo(String drugName, double inventory);

    //    查询药品信息
    public Boolean getDrugInfo(String drugName);

    //    记录报损单信息
    public Boolean addDrugReportedloss(DrugReportedloss drugReportedloss);

    //   查询报损信息
    public DrugReportedloss getDrugReportedlossInfo(String drugName);

    //    添加调拨单信息
    public Allocating getAllocatingInfo(String drugNumber);

}

DrugManagerMapper.xml

<!--  注册-->
    <insert id="regist">
        insert into loginuser(userName,userPwd)values(#{userName},#{userPwd})
    </insert>

    <!--   登录-->
    <select id="doLogin" resultType="User">
        select * from loginuser u
        <trim prefix="where" prefixOverrides="and|or">
            <if test="userName!=null">
                and u.userName=#{userName}
            </if>
            <if test="userPwd!=null">
                and u.userPwd=#{userPwd}
            </if>
        </trim>
    </select>

    <!-- 修改密码-->
    <update id="updateUserPwd">
        update loginuser set userPwd=#{userPwd} where userName=#{userName}
    </update>

    <!--  挂单号的录入-->
    <insert id="addRegistOrder">
        insert into sickinfo(sickId,hospId,sickRegistType,sickName,sickSex,sickAge,sickData,registerId)
        value(#{sickId},#{hospId},#{sickRegistType},#{sickName},#{sickSex},#{sickAge},#{sickData},#{registerId})
    </insert>

    <!--  挂号单查询-->
    <select id="getRegist" resultMap="info1">
        select si.sickId,d.departmentType,s.staffName,si.sickData from departmentinfo d,staffinfo s,sickinfo si
        where s.departmentId=d.departmentId
        <if test="sickId=!null">
            and si.sickId like concat('%',#{sickId},'%')
        </if>
        <if test="staffName!=null">
            and s.staffName like concat('%',#{staffName},'%')
        </if>
        <if test="departmentType!=null">
            and d.departmentType like concat('%',#{departmentType},'%')
        </if>
        <if test="startTime!=null && endTime!=null">
            and si.sickData between year(#{startTime}) and year(#{endTime})
        </if>
    </select>
    <resultMap id="info1" type="Sick">
        <result property="s.staffName" column="staffName"/>
        <result property="d.departmentType" column="departmentType"/>
    </resultMap>

    <!-- 结算-->
    <select id="settlement" resultMap="info2">
        select s.sickIdb,s.sickName,c.chargesPay from sickinfo s,charges c
        where c.sickIdb=s.sickId
        <if test="sickId!=null">
            and s.sickId like concat('%',#{sickId},'%')
        </if>
        <if test="userName!=null">
            and s.userName like concat('%',#{userName},'%')
        </if>
    </select>
    <resultMap id="info2" type="Charges">
        <result property="sickName" column="sickName"/>
    </resultMap>

你可能感兴趣的:(实践)