Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Define a constant instead of duplicating "http://loinc.org" 3 times

I tried defining a const by typing in
const loinc = "http://loinc.org";

After pushing my code, the build fails and I get this error: illegal start of expression

List<ObservationComponentComponent> listComponent = new ArrayList<>();
        // loop through the different types in array 
        for (int i = 0; i < body.length; i++) {
            DeviceBloodPressureBody curBody = body[i];
            ObservationComponentComponent component = new ObservationComponentComponent();
            // set LOINC codes for components
            CodeableConcept observationComCodeConcept = new CodeableConcept();
            Coding observationComCodeCoding = new Coding("", "", "");
            const loinc = "http://loinc.org";
            if (curBody.getDataType().equals("diastolic")) {
                observationComCodeCoding = new Coding(loinc, "88462-4", "Diastolic blood pressure");
            } else if (curBody.getDataType().equals("systolic")){
                observationComCodeCoding = new Coding(loinc, "8480-6", "Systolic blood pressure");
            } else if(curBody.getDataType().equals("pulse")){
                observationComCodeCoding = new Coding(loinc, "8867-4", "Heart rate");
            }
            observationComCodeConcept.addCoding(observationComCodeCoding);
            component.setCode(observationComCodeConcept);

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

That way of defining a constant is for Javascript, not Java.

You can define one by changing

const loinc = "http://loinc.org";

For

final String loinc = "http://loinc.org";

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading