11import { PlusOutlined } from '@ant-design/icons' ;
22import { t , Trans } from '@lingui/macro' ;
3- import { Encounter } from 'fhir/r4b' ;
3+ import { Encounter , Reference } from 'fhir/r4b' ;
44
55import { questionnaireAction , navigationAction , ResourceListPage } from '@beda.software/emr/components' ;
66import { SearchBarColumnType } from '@beda.software/emr/dist/components/SearchBar/types' ;
7- import { formatPeriodDateTime } from '@beda.software/emr/utils' ;
7+ import { compileAsFirst , formatPeriodDateTime } from '@beda.software/emr/utils' ;
8+
9+ export const getPractitioner = compileAsFirst < Encounter , Reference > ( "Encounter.participant.individual.where(resourceType='Practitioner').individual" ) ;
10+ export const getPatient = compileAsFirst < Encounter , Reference > ( "Encounter.subject" ) ;
11+ export const getOrganization = compileAsFirst < Encounter , Reference > ( "Encounter.serviceProvider" ) ;
812
913export function EncountersUberList ( ) {
1014 return (
1115 < ResourceListPage < Encounter >
1216 headerTitle = "Encounters"
1317 resourceType = "Encounter"
1418 getTableColumns = { ( ) => [
15- {
16- title : 'Practitioner' ,
17- dataIndex : 'practitioner' ,
18- key : 'practitioner' ,
19- render : ( _text : any , { resource } ) => resource . participant ?. [ 0 ] ?. individual ?. display ,
20- } ,
2119 {
2220 title : 'Status' ,
2321 dataIndex : 'status' ,
@@ -33,6 +31,42 @@ export function EncountersUberList() {
3331 width : 250 ,
3432 render : ( _text : any , { resource } ) => formatPeriodDateTime ( resource . period ) ,
3533 } ,
34+ {
35+ title : 'Practitioner' ,
36+ dataIndex : 'practitioner' ,
37+ key : 'practitioner' ,
38+ render : ( _text : any , { resource } ) => {
39+ const reference = getPractitioner ( resource ) ;
40+ if ( reference ) {
41+ return reference . display ?? reference . reference ;
42+
43+ }
44+ } ,
45+ } ,
46+ {
47+ title : 'Patient' ,
48+ dataIndex : 'patient' ,
49+ key : 'patient' ,
50+ render : ( _text : any , { resource } ) => {
51+ const reference = getPatient ( resource ) ;
52+ if ( reference ) {
53+ return reference . display ?? reference . reference ;
54+
55+ }
56+ } ,
57+ } ,
58+ {
59+ title : 'Organization' ,
60+ dataIndex : 'organization' ,
61+ key : 'organization' ,
62+ render : ( _text : any , { resource } ) => {
63+ const reference = getOrganization ( resource ) ;
64+ if ( reference ) {
65+ return reference . display ?? reference . reference ;
66+
67+ }
68+ } ,
69+ } ,
3670 ] }
3771 getFilters = { ( ) => [
3872 {
@@ -68,7 +102,6 @@ export function EncountersUberList() {
68102 placement : [ 'table' , 'search-bar' ] ,
69103 } ,
70104 ] }
71- getRecordActions = { ( record ) => [ navigationAction ( 'Open' , `/` ) ] }
72105 getHeaderActions = { ( ) => [
73106 questionnaireAction ( < Trans > Create encounter</ Trans > , 'encounter-create-connectathon' , {
74107 icon : < PlusOutlined /> ,
0 commit comments