Files
dzpt/src/main/resources/mapper/HisDetailMapper.xml

203 lines
8.3 KiB
XML
Raw Normal View History

2025-07-23 09:55:50 +08:00
<?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.saye.hospitalgd.mapper.HisDetailMapper">
<select id="findHisDetail" parameterType="HashMap" resultType="HashMap">
2025-08-21 10:00:57 +08:00
select PayMethod
2025-07-23 09:55:50 +08:00
,TradingStatus
,BizType
,PayType
,TradeTime
2025-08-21 10:00:57 +08:00
,HisOperCode
2025-07-23 09:55:50 +08:00
,Amount
2025-08-21 10:00:57 +08:00
,remarks
2025-07-23 09:55:50 +08:00
,PlatformTransId
2025-08-21 10:00:57 +08:00
,PatientId
2025-07-23 09:55:50 +08:00
,PatientName
,trade_date
2025-08-21 10:00:57 +08:00
,his_wsdl_id
,HisTransId
from hisbill_history
2025-07-23 09:55:50 +08:00
<where>
<if test="payType!=null and payType!=''">
and PayType = #{payType}
</if>
<if test="startTime!=null and startTime!=''">
and trade_date &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and trade_date &lt;= #{endTime}
</if>
<if test="likeFiled!=null and likeFiled!=''">
and PlatformTransId like concat('%',concat(#{likeFiled},'%'))
</if>
</where>
order by trade_date,TradeTime
</select>
2025-08-21 10:00:57 +08:00
<!-- 添加一个明确的count查询避免分页插件的自动生成问题 -->
<select id="findHisDetailCount" parameterType="HashMap" resultType="long">
select count(1)
from hisbill_history
<where>
<if test="payType!=null and payType!=''">
and PayType = #{payType}
</if>
<if test="startTime!=null and startTime!=''">
and trade_date &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and trade_date &lt;= #{endTime}
</if>
<if test="likeFiled!=null and likeFiled!=''">
and PlatformTransId like concat('%',concat(#{likeFiled},'%'))
</if>
</where>
</select>
2025-07-23 09:55:50 +08:00
<delete id="deleteHisBillOriginalByParam" parameterType="HashMap">
delete from hisbill_original where trade_date=#{trade_date}
</delete>
<delete id="deleteHisBillOriginalWNByParam" parameterType="HashMap">
delete from hisbill_original_wn where trade_date=#{trade_date}
</delete>
<delete id="deleteHisBillOriginalHYByParam" parameterType="HashMap">
delete from hisbill_original_hy where trade_date=#{trade_date}
</delete>
<delete id="deleteHisBillByParam" parameterType="HashMap">
delete from hisbill_history where trade_date=#{trade_date}
</delete>
<insert id="insertAllHisBillOriginal" parameterType="java.util.List">
insert into
hisbill_original(PayMethod,TradingStatus,BizType,PayType,TradeTime,HisOperCode,Amount,remarks,PlatformTransId,PatientId,PatientName,trade_date,his_wsdl_id)
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.payMethod},#{itm.tradingStatus},#{itm.bizType},#{itm.payType},#{itm.tradeTime},#{itm.hisOperCode},#{itm.amount},
#{itm.remarks},#{itm.platformTransId},#{itm.patientId},#{itm.patientName},#{itm.trade_date},#{itm.his_wsdl_id}
)
</foreach>
</insert>
<insert id="insertAllHisBillOriginalWN" parameterType="java.util.List">
insert into hisbill_original_wn(sjlx, hzxm, patid, jyje, tyje, zflsh, jyrq, sftkjl, zffs, jylx, czyh,
trade_date, his_wsdl_id)
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.sjlx},#{itm.hzxm},#{itm.patid},#{itm.jyje},#{itm.tyje},#{itm.zflsh},#{itm.jyrq},
#{itm.sftkjl},#{itm.zffs},#{itm.jylx},#{itm.czyh},#{itm.trade_date},#{itm.his_wsdl_id}
)
</foreach>
</insert>
<insert id="insertAllHisBillOriginalHY" parameterType="java.util.List">
insert into
hisbill_original_hy(VisitzOrg,BizType,PayType,Amount,ZFAmount,YBZHAmount,YBTCAmount,Receipt_no,PatientID,PatientName,TradeTime,HisTime,HisOperNum,PowerTranID,trade_date)
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.visitzOrg},#{itm.bizType},#{itm.payType},#{itm.amount},#{itm.zfAmount},#{itm.ybzhAmount},#{itm.ybtcAmount},
#{itm.receiptNO},#{itm.patientID},#{itm.patientName},#{itm.tradeTime},#{itm.hisTime},#{itm.hisOperNum},#{itm.powerTranID},#{itm.trade_date}
)
</foreach>
</insert>
2025-08-21 10:00:57 +08:00
2025-07-23 09:55:50 +08:00
<insert id="insertAllHisBillHistory" parameterType="java.util.List">
insert into
2025-08-21 10:00:57 +08:00
hisbill_history(PayMethod,TradingStatus,BizType,PayType,TradeTime,HisOperCode,Amount,remarks,PlatformTransId,PatientId,PatientName,trade_date,his_wsdl_id,HisTransId)
2025-07-23 09:55:50 +08:00
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.payMethod},#{itm.tradingStatus},#{itm.bizType},#{itm.payType},#{itm.tradeTime},#{itm.hisOperCode},#{itm.amount},#{itm.remarks},#{itm.platformTransId},#{itm.patientId}
2025-08-21 10:00:57 +08:00
,#{itm.patientName},#{itm.trade_date},#{itm.his_wsdl_id},#{itm.hisTransId}
2025-07-23 09:55:50 +08:00
)
</foreach>
</insert>
<delete id="deleteTempTable">
delete from temp_hisbill_history
</delete>
<insert id="findHisDetailToTemp" parameterType="HashMap">
insert into temp_hisbill_history
select a.PayMethod,a.TradingStatus,a.BizType,a.PayType,a.TradeTime,a.HisOperCode,a.Amount,a.remarks,a.PlatformTransId,a.PatientId,a.PatientName,a.trade_date,a.his_wsdl_id
from hisbill_history a
left join (select PlatformTransId from hisbill_history where TradingStatus='2' and trade_date=#{trade_date}) b
on a.PlatformTransId=b.PlatformTransId
where a.trade_date=#{trade_date} and b.PlatformTransId is null and a.PayType!='5'
</insert>
<select id="findHisDetailByParam" parameterType="HashMap" resultType="HashMap">
2025-08-21 10:00:57 +08:00
select PayMethod
,TradingStatus
,BizType
,PayType
,TradeTime
,HisOperCode
,Amount
,remarks
,PlatformTransId
,PatientId
,PatientName
,trade_date
,his_wsdl_id
,HisTransId
from hisbill_history
2025-07-23 09:55:50 +08:00
where trade_date=#{trade_date}
2025-08-21 10:00:57 +08:00
<if test="payType!=null and payType!=''">
and PayType = #{payType}
2025-07-23 09:55:50 +08:00
</if>
2025-08-21 10:00:57 +08:00
<if test="tradingStatus!=null and tradingStatus!=''">
and TradingStatus = #{tradingStatus}
2025-07-23 09:55:50 +08:00
</if>
2025-08-21 10:00:57 +08:00
<if test="orderby_amount!=null and orderby_amount!=''">
order by Amount desc
2025-07-23 09:55:50 +08:00
</if>
</select>
<select id="findHisDetailByTimeAndYSDDH" parameterType="HashMap" resultType="HashMap">
select PayMethod,TradingStatus,BizType,PayType,TradeTime,HisOperCode,Amount,remarks,PlatformTransId,
2025-08-21 10:00:57 +08:00
PatientId,PatientName,HisTransId
2025-07-23 09:55:50 +08:00
from hisbill_history
where trade_date=#{searchTime}
and PlatformTransId = #{c_ysddh}
</select>
<select id="findHisDetailFirmNumByTime" parameterType="HashMap" resultType="HashMap">
select his_wsdl_id,count(1) as firmNum
from hisbill_history
where TradeTime &gt;= #{startTime}
and TradeTime &lt;= #{endTime}
group by his_wsdl_id
</select>
<select id="findHisCashDetail" parameterType="HashMap" resultType="HashMap">
2025-08-21 10:00:57 +08:00
select PayMethod, TradingStatus, BizType, PayType, TradeTime, HisOperCode, Amount, remarks, PlatformTransId, PatientId, PatientName, trade_date, his_wsdl_id, HisTransId
2025-07-23 09:55:50 +08:00
from hisbill_history
where trade_date=#{trade_date} and PayType='5'
</select>
<select id="findHisDetailCountData" parameterType="HashMap" resultType="HashMap">
select count(1) as num,cast(IFNULL(sum(Amount),0) as decimal(19,2)) as money
from hisbill_history
<where>
<if test="payType!=null and payType!=''">
and PayType = #{payType}
</if>
<if test="startTime!=null and startTime!=''">
and TradeTime &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and TradeTime &lt;= #{endTime}
</if>
<if test="likeFiled!=null and likeFiled!=''">
and PlatformTransId like concat('%',concat(#{likeFiled},'%'))
</if>
</where>
</select>
</mapper>