|
@@ -19,6 +19,108 @@ import java.util.List;
|
|
|
@Mapper
|
|
|
public interface XiangMuLuRuDao {
|
|
|
|
|
|
+
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT a.admiss_times, " +
|
|
|
+ " a.inpatient_no, " +
|
|
|
+ " a.ledger_sn, " +
|
|
|
+ " a.detail_sn, " +
|
|
|
+ " a.charge_date, " +
|
|
|
+ " a.op_id_code, " +
|
|
|
+ " d.name op_name, " +
|
|
|
+ " a.charge_code, " +
|
|
|
+ " a.charge_fee, " +
|
|
|
+ " a.charge_status , " +
|
|
|
+ " bill_item_code= b.bill_item_zy, " +
|
|
|
+ " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " spec=b.charge_unit, " +
|
|
|
+ " a.charge_code_mx, " +
|
|
|
+ " a.serial, " +
|
|
|
+ " price=0.0000, " +
|
|
|
+ " charge_amount=a.charge_amount, " +
|
|
|
+ " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
|
|
|
+ " self_flag=isnull(a.self_flag,0), " +
|
|
|
+ " suppress_flag=a.suppress_flag, " +
|
|
|
+ " group_no='00', " +
|
|
|
+ " separate_flag=a.separate_flag, " +
|
|
|
+ " ope_flag=a.ope_flag, " +
|
|
|
+ " drugname=c.name, " +
|
|
|
+ " a.ori_detail_sn " +
|
|
|
+ "FROM zy_detail_charge a ,zd_charge_item b,yp_zd_dict c , a_employee_mi d " +
|
|
|
+ "where a.charge_code=b.code and a.serial=c.serial and a.charge_code like 'BILL%' and c.code= a.charge_code_mx and a.ledger_sn > 0 " +
|
|
|
+ "and d.code = a.op_id_code and trans_flag_yb !=2 and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
|
|
|
+ "<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
+ "and charge_code_mx = #{chargeCode} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
+ "and convert(varchar(100),a.charge_date,23) = #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"dept != null and dept != '' \"> " +
|
|
|
+ "and a.exec_unit=#{dept} " +
|
|
|
+ "</if>" +
|
|
|
+ "</script>")
|
|
|
+ List<ZyDetailCharge> huanZheYaoPinFeiYong(@Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("chargeCode") String chargeCode,
|
|
|
+ @Param("infantFlag") int infantFlag,
|
|
|
+ @Param("startTime") String startTime,
|
|
|
+ @Param("orderNo") BigDecimal orderNo,
|
|
|
+ @Param("dept") String dept);
|
|
|
+
|
|
|
+
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT a.admiss_times, " +
|
|
|
+ " a.inpatient_no, " +
|
|
|
+ " a.ledger_sn, " +
|
|
|
+ " a.detail_sn, " +
|
|
|
+ " a.charge_date, " +
|
|
|
+ " a.op_id_code, " +
|
|
|
+ " c.name op_name, " +
|
|
|
+ " a.charge_code, " +
|
|
|
+ " a.charge_fee, " +
|
|
|
+ " a.charge_status , " +
|
|
|
+ " bill_item_code = b.bill_item_zy, " +
|
|
|
+ " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " spec=b.charge_unit, " +
|
|
|
+ " a.charge_code_mx, " +
|
|
|
+ " a.serial, " +
|
|
|
+ " price=0.0000, " +
|
|
|
+ " charge_amount=a.charge_amount, " +
|
|
|
+ " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
|
|
|
+ " self_flag=a.self_flag, " +
|
|
|
+ " suppress_flag=a.suppress_flag, " +
|
|
|
+ " group_no='00', " +
|
|
|
+ " separate_flag=a.separate_flag, " +
|
|
|
+ " ope_flag=a.ope_flag, " +
|
|
|
+ " drugname=b.name, " +
|
|
|
+ " a.ori_detail_sn " +
|
|
|
+ " FROM zy_detail_charge a ,zd_charge_item b , a_employee_mi c " +
|
|
|
+ " where a.inpatient_no= #{inpatientNo} and " +
|
|
|
+ " a.admiss_times= #{admissTimes} and " +
|
|
|
+ " a.infant_flag = #{infantFlag} and c.code = a.op_id_code and trans_flag_yb !=2 " +
|
|
|
+ " AND a.charge_code not like 'BILL%' and a.ledger_sn > 0 and a.charge_code=b.code " +
|
|
|
+ "<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
+ "and charge_code_mx = #{chargeCode} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
+ "and convert(varchar(100),a.charge_date,23) = #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"dept != null and dept != '' \"> " +
|
|
|
+ "and a.exec_unit=#{dept} " +
|
|
|
+ "</if>" +
|
|
|
+ "</script>")
|
|
|
+ List<ZyDetailCharge> huanZheXiangMuFeiYong(@Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("chargeCode") String chargeCode,
|
|
|
+ @Param("infantFlag") int infantFlag,
|
|
|
+ @Param("startTime") String startTime,
|
|
|
+ @Param("orderNo") BigDecimal orderNo,
|
|
|
+ @Param("dept") String dept);
|
|
|
+
|
|
|
/**
|
|
|
* 获取患者的费用
|
|
|
*
|
|
@@ -48,7 +150,7 @@ public interface XiangMuLuRuDao {
|
|
|
" price=0.0000, " +
|
|
|
" charge_amount=a.charge_amount, " +
|
|
|
" exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
- " dept_code = (select name from zd_unit_code where code = a.dept_code) , " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
|
|
|
" self_flag=isnull(a.self_flag,0), " +
|
|
|
" suppress_flag=a.suppress_flag, " +
|
|
|
" group_no='00', " +
|
|
@@ -82,9 +184,8 @@ public interface XiangMuLuRuDao {
|
|
|
"</otherwise>" +
|
|
|
"</choose>" +
|
|
|
"</if>" +
|
|
|
-
|
|
|
- " a.serial=c.serial and " +
|
|
|
- " c.code= a.charge_code_mx and a.charge_code like 'BILL%' and " +
|
|
|
+ " a.serial=c.serial and a.charge_code like 'BILL%' and " +
|
|
|
+ " c.code= a.charge_code_mx and a.ledger_sn > 0 and " +
|
|
|
" a.infant_flag = #{infantFlag} and d.code = a.op_id_code and trans_flag_yb !=2 " +
|
|
|
"union " +
|
|
|
"SELECT a.admiss_times, " +
|
|
@@ -106,7 +207,7 @@ public interface XiangMuLuRuDao {
|
|
|
" price=0.0000, " +
|
|
|
" charge_amount=a.charge_amount, " +
|
|
|
" exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
- " ward_code = (select name from zd_unit_code where code = a.ward_code) , " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
|
|
|
" self_flag=a.self_flag, " +
|
|
|
" suppress_flag=a.suppress_flag, " +
|
|
|
" group_no='00', " +
|
|
@@ -140,8 +241,8 @@ public interface XiangMuLuRuDao {
|
|
|
"</otherwise>" +
|
|
|
"</choose>" +
|
|
|
"</if>" +
|
|
|
- " a.charge_code not like 'BILL%' and " +
|
|
|
- " a.infant_flag = #{infantFlag} and c.code = a.op_id_code and trans_flag_yb !=2 ) temp" +
|
|
|
+ "a.infant_flag = #{infantFlag} and c.code = a.op_id_code and trans_flag_yb !=2 AND a.charge_code not like 'BILL%' " +
|
|
|
+ "and a.ledger_sn > 0 ) temp" +
|
|
|
"</script>")
|
|
|
List<ZyDetailCharge> getHuanZheFeiYong(@Param("inpatientNo") String inpatientNo,
|
|
|
@Param("admissTimes") Integer admissTimes,
|
|
@@ -161,15 +262,14 @@ public interface XiangMuLuRuDao {
|
|
|
* @param pyCode 拼音编码
|
|
|
* @return 获取项目的名称和code
|
|
|
*/
|
|
|
- @Select("select code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
|
|
|
+ @Select("select distinct code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
|
|
|
"union all " +
|
|
|
- "select code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
|
|
|
+ "select distinct code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
|
|
|
List<GetDropdownBox> getChargeCode(String pyCode);
|
|
|
|
|
|
/**
|
|
|
* @param inpatientNo 住院次数
|
|
|
* @param admissTimes 住院号
|
|
|
- * @param ledgerSn 结算次数
|
|
|
* @param list 需要退费的流水号
|
|
|
* @return 获取患者的全部详细信息 因为要生成一条一样的数据 只是 费用和数量不一致 以及录入人 和 录入时间
|
|
|
*/
|
|
@@ -213,7 +313,7 @@ public interface XiangMuLuRuDao {
|
|
|
" refer_physician, " +
|
|
|
" consult_physician, " +
|
|
|
" ori_detail_sn" +
|
|
|
- " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and detail_sn in " +
|
|
|
+ " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn > 0 and detail_sn in " +
|
|
|
"<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
|
|
|
"#{item.detailSn}" +
|
|
|
"</foreach>" +
|
|
@@ -227,7 +327,6 @@ public interface XiangMuLuRuDao {
|
|
|
*
|
|
|
* @param inpatientNo 住院号
|
|
|
* @param admissTimes 住院次数
|
|
|
- * @param ledgerSn 结算次数
|
|
|
* @param list 流水号
|
|
|
* @return 返回 已经退过费用的数据
|
|
|
*/
|
|
@@ -340,7 +439,7 @@ public interface XiangMuLuRuDao {
|
|
|
*/
|
|
|
@Select("SELECT charge_name=RTRIM(b.name), " +
|
|
|
" pattern_name=zy_charge_pattern.pattern_name, " +
|
|
|
- " charge_code=b.code, " +
|
|
|
+ " charge_code_mx=b.code, " +
|
|
|
" spec=charge_unit, " +
|
|
|
" group_no='00', " +
|
|
|
" serial='00', " +
|
|
@@ -369,13 +468,12 @@ public interface XiangMuLuRuDao {
|
|
|
"WHERE ( zy_charge_pattern.pattern_name = #{patternName}) and " +
|
|
|
" zy_charge_pattern.op_id_code=#{opIdCode} and " +
|
|
|
" zy_charge_pattern.charge_code=b.code and " +
|
|
|
- " (isnull(zy_charge_pattern.group_no,'00')='00' or zy_charge_pattern.group_no='') and " +
|
|
|
" (isnull(b.del_flag,'0') <> '1' ) and " +
|
|
|
" zy_charge_pattern.exec_unit*=c.code " +
|
|
|
"union all " +
|
|
|
"SELECT charge_name=RTRIM(d.name), " +
|
|
|
" pattern_name=zy_charge_pattern.pattern_name, " +
|
|
|
- " charge_code=b.charge_code, " +
|
|
|
+ " charge_code_mx=b.charge_code, " +
|
|
|
" spec=d.specification, " +
|
|
|
" group_no=b.group_no, " +
|
|
|
" serial=isnull(b.serial,'01'), " +
|
|
@@ -403,7 +501,6 @@ public interface XiangMuLuRuDao {
|
|
|
"FROM zy_charge_pattern ,zd_unit_code c,yp_base_yf b,yp_zd_dict d " +
|
|
|
"WHERE ( zy_charge_pattern.pattern_name = #{patternName}) and " +
|
|
|
" zy_charge_pattern.op_id_code=#{opIdCode} and " +
|
|
|
- " zy_charge_pattern.group_no='00' and " +
|
|
|
" zy_charge_pattern.group_no=b.group_no and " +
|
|
|
" zy_charge_pattern.charge_code=b.charge_code and " +
|
|
|
" isnull(zy_charge_pattern.serial,'01')=b.serial and " +
|
|
@@ -449,6 +546,37 @@ public interface XiangMuLuRuDao {
|
|
|
" (a.py_code like #{pyCode} or a.code like #{pyCode} or a.name like #{pyCode})")
|
|
|
List<ZyDetailCharge> queryXiangMu(String pyCode);
|
|
|
|
|
|
+
|
|
|
+ @Select("SELECT distinct a.code charge_code_mx, " +
|
|
|
+ " charge_code = (select charge_code from zy_bill_item where a.bill_item_zy = zy_bill_item.code), " +
|
|
|
+ " a.serial, " +
|
|
|
+ " RTRIM(a.name) charge_name, " +
|
|
|
+ " a.pack_size amount, " +
|
|
|
+ " charge_amount=a.pack_retprice, " +
|
|
|
+ " spec=a.specification, " +
|
|
|
+ " a.drug_flag , " +
|
|
|
+ " a.fix_price, " +
|
|
|
+ " c.stock_amount, " +
|
|
|
+ " self_flag=isnull(a.self_flag,'0'), " +
|
|
|
+ " suppress_flag=a.suprice_flag, " +
|
|
|
+ " group_no=c.group_no, " +
|
|
|
+ " bill_item_code=a.bill_item_zy, " +
|
|
|
+ " bill_item_name=(select name from zy_bill_item where code = a.bill_item_zy), " +
|
|
|
+ " ybbz=a.yb_comment_new, " +
|
|
|
+ " yblx=(select name from yp_zd_yb_type where code=a.yb_flag_new), " +
|
|
|
+ " xnh=a.xnh_flag " +
|
|
|
+ "FROM yp_zd_dict a ,yp_print_name b , " +
|
|
|
+ " yp_base_yf c " +
|
|
|
+ "where " +
|
|
|
+ "(a.py_code like #{pyCode} or a.name like #{pyCode} or a.code like #{pyCode}) and" +
|
|
|
+ " a.code=b.charge_code and " +
|
|
|
+ " a.code=c.charge_code and " +
|
|
|
+ " a.serial=c.serial and " +
|
|
|
+ " c.visible_flag_mz <> '1' and " +
|
|
|
+ " c.visible_flag_zy <> '1' and " +
|
|
|
+ " c.group_no='73'")
|
|
|
+ List<ZyDetailCharge> queryYaoPin(String pyCode);
|
|
|
+
|
|
|
/**
|
|
|
* 插入项目录入费用
|
|
|
*
|
|
@@ -460,14 +588,22 @@ public interface XiangMuLuRuDao {
|
|
|
" , op_id_code, charge_code, infant_flag, charge_status, charge_fee " +
|
|
|
" , self_flag, separate_flag, suppress_flag, ward_code, dept_code " +
|
|
|
" , order_no, ope_flag, exec_unit, charge_amount, gen_time " +
|
|
|
- " , zy_serial_no, charge_code_mx, serial) " +
|
|
|
+ " , zy_serial_no, charge_code_mx, serial,ss_code,yb_self_flag,refer_physician) " +
|
|
|
"VALUES " +
|
|
|
"<foreach collection='list' item='item' separator=','>" +
|
|
|
"(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, 1, #{item.detailSn}, getdate() " +
|
|
|
" , #{zyDetailCharge.opIdCode}, #{item.chargeCode}, #{infantFlag}, '2', cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) " +
|
|
|
" , '0', '0', NULL, #{zyDetailCharge.ward}, #{zyDetailCharge.dept} " +
|
|
|
" , 0, '0', #{item.deptCode}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)), getdate() " +
|
|
|
- " , #{zyDetailCharge.zySerialNo}, #{item.chargeCodeMx}, '00')" +
|
|
|
+ " , #{zyDetailCharge.zySerialNo}, #{item.chargeCodeMx}, #{item.serial},#{zyDetailCharge.ssCode}," +
|
|
|
+ // 是否医保报销 标志 默认为空值
|
|
|
+ "<if test=\"item.ybSelfFlag == null\">" +
|
|
|
+ "0" +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"item.ybSelfFlag != null\">" +
|
|
|
+ "#{item.ybSelfFlag}" +
|
|
|
+ "</if>" +
|
|
|
+ ",#{zyDetailCharge.referPhysician})" +
|
|
|
"</foreach>" +
|
|
|
"</script>")
|
|
|
void chaRuFeiYong(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
|
|
@@ -484,7 +620,7 @@ public interface XiangMuLuRuDao {
|
|
|
@Update("<script>" +
|
|
|
"update zy_actpatient " +
|
|
|
"<trim prefix='set' suffixOverrides=','> " +
|
|
|
- "total_charge = total_charge + #{fy.totalCharge} ,\n" +
|
|
|
+ "total_charge = total_charge + #{fy.totalCharge} , " +
|
|
|
"balance = balance - #{fy.totalCharge}," +
|
|
|
"<if test=\"fy.charge1 !=null \">" +
|
|
|
"charge1 =charge1 + #{fy.charge1} ," +
|
|
@@ -637,7 +773,7 @@ public interface XiangMuLuRuDao {
|
|
|
" )" +
|
|
|
" VALUES " +
|
|
|
"<foreach collection='param.list' item='item' index='index' separator=','>" +
|
|
|
- "( substring(#{item.chargeName},0,15) , #{param.name} , #{item.chargeCode} , '00', '00', cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)) , " +
|
|
|
+ "( substring(#{item.chargeName},0,15) , #{param.name} , #{item.chargeCodeMx} , #{item.groupNo}, #{item.serial}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)) , " +
|
|
|
"'0', '0', '0', '0', 1, 1, 1, 1, 1, #{index} + 1 , #{param.opIdCode} , #{param.pyCode} , #{param.dCode} , cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) ," +
|
|
|
" #{param.deptCode} , " +
|
|
|
"#{param.defaultNo} )" +
|
|
@@ -689,4 +825,8 @@ public interface XiangMuLuRuDao {
|
|
|
@Select("select code,rtrim(name) name from zd_unit_code where code like '8%'")
|
|
|
List<GetDropdownBox> getWard();
|
|
|
|
|
|
+
|
|
|
+ @Select("SELECT small_dept code,name=(select name from zd_unit_code where code = small_dept) FROM zd_dept_all where dept = #{dept}")
|
|
|
+ List<GetDropdownBox> getBingQuDuiYingKeShi(@Param("dept") String dept);
|
|
|
+
|
|
|
}
|