-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/963 report behavior has new collectible info about transporte…
…d patients (#978) * Add transfer counts radiogram * Add empty radiogram component * Make transfer counts radiogram reportable * Display information of transfer counts radiogram * Add changes to changelog * Add test scenario * Use more descriptive radiogram title * Use more descriptive table header * Support all triage categories * Update test scenarios to use all triage categories * Extract scope type to utils
- Loading branch information
1 parent
dd46e03
commit d3e33b7
Showing
15 changed files
with
224 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...iogram-card-content-transfer-counts/radiogram-card-content-transfer-counts.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<h5>Transportstatus</h5> | ||
|
||
<ng-container *appLet="radiogram$ | async as radiogram"> | ||
<p *ngIf="radiogram.scope === 'singleRegion'">Für diese Patientenablage.</p> | ||
<p *ngIf="radiogram.scope === 'transportManagement'"> | ||
Für alle von dieser Transportorganisation verwalteten Patientenablagen. | ||
</p> | ||
|
||
<table class="table table-sm w-100"> | ||
<thead> | ||
<tr> | ||
<th>SK</th> | ||
<th>Abtransportiert</th> | ||
<th>Verbleibend</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let category of alwaysShowCategories"> | ||
<td> | ||
<app-patient-status-badge [status]="category" /> | ||
</td> | ||
<td> | ||
{{ radiogram.transferredPatientsCounts[category] }} | ||
</td> | ||
<td> | ||
{{ radiogram.remainingPatientsCounts[category] }} | ||
</td> | ||
</tr> | ||
<ng-container | ||
*ngFor="let category of showIfTransferredOrRemainingCategories" | ||
> | ||
<tr | ||
*ngIf=" | ||
radiogram.transferredPatientsCounts[category] > 0 || | ||
radiogram.remainingPatientsCounts[category] > 0 | ||
" | ||
> | ||
<td> | ||
<app-patient-status-badge [status]="category" /> | ||
</td> | ||
<td> | ||
{{ radiogram.transferredPatientsCounts[category] }} | ||
</td> | ||
<td> | ||
{{ radiogram.remainingPatientsCounts[category] }} | ||
</td> | ||
</tr> | ||
</ng-container> | ||
<ng-container *ngFor="let category of showIfTransferredCategories"> | ||
<tr *ngIf="radiogram.transferredPatientsCounts[category] > 0"> | ||
<td> | ||
<app-patient-status-badge [status]="category" /> | ||
</td> | ||
<td> | ||
{{ radiogram.transferredPatientsCounts[category] }} | ||
</td> | ||
<td> | ||
{{ radiogram.remainingPatientsCounts[category] }} | ||
</td> | ||
</tr> | ||
</ng-container> | ||
</tbody> | ||
</table> | ||
</ng-container> |
Empty file.
46 changes: 46 additions & 0 deletions
46
...adiogram-card-content-transfer-counts/radiogram-card-content-transfer-counts.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { OnInit } from '@angular/core'; | ||
import { Component, Input } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import type { TransferCountsRadiogram } from 'digital-fuesim-manv-shared'; | ||
import { UUID } from 'digital-fuesim-manv-shared'; | ||
import type { Observable } from 'rxjs'; | ||
import type { AppState } from 'src/app/state/app.state'; | ||
import { createSelectRadiogram } from 'src/app/state/application/selectors/exercise.selectors'; | ||
|
||
@Component({ | ||
selector: 'app-radiogram-card-content-transfer-counts', | ||
templateUrl: './radiogram-card-content-transfer-counts.component.html', | ||
styleUrls: ['./radiogram-card-content-transfer-counts.component.scss'], | ||
}) | ||
export class RadiogramCardContentTransferCountsComponent implements OnInit { | ||
/** | ||
* Categories that should always be listed in the table. | ||
*/ | ||
readonly alwaysShowCategories = ['red', 'yellow', 'green'] as const; | ||
|
||
/** | ||
* Categories that should be listed in the table if patients of these categories have been transferred and/or are remaining. | ||
*/ | ||
readonly showIfTransferredOrRemainingCategories = [ | ||
'blue', | ||
'white', | ||
] as const; | ||
|
||
/** | ||
* Categories that should only be listed in the table if patients of these categories have been transferred. | ||
* (Black patients should usually never be transferred, so its okay to not show their remaining number.) | ||
*/ | ||
readonly showIfTransferredCategories = ['black'] as const; | ||
|
||
@Input() radiogramId!: UUID; | ||
|
||
radiogram$!: Observable<TransferCountsRadiogram>; | ||
|
||
constructor(private readonly store: Store<AppState>) {} | ||
|
||
ngOnInit(): void { | ||
this.radiogram$ = this.store.select( | ||
createSelectRadiogram<TransferCountsRadiogram>(this.radiogramId) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { IsBoolean, IsUUID, ValidateNested } from 'class-validator'; | ||
import { UUID, uuidValidationOptions } from '../../utils'; | ||
import { IsLiteralUnion, IsValue } from '../../utils/validators'; | ||
import { IsRadiogramStatus } from '../../utils/validators/is-radiogram-status'; | ||
import type { PatientStatus } from '../utils'; | ||
import { getCreate } from '../utils'; | ||
import { ResourceDescription } from '../utils/resource-description'; | ||
import { IsResourceDescription } from '../../utils/validators/is-resource-description'; | ||
import type { Radiogram } from './radiogram'; | ||
import { ExerciseRadiogramStatus } from './status/exercise-radiogram-status'; | ||
import { Scope, scopeAllowedValues } from './utils/scope'; | ||
|
||
export class TransferCountsRadiogram implements Radiogram { | ||
@IsUUID(4, uuidValidationOptions) | ||
readonly id: UUID; | ||
|
||
@IsValue('transferCountsRadiogram') | ||
readonly type = 'transferCountsRadiogram'; | ||
|
||
@IsUUID(4, uuidValidationOptions) | ||
readonly simulatedRegionId: UUID; | ||
|
||
/** | ||
* @deprecated use the helpers from {@link radiogram-helpers.ts} | ||
* or {@link radiogram-helpers-mutable.ts} instead | ||
*/ | ||
@IsRadiogramStatus() | ||
@ValidateNested() | ||
readonly status: ExerciseRadiogramStatus; | ||
|
||
@IsBoolean() | ||
readonly informationAvailable: boolean = false; | ||
|
||
@IsResourceDescription() | ||
readonly transferredPatientsCounts: ResourceDescription<PatientStatus> = { | ||
red: 0, | ||
yellow: 0, | ||
green: 0, | ||
blue: 0, | ||
black: 0, | ||
white: 0, | ||
}; | ||
|
||
@IsResourceDescription() | ||
readonly remainingPatientsCounts: ResourceDescription<PatientStatus> = { | ||
red: 0, | ||
yellow: 0, | ||
green: 0, | ||
blue: 0, | ||
black: 0, | ||
white: 0, | ||
}; | ||
|
||
/** | ||
* Defines the scope of the counts reported with this radiogram. | ||
* * `singleRegion`: The patient counts refer only to the simulated region that sent the radiogram | ||
* * `transportManagement`: The patient counts refer to all simulated regions | ||
* that are managed by the transport management behavior of the simulated region that sent the radiogram | ||
*/ | ||
@IsLiteralUnion(scopeAllowedValues) | ||
readonly scope: Scope = 'singleRegion'; | ||
|
||
/** | ||
* @deprecated Use {@link create} instead | ||
*/ | ||
constructor( | ||
id: UUID, | ||
simulatedRegionId: UUID, | ||
status: ExerciseRadiogramStatus | ||
) { | ||
this.id = id; | ||
this.simulatedRegionId = simulatedRegionId; | ||
this.status = status; | ||
} | ||
|
||
static readonly create = getCreate(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './scope'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { AllowedValues } from '../../../utils/validators'; | ||
|
||
export type Scope = 'singleRegion' | 'transportManagement'; | ||
|
||
export const scopeAllowedValues: AllowedValues<Scope> = { | ||
singleRegion: true, | ||
transportManagement: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule test-scenarios
updated
1 files
+2,317 −0 | migration-test-scenarios/from-state-31/combined-scenarios/transfer-counts-radiogram-current.json |