-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement backend for participant Clincial
- Loading branch information
Showing
8 changed files
with
327 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
src/main/java/org/kpmp/participant/ParticipantClinicalDataset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package org.kpmp.participant; | ||
|
||
import java.io.Serializable; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "participant_clinical") | ||
public class ParticipantClinicalDataset implements Serializable{ | ||
@Id | ||
@Column(name="participant_clinical_id") | ||
private int participantClinicalId; | ||
@Column(unique = true, name = "participant_id") | ||
private int participantId; | ||
@Column(name = "kdigo_stage") | ||
private String kdigoStage; | ||
@Column(name = "baseline_egfr") | ||
private String baselineEgfr; | ||
@Column(name = "proteinuria") | ||
private String proteinuria; | ||
@Column(name = "a1c") | ||
private String a1c; | ||
@Column(name = "albuminuria") | ||
private String albuminuria; | ||
@Column(name = "diabetes_history") | ||
private String diabetesHistory; | ||
@Column(name = "diabetes_duration") | ||
private String diabetesDuration; | ||
@Column(name = "hypertension_history") | ||
private String hypertensionHistory; | ||
@Column(name = "hypertension_duration") | ||
private String hypertensionDuration; | ||
@Column(name = "on_raas_blockade") | ||
private String onRaasBlockade; | ||
|
||
|
||
public int getParticipantClinicalId() { | ||
return this.participantClinicalId; | ||
} | ||
|
||
public void setParticipantClinicalId(int participantClinicalId) { | ||
this.participantClinicalId = participantClinicalId; | ||
} | ||
|
||
public int getParticipantId() { | ||
return this.participantId; | ||
} | ||
|
||
public void setParticipantId(int participantId) { | ||
this.participantId = participantId; | ||
} | ||
|
||
public String getKdigoStage() { | ||
return this.kdigoStage; | ||
} | ||
|
||
public void setKdigoStage(String kdigoStage) { | ||
this.kdigoStage = kdigoStage; | ||
} | ||
|
||
public String getBaselineEgfr() { | ||
return this.baselineEgfr; | ||
} | ||
|
||
public void setBaselineEgfr(String baselineEgfr) { | ||
this.baselineEgfr = baselineEgfr; | ||
} | ||
|
||
public String getProteinuria() { | ||
return this.proteinuria; | ||
} | ||
|
||
public void setProteinuria(String proteinuria) { | ||
this.proteinuria = proteinuria; | ||
} | ||
|
||
public String getA1c() { | ||
return this.a1c; | ||
} | ||
|
||
public void setA1c(String a1c) { | ||
this.a1c = a1c; | ||
} | ||
|
||
public String getAlbuminuria() { | ||
return this.albuminuria; | ||
} | ||
|
||
public void setAlbuminuria(String albuminuria) { | ||
this.albuminuria = albuminuria; | ||
} | ||
|
||
public String getDiabetesHistory() { | ||
return this.diabetesHistory; | ||
} | ||
|
||
public void setDiabetesHistory(String diabetesHistory) { | ||
this.diabetesHistory = diabetesHistory; | ||
} | ||
|
||
public String getDiabetesDuration() { | ||
return this.diabetesDuration; | ||
} | ||
|
||
public void setDiabetesDuration(String diabetesDuration) { | ||
this.diabetesDuration = diabetesDuration; | ||
} | ||
|
||
public String getHypertensionHistory() { | ||
return this.hypertensionHistory; | ||
} | ||
|
||
public void setHypertensionHistory(String hypertensionHistory) { | ||
this.hypertensionHistory = hypertensionHistory; | ||
} | ||
|
||
public String getHypertensionDuration() { | ||
return this.hypertensionDuration; | ||
} | ||
|
||
public void setHypertensionDuration(String hypertensionDuration) { | ||
this.hypertensionDuration = hypertensionDuration; | ||
} | ||
|
||
public String getOnRaasBlockade() { | ||
return this.onRaasBlockade; | ||
} | ||
|
||
public void setOnRaasBlockade(String onRaasBlockade) { | ||
this.onRaasBlockade = onRaasBlockade; | ||
} | ||
|
||
} | ||
|
15 changes: 15 additions & 0 deletions
15
src/main/java/org/kpmp/participant/ParticipantClinicalDatasetRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.kpmp.participant; | ||
|
||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ParticipantClinicalDatasetRepository extends CrudRepository<ParticipantClinicalDataset, Long> { | ||
|
||
@Cacheable("participantById") | ||
@Query(value = "select * from participant_clinical where participant_id= :participantId", nativeQuery = true) | ||
ParticipantClinicalDataset findByParticipantId(@Param("participantId") Integer participantId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/test/java/org/kpmp/participant/ParticipantClinicalDatasetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package org.kpmp.participant; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.junit.jupiter.api.TestInstance.Lifecycle; | ||
|
||
@TestInstance(Lifecycle.PER_CLASS) | ||
public class ParticipantClinicalDatasetTest { | ||
ParticipantClinicalDataset participantClinicalDataset; | ||
|
||
@BeforeAll | ||
public void setUp() throws Exception { | ||
this.participantClinicalDataset = new ParticipantClinicalDataset(); | ||
} | ||
|
||
@AfterAll | ||
public void tearDown() throws Exception { | ||
participantClinicalDataset = null; | ||
} | ||
|
||
@Test | ||
void testSetParticipantClicalId() { | ||
participantClinicalDataset.setParticipantClinicalId(0); | ||
assertEquals(0, participantClinicalDataset.getParticipantClinicalId()); | ||
} | ||
|
||
@Test | ||
void testSetParticipantId() { | ||
participantClinicalDataset.setParticipantId(2); | ||
assertEquals(2, participantClinicalDataset.getParticipantId()); | ||
} | ||
|
||
@Test | ||
void testSetKdigoStage() { | ||
participantClinicalDataset.setKdigoStage("Stage 1"); | ||
assertEquals("Stage 1", participantClinicalDataset.getKdigoStage()); | ||
} | ||
|
||
@Test | ||
void testSetBaselineEgfr() { | ||
participantClinicalDataset.setBaselineEgfr("blah"); | ||
assertEquals("blah", participantClinicalDataset.getBaselineEgfr()); | ||
} | ||
|
||
@Test | ||
void testSetProteinuria() { | ||
participantClinicalDataset.setProteinuria("proteinuria"); | ||
assertEquals("proteinuria", participantClinicalDataset.getProteinuria()); | ||
} | ||
|
||
@Test | ||
void testSetA1c() { | ||
participantClinicalDataset.setA1c("a1c"); | ||
assertEquals("a1c", participantClinicalDataset.getA1c()); | ||
} | ||
|
||
@Test | ||
void testSetAlbuminuria() { | ||
participantClinicalDataset.setAlbuminuria("ouchie"); | ||
assertEquals("ouchie", participantClinicalDataset.getAlbuminuria()); | ||
} | ||
|
||
@Test | ||
void testSetDiabetesHistory() { | ||
participantClinicalDataset.setDiabetesHistory("nope"); | ||
assertEquals("nope", participantClinicalDataset.getDiabetesHistory()); | ||
} | ||
|
||
@Test | ||
void testSetDiabetesDuration () { | ||
participantClinicalDataset.setDiabetesDuration("since the stone age"); | ||
assertEquals("since the stone age", participantClinicalDataset.getDiabetesDuration()); | ||
} | ||
|
||
@Test | ||
void testSetHypertensionHistory() { | ||
participantClinicalDataset.setHypertensionHistory("yes"); | ||
assertEquals("yes", participantClinicalDataset.getHypertensionHistory()); | ||
} | ||
|
||
@Test | ||
void testSetHypertensionDuration() { | ||
participantClinicalDataset.setHypertensionDuration("since the bronze age"); | ||
assertEquals("since the bronze age", participantClinicalDataset.getHypertensionDuration()); | ||
} | ||
|
||
@Test | ||
void testSetOnRaasBlockade() { | ||
participantClinicalDataset.setOnRaasBlockade("yes"); | ||
assertEquals("yes", participantClinicalDataset.getOnRaasBlockade()); | ||
} | ||
|
||
} |
Oops, something went wrong.