Skip to content

Commit

Permalink
IS-2701: Remove avsendermottaker from journalfort notat (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
vetlesolgaard authored Oct 1, 2024
1 parent a2fec08 commit e4f1762
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
32 changes: 14 additions & 18 deletions src/main/kotlin/no/nav/syfo/domain/ManglendeMedvirkningVurdering.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,28 +147,24 @@ enum class VurderingType(val isActive: Boolean) {
OPPFYLT(false),
STANS(false),
IKKE_AKTUELL(false),
UNNTAK(false),
UNNTAK(false);

fun brevkode(): BrevkodeType =
when (this) {
FORHANDSVARSEL -> BrevkodeType.MANGLENDE_MEDVIRKNING_FORHANDSVARSEL
OPPFYLT, IKKE_AKTUELL, UNNTAK -> BrevkodeType.MANGLENDE_MEDVIRKNING_VURDERING
STANS -> BrevkodeType.MANGLENDE_MEDVIRKNING_STANS
}

fun journalpostType(): JournalpostType =
when (this) {
FORHANDSVARSEL, OPPFYLT, IKKE_AKTUELL, UNNTAK -> JournalpostType.UTGAAENDE
STANS -> JournalpostType.NOTAT
}
}

data class Varsel(
val uuid: UUID,
val createdAt: OffsetDateTime,
val svarfrist: LocalDate,
)

fun VurderingType.dokumentTittel(): String = when (this) {
VurderingType.FORHANDSVARSEL -> "Forhåndsvarsel om stans av sykepenger"
VurderingType.OPPFYLT, VurderingType.IKKE_AKTUELL, VurderingType.UNNTAK -> "Vurdering av § 8-8 manglende medvirkning"
VurderingType.STANS -> "Innstilling om stans"
}

fun VurderingType.brevkode(): BrevkodeType = when (this) {
VurderingType.FORHANDSVARSEL -> BrevkodeType.MANGLENDE_MEDVIRKNING_FORHANDSVARSEL
VurderingType.OPPFYLT, VurderingType.IKKE_AKTUELL, VurderingType.UNNTAK -> BrevkodeType.MANGLENDE_MEDVIRKNING_VURDERING
VurderingType.STANS -> BrevkodeType.MANGLENDE_MEDVIRKNING_STANS
}

fun VurderingType.journalpostType(): JournalpostType = when (this) {
VurderingType.FORHANDSVARSEL, VurderingType.OPPFYLT, VurderingType.IKKE_AKTUELL, VurderingType.UNNTAK -> JournalpostType.UTGAAENDE
VurderingType.STANS -> JournalpostType.NOTAT
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum class JournalpostTema(val value: String) {
}

data class JournalpostRequest(
val avsenderMottaker: AvsenderMottaker,
val avsenderMottaker: AvsenderMottaker?,
val tittel: String,
val bruker: Bruker? = null,
val dokumenter: List<Dokument>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ class JournalforingService(
pdf: ByteArray,
vurdering: ManglendeMedvirkningVurdering,
): JournalpostRequest {
val avsenderMottaker = AvsenderMottaker(
id = personIdent.value,
idType = BrukerIdType.PERSON_IDENT.value,
navn = navn,
)
val avsenderMottaker = if (vurdering.vurderingType.journalpostType() != JournalpostType.NOTAT) {
AvsenderMottaker(
id = personIdent.value,
idType = BrukerIdType.PERSON_IDENT.value,
navn = navn,
)
} else {
null
}
val bruker = Bruker(
id = personIdent.value,
idType = BrukerIdType.PERSON_IDENT.value,
Expand Down Expand Up @@ -69,3 +73,10 @@ class JournalforingService(
)
}
}

fun VurderingType.dokumentTittel(): String =
when (this) {
VurderingType.FORHANDSVARSEL -> "Forhåndsvarsel om stans av sykepenger"
VurderingType.OPPFYLT, VurderingType.IKKE_AKTUELL, VurderingType.UNNTAK -> "Vurdering av § 8-8 manglende medvirkning"
VurderingType.STANS -> "Innstilling om stans"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ fun generateJournalpostRequest(
vurderingUuid: UUID,
journalpostType: String = JournalpostType.UTGAAENDE.name,
) = JournalpostRequest(
avsenderMottaker = AvsenderMottaker(
id = UserConstants.ARBEIDSTAKER_PERSONIDENT.value,
idType = BrukerIdType.PERSON_IDENT.value,
navn = UserConstants.PERSON_FULLNAME,
),
avsenderMottaker = if (journalpostType == "NOTAT") {
null
} else {
AvsenderMottaker(
id = UserConstants.ARBEIDSTAKER_PERSONIDENT.value,
idType = BrukerIdType.PERSON_IDENT.value,
navn = UserConstants.PERSON_FULLNAME,
)
},
bruker = Bruker(
id = UserConstants.ARBEIDSTAKER_PERSONIDENT.value,
idType = BrukerIdType.PERSON_IDENT.value
Expand Down

0 comments on commit e4f1762

Please sign in to comment.