daily pastebin goal


a guest Jan 24th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*!!!*/ --признак ds_onk, onk_sl, onk_add в fin_bill_cases, чтобы при выгрузке было проще. Проверить схему у billing.fin_bill_cases
  2.     WITH cases AS
  3.       (
  4.         SELECT case_id, region_data->'ds_onk' as ds_onk, region_data->'onk_sl' as onk_sl FROM tmp_hstore
  5.       )  
  6.     UPDATE billing.fin_bill_cases f SET region_data=coalesce(region_data,hstore(''))||hstore(ARRAY['ds_onk',ds_onk, 'onk_sl',onk_sl])
  7.     FROM cases
  8.     WHERE f.bill_id=p1_bill_id AND f.case_id=cases.case_id
  9.     ;
  11.     ---Вынесено в отдельный скрипт, т.к. для onk_add заполняется консилиум
  12.     WITH cases AS
  13.       (
  16.         SELECT case_id FROM tmp_add_onko --добавляем случаи онко без лечения и без онко услуг/протоколов
  17.       )  
  18.     UPDATE billing.fin_bill_cases f SET region_data=coalesce(region_data,hstore(''))||hstore('onk_add','1')
  19.     FROM cases
  20.     WHERE f.bill_id=p1_bill_id AND f.case_id=cases.case_id
  21.     ;
  22.     /*log*/IF _is_log THEN INSERT INTO billing.fin_bill_generate_status_log (bill_id,parent_id,function_name,statement_name) VALUES (p1_bill_id,_log_id,_fnc_name,'признак ds_onk, onk_sl, onk_add') RETURNING id INTO _log_id; END IF;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand