@andes/fhir 1.13.0-beta.1 → 1.13.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/identifier-systems.d.ts +13 -0
- package/dist/constants/identifier-systems.js +16 -0
- package/dist/index.js +17 -7
- package/dist/lib/allergyIntolerance.d.ts +12 -0
- package/dist/lib/allergyIntolerance.js +18 -3
- package/dist/lib/bundle.d.ts +1 -1
- package/dist/lib/bundle.js +4 -8
- package/dist/lib/composition.d.ts +7 -12
- package/dist/lib/composition.js +189 -92
- package/dist/lib/condition.d.ts +1 -49
- package/dist/lib/condition.js +43 -39
- package/dist/lib/config.js +7 -7
- package/dist/lib/device.d.ts +5 -1
- package/dist/lib/device.js +8 -5
- package/dist/lib/document-reference.js +2 -7
- package/dist/lib/immunization.d.ts +1 -38
- package/dist/lib/immunization.js +54 -42
- package/dist/lib/medication.js +1 -2
- package/dist/lib/medicationRequest.d.ts +2 -2
- package/dist/lib/medicationRequest.js +4 -8
- package/dist/lib/medicationStatement.js +2 -3
- package/dist/lib/organization.js +30 -13
- package/dist/lib/patient.js +31 -17
- package/dist/lib/practitioner.d.ts +0 -3
- package/dist/lib/practitioner.js +56 -30
- package/dist/types/andes/practitioner.types.d.ts +3 -2
- package/dist/utils/fhirDate.d.ts +3 -0
- package/dist/utils/fhirDate.js +24 -0
- package/dist/utils/rankingMapping.js +2 -3
- package/package.json +11 -13
- package/dist/data/patient.json +0 -192
- package/dist/helpers/patientFactory.d.ts +0 -26
- package/dist/helpers/patientFactory.js +0 -35
- package/dist/lib/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -19
- package/dist/lib/device.test.d.ts +0 -1
- package/dist/lib/device.test.js +0 -9
- package/dist/lib/patient.test.d.ts +0 -1
- package/dist/lib/patient.test.js +0 -132
package/dist/lib/condition.js
CHANGED
|
@@ -4,16 +4,34 @@
|
|
|
4
4
|
* @param registro Registro RUP a transformar a FHIR
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.encode =
|
|
7
|
+
exports.encode = encode;
|
|
8
8
|
function encode(patientReference, registro) {
|
|
9
|
-
|
|
9
|
+
const estado = registro.valor?.estado;
|
|
10
|
+
let clinicalStatusCode = 'active';
|
|
11
|
+
if (estado === 'inactivo' || estado === 'inactive') {
|
|
12
|
+
clinicalStatusCode = 'inactive';
|
|
13
|
+
}
|
|
14
|
+
else if (estado === 'resuelto' || estado === 'resolved') {
|
|
15
|
+
clinicalStatusCode = 'resolved';
|
|
16
|
+
}
|
|
17
|
+
const condition = {
|
|
18
|
+
resourceType: 'Condition',
|
|
10
19
|
id: registro._id,
|
|
20
|
+
meta: {
|
|
21
|
+
profile: [
|
|
22
|
+
'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips'
|
|
23
|
+
]
|
|
24
|
+
},
|
|
11
25
|
category: [
|
|
12
26
|
{
|
|
13
27
|
coding: [
|
|
28
|
+
{
|
|
29
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-category',
|
|
30
|
+
code: 'problem-list-item',
|
|
31
|
+
display: 'Problem List Item'
|
|
32
|
+
},
|
|
14
33
|
{
|
|
15
34
|
system: 'http://loinc.org',
|
|
16
|
-
display: 'Problem',
|
|
17
35
|
code: '75326-9'
|
|
18
36
|
}
|
|
19
37
|
]
|
|
@@ -22,58 +40,44 @@ function encode(patientReference, registro) {
|
|
|
22
40
|
subject: {
|
|
23
41
|
reference: patientReference
|
|
24
42
|
},
|
|
25
|
-
onsetDateTime: registro.createdAt.
|
|
26
|
-
resourceType: 'Condition',
|
|
27
|
-
// Por el momento ponemos 'confirmed'
|
|
43
|
+
onsetDateTime: registro.createdAt ? new Date(registro.createdAt).toISOString() : new Date().toISOString(),
|
|
28
44
|
verificationStatus: {
|
|
29
45
|
coding: [
|
|
30
46
|
{
|
|
31
|
-
system: 'http://terminology.hl7.org
|
|
47
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status',
|
|
32
48
|
code: 'confirmed'
|
|
33
49
|
}
|
|
34
50
|
]
|
|
35
51
|
},
|
|
36
|
-
|
|
52
|
+
clinicalStatus: {
|
|
37
53
|
coding: [
|
|
38
54
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
display: registro.concepto.fsn
|
|
55
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
56
|
+
code: clinicalStatusCode
|
|
42
57
|
}
|
|
43
58
|
]
|
|
44
59
|
},
|
|
45
|
-
|
|
46
|
-
meta: {
|
|
47
|
-
profile: [
|
|
48
|
-
'http://hl7.org/fhir/uv/ips/StructureDefinition/condition-uv-ips'
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
text: {
|
|
52
|
-
status: 'generated',
|
|
53
|
-
div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Problema: </p><p>${registro.nombre}</p></div>`
|
|
54
|
-
},
|
|
55
|
-
severity: {
|
|
60
|
+
code: {
|
|
56
61
|
coding: [
|
|
57
62
|
{
|
|
58
|
-
system: 'http://
|
|
59
|
-
|
|
60
|
-
code: 'LA6751-7'
|
|
63
|
+
system: 'http://snomed.info/sct',
|
|
64
|
+
code: String(registro.concepto.conceptId)
|
|
61
65
|
}
|
|
62
|
-
]
|
|
66
|
+
],
|
|
67
|
+
text: registro.concepto.term || registro.concepto.fsn
|
|
63
68
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
code: registro.valor.estado // [TODO] Tenemos este dato.
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
system: 'http://terminology.hl7.org/CodeSystem/evolution',
|
|
72
|
-
// code: registro.valor.evolucion.replace('<p>','').replace('</p>','') // [TODO] Tenemos este dato.
|
|
73
|
-
code: registro.valor.evolucion // [TODO] Tenemos este dato.
|
|
74
|
-
}
|
|
75
|
-
]
|
|
69
|
+
recordedDate: registro.createdAt ? new Date(registro.createdAt).toISOString() : undefined,
|
|
70
|
+
text: {
|
|
71
|
+
status: 'generated',
|
|
72
|
+
div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Problema: </p><p>${registro.nombre || registro.concepto?.term || ''}</p></div>`
|
|
76
73
|
}
|
|
77
74
|
};
|
|
75
|
+
if (registro.valor?.evolucion) {
|
|
76
|
+
condition.note = [
|
|
77
|
+
{
|
|
78
|
+
text: String(registro.valor.evolucion)
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
return condition;
|
|
78
83
|
}
|
|
79
|
-
exports.encode = encode;
|
package/dist/lib/config.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.initialize = initialize;
|
|
4
|
+
exports.getDominio = getDominio;
|
|
5
|
+
exports.makeUrl = makeUrl;
|
|
6
|
+
exports.__reset = __reset;
|
|
7
|
+
const identifier_systems_1 = require("../constants/identifier-systems");
|
|
8
|
+
let DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
|
|
5
9
|
function initialize(config) {
|
|
6
10
|
DOMINIO = config.dominio;
|
|
7
11
|
}
|
|
8
|
-
exports.initialize = initialize;
|
|
9
12
|
function getDominio() {
|
|
10
13
|
return DOMINIO;
|
|
11
14
|
}
|
|
12
|
-
exports.getDominio = getDominio;
|
|
13
15
|
function makeUrl(resource, id) {
|
|
14
16
|
let url = `${DOMINIO}/${resource}`;
|
|
15
17
|
if (id) {
|
|
@@ -17,11 +19,9 @@ function makeUrl(resource, id) {
|
|
|
17
19
|
}
|
|
18
20
|
return url;
|
|
19
21
|
}
|
|
20
|
-
exports.makeUrl = makeUrl;
|
|
21
22
|
/**
|
|
22
23
|
* Reseteo explícito para tests
|
|
23
24
|
*/
|
|
24
25
|
function __reset() {
|
|
25
|
-
DOMINIO =
|
|
26
|
+
DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
|
|
26
27
|
}
|
|
27
|
-
exports.__reset = __reset;
|
package/dist/lib/device.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare function encode(): {
|
|
2
2
|
resourceType: string;
|
|
3
3
|
id: string;
|
|
4
|
+
text: {
|
|
5
|
+
status: string;
|
|
6
|
+
div: string;
|
|
7
|
+
};
|
|
4
8
|
identifier: {
|
|
5
9
|
system: string;
|
|
6
10
|
value: string;
|
|
@@ -9,8 +13,8 @@ export declare function encode(): {
|
|
|
9
13
|
coding: {
|
|
10
14
|
system: string;
|
|
11
15
|
code: string;
|
|
12
|
-
display: string;
|
|
13
16
|
}[];
|
|
17
|
+
text: string;
|
|
14
18
|
};
|
|
15
19
|
owner: {
|
|
16
20
|
reference: string;
|
package/dist/lib/device.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode =
|
|
3
|
+
exports.encode = encode;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
5
|
function encode() {
|
|
6
6
|
/**
|
|
@@ -9,6 +9,10 @@ function encode() {
|
|
|
9
9
|
return {
|
|
10
10
|
resourceType: 'Device',
|
|
11
11
|
id: 'device-01',
|
|
12
|
+
text: {
|
|
13
|
+
status: 'generated',
|
|
14
|
+
div: '<div xmlns="http://www.w3.org/1999/xhtml"><p>Sistema de Aplicaciones Neuquinas de Salud (ANDES)</p></div>'
|
|
15
|
+
},
|
|
12
16
|
identifier: [
|
|
13
17
|
{
|
|
14
18
|
system: (0, config_1.makeUrl)('Device'),
|
|
@@ -19,10 +23,10 @@ function encode() {
|
|
|
19
23
|
coding: [
|
|
20
24
|
{
|
|
21
25
|
system: 'http://snomed.info/sct',
|
|
22
|
-
code: '462894001'
|
|
23
|
-
display: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
|
|
26
|
+
code: '462894001'
|
|
24
27
|
}
|
|
25
|
-
]
|
|
28
|
+
],
|
|
29
|
+
text: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
|
|
26
30
|
},
|
|
27
31
|
owner: {
|
|
28
32
|
reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
|
|
@@ -35,4 +39,3 @@ function encode() {
|
|
|
35
39
|
]
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
|
-
exports.encode = encode;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.encode =
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
3
|
+
exports.encode = encode;
|
|
8
4
|
const config_1 = require("./config");
|
|
9
5
|
function encode(ID, author, organization, patient, binaryURL) {
|
|
10
6
|
return {
|
|
11
7
|
resourceType: 'DocumentReference',
|
|
12
8
|
id: ID,
|
|
13
9
|
meta: {
|
|
14
|
-
lastUpdated:
|
|
10
|
+
lastUpdated: new Date().toISOString()
|
|
15
11
|
},
|
|
16
12
|
contained: [
|
|
17
13
|
{
|
|
@@ -103,4 +99,3 @@ function encode(ID, author, organization, patient, binaryURL) {
|
|
|
103
99
|
}
|
|
104
100
|
};
|
|
105
101
|
}
|
|
106
|
-
exports.encode = encode;
|
|
@@ -4,41 +4,4 @@
|
|
|
4
4
|
* [ASK] El code de extension puede ir en vaccineCode?
|
|
5
5
|
* [ASk] Location no se sabe. Solo esta el texto
|
|
6
6
|
*/
|
|
7
|
-
export declare function encode(patientReference: any, nomivac: any):
|
|
8
|
-
resourceType: string;
|
|
9
|
-
id: any;
|
|
10
|
-
extension: {
|
|
11
|
-
url: string;
|
|
12
|
-
valueCoding: {
|
|
13
|
-
system: string;
|
|
14
|
-
code: string;
|
|
15
|
-
display: any;
|
|
16
|
-
};
|
|
17
|
-
}[];
|
|
18
|
-
status: string;
|
|
19
|
-
notGiven: boolean;
|
|
20
|
-
vaccineCode: {
|
|
21
|
-
coding: {
|
|
22
|
-
system: string;
|
|
23
|
-
code: any;
|
|
24
|
-
display: any;
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
27
|
-
patient: {
|
|
28
|
-
reference: any;
|
|
29
|
-
};
|
|
30
|
-
date: any;
|
|
31
|
-
primarySource: boolean;
|
|
32
|
-
location: {
|
|
33
|
-
reference: string;
|
|
34
|
-
};
|
|
35
|
-
vaccinationProtocol: {
|
|
36
|
-
doseSequence: number;
|
|
37
|
-
doseStatus: {
|
|
38
|
-
coding: {
|
|
39
|
-
system: string;
|
|
40
|
-
code: any;
|
|
41
|
-
}[];
|
|
42
|
-
};
|
|
43
|
-
}[];
|
|
44
|
-
};
|
|
7
|
+
export declare function encode(patientReference: any, nomivac: any): any;
|
package/dist/lib/immunization.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode =
|
|
3
|
+
exports.encode = encode;
|
|
4
4
|
/**
|
|
5
5
|
* Encode de Vacunas Nomivac from ANDES to FHIR
|
|
6
6
|
* @param {} nomivac
|
|
@@ -8,60 +8,72 @@ exports.encode = void 0;
|
|
|
8
8
|
* [ASk] Location no se sabe. Solo esta el texto
|
|
9
9
|
*/
|
|
10
10
|
function encode(patientReference, nomivac) {
|
|
11
|
-
|
|
11
|
+
const occurrenceDate = nomivac.fechaAplicacion
|
|
12
|
+
? new Date(nomivac.fechaAplicacion).toISOString()
|
|
13
|
+
: new Date().toISOString();
|
|
14
|
+
const immunization = {
|
|
12
15
|
resourceType: 'Immunization',
|
|
13
|
-
id: nomivac.idvacuna,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
url: 'http://sisa/fhir/condicionAplicacion',
|
|
25
|
-
valueCoding: {
|
|
26
|
-
system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
|
|
27
|
-
code: '17',
|
|
28
|
-
display: 'Personal de Salud'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
],
|
|
16
|
+
id: String(nomivac.idvacuna),
|
|
17
|
+
meta: {
|
|
18
|
+
profile: [
|
|
19
|
+
'http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips'
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
status: 'generated',
|
|
24
|
+
div: `<div xmlns="http://www.w3.org/1999/xhtml"><p>${nomivac.vacuna || 'Vacuna'}</p></div>`
|
|
25
|
+
},
|
|
32
26
|
status: 'completed',
|
|
33
|
-
notGiven: false,
|
|
34
27
|
vaccineCode: {
|
|
35
28
|
coding: [
|
|
36
29
|
{
|
|
37
30
|
system: 'https://snomed.info/sct/11000221109/id/228100022110',
|
|
38
|
-
code: nomivac.idvacuna,
|
|
31
|
+
code: String(nomivac.idvacuna),
|
|
39
32
|
display: nomivac.vacuna
|
|
40
33
|
}
|
|
41
|
-
]
|
|
34
|
+
],
|
|
35
|
+
text: nomivac.vacuna
|
|
42
36
|
},
|
|
43
37
|
patient: {
|
|
44
38
|
reference: patientReference
|
|
45
39
|
},
|
|
46
|
-
|
|
47
|
-
primarySource: false
|
|
48
|
-
|
|
40
|
+
occurrenceDateTime: occurrenceDate,
|
|
41
|
+
primarySource: false
|
|
42
|
+
};
|
|
43
|
+
if (nomivac.vacuna || nomivac.condicion) {
|
|
44
|
+
immunization.extension = [];
|
|
45
|
+
if (nomivac.vacuna) {
|
|
46
|
+
immunization.extension.push({
|
|
47
|
+
url: 'http://sisa/fhir/esquema',
|
|
48
|
+
valueCoding: {
|
|
49
|
+
system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
|
|
50
|
+
code: '0',
|
|
51
|
+
display: nomivac.vacuna
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (nomivac.condicion) {
|
|
56
|
+
immunization.extension.push({
|
|
57
|
+
url: 'http://sisa/fhir/condicionAplicacion',
|
|
58
|
+
valueCoding: {
|
|
59
|
+
system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
|
|
60
|
+
code: '17',
|
|
61
|
+
display: 'Personal de Salud'
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (nomivac.location) {
|
|
67
|
+
immunization.location = {
|
|
49
68
|
reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (nomivac.dosis) {
|
|
72
|
+
immunization.protocolApplied = [
|
|
53
73
|
{
|
|
54
|
-
|
|
55
|
-
doseStatus: {
|
|
56
|
-
coding: [
|
|
57
|
-
{
|
|
58
|
-
system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
|
|
59
|
-
code: nomivac.dosis
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
74
|
+
doseNumberString: String(nomivac.dosis)
|
|
63
75
|
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
return immunization;
|
|
66
79
|
}
|
|
67
|
-
exports.encode = encode;
|
package/dist/lib/medication.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode =
|
|
3
|
+
exports.encode = encode;
|
|
4
4
|
/**
|
|
5
5
|
* Encode de Medicamentos from ANDES to FHIR
|
|
6
6
|
* @param {} medication
|
|
@@ -61,4 +61,3 @@ function encode(medication) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
exports.encode = encode;
|
|
@@ -11,7 +11,7 @@ export declare function encode(patientReference: any, practitionerReference: any
|
|
|
11
11
|
contained: any[];
|
|
12
12
|
identifier: {
|
|
13
13
|
use: string;
|
|
14
|
-
system:
|
|
14
|
+
system: "http://app.andes.gob.ar/prescriptions";
|
|
15
15
|
value: any;
|
|
16
16
|
}[];
|
|
17
17
|
status: string;
|
|
@@ -25,7 +25,7 @@ export declare function encode(patientReference: any, practitionerReference: any
|
|
|
25
25
|
subject: {
|
|
26
26
|
reference: any;
|
|
27
27
|
};
|
|
28
|
-
authoredOn: string;
|
|
28
|
+
authoredOn: string | undefined;
|
|
29
29
|
requester: {
|
|
30
30
|
reference: any;
|
|
31
31
|
};
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
* Encode medicationRequest from ANDES to FHIR
|
|
4
4
|
* @param {} medicationRequest
|
|
5
5
|
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.encode =
|
|
11
|
-
const
|
|
7
|
+
exports.encode = encode;
|
|
8
|
+
const identifier_systems_1 = require("../constants/identifier-systems");
|
|
12
9
|
// Muy incompleto hay que mejorarlo mucho todavía
|
|
13
10
|
function encode(patientReference, practitionerReference, medicationFHIR, data) {
|
|
14
11
|
return {
|
|
@@ -24,7 +21,7 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
|
|
|
24
21
|
identifier: [
|
|
25
22
|
{
|
|
26
23
|
use: 'official',
|
|
27
|
-
system:
|
|
24
|
+
system: identifier_systems_1.FhirIdentifierSystems.PRESCRIPTIONS, // Es el id de la prestación completa
|
|
28
25
|
value: data.registro.id
|
|
29
26
|
}
|
|
30
27
|
],
|
|
@@ -53,7 +50,7 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
|
|
|
53
50
|
reference: patientReference // podría ser una reference a un group también
|
|
54
51
|
},
|
|
55
52
|
// encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
|
|
56
|
-
authoredOn:
|
|
53
|
+
authoredOn: data.registro?.createdAt ? new Date(data.registro.createdAt).toISOString().slice(0, 10) : undefined,
|
|
57
54
|
// requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
|
|
58
55
|
// por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
|
|
59
56
|
requester: {
|
|
@@ -100,4 +97,3 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
|
|
|
100
97
|
eventHistory: null // [{ Reference(Provenance) }]
|
|
101
98
|
};
|
|
102
99
|
}
|
|
103
|
-
exports.encode = encode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode =
|
|
3
|
+
exports.encode = encode;
|
|
4
4
|
/**
|
|
5
5
|
* Encode de Medicamentos from ANDES to FHIR
|
|
6
6
|
* @param {} medicationStatement
|
|
@@ -23,7 +23,7 @@ function encode(patientReference, medicationReference, prestacionMedicamento) {
|
|
|
23
23
|
},
|
|
24
24
|
meta: {
|
|
25
25
|
profile: [
|
|
26
|
-
'http://hl7.org/fhir/uv/ips/StructureDefinition/
|
|
26
|
+
'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips'
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
// extension: null,
|
|
@@ -52,4 +52,3 @@ function encode(patientReference, medicationReference, prestacionMedicamento) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
exports.encode = encode;
|
package/dist/lib/organization.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode =
|
|
3
|
+
exports.encode = encode;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
5
|
const rankingMapping_1 = require("../utils/rankingMapping");
|
|
6
|
+
const identifier_systems_1 = require("../constants/identifier-systems");
|
|
6
7
|
/**
|
|
7
8
|
* Encode an ANDES Organization to FHIR Organization
|
|
8
9
|
*/
|
|
@@ -14,25 +15,25 @@ function encode(organization) {
|
|
|
14
15
|
const identificadores = [];
|
|
15
16
|
if (data.codigo?.sisa) {
|
|
16
17
|
identificadores.push({
|
|
17
|
-
system:
|
|
18
|
+
system: identifier_systems_1.FhirIdentifierSystems.SISA,
|
|
18
19
|
value: data.codigo.sisa
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
if (data.codigo?.cuie) {
|
|
22
23
|
identificadores.push({
|
|
23
|
-
system:
|
|
24
|
+
system: identifier_systems_1.FhirIdentifierSystems.CUIE,
|
|
24
25
|
value: data.codigo.cuie
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
if (data.codigo?.remediar) {
|
|
28
29
|
identificadores.push({
|
|
29
|
-
system:
|
|
30
|
+
system: identifier_systems_1.FhirIdentifierSystems.REMEDIAR,
|
|
30
31
|
value: data.codigo.remediar
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
if (data.codigo?.sips) {
|
|
34
35
|
identificadores.push({
|
|
35
|
-
system:
|
|
36
|
+
system: identifier_systems_1.FhirIdentifierSystems.SIPS,
|
|
36
37
|
value: data.codigo.sips
|
|
37
38
|
});
|
|
38
39
|
}
|
|
@@ -62,18 +63,35 @@ function encode(organization) {
|
|
|
62
63
|
const direcciones = [];
|
|
63
64
|
if (data.direccion) {
|
|
64
65
|
const dir = data.direccion;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
66
|
+
const address = {};
|
|
67
|
+
const city = dir.ubicacion?.localidad?.nombre;
|
|
68
|
+
const state = dir.ubicacion?.provincia?.nombre;
|
|
69
|
+
const country = dir.ubicacion?.pais?.nombre;
|
|
70
|
+
if (dir.valor?.trim()) {
|
|
71
|
+
address.line = [dir.valor.trim()];
|
|
72
|
+
}
|
|
73
|
+
if (dir.codigoPostal && String(dir.codigoPostal).trim()) {
|
|
74
|
+
address.postalCode = String(dir.codigoPostal).trim();
|
|
75
|
+
}
|
|
76
|
+
if (city?.trim()) {
|
|
77
|
+
address.city = city.trim();
|
|
78
|
+
}
|
|
79
|
+
if (state?.trim()) {
|
|
80
|
+
address.state = state.trim();
|
|
81
|
+
}
|
|
82
|
+
if (country?.trim()) {
|
|
83
|
+
address.country = country.trim();
|
|
84
|
+
}
|
|
85
|
+
direcciones.push(address);
|
|
72
86
|
}
|
|
73
87
|
// Organización FHIR
|
|
74
88
|
const organizacionFHIR = {
|
|
75
89
|
resourceType: 'Organization',
|
|
76
90
|
id: data._id ?? data.id,
|
|
91
|
+
text: {
|
|
92
|
+
status: 'generated',
|
|
93
|
+
div: `<div xmlns="http://www.w3.org/1999/xhtml"><p>${data.nombre || 'Organización'}</p></div>`
|
|
94
|
+
},
|
|
77
95
|
identifier: identificadores,
|
|
78
96
|
active: data.activo ?? undefined,
|
|
79
97
|
name: data.nombre ?? undefined,
|
|
@@ -91,4 +109,3 @@ function encode(organization) {
|
|
|
91
109
|
}
|
|
92
110
|
return organizacionFHIR;
|
|
93
111
|
}
|
|
94
|
-
exports.encode = encode;
|