@andes/fhir 1.12.1-beta.6 → 1.12.1-beta.7
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/lib/patient.js +13 -3
- package/package.json +1 -1
package/dist/lib/patient.js
CHANGED
|
@@ -99,6 +99,16 @@ function mapEstadoCivilFHIRToAndes(estadoCivil) {
|
|
|
99
99
|
return 'otro';
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
function mapAndesRankingToFhirRank(andesRanking) {
|
|
103
|
+
return typeof andesRanking === 'number' && Number.isInteger(andesRanking) && andesRanking >= 0
|
|
104
|
+
? andesRanking + 1
|
|
105
|
+
: 1;
|
|
106
|
+
}
|
|
107
|
+
function mapFhirRankToAndesRanking(fhirRank) {
|
|
108
|
+
return typeof fhirRank === 'number' && Number.isInteger(fhirRank) && fhirRank > 0
|
|
109
|
+
? fhirRank - 1
|
|
110
|
+
: 0;
|
|
111
|
+
}
|
|
102
112
|
/**
|
|
103
113
|
* Encode a patient from ANDES to FHIR
|
|
104
114
|
*/
|
|
@@ -145,7 +155,7 @@ function encode(patient) {
|
|
|
145
155
|
.map((unContacto) => {
|
|
146
156
|
const cont = {
|
|
147
157
|
value: unContacto.valor,
|
|
148
|
-
rank: unContacto.ranking
|
|
158
|
+
rank: mapAndesRankingToFhirRank(unContacto.ranking)
|
|
149
159
|
};
|
|
150
160
|
switch (unContacto.tipo) {
|
|
151
161
|
case 'fijo':
|
|
@@ -240,7 +250,7 @@ function encode(patient) {
|
|
|
240
250
|
}
|
|
241
251
|
if (patient.createdBy?.organizacion) {
|
|
242
252
|
const managingOrganization = {
|
|
243
|
-
reference: patient.createdBy.organizacion.id
|
|
253
|
+
reference: `Organization/${patient.createdBy.organizacion.id}`,
|
|
244
254
|
display: patient.createdBy.organizacion.nombre
|
|
245
255
|
};
|
|
246
256
|
pacienteFHIR.managingOrganization = managingOrganization;
|
|
@@ -299,7 +309,7 @@ function decode(patient) {
|
|
|
299
309
|
? patient.telecom.map((unContacto) => {
|
|
300
310
|
const cont = {
|
|
301
311
|
valor: unContacto.value,
|
|
302
|
-
ranking: unContacto.rank
|
|
312
|
+
ranking: mapFhirRankToAndesRanking(unContacto.rank)
|
|
303
313
|
};
|
|
304
314
|
switch (unContacto.system) {
|
|
305
315
|
case 'phone':
|