7992f51fe8ce5850e2dbe9baedd52040e80043ad.svn-base 4.4 KB

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