KlConceptMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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.diagbot.mapper.KlConceptMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.KlConcept">
  6. <id column="id" property="id" />
  7. <result column="is_deleted" property="isDeleted" />
  8. <result column="gmt_create" property="gmtCreate" />
  9. <result column="gmt_modified" property="gmtModified" />
  10. <result column="creator" property="creator" />
  11. <result column="modifier" property="modifier" />
  12. <result column="lib_id" property="libId" />
  13. <result column="lib_name" property="libName" />
  14. <result column="lib_type" property="libType" />
  15. <result column="status" property="status" />
  16. </resultMap>
  17. <select id="index" resultType="com.diagbot.dto.IndexDTO">
  18. SELECT DISTINCT
  19. t.id as id,
  20. t.lib_name as name
  21. <if test="typeId!=null and typeId==100">
  22. ,t.code as code
  23. </if>
  24. <if test="typeId!=null and typeId==127">
  25. ,t.code as code
  26. </if>
  27. <if test="typeId!=null and typeId==128">
  28. ,t.code as code
  29. </if>
  30. <if test="typeId!=null and typeId==106">
  31. ,t.code as code
  32. </if>
  33. <if test="typeId!=null and typeId==108">
  34. ,
  35. t1.max_value as `maxValue`,
  36. t1.min_value as minValue,
  37. t1.unit as units,
  38. t1.type as `range`,
  39. t4.lib_name AS packName,
  40. t4.id as packId
  41. </if>
  42. FROM
  43. (
  44. SELECT DISTINCT
  45. b.id,
  46. b.lib_name
  47. <if test="typeId!=null and typeId==100">
  48. ,c.icd10_code as code
  49. </if>
  50. <if test="typeId!=null and typeId==127">
  51. ,c.code as code
  52. </if>
  53. <if test="typeId!=null and typeId==128">
  54. ,c.code as code
  55. </if>
  56. <if test="typeId!=null and typeId==106">
  57. ,c.operation_code as code
  58. </if>
  59. FROM
  60. kl_library_info a,
  61. kl_concept b
  62. <if test="typeId!=null and typeId==100">
  63. left join kl_disease c
  64. on c.is_deleted = 'N'
  65. and b.id = c.concept_id
  66. </if>
  67. <if test="typeId!=null and typeId==127">
  68. left join kl_tcm_disease c
  69. on c.is_deleted = 'N'
  70. and b.id = c.concept_id
  71. </if>
  72. <if test="typeId!=null and typeId==128">
  73. left join kl_tcm_syndrome c
  74. on c.is_deleted = 'N'
  75. and b.id = c.concept_id
  76. </if>
  77. <if test="typeId!=null and typeId==106">
  78. LEFT JOIN `kl_operation` c
  79. ON c.is_deleted = 'N'
  80. AND b.id = c.concept_id
  81. </if>
  82. WHERE
  83. a.is_deleted = 'N'
  84. AND b.is_deleted = 'N'
  85. AND a.concept_id = b.id
  86. AND a.id = b.lib_id
  87. AND b.status = 1
  88. <if test="inputStr!=null and inputStr!=''">
  89. AND ( a.`name` = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr})
  90. <if test="typeId!=null and typeId==100">
  91. OR LOWER(c.icd10_code) = LOWER(#{inputStr})
  92. </if>
  93. <if test="typeId!=null and typeId==127">
  94. OR LOWER(c.code) = LOWER(#{inputStr})
  95. </if>
  96. <if test="typeId!=null and typeId==128">
  97. OR LOWER(c.code) = LOWER(#{inputStr})
  98. </if>
  99. <if test="typeId!=null and typeId==106">
  100. OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
  101. </if>
  102. )
  103. </if>
  104. <if test="typeIds != null and typeIds.size > 0">
  105. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
  106. a.type_id =#{typeId}
  107. </foreach>
  108. </if>
  109. UNION
  110. SELECT DISTINCT
  111. b.id,
  112. b.lib_name
  113. <if test="typeId!=null and typeId==100">
  114. ,c.icd10_code as code
  115. </if>
  116. <if test="typeId!=null and typeId==127">
  117. ,c.code as code
  118. </if>
  119. <if test="typeId!=null and typeId==128">
  120. ,c.code as code
  121. </if>
  122. <if test="typeId!=null and typeId==106">
  123. ,c.operation_code as code
  124. </if>
  125. FROM
  126. kl_library_info a,
  127. kl_concept b
  128. <if test="typeId!=null and typeId==100">
  129. left join kl_disease c
  130. on c.is_deleted = 'N'
  131. and b.id = c.concept_id
  132. </if>
  133. <if test="typeId!=null and typeId==127">
  134. left join kl_tcm_disease c
  135. on c.is_deleted = 'N'
  136. and b.id = c.concept_id
  137. </if>
  138. <if test="typeId!=null and typeId==128">
  139. left join kl_tcm_syndrome c
  140. on c.is_deleted = 'N'
  141. and b.id = c.concept_id
  142. </if>
  143. <if test="typeId!=null and typeId==106">
  144. LEFT JOIN `kl_operation` c
  145. ON c.is_deleted = 'N'
  146. AND b.id = c.concept_id
  147. </if>
  148. WHERE
  149. a.is_deleted = 'N'
  150. AND b.is_deleted = 'N'
  151. AND a.concept_id = b.id
  152. AND a.id = b.lib_id
  153. AND b.status = 1
  154. <if test="inputStr!=null and inputStr!=''">
  155. AND ( a.`name` LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER(concat(#{inputStr},'%'))
  156. <if test="typeId!=null and typeId==100">
  157. OR LOWER(c.icd10_code) LIKE LOWER(concat(#{inputStr},'%'))
  158. </if>
  159. <if test="typeId!=null and typeId==127">
  160. OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
  161. </if>
  162. <if test="typeId!=null and typeId==128">
  163. OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
  164. </if>
  165. <if test="typeId!=null and typeId==106">
  166. OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
  167. </if>
  168. )
  169. </if>
  170. <if test="typeIds != null and typeIds.size > 0">
  171. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
  172. a.type_id =#{typeId}
  173. </foreach>
  174. </if>
  175. UNION
  176. SELECT DISTINCT
  177. b.id,
  178. b.lib_name
  179. <if test="typeId!=null and typeId==100">
  180. ,c.icd10_code as code
  181. </if>
  182. <if test="typeId!=null and typeId==127">
  183. ,c.code as code
  184. </if>
  185. <if test="typeId!=null and typeId==128">
  186. ,c.code as code
  187. </if>
  188. <if test="typeId!=null and typeId==106">
  189. ,c.operation_code as code
  190. </if>
  191. FROM
  192. kl_library_info a,
  193. kl_concept b
  194. <if test="typeId!=null and typeId==100">
  195. left join kl_disease c
  196. on c.is_deleted = 'N'
  197. and b.id = c.concept_id
  198. </if>
  199. <if test="typeId!=null and typeId==127">
  200. left join kl_tcm_disease c
  201. on c.is_deleted = 'N'
  202. and b.id = c.concept_id
  203. </if>
  204. <if test="typeId!=null and typeId==128">
  205. left join kl_tcm_syndrome c
  206. on c.is_deleted = 'N'
  207. and b.id = c.concept_id
  208. </if>
  209. <if test="typeId!=null and typeId==106">
  210. LEFT JOIN `kl_operation` c
  211. ON c.is_deleted = 'N'
  212. AND b.id = c.concept_id
  213. </if>
  214. WHERE
  215. a.is_deleted = 'N'
  216. AND b.is_deleted = 'N'
  217. AND a.concept_id = b.id
  218. AND a.id = b.lib_id
  219. AND b.status = 1
  220. <if test="inputStr!=null and inputStr!=''">
  221. AND ( a.`name` LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat('%',#{inputStr},'%'))
  222. <if test="typeId!=null and typeId==100">
  223. OR LOWER(c.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
  224. </if>
  225. <if test="typeId!=null and typeId==127">
  226. OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
  227. </if>
  228. <if test="typeId!=null and typeId==128">
  229. OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
  230. </if>
  231. <if test="typeId!=null and typeId==106">
  232. OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
  233. </if>
  234. )
  235. </if>
  236. <if test="typeIds != null and typeIds.size > 0">
  237. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
  238. a.type_id =#{typeId}
  239. </foreach>
  240. </if>
  241. ) t
  242. <if test="typeId!=null and typeId==108">
  243. LEFT JOIN kl_lis t1 ON t.id = t1.concept_id
  244. AND t1.is_deleted = 'N'
  245. LEFT JOIN kl_relation t3 ON t.id = t3.end_id
  246. AND t3.relation_id = 600
  247. AND t3.is_deleted = 'N'
  248. LEFT JOIN kl_concept t4 ON t3.start_id = t4.id
  249. AND t4.lib_type = 107
  250. AND t4.is_deleted = 'N'
  251. </if>
  252. <if test="size!=null">
  253. LIMIT #{size}
  254. </if>
  255. </select>
  256. <select id="staticIndex" resultType="com.diagbot.dto.StaticKnowledgeIndexDTO">
  257. SELECT
  258. f.*
  259. FROM
  260. (
  261. SELECT
  262. s.moduleNo,
  263. s.id,
  264. s.name,
  265. s.retrievalName,
  266. s.isConcept,
  267. s.type,
  268. s.typeName,
  269. s.code,
  270. IF( s2.concept_id IS NOT NULL, s2.concept_id, s3.concept_id ) AS conceptId,
  271. s1.clinical_pathway_name,
  272. s1.notice_name,
  273. s1.`status` AS status,
  274. IF( count( s2.id )> 0, 1, IF( count( s3.id )>0 ,1 ,0 ) ) AS hasInfo ,
  275. IF( sum( IF ( FIND_IN_SET( 1, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasStaticKnowledge,
  276. IF( sum( IF ( FIND_IN_SET( 2, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasNotice,
  277. IF( sum( IF ( FIND_IN_SET( 3, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasClinicalPathway,
  278. IF( sum( IF ( FIND_IN_SET( 4, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasTreatInfo
  279. FROM
  280. (SELECT
  281. o1.*
  282. FROM
  283. (
  284. SELECT
  285. t.moduleNo,
  286. t.id,
  287. t.NAME,
  288. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  289. t.isConcept,
  290. t.type,
  291. t.typeName,
  292. t1.icd10_code AS code
  293. FROM
  294. (
  295. SELECT
  296. concat( '1', b.lib_type ) AS moduleNo,
  297. a.NAME AS retrievalName,
  298. a.spell AS spell,
  299. a.is_concept AS isConcept,
  300. b.id AS id,
  301. b.lib_name AS NAME,
  302. b.lib_type AS type,
  303. c.NAME AS typeName
  304. FROM
  305. kl_library_info a,
  306. kl_concept b,
  307. kl_lexicon c
  308. WHERE
  309. a.is_deleted = 'N'
  310. AND b.is_deleted = 'N'
  311. AND c.is_deleted = 'N'
  312. AND a.concept_id = b.id
  313. AND b.lib_type = c.code
  314. AND b.`status` = 1
  315. <if test="typeIds != null and typeIds.size > 0">
  316. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
  317. a.type_id =#{typeId}
  318. </foreach>AND ( a.name = #{inputStr}</if>
  319. <if test="inputStr!=null and inputStr!=''">OR LOWER(a.spell
  320. ) = LOWER(#{inputStr}))
  321. </if>
  322. ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
  323. UNION
  324. SELECT
  325. t.moduleNo,
  326. t.id,
  327. t.NAME,
  328. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  329. t.isConcept,
  330. t.type,
  331. t.typeName,
  332. t1.icd10_code AS code
  333. FROM
  334. (
  335. SELECT
  336. concat( '2', b.lib_type ) AS moduleNo,
  337. a.NAME AS retrievalName,
  338. a.spell AS spell,
  339. a.is_concept AS isConcept,
  340. b.id AS id,
  341. b.lib_name AS NAME,
  342. b.lib_type AS type,
  343. c.NAME AS typeName
  344. FROM
  345. kl_library_info a,
  346. kl_concept b,
  347. kl_lexicon c
  348. WHERE
  349. a.is_deleted = 'N'
  350. AND b.is_deleted = 'N'
  351. AND c.is_deleted = 'N'
  352. AND a.concept_id = b.id
  353. AND b.lib_type = c.code
  354. AND b.`status` = 1
  355. <if test="typeIds != null and typeIds.size > 0">
  356. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
  357. a.type_id =#{typeId}
  358. </foreach>
  359. </if>
  360. <if test="inputStr!=null and inputStr!=''">
  361. AND ( a.name LIKE concat(#{inputStr},'%')
  362. OR LOWER(a.spell) LIKE LOWER( concat(#{inputStr},'%')))
  363. </if>
  364. ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
  365. UNION
  366. SELECT
  367. t.moduleNo,
  368. t.id,
  369. t.NAME,
  370. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  371. t.isConcept,
  372. t.type,
  373. t.typeName,
  374. t1.icd10_code AS code
  375. FROM
  376. (
  377. SELECT
  378. concat( '3', b.lib_type ) AS moduleNo,
  379. a.NAME AS retrievalName,
  380. a.spell AS spell,
  381. a.is_concept AS isConcept,
  382. b.id AS id,
  383. b.lib_name AS NAME,
  384. b.lib_type AS type,
  385. c.NAME AS typeName
  386. FROM
  387. kl_library_info a,
  388. kl_concept b,
  389. kl_lexicon c
  390. WHERE
  391. a.is_deleted = 'N'
  392. AND b.is_deleted = 'N'
  393. AND c.is_deleted = 'N'
  394. AND a.concept_id = b.id
  395. AND b.lib_type = c.code
  396. AND b.`status` = 1
  397. <if test="typeIds != null and typeIds.size > 0">
  398. <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
  399. a.type_id =#{typeId}
  400. </foreach>
  401. </if>
  402. <if test="inputStr!=null and inputStr!=''">
  403. AND ( a.name LIKE concat('%',#{inputStr},'%')
  404. OR LOWER(a.spell) LIKE LOWER( concat('%',#{inputStr},'%')))
  405. </if>
  406. ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
  407. <if test="typeIds.contains(107) or typeIds.contains(108)">
  408. UNION
  409. SELECT DISTINCT
  410. concat( '1', e.lib_type ) AS moduleNo,
  411. e.id AS id,
  412. e.lib_name AS NAME,
  413. b.lib_name AS retrievalName,
  414. 1 AS isConcept,
  415. e.lib_type AS type,
  416. c.name AS typeName,
  417. NULL AS code
  418. FROM
  419. kl_library_info a,
  420. kl_concept b,
  421. kl_lexicon c,
  422. kl_relation d,
  423. kl_concept e
  424. WHERE
  425. a.is_deleted = 'N'
  426. AND b.is_deleted = 'N'
  427. AND c.is_deleted = 'N'
  428. AND d.is_deleted = 'N'
  429. AND e.is_deleted = 'N'
  430. AND a.concept_id = b.id
  431. AND b.id = d.end_id
  432. AND e.id = d.start_id
  433. AND e.lib_type = c.code
  434. AND b.lib_type = 108
  435. AND e.lib_type = 107
  436. AND d.relation_id = 600
  437. AND b.`status` = 1
  438. <if test="inputStr!=null and inputStr!=''">
  439. AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr}))
  440. </if>
  441. UNION
  442. SELECT DISTINCT
  443. concat( '2', e.lib_type ) AS moduleNo,
  444. e.id AS id,
  445. e.lib_name AS NAME,
  446. b.lib_name AS retrievalName,
  447. 1 AS isConcept,
  448. e.lib_type AS type,
  449. c.name AS typeName,
  450. NULL AS code
  451. FROM
  452. kl_library_info a,
  453. kl_concept b,
  454. kl_lexicon c,
  455. kl_relation d,
  456. kl_concept e
  457. WHERE
  458. a.is_deleted = 'N'
  459. AND b.is_deleted = 'N'
  460. AND c.is_deleted = 'N'
  461. AND d.is_deleted = 'N'
  462. AND e.is_deleted = 'N'
  463. AND a.concept_id = b.id
  464. AND b.id = d.end_id
  465. AND e.id = d.start_id
  466. AND e.lib_type = c.code
  467. AND b.lib_type = 108
  468. AND e.lib_type = 107
  469. AND d.relation_id = 600
  470. AND b.`status` = 1
  471. <if test="inputStr!=null and inputStr!=''">
  472. AND ( a.name LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat(#{inputStr},'%')))
  473. </if>
  474. UNION
  475. SELECT DISTINCT
  476. concat( '3', e.lib_type ) AS moduleNo,
  477. e.id AS id,
  478. e.lib_name AS NAME,
  479. b.lib_name AS retrievalName,
  480. 1 AS isConcept,
  481. e.lib_type AS type,
  482. c.name AS typeName,
  483. NULL AS code
  484. FROM
  485. kl_library_info a,
  486. kl_concept b,
  487. kl_lexicon c,
  488. kl_relation d,
  489. kl_concept e
  490. WHERE
  491. a.is_deleted = 'N'
  492. AND b.is_deleted = 'N'
  493. AND c.is_deleted = 'N'
  494. AND d.is_deleted = 'N'
  495. AND e.is_deleted = 'N'
  496. AND a.concept_id = b.id
  497. AND b.id = d.end_id
  498. AND e.id = d.start_id
  499. AND e.lib_type = c.code
  500. AND b.lib_type = 108
  501. AND e.lib_type = 107
  502. AND d.relation_id = 600
  503. AND b.`status` = 1
  504. <if test="inputStr!=null and inputStr!=''">
  505. AND ( a.name LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE
  506. LOWER( concat('%',#{inputStr},'%')))
  507. </if>
  508. </if>
  509. <if test="typeIds.contains(100) ">
  510. UNION
  511. SELECT
  512. t.moduleNo,
  513. t.id,
  514. t.NAME,
  515. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  516. t.isConcept,
  517. t.type,
  518. t.typeName,
  519. l1.icd10_code AS code
  520. FROM
  521. (
  522. SELECT
  523. concat( '1', b.lib_type ) AS moduleNo,
  524. a.NAME AS retrievalName,
  525. a.spell AS spell,
  526. a.is_concept AS isConcept,
  527. b.id AS id,
  528. b.lib_name AS NAME,
  529. b.lib_type AS type,
  530. c.NAME AS typeName
  531. FROM
  532. kl_library_info a,
  533. kl_concept b,
  534. kl_lexicon c
  535. WHERE
  536. a.is_deleted = 'N'
  537. AND b.is_deleted = 'N'
  538. AND c.is_deleted = 'N'
  539. AND a.concept_id = b.id
  540. AND b.lib_type = c.code
  541. AND b.`status` = 1
  542. AND a.type_id =100
  543. ) t
  544. LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
  545. AND l1.is_deleted = 'N'
  546. WHERE
  547. 1=1
  548. <if test="inputStr!=null and inputStr!=''">
  549. AND LOWER(l1.icd10_code) = LOWER(#{inputStr})
  550. </if>
  551. UNION
  552. SELECT
  553. t.moduleNo,
  554. t.id,
  555. t.NAME,
  556. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  557. t.isConcept,
  558. t.type,
  559. t.typeName,
  560. l1.icd10_code AS code
  561. FROM
  562. (
  563. SELECT
  564. concat( '2', b.lib_type ) AS moduleNo,
  565. a.NAME AS retrievalName,
  566. a.spell AS spell,
  567. a.is_concept AS isConcept,
  568. b.id AS id,
  569. b.lib_name AS NAME,
  570. b.lib_type AS type,
  571. c.NAME AS typeName
  572. FROM
  573. kl_library_info a,
  574. kl_concept b,
  575. kl_lexicon c
  576. WHERE
  577. a.is_deleted = 'N'
  578. AND b.is_deleted = 'N'
  579. AND c.is_deleted = 'N'
  580. AND a.concept_id = b.id
  581. AND b.lib_type = c.code
  582. AND b.`status` = 1
  583. AND a.type_id =100
  584. ) t
  585. LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
  586. AND l1.is_deleted = 'N'
  587. WHERE
  588. 1=1
  589. <if test="inputStr!=null and inputStr!=''">
  590. AND LOWER(l1.icd10_code) LIKE LOWER( concat(#{inputStr},'%'))
  591. </if>
  592. UNION
  593. SELECT
  594. t.moduleNo,
  595. t.id,
  596. t.NAME,
  597. IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
  598. t.isConcept,
  599. t.type,
  600. t.typeName,
  601. l1.icd10_code AS code
  602. FROM
  603. (
  604. SELECT
  605. concat( '3', b.lib_type ) AS moduleNo,
  606. a.NAME AS retrievalName,
  607. a.spell AS spell,
  608. a.is_concept AS isConcept,
  609. b.id AS id,
  610. b.lib_name AS NAME,
  611. b.lib_type AS type,
  612. c.NAME AS typeName
  613. FROM
  614. kl_library_info a,
  615. kl_concept b,
  616. kl_lexicon c
  617. WHERE
  618. a.is_deleted = 'N'
  619. AND b.is_deleted = 'N'
  620. AND c.is_deleted = 'N'
  621. AND a.concept_id = b.id
  622. AND b.lib_type = c.code
  623. AND b.`status` = 1
  624. AND a.type_id =100
  625. ) t
  626. LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
  627. AND l1.is_deleted = 'N'
  628. WHERE
  629. 1=1
  630. <if test="inputStr!=null and inputStr!=''">
  631. AND LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
  632. </if>
  633. </if>)o1
  634. order by o1.type asc,o1.moduleNo ASC,o1.isConcept DESC
  635. Limit 1000
  636. ) s
  637. LEFT JOIN kl_concept_static s1 ON s.id = s1.concept_id
  638. AND s1.is_deleted = 'N'
  639. LEFT JOIN kl_concept_detail s2 ON s.id = s2.concept_id
  640. AND s2.is_deleted = 'N'
  641. LEFT JOIN kl_concept_scale s3 ON s.id = s3.concept_id
  642. AND s3.is_deleted = 'N'
  643. GROUP BY s.id
  644. ) f
  645. WHERE
  646. 1 = 1
  647. <if test="hasInfo!=null ">
  648. <choose>
  649. <when test="hasInfo==0">
  650. AND f.conceptId IS NULL
  651. </when>
  652. <when test="hasInfo==1">
  653. AND f.conceptId IS NOT NULL
  654. </when>
  655. </choose>
  656. </if>
  657. <if test="size!=null">
  658. LIMIT #{size}
  659. </if>
  660. </select>
  661. <select id="getLisDetaisByNames" parameterType="com.diagbot.vo.KllisDetailVO" resultType="com.diagbot.dto.KllisDetailDTO">
  662. SELECT
  663. t1.lib_name,
  664. t1.id,
  665. t2.min_value,
  666. t2.max_value,
  667. t2.type,
  668. t2.unit
  669. FROM
  670. `kl_concept` t1,
  671. kl_lis t2
  672. WHERE
  673. t1.is_deleted = "N"
  674. AND t2.is_deleted = "N"
  675. AND t1.id = t2.concept_id
  676. AND t1.lib_type = 108
  677. AND t1.`status` = 1
  678. <if test="names != null and names.size > 0">
  679. and t1.lib_name in
  680. <foreach item="name" collection="names" open="(" separator="," close=")">
  681. #{name}
  682. </foreach>
  683. </if>
  684. </select>
  685. </mapper>