mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-09-13 16:02:52 +00:00
feat: add genetic counseling recommendation
This commit is contained in:
@@ -121,4 +121,29 @@ public class ResultSet {
|
||||
throw new IllegalArgumentException("Cannot convert " + raw.getClass() + " to Date");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check column value is equal to true
|
||||
*
|
||||
* @param columnName The name of the column
|
||||
* @return True if column value is equal to true
|
||||
*/
|
||||
public boolean isTrue(String columnName) {
|
||||
var raw = this.rawData.get(columnName);
|
||||
|
||||
if (raw == null) {
|
||||
return false;
|
||||
}
|
||||
if (raw instanceof Boolean) {
|
||||
return ((Boolean) raw);
|
||||
} else if (raw instanceof Integer) {
|
||||
return ((Integer) raw) == 1;
|
||||
} else if (raw instanceof Long) {
|
||||
return ((Long) raw) == 1;
|
||||
} else if (raw instanceof String) {
|
||||
return raw.toString().equals("1");
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Cannot convert " + raw.getClass() + " to Boolean");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,11 +57,13 @@ public class TherapieplanDataMapper implements DataMapper<MtbCarePlan> {
|
||||
.procedureRecommendations(einzelempfehlungProzedurDataMapper.getByParentId(id))
|
||||
;
|
||||
|
||||
// Formularfeld "protokollauszug"
|
||||
if (therapieplanData.getString("protokollauszug") != null) {
|
||||
// TODO see https://github.com/dnpm-dip/mtb-model/issues/8
|
||||
builder.notes(List.of(therapieplanData.getString("protokollauszug")));
|
||||
}
|
||||
|
||||
// Formularfeld "status_begruendung"
|
||||
if (
|
||||
null != therapieplanData.getString("status_begruendung")
|
||||
&& therapieplanData.getString("status_begruendung").equals(MtbCarePlanRecommendationsMissingReasonCodingCode.NO_TARGET.toValue())
|
||||
@@ -77,6 +79,23 @@ public class TherapieplanDataMapper implements DataMapper<MtbCarePlan> {
|
||||
);
|
||||
}
|
||||
|
||||
// Humangenetische Beratung
|
||||
if (therapieplanData.isTrue("humangen_beratung")) {
|
||||
builder.geneticCounselingRecommendation(
|
||||
GeneticCounselingRecommendation.builder()
|
||||
.id(therapieplanData.getString("id"))
|
||||
.patient(getPatientReference(therapieplanData.getString("patient_id")))
|
||||
.issuedOn(therapieplanData.getDate("datum_tk_humangenber"))
|
||||
.reason(
|
||||
getGeneticCounselingRecommendationReasonCoding(
|
||||
therapieplanData.getString("humangen_ber_grund"),
|
||||
therapieplanData.getInteger("humangen_ber_grund_propcat_version")
|
||||
)
|
||||
)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@@ -95,4 +114,21 @@ public class TherapieplanDataMapper implements DataMapper<MtbCarePlan> {
|
||||
return resultBuilder.build();
|
||||
}
|
||||
|
||||
private GeneticCounselingRecommendationReasonCoding getGeneticCounselingRecommendationReasonCoding(String value, int version) {
|
||||
if (value == null || !Arrays.stream(GeneticCounselingRecommendationReasonCodingCode.values()).map(GeneticCounselingRecommendationReasonCodingCode::toValue).collect(Collectors.toSet()).contains(value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var resultBuilder = GeneticCounselingRecommendationReasonCoding.builder()
|
||||
.system("dnpm-dip/mtb/recommendation/genetic-counseling/reason");
|
||||
try {
|
||||
resultBuilder.code(GeneticCounselingRecommendationReasonCodingCode.forValue(value));
|
||||
resultBuilder.display(propertyCatalogue.getByCodeAndVersion(value, version).getShortdesc());
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return resultBuilder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user