Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.84 KB | None | 0 0
  1. SEVERE 3/19/18 9:45 AM: liquibase: assemblyChangelog.xml: /opt/R1/share/n2o-liquibase/liquibase/db/changelog/201802221400_create_or_replace_set_result_appointment_queue_state_funtion.xml::set_result_appointment_queue_state_funtion::yditarova: Change Set /opt/R1/share/n2o-liquibase/liquibase/db/changelog/201802221400_create_or_replace_set_result_appointment_queue_state_funtion.xml::set_result_appointment_queue_state_funtion::yditarova failed. Error: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  2. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  3. appointmentId integer,
  4. user_id integer,
  5. org_id integer,
  6. dep_id integer)
  7.  
  8. RETURNS integer AS
  9.  
  10. $BODY$
  11.  
  12. DECLARE
  13. showButtonReceptionOver boolean;
  14. openVisitByClickAppeared boolean;
  15. BEGIN
  16.  
  17. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  18. join cmn_scope cs on cs.id = csv.scope_id
  19. join md_clinic mc on mc.scope_id = cs.id
  20. join cmn_scope_type cst on cst.id=cs.type_id
  21. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  22.  
  23. then (select value from cmn_setting_value csv
  24. join cmn_scope cs on cs.id = csv.scope_id
  25. join md_clinic mc on mc.scope_id = cs.id
  26. join cmn_scope_type cst on cst.id=cs.type_id
  27. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  28.  
  29. when exists(select 1 from cmn_setting_value csv
  30. join cmn_scope cs on cs.id = csv.scope_id
  31. join cmn_scope_type cst on cst.id=cs.type_id
  32. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  33.  
  34. then (select value from cmn_setting_value csv
  35. join cmn_scope cs on cs.id = csv.scope_id
  36. join cmn_scope_type cst on cst.id=cs.type_id
  37. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  38.  
  39. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  40. end)::boolean;
  41.  
  42. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  43. join cmn_scope cs on cs.id = csv.scope_id
  44. join sec_user su on su.scope_id = cs.id
  45. join cmn_scope_type cst on cst.id=cs.type_id
  46. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  47.  
  48. then (select value from cmn_setting_value csv
  49. join cmn_scope cs on cs.id = csv.scope_id
  50. join sec_user su on su.scope_id = cs.id
  51. join cmn_scope_type cst on cst.id=cs.type_id
  52. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  53.  
  54. when exists (select 1 from cmn_setting_value csv
  55. join cmn_scope cs on cs.id = csv.scope_id
  56. join pim_department pd on pd.scope_id = cs.id
  57. join cmn_scope_type cst on cst.id=cs.type_id
  58. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  59.  
  60. then (select value from cmn_setting_value csv
  61. join cmn_scope cs on cs.id = csv.scope_id
  62. join pim_department pd on pd.scope_id = cs.id
  63. join cmn_scope_type cst on cst.id=cs.type_id
  64. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  65.  
  66. when exists (select 1 from cmn_setting_value csv
  67. join cmn_scope cs on cs.id = csv.scope_id
  68. join md_clinic mc on mc.scope_id = cs.id
  69. join cmn_scope_type cst on cst.id=cs.type_id
  70. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  71.  
  72. then (select value from cmn_setting_value csv
  73. join cmn_scope cs on cs.id = csv.scope_id
  74. join md_clinic mc on mc.scope_id = cs.id
  75. join cmn_scope_type cst on cst.id=cs.type_id
  76. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  77.  
  78. when exists(select 1 from cmn_setting_value csv
  79. join cmn_scope cs on cs.id = csv.scope_id
  80. join cmn_scope_type cst on cst.id=cs.type_id
  81. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  82.  
  83. then (select value from cmn_setting_value csv
  84. join cmn_scope cs on cs.id = csv.scope_id
  85. join cmn_scope_type cst on cst.id=cs.type_id
  86. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  87.  
  88. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  89. end)::boolean;
  90.  
  91.  
  92.  
  93. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  94. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  95. 'OVER' limit 1) where id = appointmentId;
  96. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  97. 'OVER' limit 1) );
  98.  
  99. ELSE IF (appointmentId is not NULL) THEN
  100. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  101. 'RECEIVED' limit 1) where id = appointmentId;
  102. END IF;
  103. END IF;
  104. return appointmentId;
  105. END;
  106. $BODY$
  107. LANGUAGE plpgsql VOLATILE
  108. COST 100;]
  109. liquibase.exception.DatabaseException: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  110. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  111. appointmentId integer,
  112. user_id integer,
  113. org_id integer,
  114. dep_id integer)
  115.  
  116. RETURNS integer AS
  117.  
  118. $BODY$
  119.  
  120. DECLARE
  121. showButtonReceptionOver boolean;
  122. openVisitByClickAppeared boolean;
  123. BEGIN
  124.  
  125. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  126. join cmn_scope cs on cs.id = csv.scope_id
  127. join md_clinic mc on mc.scope_id = cs.id
  128. join cmn_scope_type cst on cst.id=cs.type_id
  129. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  130.  
  131. then (select value from cmn_setting_value csv
  132. join cmn_scope cs on cs.id = csv.scope_id
  133. join md_clinic mc on mc.scope_id = cs.id
  134. join cmn_scope_type cst on cst.id=cs.type_id
  135. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  136.  
  137. when exists(select 1 from cmn_setting_value csv
  138. join cmn_scope cs on cs.id = csv.scope_id
  139. join cmn_scope_type cst on cst.id=cs.type_id
  140. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  141.  
  142. then (select value from cmn_setting_value csv
  143. join cmn_scope cs on cs.id = csv.scope_id
  144. join cmn_scope_type cst on cst.id=cs.type_id
  145. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  146.  
  147. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  148. end)::boolean;
  149.  
  150. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  151. join cmn_scope cs on cs.id = csv.scope_id
  152. join sec_user su on su.scope_id = cs.id
  153. join cmn_scope_type cst on cst.id=cs.type_id
  154. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  155.  
  156. then (select value from cmn_setting_value csv
  157. join cmn_scope cs on cs.id = csv.scope_id
  158. join sec_user su on su.scope_id = cs.id
  159. join cmn_scope_type cst on cst.id=cs.type_id
  160. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  161.  
  162. when exists (select 1 from cmn_setting_value csv
  163. join cmn_scope cs on cs.id = csv.scope_id
  164. join pim_department pd on pd.scope_id = cs.id
  165. join cmn_scope_type cst on cst.id=cs.type_id
  166. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  167.  
  168. then (select value from cmn_setting_value csv
  169. join cmn_scope cs on cs.id = csv.scope_id
  170. join pim_department pd on pd.scope_id = cs.id
  171. join cmn_scope_type cst on cst.id=cs.type_id
  172. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  173.  
  174. when exists (select 1 from cmn_setting_value csv
  175. join cmn_scope cs on cs.id = csv.scope_id
  176. join md_clinic mc on mc.scope_id = cs.id
  177. join cmn_scope_type cst on cst.id=cs.type_id
  178. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  179.  
  180. then (select value from cmn_setting_value csv
  181. join cmn_scope cs on cs.id = csv.scope_id
  182. join md_clinic mc on mc.scope_id = cs.id
  183. join cmn_scope_type cst on cst.id=cs.type_id
  184. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  185.  
  186. when exists(select 1 from cmn_setting_value csv
  187. join cmn_scope cs on cs.id = csv.scope_id
  188. join cmn_scope_type cst on cst.id=cs.type_id
  189. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  190.  
  191. then (select value from cmn_setting_value csv
  192. join cmn_scope cs on cs.id = csv.scope_id
  193. join cmn_scope_type cst on cst.id=cs.type_id
  194. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  195.  
  196. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  197. end)::boolean;
  198.  
  199.  
  200.  
  201. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  202. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  203. 'OVER' limit 1) where id = appointmentId;
  204. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  205. 'OVER' limit 1) );
  206.  
  207. ELSE IF (appointmentId is not NULL) THEN
  208. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  209. 'RECEIVED' limit 1) where id = appointmentId;
  210. END IF;
  211. END IF;
  212. return appointmentId;
  213. END;
  214. $BODY$
  215. LANGUAGE plpgsql VOLATILE
  216. COST 100;]
  217. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
  218. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
  219. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
  220. at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
  221. at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
  222. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
  223. at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
  224. at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
  225. at liquibase.Liquibase.update(Liquibase.java:210)
  226. at liquibase.Liquibase.update(Liquibase.java:190)
  227. at liquibase.integration.commandline.Main.doMigration(Main.java:1096)
  228. at liquibase.integration.commandline.Main.run(Main.java:180)
  229. at liquibase.integration.commandline.Main.main(Main.java:99)
  230. Caused by: org.postgresql.util.PSQLException: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist
  231. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
  232. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
  233. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
  234. at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
  235. at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405)
  236. at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:397)
  237. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
  238. ... 12 more
  239. INFO 3/19/18 9:45 AM: liquibase: /opt/R1/share/n2o-liquibase/liquibase/db/changelog/201802221400_create_or_replace_set_result_appointment_queue_state_funtion.xml::set_result_appointment_queue_state_funtion::yditarova: Successfully released change log lock
  240. Unexpected error running Liquibase: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  241. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  242. appointmentId integer,
  243. user_id integer,
  244. org_id integer,
  245. dep_id integer)
  246.  
  247. RETURNS integer AS
  248.  
  249. $BODY$
  250.  
  251. DECLARE
  252. showButtonReceptionOver boolean;
  253. openVisitByClickAppeared boolean;
  254. BEGIN
  255.  
  256. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  257. join cmn_scope cs on cs.id = csv.scope_id
  258. join md_clinic mc on mc.scope_id = cs.id
  259. join cmn_scope_type cst on cst.id=cs.type_id
  260. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  261.  
  262. then (select value from cmn_setting_value csv
  263. join cmn_scope cs on cs.id = csv.scope_id
  264. join md_clinic mc on mc.scope_id = cs.id
  265. join cmn_scope_type cst on cst.id=cs.type_id
  266. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  267.  
  268. when exists(select 1 from cmn_setting_value csv
  269. join cmn_scope cs on cs.id = csv.scope_id
  270. join cmn_scope_type cst on cst.id=cs.type_id
  271. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  272.  
  273. then (select value from cmn_setting_value csv
  274. join cmn_scope cs on cs.id = csv.scope_id
  275. join cmn_scope_type cst on cst.id=cs.type_id
  276. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  277.  
  278. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  279. end)::boolean;
  280.  
  281. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  282. join cmn_scope cs on cs.id = csv.scope_id
  283. join sec_user su on su.scope_id = cs.id
  284. join cmn_scope_type cst on cst.id=cs.type_id
  285. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  286.  
  287. then (select value from cmn_setting_value csv
  288. join cmn_scope cs on cs.id = csv.scope_id
  289. join sec_user su on su.scope_id = cs.id
  290. join cmn_scope_type cst on cst.id=cs.type_id
  291. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  292.  
  293. when exists (select 1 from cmn_setting_value csv
  294. join cmn_scope cs on cs.id = csv.scope_id
  295. join pim_department pd on pd.scope_id = cs.id
  296. join cmn_scope_type cst on cst.id=cs.type_id
  297. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  298.  
  299. then (select value from cmn_setting_value csv
  300. join cmn_scope cs on cs.id = csv.scope_id
  301. join pim_department pd on pd.scope_id = cs.id
  302. join cmn_scope_type cst on cst.id=cs.type_id
  303. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  304.  
  305. when exists (select 1 from cmn_setting_value csv
  306. join cmn_scope cs on cs.id = csv.scope_id
  307. join md_clinic mc on mc.scope_id = cs.id
  308. join cmn_scope_type cst on cst.id=cs.type_id
  309. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  310.  
  311. then (select value from cmn_setting_value csv
  312. join cmn_scope cs on cs.id = csv.scope_id
  313. join md_clinic mc on mc.scope_id = cs.id
  314. join cmn_scope_type cst on cst.id=cs.type_id
  315. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  316.  
  317. when exists(select 1 from cmn_setting_value csv
  318. join cmn_scope cs on cs.id = csv.scope_id
  319. join cmn_scope_type cst on cst.id=cs.type_id
  320. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  321.  
  322. then (select value from cmn_setting_value csv
  323. join cmn_scope cs on cs.id = csv.scope_id
  324. join cmn_scope_type cst on cst.id=cs.type_id
  325. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  326.  
  327. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  328. end)::boolean;
  329.  
  330.  
  331.  
  332. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  333. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  334. 'OVER' limit 1) where id = appointmentId;
  335. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  336. 'OVER' limit 1) );
  337.  
  338. ELSE IF (appointmentId is not NULL) THEN
  339. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  340. 'RECEIVED' limit 1) where id = appointmentId;
  341. END IF;
  342. END IF;
  343. return appointmentId;
  344. END;
  345. $BODY$
  346. LANGUAGE plpgsql VOLATILE
  347. COST 100;]
  348.  
  349. SEVERE 3/19/18 9:45 AM: liquibase: /opt/R1/share/n2o-liquibase/liquibase/db/changelog/201802221400_create_or_replace_set_result_appointment_queue_state_funtion.xml::set_result_appointment_queue_state_funtion::yditarova: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  350. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  351. appointmentId integer,
  352. user_id integer,
  353. org_id integer,
  354. dep_id integer)
  355.  
  356. RETURNS integer AS
  357.  
  358. $BODY$
  359.  
  360. DECLARE
  361. showButtonReceptionOver boolean;
  362. openVisitByClickAppeared boolean;
  363. BEGIN
  364.  
  365. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  366. join cmn_scope cs on cs.id = csv.scope_id
  367. join md_clinic mc on mc.scope_id = cs.id
  368. join cmn_scope_type cst on cst.id=cs.type_id
  369. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  370.  
  371. then (select value from cmn_setting_value csv
  372. join cmn_scope cs on cs.id = csv.scope_id
  373. join md_clinic mc on mc.scope_id = cs.id
  374. join cmn_scope_type cst on cst.id=cs.type_id
  375. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  376.  
  377. when exists(select 1 from cmn_setting_value csv
  378. join cmn_scope cs on cs.id = csv.scope_id
  379. join cmn_scope_type cst on cst.id=cs.type_id
  380. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  381.  
  382. then (select value from cmn_setting_value csv
  383. join cmn_scope cs on cs.id = csv.scope_id
  384. join cmn_scope_type cst on cst.id=cs.type_id
  385. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  386.  
  387. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  388. end)::boolean;
  389.  
  390. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  391. join cmn_scope cs on cs.id = csv.scope_id
  392. join sec_user su on su.scope_id = cs.id
  393. join cmn_scope_type cst on cst.id=cs.type_id
  394. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  395.  
  396. then (select value from cmn_setting_value csv
  397. join cmn_scope cs on cs.id = csv.scope_id
  398. join sec_user su on su.scope_id = cs.id
  399. join cmn_scope_type cst on cst.id=cs.type_id
  400. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  401.  
  402. when exists (select 1 from cmn_setting_value csv
  403. join cmn_scope cs on cs.id = csv.scope_id
  404. join pim_department pd on pd.scope_id = cs.id
  405. join cmn_scope_type cst on cst.id=cs.type_id
  406. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  407.  
  408. then (select value from cmn_setting_value csv
  409. join cmn_scope cs on cs.id = csv.scope_id
  410. join pim_department pd on pd.scope_id = cs.id
  411. join cmn_scope_type cst on cst.id=cs.type_id
  412. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  413.  
  414. when exists (select 1 from cmn_setting_value csv
  415. join cmn_scope cs on cs.id = csv.scope_id
  416. join md_clinic mc on mc.scope_id = cs.id
  417. join cmn_scope_type cst on cst.id=cs.type_id
  418. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  419.  
  420. then (select value from cmn_setting_value csv
  421. join cmn_scope cs on cs.id = csv.scope_id
  422. join md_clinic mc on mc.scope_id = cs.id
  423. join cmn_scope_type cst on cst.id=cs.type_id
  424. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  425.  
  426. when exists(select 1 from cmn_setting_value csv
  427. join cmn_scope cs on cs.id = csv.scope_id
  428. join cmn_scope_type cst on cst.id=cs.type_id
  429. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  430.  
  431. then (select value from cmn_setting_value csv
  432. join cmn_scope cs on cs.id = csv.scope_id
  433. join cmn_scope_type cst on cst.id=cs.type_id
  434. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  435.  
  436. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  437. end)::boolean;
  438.  
  439.  
  440.  
  441. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  442. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  443. 'OVER' limit 1) where id = appointmentId;
  444. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  445. 'OVER' limit 1) );
  446.  
  447. ELSE IF (appointmentId is not NULL) THEN
  448. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  449. 'RECEIVED' limit 1) where id = appointmentId;
  450. END IF;
  451. END IF;
  452. return appointmentId;
  453. END;
  454. $BODY$
  455. LANGUAGE plpgsql VOLATILE
  456. COST 100;]
  457. liquibase.exception.MigrationFailedException: Migration failed for change set /opt/R1/share/n2o-liquibase/liquibase/db/changelog/201802221400_create_or_replace_set_result_appointment_queue_state_funtion.xml::set_result_appointment_queue_state_funtion::yditarova:
  458. Reason: liquibase.exception.DatabaseException: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  459. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  460. appointmentId integer,
  461. user_id integer,
  462. org_id integer,
  463. dep_id integer)
  464.  
  465. RETURNS integer AS
  466.  
  467. $BODY$
  468.  
  469. DECLARE
  470. showButtonReceptionOver boolean;
  471. openVisitByClickAppeared boolean;
  472. BEGIN
  473.  
  474. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  475. join cmn_scope cs on cs.id = csv.scope_id
  476. join md_clinic mc on mc.scope_id = cs.id
  477. join cmn_scope_type cst on cst.id=cs.type_id
  478. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  479.  
  480. then (select value from cmn_setting_value csv
  481. join cmn_scope cs on cs.id = csv.scope_id
  482. join md_clinic mc on mc.scope_id = cs.id
  483. join cmn_scope_type cst on cst.id=cs.type_id
  484. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  485.  
  486. when exists(select 1 from cmn_setting_value csv
  487. join cmn_scope cs on cs.id = csv.scope_id
  488. join cmn_scope_type cst on cst.id=cs.type_id
  489. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  490.  
  491. then (select value from cmn_setting_value csv
  492. join cmn_scope cs on cs.id = csv.scope_id
  493. join cmn_scope_type cst on cst.id=cs.type_id
  494. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  495.  
  496. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  497. end)::boolean;
  498.  
  499. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  500. join cmn_scope cs on cs.id = csv.scope_id
  501. join sec_user su on su.scope_id = cs.id
  502. join cmn_scope_type cst on cst.id=cs.type_id
  503. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  504.  
  505. then (select value from cmn_setting_value csv
  506. join cmn_scope cs on cs.id = csv.scope_id
  507. join sec_user su on su.scope_id = cs.id
  508. join cmn_scope_type cst on cst.id=cs.type_id
  509. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  510.  
  511. when exists (select 1 from cmn_setting_value csv
  512. join cmn_scope cs on cs.id = csv.scope_id
  513. join pim_department pd on pd.scope_id = cs.id
  514. join cmn_scope_type cst on cst.id=cs.type_id
  515. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  516.  
  517. then (select value from cmn_setting_value csv
  518. join cmn_scope cs on cs.id = csv.scope_id
  519. join pim_department pd on pd.scope_id = cs.id
  520. join cmn_scope_type cst on cst.id=cs.type_id
  521. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  522.  
  523. when exists (select 1 from cmn_setting_value csv
  524. join cmn_scope cs on cs.id = csv.scope_id
  525. join md_clinic mc on mc.scope_id = cs.id
  526. join cmn_scope_type cst on cst.id=cs.type_id
  527. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  528.  
  529. then (select value from cmn_setting_value csv
  530. join cmn_scope cs on cs.id = csv.scope_id
  531. join md_clinic mc on mc.scope_id = cs.id
  532. join cmn_scope_type cst on cst.id=cs.type_id
  533. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  534.  
  535. when exists(select 1 from cmn_setting_value csv
  536. join cmn_scope cs on cs.id = csv.scope_id
  537. join cmn_scope_type cst on cst.id=cs.type_id
  538. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  539.  
  540. then (select value from cmn_setting_value csv
  541. join cmn_scope cs on cs.id = csv.scope_id
  542. join cmn_scope_type cst on cst.id=cs.type_id
  543. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  544.  
  545. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  546. end)::boolean;
  547.  
  548.  
  549.  
  550. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  551. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  552. 'OVER' limit 1) where id = appointmentId;
  553. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  554. 'OVER' limit 1) );
  555.  
  556. ELSE IF (appointmentId is not NULL) THEN
  557. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  558. 'RECEIVED' limit 1) where id = appointmentId;
  559. END IF;
  560. END IF;
  561. return appointmentId;
  562. END;
  563. $BODY$
  564. LANGUAGE plpgsql VOLATILE
  565. COST 100;]
  566. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:584)
  567. at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
  568. at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
  569. at liquibase.Liquibase.update(Liquibase.java:210)
  570. at liquibase.Liquibase.update(Liquibase.java:190)
  571. at liquibase.integration.commandline.Main.doMigration(Main.java:1096)
  572. at liquibase.integration.commandline.Main.run(Main.java:180)
  573. at liquibase.integration.commandline.Main.main(Main.java:99)
  574. Caused by: liquibase.exception.DatabaseException: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist [Failed SQL: DROP FUNCTION public.set_result_appointment_queue_state_log(integer, integer, integer);
  575. CREATE OR REPLACE FUNCTION public.set_result_appointment_queue_state_log(
  576. appointmentId integer,
  577. user_id integer,
  578. org_id integer,
  579. dep_id integer)
  580.  
  581. RETURNS integer AS
  582.  
  583. $BODY$
  584.  
  585. DECLARE
  586. showButtonReceptionOver boolean;
  587. openVisitByClickAppeared boolean;
  588. BEGIN
  589.  
  590. showButtonReceptionOver = (SELECT case when exists(select 1 from cmn_setting_value csv
  591. join cmn_scope cs on cs.id = csv.scope_id
  592. join md_clinic mc on mc.scope_id = cs.id
  593. join cmn_scope_type cst on cst.id=cs.type_id
  594. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer)
  595.  
  596. then (select value from cmn_setting_value csv
  597. join cmn_scope cs on cs.id = csv.scope_id
  598. join md_clinic mc on mc.scope_id = cs.id
  599. join cmn_scope_type cst on cst.id=cs.type_id
  600. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  601.  
  602. when exists(select 1 from cmn_setting_value csv
  603. join cmn_scope cs on cs.id = csv.scope_id
  604. join cmn_scope_type cst on cst.id=cs.type_id
  605. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global')
  606.  
  607. then (select value from cmn_setting_value csv
  608. join cmn_scope cs on cs.id = csv.scope_id
  609. join cmn_scope_type cst on cst.id=cs.type_id
  610. where setting_id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' and cst.code = 'Global' limit 1)
  611.  
  612. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.showButtonreceptionOver' limit 1)
  613. end)::boolean;
  614.  
  615. openVisitByClickAppeared = (SELECT case when exists(select 1 from cmn_setting_value csv
  616. join cmn_scope cs on cs.id = csv.scope_id
  617. join sec_user su on su.scope_id = cs.id
  618. join cmn_scope_type cst on cst.id=cs.type_id
  619. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer)
  620.  
  621. then (select value from cmn_setting_value csv
  622. join cmn_scope cs on cs.id = csv.scope_id
  623. join sec_user su on su.scope_id = cs.id
  624. join cmn_scope_type cst on cst.id=cs.type_id
  625. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'User' and su.id = user_id::integer limit 1)
  626.  
  627. when exists (select 1 from cmn_setting_value csv
  628. join cmn_scope cs on cs.id = csv.scope_id
  629. join pim_department pd on pd.scope_id = cs.id
  630. join cmn_scope_type cst on cst.id=cs.type_id
  631. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id)
  632.  
  633. then (select value from cmn_setting_value csv
  634. join cmn_scope cs on cs.id = csv.scope_id
  635. join pim_department pd on pd.scope_id = cs.id
  636. join cmn_scope_type cst on cst.id=cs.type_id
  637. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Department' and pd.id = dep_id limit 1)
  638.  
  639. when exists (select 1 from cmn_setting_value csv
  640. join cmn_scope cs on cs.id = csv.scope_id
  641. join md_clinic mc on mc.scope_id = cs.id
  642. join cmn_scope_type cst on cst.id=cs.type_id
  643. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer)
  644.  
  645. then (select value from cmn_setting_value csv
  646. join cmn_scope cs on cs.id = csv.scope_id
  647. join md_clinic mc on mc.scope_id = cs.id
  648. join cmn_scope_type cst on cst.id=cs.type_id
  649. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Clinic' and mc.id = org_id::integer limit 1)
  650.  
  651. when exists(select 1 from cmn_setting_value csv
  652. join cmn_scope cs on cs.id = csv.scope_id
  653. join cmn_scope_type cst on cst.id=cs.type_id
  654. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global')
  655.  
  656. then (select value from cmn_setting_value csv
  657. join cmn_scope cs on cs.id = csv.scope_id
  658. join cmn_scope_type cst on cst.id=cs.type_id
  659. where setting_id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' and cst.code = 'Global' limit 1)
  660.  
  661. else (select default_value from cmn_setting where id = 'cz.atria.md.planning.PlanningSettings.openVisitByClickAppeared' limit 1)
  662. end)::boolean;
  663.  
  664.  
  665.  
  666. IF (appointmentId is not NULL and showButtonReceptionOver and openVisitByClickAppeared) THEN
  667. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  668. 'OVER' limit 1) where id = appointmentId;
  669. insert into md_appointment_queue_state_log (appointment_id, user_id, queue_state) values(appointmentId, user_id, (select id from md_appointment_queue_state where code =
  670. 'OVER' limit 1) );
  671.  
  672. ELSE IF (appointmentId is not NULL) THEN
  673. UPDATE md_appointment SET queue_state_id = (select id from md_appointment_queue_state where code =
  674. 'RECEIVED' limit 1) where id = appointmentId;
  675. END IF;
  676. END IF;
  677. return appointmentId;
  678. END;
  679. $BODY$
  680. LANGUAGE plpgsql VOLATILE
  681. COST 100;]
  682. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
  683. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
  684. at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
  685. at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
  686. at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
  687. at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
  688. ... 7 more
  689. Caused by: org.postgresql.util.PSQLException: ERROR: function public.set_result_appointment_queue_state_log(integer, integer, integer) does not exist
  690. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
  691. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
  692. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
  693. at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
  694. at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405)
  695. at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:397)
  696. at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
  697. ... 12 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement