CostIncomeGroupMapper.xml 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.imed.costaccount.mapper.CostIncomeGroupMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.imed.costaccount.model.CostIncomeGroup" id="costIncomeGroupMap">
  6. <result property="id" jdbcType="BIGINT" column="id"/>
  7. <result property="openDepartmentCode" column="open_department_code"/>
  8. <result property="openDepartmentName" column="open_department_name"/>
  9. <result property="openResponsibilityCode" column="open_responsibility_code"/>
  10. <result property="openResponsibilityName" column="open_responsibility_name"/>
  11. <result property="startDepartmentCode" column="start_department_code"/>
  12. <result property="startDepartmentName" column="start_department_name"/>
  13. <result property="startResponsibilityCode" column="start_responsibility_code"/>
  14. <result property="startResponsibilityName" column="start_responsibility_name"/>
  15. <result property="productCode" column="product_code"/>
  16. <result property="productName" column="product_name"/>
  17. <result property="accountCode" column="account_code"/>
  18. <result property="accountName" column="account_name"/>
  19. <result property="openDepartmentAmount" column="open_department_amount"/>
  20. <result property="startDepartmentAmount" column="start_department_amount"/>
  21. <result property="amount" column="amount"/>
  22. <result property="hospId" column="hosp_id"/>
  23. <result property="fileId" column="file_id"/>
  24. <result property="doctorNumber" column="doctor_number"/>
  25. <result property="doctorName" column="doctor_name"/>
  26. <result property="patientId" column="patient_id"/>
  27. <result property="outpatientId" column="outpatient_id"/>
  28. <result property="patientName" column="patient_name"/>
  29. <result property="patientFee" column="patient_fee"/>
  30. <result property="receiptFee" column="receipt_fee"/>
  31. <result property="totalNumber" column="total_number"/>
  32. <result property="unit" column="unit"/>
  33. <result property="feeDatetime" column="fee_datetime"/>
  34. <result property="afterIncomeGroup" column="after_income_group"/>
  35. <result property="dateYear" column="date_year"/>
  36. <result property="dateMonth" column="date_month"/>
  37. <result property="createTime" column="create_time"/>
  38. <result property="deleteTime" column="delete_time"/>
  39. </resultMap>
  40. <sql id="Base_Column_List">
  41. id
  42. , open_department_code, open_department_name, open_responsibility_code, open_responsibility_name, start_department_code, start_department_name, start_responsibility_code,
  43. start_responsibility_name, product_code , product_name, account_code, account_name, open_department_amount, start_department_amount,amount,hosp_id,file_id,
  44. doctor_number ,doctor_name,patient_id,outpatient_id,patient_name, patient_fee ,receipt_fee ,total_number ,unit ,fee_datetime,date_year,date_month,create_time,delete_time
  45. </sql>
  46. <select id="countMoney" resultType="com.imed.costaccount.model.vo.CostIncomeGroupAllAmountVO">
  47. select
  48. <include refid="Base_Column_List"/>
  49. ,group_concat(amount) as allMoney
  50. from cost_income_group
  51. where id IN
  52. <foreach close=")" collection="idList" item="item" open="(" separator=",">
  53. #{item}
  54. </foreach>
  55. group by open_department_code , start_department_code , product_code
  56. </select>
  57. <select id="getCollections" resultType="com.imed.costaccount.model.vo.CollectionVO">
  58. select file_id, date_year as `year`, date_month as `month`, sum(amount) as amount
  59. from cost_income_group
  60. where hosp_id = #{hospId} and delete_time = 0
  61. <if test="date != null and date != ''">
  62. and date_year = YEAR(concat(#{date},'01')) and date_month = MONTH(concat(#{date},'01'))
  63. </if>
  64. group by date_month, date_year
  65. limit #{startIndex},#{pageSize}
  66. </select>
  67. <select id="getCollectionCount" resultType="java.lang.Integer">
  68. select count(*) from (
  69. select id
  70. from cost_income_group
  71. where hosp_id = #{hospId} and delete_time = 0
  72. <if test="date != null and date != ''">
  73. and date_year = YEAR(concat(#{date},'01')) and date_month = MONTH(concat(#{date},'01'))
  74. </if>
  75. group by date_month, date_year
  76. ) t
  77. </select>
  78. <select id="selectListAndMoney" resultType="com.imed.costaccount.model.vo.CostIncomeGroupAllAmountBO">
  79. select * , group_concat(amount) as allMoney
  80. from cost_income_group
  81. where date_year = #{year}
  82. and date_month = #{month}
  83. and hosp_id = #{hospId}
  84. and delete_time = 0
  85. </select>
  86. </mapper>