Advertisement
Guest User

Untitled

a guest
Aug 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.06 KB | None | 0 0
  1. SQL ошибка
  2. ERROR: function json_array_elements(integer) does not exist
  3. Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  4. Position: 3296
  5.  
  6. SQL-запрос
  7. select c.clinic_id, c.id, c.uid, c.patient_id, coalesce(i.surname, '') || coalesce(' ' || i.name, '') || coalesce(' ' || i.patr_name, ''), coalesce('№' || c.uid || ',', ''), (select extract_age_particularly(i.birth_dt)), c.open_date, c.close_date, (select get_bed_day_amount_n2o(c.id)), fin.id, fin.name, mdd.code, c.case_type_id, c.care_level_id,
  8. (select string_agg(mcsg.code, ';') from md_clinical_statistical_group mcsg where mcsg.id in (select step.csg_id from mc_step step where step.case_id = c.id))
  9. , lsr.name, ls.result_id, lscr.name, c.closing_step_id,
  10.  
  11. (select case when max(bsi.id) is not null then 1 else 2 end from fin_bill_spec_item bsi
  12. join fin_bill b on b.id = bsi.bill_id
  13. join sr_srv_rendered ssr on ssr.id = bsi.service_id
  14. where b.status_id <> 0 and ssr.md_case_id = c.id
  15. )
  16. , (select adr__get_element_as_text(
  17. (select pa.addr_id from pim_party_address pa
  18. inner join pim_party_addr_to_addr_type patat on pa.party_id = i.id and patat.party_address_id = pa.id and patat.address_type_id = 4
  19. limit 1), '(1,n,1)(2,s,0)(3,s,0)(4,s,0)(5,s,0)(6,s,0)(7,s,0)(8,s,0)(9,s,0)'))
  20. ,
  21. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  22. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  23. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  24. , coalesce('№' || c.uid || ', ', '') || i.surname || ' ' || i.name || ' ' || i.patr_name || ' (' || to_char(i.birth_dt, 'dd.MM.yyyy') || ')', ls.id, ls.is_autopsy, c.closing_step_id is not null,
  25. (select is_death from mc_step_result where id = ls.result_id)
  26. ,
  27. (select exists(select id from hospital.childbirth chb where chb.step_id in (select id from mc_step where case_id = c.id)))
  28. ,
  29. (select name from pim_department where id = (select hsp_department_id from mc_step where _case_mode_id = 2 and case_id = c.id and _is_last is true))
  30.  
  31. from mc_case c
  32. join mc_case_type ct on ct.id = c.case_type_id
  33. left join fin_funding_source_type fin on fin.id = c.funding_id
  34. left join mc_diagnosis mcd on mcd.id = c.main_diagnos_id
  35. left join md_diagnosis mdd on mdd .id = mcd.diagnos_id
  36.  
  37. left join mc_step ls on ls.id = c.closing_step_id
  38. left join mc_step_result lsr on lsr.id = ls.result_id
  39. left join mc_step_care_result lscr on lscr.id = ls.outcome_id
  40. left join pim_individual i on i.id = c.patient_id
  41.  
  42. where ct.case_mode_id = 2 and c.clinic_id=:clinicId and
  43. (:outcomeDate.begin::date is null and :outcomeDate.end::date is null or
  44. ((:outcomeDate.begin::date is null or c.close_date >= :outcomeDate.begin) and
  45. (:outcomeDate.end::date is null or c.close_date <= :outcomeDate.end)))
  46. and
  47. exists(select 1 from mc_step s where s._case_mode_id =2 and s.case_id = c.id and
  48. s.hsp_previous_id is not null and s.hsp_department_id in (select cast(json_array_elements(:department*.id) as integer)))
  49. and
  50. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  51. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  52. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  53. =:regimen.id
  54. order by c.open_date, c.id
  55. limit 15
  56.  
  57. Параметры
  58. regimen.id = 1
  59. clinicId = 438
  60. outcomeDate.begin = Thu Aug 24 00:00:00 MSK 2017
  61. outcomeDate.end = Thu Aug 24 00:00:00 MSK 2017
  62. department*.id = [32272]
  63. csg.id = null
  64. financialType.id = null
  65. patient.id = null
  66. caseType.id = null
  67. result.id = null
  68. chooseCases.id = null
  69. bedProfile.id = null
  70. bedDaysAmount = null
  71. uidForTitleInAutopsy = null
  72. uid = null
  73. admissionDate.end = null
  74. isAutopsy = null
  75. id = null
  76. step.id = null
  77. admissionDate.begin = null
  78. outcome = null
  79. hasChildbirth = null
  80. uidForTitle = null
  81. admissionDate = null
  82. address = null
  83. diagnosis = null
  84. careLevel.id = null
  85. caseState.id = null
  86. attendant.id = null
  87. dep.name = null
  88. financialType.name = null
  89. isDeath = null
  90. isClosed = null
  91. result.name = null
  92. department.id = null
  93. patient.name = null
  94. age = null
  95. csg.code = null
  96. hasBill.id = null
  97. outcomeDate = {begin=24.08.2017 00:00, end=24.08.2017 00:00}
  98.  
  99. Stacktrace
  100. net.n2oapp.framework.engine.exception.N2oSqlException: ERROR: function json_array_elements(integer) does not exist
  101. Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  102. Position: 3296
  103. at net.n2oapp.framework.engine.data.query.SqlQueryEngine.init(SqlQueryEngine.java:50)
  104. at net.n2oapp.framework.api.data.ComputationalQueryEngine.executeQuery(ComputationalQueryEngine.java:22)
  105. at net.n2oapp.framework.engine.processor.QueryProcessor.doQuery(QueryProcessor.java:126)
  106. at net.n2oapp.framework.engine.processor.QueryProcessor.executeQuery(QueryProcessor.java:67)
  107. at net.n2oapp.framework.engine.processor.QueryProcessor.execute(QueryProcessor.java:43)
  108. at net.n2oapp.framework.ui.controller.query.GetController.executeQuery(GetController.java:39)
  109. at net.n2oapp.framework.ui.controller.query.QueryController.execute(QueryController.java:46)
  110. at net.n2oapp.framework.ui.controller.DataController.getData(DataController.java:57)
  111. at net.n2oapp.framework.ui.servlet.data.DataServlet$1.resolveSuccessModel(DataServlet.java:32)
  112. at net.n2oapp.framework.mvc.callback.json.JsonServletCallback.onService(JsonServletCallback.java:25)
  113. at net.n2oapp.framework.mvc.api.SimpleServletTemplate.doService(SimpleServletTemplate.java:28)
  114. at net.n2oapp.framework.ui.servlet.data.DataServlet.safeDoGet(DataServlet.java:28)
  115. at net.n2oapp.framework.mvc.n2o.N2oServlet.doGet(N2oServlet.java:81)
  116. at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
  117. at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
  118. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
  119. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  120. at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  121. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
  122. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  123. at net.n2oapp.security.auth.filter.WorkplaceFilter.doFilter(WorkplaceFilter.java:53)
  124. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
  125. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  126. at net.n2oapp.framework.ui.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:28)
  127. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
  128. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  129. at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:110)
  130. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
  131. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  132. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
  133. at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
  134. at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
  135. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  136. at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
  137. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  138. at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
  139. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  140. at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
  141. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  142. at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
  143. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  144. at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
  145. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  146. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  147. at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:177)
  148. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  149. at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
  150. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  151. at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
  152. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  153. at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
  154. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  155. at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
  156. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  157. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  158. at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
  159. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  160. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  161. at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
  162. at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  163. at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
  164. at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
  165. at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  166. at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  167. at net.n2oapp.security.auth.filter.SecurityFilter.doFilter(SecurityFilter.java:43)
  168. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
  169. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  170. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
  171. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
  172. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
  173. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
  174. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
  175. at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
  176. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
  177. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
  178. at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
  179. at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
  180. at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2459)
  181. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  182. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  183. at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  184. at java.lang.Thread.run(Thread.java:745)
  185. Caused by: net.n2oapp.criteria.sql.query.CriteriaSqlException: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [
  186. select c.clinic_id, c.id, c.uid, c.patient_id, coalesce(i.surname, '') || coalesce(' ' || i.name, '') || coalesce(' ' || i.patr_name, ''), coalesce('№' || c.uid || ',', ''), (select extract_age_particularly(i.birth_dt)), c.open_date, c.close_date, (select get_bed_day_amount_n2o(c.id)), fin.id, fin.name, mdd.code, c.case_type_id, c.care_level_id,
  187. (select string_agg(mcsg.code, ';') from md_clinical_statistical_group mcsg where mcsg.id in (select step.csg_id from mc_step step where step.case_id = c.id))
  188. , lsr.name, ls.result_id, lscr.name, c.closing_step_id,
  189.  
  190. (select case when max(bsi.id) is not null then 1 else 2 end from fin_bill_spec_item bsi
  191. join fin_bill b on b.id = bsi.bill_id
  192. join sr_srv_rendered ssr on ssr.id = bsi.service_id
  193. where b.status_id <> 0 and ssr.md_case_id = c.id
  194. )
  195. , (select adr__get_element_as_text(
  196. (select pa.addr_id from pim_party_address pa
  197. inner join pim_party_addr_to_addr_type patat on pa.party_id = i.id and patat.party_address_id = pa.id and patat.address_type_id = 4
  198. limit 1), '(1,n,1)(2,s,0)(3,s,0)(4,s,0)(5,s,0)(6,s,0)(7,s,0)(8,s,0)(9,s,0)'))
  199. ,
  200. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  201. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  202. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  203. , coalesce('№' || c.uid || ', ', '') || i.surname || ' ' || i.name || ' ' || i.patr_name || ' (' || to_char(i.birth_dt, 'dd.MM.yyyy') || ')', ls.id, ls.is_autopsy, c.closing_step_id is not null,
  204. (select is_death from mc_step_result where id = ls.result_id)
  205. ,
  206. (select exists(select id from hospital.childbirth chb where chb.step_id in (select id from mc_step where case_id = c.id)))
  207. ,
  208. (select name from pim_department where id = (select hsp_department_id from mc_step where _case_mode_id = 2 and case_id = c.id and _is_last is true))
  209.  
  210. from mc_case c
  211. join mc_case_type ct on ct.id = c.case_type_id
  212. left join fin_funding_source_type fin on fin.id = c.funding_id
  213. left join mc_diagnosis mcd on mcd.id = c.main_diagnos_id
  214. left join md_diagnosis mdd on mdd .id = mcd.diagnos_id
  215.  
  216. left join mc_step ls on ls.id = c.closing_step_id
  217. left join mc_step_result lsr on lsr.id = ls.result_id
  218. left join mc_step_care_result lscr on lscr.id = ls.outcome_id
  219. left join pim_individual i on i.id = c.patient_id
  220.  
  221. where ct.case_mode_id = 2 and c.clinic_id=? and
  222. (?::date is null and ?::date is null or
  223. ((?::date is null or c.close_date >= ?) and
  224. (?::date is null or c.close_date <= ?)))
  225. and
  226. exists(select 1 from mc_step s where s._case_mode_id =2 and s.case_id = c.id and
  227. s.hsp_previous_id is not null and s.hsp_department_id in (select cast(json_array_elements(?) as integer)))
  228. and
  229. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  230. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  231. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  232. =?
  233. order by c.open_date, c.id
  234. limit 15]; nested exception is org.postgresql.util.PSQLException: ERROR: function json_array_elements(integer) does not exist
  235. Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  236. Position: 3296
  237. at net.n2oapp.criteria.sql.query.SqlPageDao.getList(SqlPageDao.java:48)
  238. at net.n2oapp.criteria.api.query.QueryPage.getCollectionInitial(QueryPage.java:42)
  239. at net.n2oapp.framework.engine.data.query.page.TransactionalQueryPage.getCollectionInitial(TransactionalQueryPage.java:48)
  240. at net.n2oapp.criteria.api.ComputationalCollectionPage.getCollection(ComputationalCollectionPage.java:37)
  241. at net.n2oapp.criteria.api.ComputationalCollectionPage.init(ComputationalCollectionPage.java:61)
  242. at net.n2oapp.framework.engine.data.query.page.TransactionalQueryPage.access$1(TransactionalQueryPage.java:1)
  243. at net.n2oapp.framework.engine.data.query.page.TransactionalQueryPage$1.doInTransactionWithoutResult(TransactionalQueryPage.java:33)
  244. at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
  245. at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
  246. at net.n2oapp.routing.datasource.JndiRoutingDataSourceTemplate.lambda$execute$0(JndiRoutingDataSourceTemplate.java:26)
  247. at net.n2oapp.routing.datasource.JndiRoutingDataSourceTemplate.execute(JndiRoutingDataSourceTemplate.java:17)
  248. at net.n2oapp.routing.datasource.JndiRoutingDataSourceTemplate.execute(JndiRoutingDataSourceTemplate.java:25)
  249. at net.n2oapp.framework.engine.data.query.page.TransactionalQueryPage.init(TransactionalQueryPage.java:30)
  250. at net.n2oapp.framework.api.data.ComputationalQueryEngine.init(ComputationalQueryEngine.java:31)
  251. at net.n2oapp.framework.engine.data.query.SqlQueryEngine.init(SqlQueryEngine.java:48)
  252. ... 81 more
  253. Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [
  254. select c.clinic_id, c.id, c.uid, c.patient_id, coalesce(i.surname, '') || coalesce(' ' || i.name, '') || coalesce(' ' || i.patr_name, ''), coalesce('№' || c.uid || ',', ''), (select extract_age_particularly(i.birth_dt)), c.open_date, c.close_date, (select get_bed_day_amount_n2o(c.id)), fin.id, fin.name, mdd.code, c.case_type_id, c.care_level_id,
  255. (select string_agg(mcsg.code, ';') from md_clinical_statistical_group mcsg where mcsg.id in (select step.csg_id from mc_step step where step.case_id = c.id))
  256. , lsr.name, ls.result_id, lscr.name, c.closing_step_id,
  257.  
  258. (select case when max(bsi.id) is not null then 1 else 2 end from fin_bill_spec_item bsi
  259. join fin_bill b on b.id = bsi.bill_id
  260. join sr_srv_rendered ssr on ssr.id = bsi.service_id
  261. where b.status_id <> 0 and ssr.md_case_id = c.id
  262. )
  263. , (select adr__get_element_as_text(
  264. (select pa.addr_id from pim_party_address pa
  265. inner join pim_party_addr_to_addr_type patat on pa.party_id = i.id and patat.party_address_id = pa.id and patat.address_type_id = 4
  266. limit 1), '(1,n,1)(2,s,0)(3,s,0)(4,s,0)(5,s,0)(6,s,0)(7,s,0)(8,s,0)(9,s,0)'))
  267. ,
  268. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  269. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  270. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  271. , coalesce('№' || c.uid || ', ', '') || i.surname || ' ' || i.name || ' ' || i.patr_name || ' (' || to_char(i.birth_dt, 'dd.MM.yyyy') || ')', ls.id, ls.is_autopsy, c.closing_step_id is not null,
  272. (select is_death from mc_step_result where id = ls.result_id)
  273. ,
  274. (select exists(select id from hospital.childbirth chb where chb.step_id in (select id from mc_step where case_id = c.id)))
  275. ,
  276. (select name from pim_department where id = (select hsp_department_id from mc_step where _case_mode_id = 2 and case_id = c.id and _is_last is true))
  277.  
  278. from mc_case c
  279. join mc_case_type ct on ct.id = c.case_type_id
  280. left join fin_funding_source_type fin on fin.id = c.funding_id
  281. left join mc_diagnosis mcd on mcd.id = c.main_diagnos_id
  282. left join md_diagnosis mdd on mdd .id = mcd.diagnos_id
  283.  
  284. left join mc_step ls on ls.id = c.closing_step_id
  285. left join mc_step_result lsr on lsr.id = ls.result_id
  286. left join mc_step_care_result lscr on lscr.id = ls.outcome_id
  287. left join pim_individual i on i.id = c.patient_id
  288.  
  289. where ct.case_mode_id = 2 and c.clinic_id=? and
  290. (?::date is null and ?::date is null or
  291. ((?::date is null or c.close_date >= ?) and
  292. (?::date is null or c.close_date <= ?)))
  293. and
  294. exists(select 1 from mc_step s where s._case_mode_id =2 and s.case_id = c.id and
  295. s.hsp_previous_id is not null and s.hsp_department_id in (select cast(json_array_elements(?) as integer)))
  296. and
  297. (select ss.regimen_id from mc_step ss where ss.case_id = c.id and ss._case_mode_id = 2 and
  298. not exists(select 1 from mc_step s2 where s2.case_id = ss.case_id and s2._case_mode_id = 2 and
  299. s2.hsp_previous_id = ss.id) order by ss.id desc limit 1)
  300. =?
  301. order by c.open_date, c.id
  302. limit 15]; nested exception is org.postgresql.util.PSQLException: ERROR: function json_array_elements(integer) does not exist
  303. Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  304. Position: 3296
  305. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:99)
  306. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  307. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
  308. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
  309. at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:645)
  310. at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:680)
  311. at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:707)
  312. at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)
  313. at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:192)
  314. at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:199)
  315. at net.n2oapp.criteria.sql.query.SqlPageDao.getList(SqlPageDao.java:46)
  316. ... 95 more
  317. Caused by: org.postgresql.util.PSQLException: ERROR: function json_array_elements(integer) does not exist
  318. Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  319. Position: 3296
  320. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412)
  321. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125)
  322. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:297)
  323. at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
  324. at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
  325. at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
  326. at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:117)
  327. at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:688)
  328. at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:629)
  329. ... 101 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement