001/*
002 * #%L
003 * HAPI FHIR JPA Server
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.jpa.search.lastn.json;
021
022import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
023import com.fasterxml.jackson.annotation.JsonAutoDetect;
024import com.fasterxml.jackson.annotation.JsonInclude;
025import com.fasterxml.jackson.annotation.JsonProperty;
026
027import java.util.ArrayList;
028import java.util.List;
029
030@JsonInclude(JsonInclude.Include.NON_NULL)
031@JsonAutoDetect(
032                creatorVisibility = JsonAutoDetect.Visibility.NONE,
033                fieldVisibility = JsonAutoDetect.Visibility.NONE,
034                getterVisibility = JsonAutoDetect.Visibility.NONE,
035                isGetterVisibility = JsonAutoDetect.Visibility.NONE,
036                setterVisibility = JsonAutoDetect.Visibility.NONE)
037public class CodeJson {
038
039        @JsonProperty(value = "codeable_concept_id", required = false)
040        private String myCodeableConceptId;
041
042        @JsonProperty(value = "text", required = false)
043        private String myCodeableConceptText;
044
045        @JsonProperty(value = "codingcode", required = false)
046        private List<String> myCoding_code = new ArrayList<>();
047
048        @JsonProperty(value = "codingcode_system_hash", required = true)
049        private List<String> myCoding_code_system_hash = new ArrayList<>();
050
051        @JsonProperty(value = "codingdisplay", required = false)
052        private List<String> myCoding_display = new ArrayList<>();
053
054        @JsonProperty(value = "codingsystem", required = false)
055        private List<String> myCoding_system = new ArrayList<>();
056
057        public CodeJson() {}
058
059        public void setCodeableConceptId(String theCodeableConceptId) {
060                myCodeableConceptId = theCodeableConceptId;
061        }
062
063        public void addCoding(String theCoding_system, String theCoding_code, String theCoding_display) {
064                myCoding_code.add(theCoding_code);
065                myCoding_system.add(theCoding_system);
066                myCoding_display.add(theCoding_display);
067                myCoding_code_system_hash.add(String.valueOf(CodeSystemHash.hashCodeSystem(theCoding_system, theCoding_code)));
068        }
069
070        public String getCodeableConceptId() {
071                return myCodeableConceptId;
072        }
073
074        public void setCodeableConceptText(String theCodeableConceptText) {
075                myCodeableConceptText = theCodeableConceptText;
076        }
077
078        public String getCodeableConceptText() {
079                return myCodeableConceptText;
080        }
081
082        public List<String> getCoding_code() {
083                return myCoding_code;
084        }
085
086        public List<String> getCoding_code_system_hash() {
087                return myCoding_code_system_hash;
088        }
089
090        public List<String> getCoding_display() {
091                return myCoding_display;
092        }
093
094        public List<String> getCoding_system() {
095                return myCoding_system;
096        }
097}