Unverified Commit 9cd82c12 authored by ggrund-tsi's avatar ggrund-tsi Committed by GitHub
Browse files

Fix/test type (#87)



* set cert expiration from service or recovery

* add value set 4 test type
Co-authored-by: default avatarGordon Grund <gordon.grund@outlook.de>
parent a2af5f22
......@@ -30,6 +30,7 @@ import VaccineManufacturers from './assets/json-res/vaccine-mah-manf.json';
import Vaccines from './assets/json-res/vaccine-prophylaxis.json';
import TestManufacturers from './assets/json-res/test-manf.json';
import TestResult from './assets/json-res/test-result.json';
import TestType from './assets/json-res/test-type.json';
interface IValue {
active: boolean,
......@@ -116,6 +117,23 @@ export const useGetVaccines = () => {
return vaccines;
}
// TestType
export const useGetTestType = () => {
const [testType, setTestType] = React.useState<IValueSet>();
React.useEffect(() => {
// get object via api
// const testManufacturers = getApiData('/testManufacturers');
// get object via public
const testType = TestType.valueSetValues;
setTestType(testType);
}, [])
return testType;
}
// TestManufacturers
export const useGetTestManufacturers = () => {
......
{
"valueSetId": "covid-19-lab-test-type",
"valueSetDate": "2021-04-27",
"valueSetValues": {
"LP6464-4": {
"display": "Nucleic acid amplification with probe detection",
"lang": "en",
"active": true,
"version": "2.69",
"system": "http://loinc.org"
},
"LP217198-3": {
"display": "Rapid immunoassay",
"lang": "en",
"active": true,
"version": "2.69",
"system": "http://loinc.org"
}
}
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ import folding_instruction from '../assets/images/folding-instruction.png';
import { EUDGC, RecoveryEntry, TestEntry, VaccinationEntry } from '../generated-files/dgc-combined-schema';
import {
useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines,
useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult
useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult, useGetTestType
} from '../api';
import { getValueSetDisplay, convertDateToOutputFormat } from '../misc/ShowCertificateData';
// import pdfParams from '../pdf-settings.json';
......@@ -97,6 +97,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
const vaccines = useGetVaccines();
const testManufacturersValueSet = useGetTestManufacturers();
const testResultValueSet = useGetTestResult();
const testTypeValueSet = useGetTestType();
//A4 210 x 297 mm or 2480 x 3508 pixels or 595 × 842 points
//A6 105 x 74 mm or 1240 x 1748 pixels or 298 × 420 points
......@@ -727,7 +728,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
y = printVerticalBlock(x, y,
t('translation:pdfTypeOfTest'),
french.translation.pdfTypeOfTest,
testSet.tt,
getValueSetDisplay(testSet.tt, testTypeValueSet),
lineHeight, true);
y = printVerticalBlock(x, y,
......@@ -804,7 +805,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
y = printVerticalBlockRotated(x, y,
t('translation:pdfTypeOfTest'),
french.translation.pdfTypeOfTest,
testSet.tt,
getValueSetDisplay(testSet.tt, testTypeValueSet),
lineHeight, true);
y = printVerticalBlockRotated(x, y,
......
......@@ -32,7 +32,7 @@ import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import { EUDGC, TestEntry } from '../generated-files/dgc-combined-schema';
import { useGetDiseaseAgents, useGetTestManufacturers, useGetTestResult } from '../api';
import { useGetDiseaseAgents, useGetTestManufacturers, useGetTestResult, useGetTestType } from '../api';
import schema from '../generated-files/DGC.combined-schema.json';
import { Validator } from 'jsonschema';
......@@ -214,11 +214,11 @@ const RecordTestCertData = (props: any) => {
/>
{/* testType input */}
<FormGroupInput controlId='formTestTypeInput' title={t('translation:testType')}
<FormGroupValueSetSelect controlId='formTestTypeInput' title={t('translation:testType')}
value={testType}
onChange={(evt: any) => setTestType(evt.target.value)}
required
maxLength={50}
valueSet={useGetTestType}
/>
{/* testName input */}
......
......@@ -3,7 +3,7 @@ import i18n from 'i18next'
import { IValueSet } from '../api';
import moment from 'moment';
import utils from './utils';
import { useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines, useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult } from '../api';
import { useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines, useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult, useGetTestType } from '../api';
import React from 'react';
import { Card } from 'react-bootstrap';
......@@ -28,6 +28,7 @@ export const ShowCertificateData = (props: any) => {
const vaccines = useGetVaccines();
const testManufacturersValueSet = useGetTestManufacturers();
const testResultValueSet = useGetTestResult();
const testTypeValueSet = useGetTestType();
const [eudgc, setEudgc] = React.useState<EUDGC>();
const [vaccinationSet, setVaccinationSet] = React.useState<VaccinationEntry>();
......@@ -124,7 +125,7 @@ export const ShowCertificateData = (props: any) => {
title: i18n.t('translation:test-data'),
entries: [
{ label: i18n.t('translation:disease-agent'), data: getValueSetDisplay(testSet?.tg, diseaseAgentsData) || defaultString },
{ label: i18n.t('translation:testType'), data: testSet?.tt || defaultString },
{ label: i18n.t('translation:testType'), data: getValueSetDisplay(testSet?.tt, testTypeValueSet) || defaultString },
{ label: i18n.t('translation:testName'), data: testSet?.nm || defaultString },
{ label: i18n.t('translation:testManufacturers'), data: getValueSetDisplay(testSet?.ma, testManufacturersValueSet) || defaultString }
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment