pour déploiement auto v2 via gitlab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

104 lines
4.8 KiB

-- 1/3 : Création de la table temporaire
DROP TABLE IF EXISTS w_dbsetup
;
CREATE TEMP TABLE w_dbsetup AS
SELECT
code,
CASE WHEN oid = 0 THEN oid ELSE 1 END AS oid,
texte,
texte_court
FROM pmsi.t_ccam_regroupements
ORDER BY code
LIMIT 0
;
-- 2/3 : Peuplement de la table temporaire
INSERT INTO w_dbsetup(
code,
oid,
texte,
texte_court
)
VALUES
('ACO', 1, 'Acte d obstetrique', 'Acte d obstetrique'),
('ADA', 1, 'Acte d anesthesie', 'Acte d anesthesie'),
('ADC', 1, 'Actes de chirurgie', 'Actes de chirurgie'),
('ADE', 1, 'Acte d echographie', 'Acte d echographie'),
('ADI', 1, 'Acte d imagerie', 'Acte d imagerie'),
('ADM', 1, 'Actes dentaires avec technique médical', 'Actes dentaires avec technique médical'),
('ADP', 1, 'Actes divers de prothèses dentaires', 'Actes divers de prothèses dentaires'),
('AID', 1, 'Actes d imagerie dentaire', 'Actes d imagerie dentaire'),
('ASC', 1, 'Actes de chirurgie dentaire', 'Actes de chirurgie dentaire'),
('ATM', 1, 'Acte technique medical', 'Acte technique medical'),
('AXI', 1, 'Actes de Prophylaxie et Prévention', 'Actes de Prophylaxie et Prévention'),
('BR1', 1, 'Bridge RAC modéré', 'Bridge RAC modéré'),
('CAM', 1, 'Code Interne', 'Code Interne'),
('CDAM', 1, 'Nomenclature CDAM', 'Nomenclature CDAM'),
('CM0', 1, 'Prothèse fixe métallique RAC 0', 'Prothèse fixe métallique RAC 0'),
('CT0', 1, 'Couronne transitoire RAC 0', 'Couronne transitoire RAC 0'),
('CT1', 1, 'Couronne transitoire RAC modéré', 'Couronne transitoire RAC modéré'),
('CZ0', 1, 'Couronne zircone RAC 0', 'Couronne zircone RAC 0'),
('CZ1', 1, 'Couronne zircone RAC modéré', 'Couronne zircone RAC modéré'),
('DEN', 1, 'Acte dentaire', 'Acte dentaire'),
('END', 1, 'actes d endodontie', 'actes d endodontie'),
('IC0', 1, 'Inlay core RAC 0', 'Inlay core RAC 0'),
('IC1', 1, 'Inlay core RAC modéré', 'Inlay core RAC modéré'),
('ICO', 1, 'Inlay-core Tarif libre', 'Inlay-core Tarif libre'),
('IMP', 1, 'Pose d implants ou de matériel pour implantologie', 'Pose d implants ou de matériel pour implantologie'),
('IN1', 1, 'Inlay onlay RAC modéré', 'Inlay onlay RAC modéré'),
('INO', 1, 'Actes Inlay-Onlay Tarif libre', 'Actes Inlay-Onlay Tarif libre'),
('NGAP', 1, 'Nomenclature NGAP', 'Nomenclature NGAP'),
('PA0', 1, 'Prothèse amovible RAC 0', 'Prothèse amovible RAC 0'),
('PA1', 1, 'Prothèse amovible RAC modéré', 'Prothèse amovible RAC modéré'),
('PAM', 1, 'Prothèse amovible métallique Tarif libre', 'Prothèse amovible métallique Tarif libre'),
('PAR', 1, 'Prothèse amovible résine Tarif libre', 'Prothèse amovible résine Tarif libre'),
('PDA', 1, 'Prothèses dentaires amovibles', 'Prothèses dentaires amovibles'),
('PDT', 1, 'Couronne transitoire Tarif libre', 'Couronne transitoire Tarif libre'),
('PF0', 1, 'Prothèse fixe RAC 0', 'Prothèse fixe RAC 0'),
('PF1', 1, 'Prothèse fixe RAC modéré', 'Prothèse fixe RAC modéré'),
('PFC', 1, 'Prothèse fixe céramique Tarif libre', 'Prothèse fixe céramique Tarif libre'),
('PFE', 1, 'Prothèses fixes esthétiques', 'Prothèses fixes esthétiques'),
('PFM', 1, 'Prothèse fixe métallique Tarif libre', 'Prothèse fixe métallique Tarif libre'),
('PT0', 1, 'Prothèse amovible de transition RAC 0', 'Prothèse amovible de transition RAC 0'),
('RA0', 1, 'Réparation Adjonction RAC 0', 'Réparation Adjonction RAC 0'),
('RE1', 1, 'Réparation prothèse RAC modéré', 'Réparation prothèse RAC modéré'),
('RF0', 1, 'Réparation facette prothèse amovible RAC 0', 'Réparation facette prothèse amovible RAC 0'),
('RPN', 1, 'Réparation prothèse Tarif libre', 'Réparation prothèse Tarif libre'),
('RS0', 1, 'Réparation prothèse adjointe simple RAC 0', 'Réparation prothèse adjointe simple RAC 0'),
('SDE', 1, 'Soins Dentaires', 'Soins Dentaires'),
('SU0', 1, 'Supplément prothèse résine RAC 0', 'Supplément prothèse résine RAC 0'),
('SU1', 1, 'Supplément prothèse métallique RAC modéré', 'Supplément prothèse métallique RAC modéré'),
('TDS', 1, 'Parodontologie (actes sur tissus de soutien de la dent)', 'Parodontologie (actes sur tissus de soutien de la dent)'),
('TOR', 1, 'Traitement d''orthodontie', 'Traitement d''orthodontie'),
('***', 0, 'Non renseigné', 'Non renseigné')
;
-- 3/3 : Màj de la table iCTI
UPDATE pmsi.t_ccam_regroupements SET
code = w_dbsetup.code
FROM w_dbsetup
WHERE t_ccam_regroupements.oid = w_dbsetup.oid AND w_dbsetup.oid = 0;
UPDATE pmsi.t_ccam_regroupements SET
texte = w_dbsetup.texte,
texte_court = w_dbsetup.texte_court
FROM w_dbsetup
WHERE t_ccam_regroupements.code = w_dbsetup.code;
INSERT INTO pmsi.t_ccam_regroupements(oid, code, texte, texte_court)
SELECT oid, code, texte, texte_court
FROM w_dbsetup
WHERE
oid = 0
AND oid NOT IN (SELECT oid FROM pmsi.t_ccam_regroupements);
INSERT INTO pmsi.t_ccam_regroupements(code, texte, texte_court)
SELECT code, texte, texte_court
FROM w_dbsetup
WHERE
oid <> 0
AND code NOT IN (SELECT code FROM pmsi.t_ccam_regroupements);