update:对账消息推送,军保账单统计,退款数据统计
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
<?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.FinancialReconciliation.RefundStatisticsMapper">
|
||||
|
||||
<!-- 查询退款统计报表数据 -->
|
||||
<select id="findRefundStatistics" parameterType="HashMap" resultType="HashMap">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="dimension == 'time'">
|
||||
DATE_FORMAT(trade_date, '%Y-%m-%d') as dimension_value,
|
||||
'按日期' as dimension_name
|
||||
</when>
|
||||
<when test="dimension == 'payType'">
|
||||
PayType as dimension_value,
|
||||
'按支付方式' as dimension_name
|
||||
</when>
|
||||
<when test="dimension == 'refundType'">
|
||||
TradingStatus as dimension_value,
|
||||
'按退款类型' as dimension_name
|
||||
</when>
|
||||
<otherwise>
|
||||
'全部' as dimension_value,
|
||||
'全部' as dimension_name
|
||||
</otherwise>
|
||||
</choose>,
|
||||
COUNT(*) as refund_count,
|
||||
SUM(CAST(Amount AS DECIMAL(10,2))) as total_refund_amount,
|
||||
AVG(CAST(Amount AS DECIMAL(10,2))) as avg_refund_amount,
|
||||
MAX(CAST(Amount AS DECIMAL(10,2))) as max_refund_amount,
|
||||
MIN(CAST(Amount AS DECIMAL(10,2))) as min_refund_amount,
|
||||
COUNT(DISTINCT PatientId) as unique_patients,
|
||||
COUNT(DISTINCT HisOperCode) as unique_operators
|
||||
FROM hisbill_history
|
||||
WHERE TradingStatus = '2'
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
<if test="payType != null and payType != ''">
|
||||
AND PayType = #{payType}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="dimension == 'time'">
|
||||
GROUP BY DATE_FORMAT(trade_date, '%Y-%m-%d')
|
||||
ORDER BY DATE_FORMAT(trade_date, '%Y-%m-%d') DESC
|
||||
</when>
|
||||
<when test="dimension == 'payType'">
|
||||
GROUP BY PayType
|
||||
ORDER BY total_refund_amount DESC
|
||||
</when>
|
||||
<when test="dimension == 'refundType'">
|
||||
GROUP BY TradingStatus
|
||||
ORDER BY total_refund_amount DESC
|
||||
</when>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 获取退款统计汇总数据 -->
|
||||
<select id="getRefundSummary" parameterType="HashMap" resultType="HashMap">
|
||||
SELECT
|
||||
COUNT(*) as total_refund_count,
|
||||
SUM(CAST(Amount AS DECIMAL(10,2))) as total_refund_amount,
|
||||
AVG(CAST(Amount AS DECIMAL(10,2))) as avg_refund_amount,
|
||||
MAX(CAST(Amount AS DECIMAL(10,2))) as max_refund_amount,
|
||||
MIN(CAST(Amount AS DECIMAL(10,2))) as min_refund_amount,
|
||||
COUNT(DISTINCT PatientId) as unique_patients,
|
||||
COUNT(DISTINCT HisOperCode) as unique_operators,
|
||||
COUNT(DISTINCT PayType) as pay_type_count,
|
||||
COUNT(DISTINCT TradingStatus) as refund_type_count
|
||||
FROM hisbill_history
|
||||
WHERE TradingStatus = '2'
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
<if test="payType != null and payType != ''">
|
||||
AND PayType = #{payType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取退款趋势数据 -->
|
||||
<select id="getRefundTrend" parameterType="HashMap" resultType="HashMap">
|
||||
SELECT
|
||||
DATE_FORMAT(trade_date, '%Y-%m-%d') as trend_date,
|
||||
COUNT(*) as daily_refund_count,
|
||||
SUM(CAST(Amount AS DECIMAL(10,2))) as daily_refund_amount,
|
||||
AVG(CAST(Amount AS DECIMAL(10,2))) as daily_avg_amount
|
||||
FROM hisbill_history
|
||||
WHERE TradingStatus = '2'
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
<if test="payType != null and payType != ''">
|
||||
AND PayType = #{payType}
|
||||
</if>
|
||||
GROUP BY DATE_FORMAT(trade_date, '%Y-%m-%d')
|
||||
ORDER BY DATE_FORMAT(trade_date, '%Y-%m-%d') ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -190,10 +190,10 @@
|
||||
and PayType = #{payType}
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and TradeTime >= #{startTime}
|
||||
and (TradeTime >= #{startTime} or trade_date >= #{startTime})
|
||||
</if>
|
||||
<if test="endTime!=null and endTime!=''">
|
||||
and TradeTime <= #{endTime}
|
||||
and (TradeTime <= #{endTime} or trade_date <= #{endTime})
|
||||
</if>
|
||||
<if test="likeFiled!=null and likeFiled!=''">
|
||||
and PlatformTransId like concat('%',concat(#{likeFiled},'%'))
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
select *
|
||||
from hisbill_history
|
||||
where trade_date = #{trade_date}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HISOPERCODE}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findHisDetailByParam" parameterType="HashMap" resultType="HashMap">
|
||||
@@ -44,6 +50,12 @@
|
||||
|
||||
from hisbills_history
|
||||
where trade_date=#{trade_date}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HISOPERCODE}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="tranID!=null and tranID!=''">
|
||||
and HisTransId=#{tranID}
|
||||
</if>
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
select hisoper_id, HisOperCode,user_name,modify_time
|
||||
from his_operator
|
||||
<where>
|
||||
<if test="is_active!=null and is_active!=''">
|
||||
and is_active=#{is_active}
|
||||
</if>
|
||||
is_active = 1
|
||||
<if test="likeFiled!=null and likeFiled!=''">
|
||||
and (HisOperCode like concat('%',concat(#{likeFiled},'%'))
|
||||
or user_name like concat('%',concat(#{likeFiled},'%'))
|
||||
@@ -24,6 +22,12 @@
|
||||
where HisOperCode = #{hisOperCode}
|
||||
</select>
|
||||
|
||||
<select id="findMilitaryOperators" parameterType="HashMap" resultType="HashMap">
|
||||
select HisOperCode
|
||||
from his_operator
|
||||
where is_active = 1 and user_name = '军保支付'
|
||||
</select>
|
||||
|
||||
<insert id="addOperator" parameterType="HashMap">
|
||||
insert into his_operator(HisOperCode, user_name, is_active, modify_time)
|
||||
values (#{hisOperCode}, #{userName}, #{is_active}, #{modify_time})
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
inner join bankbill_history b on a.PlatformTransId = b.C_YSDDH
|
||||
where b.C_JYRQ >= #{startTime}
|
||||
and b.C_JYRQ <= #{endTime}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and a.HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
group by b.C_ZFFS, b.C_JYRQ
|
||||
</select>
|
||||
|
||||
@@ -107,10 +113,17 @@
|
||||
, ''
|
||||
, '0'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
inner join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_YSDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
</insert>
|
||||
|
||||
<insert id="insertHisUnilateral" parameterType="HashMap">
|
||||
@@ -137,11 +150,18 @@
|
||||
, '1'
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
left join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_YSDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
where b.C_YSDDH is null
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
where b.C_SHDDH is null
|
||||
</insert>
|
||||
|
||||
<insert id="insertThirdUnilateral" parameterType="HashMap">
|
||||
@@ -168,10 +188,17 @@
|
||||
, '2'
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
right join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_YSDDH and a.TradingStatus = b.C_JYLX and a.Amount + 0 = b.C_JYJE + 0
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount + 0 = b.C_JYJE + 0
|
||||
where a.PlatformTransId is null
|
||||
</insert>
|
||||
|
||||
@@ -200,7 +227,14 @@
|
||||
, ''
|
||||
, '0'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
inner join
|
||||
(select * from cash_record where trade_date = #{trade_date}) b
|
||||
on a.HisOperCode = b.czyh
|
||||
@@ -231,7 +265,14 @@
|
||||
, '1'
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
left join
|
||||
(select * from cash_record where trade_date = #{trade_date}) b
|
||||
on a.HisOperCode = b.czyh
|
||||
@@ -263,7 +304,14 @@
|
||||
, '2'
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}) a
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
right join
|
||||
(select * from cash_record where trade_date = #{trade_date}) b
|
||||
on a.HisOperCode = b.czyh
|
||||
|
||||
124
src/main/resources/mapper/system/FinanceUserMapper.xml
Normal file
124
src/main/resources/mapper/system/FinanceUserMapper.xml
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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.system.FinanceUserMapper">
|
||||
|
||||
<!-- 查询财务人员列表 -->
|
||||
<select id="findFinanceUserPageList" parameterType="HashMap" resultType="com.saye.hospitalgd.model.FinanceUser">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
wechat_name as wechatName,
|
||||
phone,
|
||||
open_id as openId,
|
||||
is_active as isActive,
|
||||
create_time as createTime,
|
||||
modify_time as modifyTime,
|
||||
remark
|
||||
FROM finance_user
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="wechatName != null and wechatName != ''">
|
||||
AND wechat_name LIKE CONCAT('%', #{wechatName}, '%')
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
AND phone LIKE CONCAT('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="isActive != null and isActive != ''">
|
||||
AND is_active = #{isActive}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 添加财务人员 -->
|
||||
<insert id="addFinanceUser" parameterType="com.saye.hospitalgd.model.FinanceUser">
|
||||
INSERT INTO finance_user (
|
||||
id,
|
||||
name,
|
||||
wechat_name,
|
||||
phone,
|
||||
open_id,
|
||||
is_active,
|
||||
create_time,
|
||||
modify_time,
|
||||
remark
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{name},
|
||||
#{wechatName},
|
||||
#{phone},
|
||||
#{openId},
|
||||
#{isActive},
|
||||
#{createTime},
|
||||
#{modifyTime},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 修改财务人员 -->
|
||||
<update id="updateFinanceUser" parameterType="com.saye.hospitalgd.model.FinanceUser">
|
||||
UPDATE finance_user SET
|
||||
name = #{name},
|
||||
wechat_name = #{wechatName},
|
||||
phone = #{phone},
|
||||
open_id = #{openId},
|
||||
is_active = #{isActive},
|
||||
modify_time = #{modifyTime},
|
||||
remark = #{remark}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除财务人员 -->
|
||||
<delete id="deleteFinanceUser" parameterType="String">
|
||||
DELETE FROM finance_user WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 根据ID查询财务人员 -->
|
||||
<select id="findFinanceUserById" parameterType="String" resultType="com.saye.hospitalgd.model.FinanceUser">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
wechat_name as wechatName,
|
||||
phone,
|
||||
open_id as openId,
|
||||
is_active as isActive,
|
||||
create_time as createTime,
|
||||
modify_time as modifyTime,
|
||||
remark
|
||||
FROM finance_user
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 获取所有启用的财务人员 -->
|
||||
<select id="findActiveFinanceUsers" resultType="com.saye.hospitalgd.model.FinanceUser">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
wechat_name as wechatName,
|
||||
phone,
|
||||
open_id as openId,
|
||||
is_active as isActive,
|
||||
create_time as createTime,
|
||||
modify_time as modifyTime,
|
||||
remark
|
||||
FROM finance_user
|
||||
WHERE is_active = '1'
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user