Reproduire la valorisation BR et coefficients géo/prudentiels du tableau VALR d'epmsi
vvr_had_ght(p, ghts, coeff_geo = 1.07, coeff_prudent = NULL)
Un noyau de paramètres créé avec noyau_pmeasyr
Un tibble contenant une ligne par tarif GHT - année séquentielle des tarifs - type de domicile
Coefficient géographique, au choix (peut être mis à 1)
Coefficient prudentiel, par défaut la fonction créé ce coefficient automatiquement, sinon il peut-être mis à 1 ou autre
Un tibble contenant les valorisations GHT des sous-séquences de la table rapss$ght PAPRICA (et donc des séjours), les coefficient géo et prudentiels sont présents dans la table, la colonne tarif n'en tient pas compte, et il faut multiplier par le nb journées GHT pour obtenir la valorisation totale.
Cette fonction ne tient pas compte du fichier de conventions ESMS (cas des finess non conventionnés non pec ici)
if (FALSE) {
library(pmeasyr)
library(dplyr, warn.conflicts = F)
p <- noyau_pmeasyr(
finess = '750712184',
annee = 2018,
mois = 12,
path = '~/Documents/data/had',
progress = FALSE,
tolower_names = TRUE,
lib = FALSE
)
adezip(p, type = "out", liste = c('rapss', 'ano'))
library(nomensland)
ghts <- get_table('tarifs_had_ght') %>%
tidyr::gather(type_tarif, tarif, - paprica_numght, - lib_ght) %>%
mutate(anseqta = stringr::str_extract(type_tarif, '[0-9]{4}'),
typdom = substr(type_tarif, 6, nchar(type_tarif)))
# Utiliser cette fonction
base_ght <- vvr_had_ght(p, ghts)
ano <- iano_had(p)
library(stringfix)
# calculer le montant Base remboursement et le nb de journées valorisées
base_ght %>%
inner_join(distinct(ano, noseqsej, .keep_all = TRUE), by = 'noseqsej') %>%
# filtre sur séjours facturables
filter(factam %in% c('1', '2')) %>%
mutate(tarif = tarif * joursght * cgeo * cprudent) %>%
summarise(
euros = sum(tarif, na.rm = TRUE) %>% round(.,2) %>%
formatC(., big.mark = " ", format = "f", digits = 2) %+% "€",
nbj = sum(joursght))
##| euros | nbj |
##|------------|-------|
##| xxx xxx,xx€| x xxx |
}