b2126fa83b0abcfbf83eee1b9fcf209cba9cf147.svn-base 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.synyi.edc.dao.ISqlbuilderDao" >
  4. <resultMap id="BaseResultMap" type="com.synyi.edc.pojo.Parameter" >
  5. <result column="org_code" property="orgCode" jdbcType="VARCHAR" />
  6. <result column="org_name" property="orgName" jdbcType="VARCHAR" />
  7. <result column="item_id" property="itemId" jdbcType="VARCHAR" />
  8. <result column="item_name" property="itemName" jdbcType="VARCHAR" />
  9. <result column="test_item_name" property="testItemName" jdbcType="VARCHAR" />
  10. <result column="text_value" property="textValue" jdbcType="VARCHAR" />
  11. <result column="numerical_value" property="numericalValue" jdbcType="VARCHAR" />
  12. <result column="reference_range" property="referenceRange" jdbcType="VARCHAR" />
  13. <result column="abnormal_flag_name" property="abnormalFlagName" jdbcType="VARCHAR" />
  14. <result column="drug_id" property="drugId" jdbcType="VARCHAR" />
  15. <result column="drug_name" property="drugName" jdbcType="VARCHAR" />
  16. <result column="parent" property="parent" jdbcType="VARCHAR" />
  17. </resultMap>
  18. <select id="getAllOrgInfo" resultMap="BaseResultMap" >
  19. select
  20. org_code,org_name from mdm.organization
  21. </select>
  22. <select id="getAllLabInfo" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  23. select item_id,item_name from mdm.lis_item where code_sys_id =197
  24. <if test="labName != null and labName != ''">
  25. and item_name like '%${labName}%'
  26. </if>
  27. </select>
  28. <select id="getSuggestionList" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  29. select distinct c.item_name,text_value,numerical_value,reference_range,abnormal_flag_name from
  30. lab.lab_report_result a join mdm.mdm_map b on a.test_item_id=b.source_id
  31. join mdm.lis_item c on b.map_id=c.item_id
  32. where b.md_type = 'lis_item' and c.code_sys_id =197
  33. <if test="itemId != null and itemId != ''">
  34. and c.item_id in (${itemId})
  35. </if>
  36. </select>
  37. <select id="getChildDrug" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  38. select id drug_id,parent, standard_ch drug_name from drug_new where parent = '${drugId}'
  39. </select>
  40. <select id="getAllDrugInfo" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  41. select drug_id,case when regular_name is null then trade_name else regular_name end drug_name
  42. from mdm.drug t where t.code_sys_id = 51
  43. <if test="drugName != null and drugName != ''">
  44. and (regular_name like '%${drugName}%' or trade_name like '%${drugName}%')
  45. </if>
  46. </select>
  47. <select id="getSuggestionByDrug" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  48. select id drug_id, standard_ch drug_name from drug_new
  49. <if test="drugName != null and drugName != ''">
  50. where original_name like '%${drugName}%' or standard_ch like '%${drugName}%'
  51. </if>
  52. </select>
  53. <select id="getAllDrugCategory" resultMap="BaseResultMap" >
  54. select id drug_id,standard_ch drug_name from drug_new where parent = 'drg000001'
  55. </select>
  56. <select id="getAllDrugPathInfo" resultMap="BaseResultMap" parameterType="com.synyi.edc.pojo.Parameter">
  57. <foreach collection="strList" item="str" index="idx">
  58. <if test="idx+1 != strSize">
  59. select id drug_id,parent,standard_ch drug_name from drug_new where parent = '${str}' union all
  60. </if>
  61. <if test="idx+1 == strSize">
  62. select id drug_id,parent,standard_ch drug_name from drug_new where parent = '${str}'
  63. </if>
  64. </foreach>
  65. </select>
  66. <select id="getParentPath" resultMap="BaseResultMap" >
  67. with RECURSIVE temp1 as (
  68. select * from drug_new where id ='${drugId}'
  69. union ALL
  70. select d.* from drug_new d ,temp1 where temp1.parent=d.id
  71. )select id drug_id,parent,standard_ch drug_name from temp1 where id != 'drg000001'
  72. </select>
  73. </mapper>