Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-4521 : Add program tab to the visit patient scenario #77

Merged
merged 7 commits into from
Mar 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add another endpoint
  • Loading branch information
dilankavishka committed Mar 13, 2025
commit 15e6e11257760c070cf6131f76126774b34e6130
Original file line number Diff line number Diff line change
@@ -246,11 +246,16 @@ public HttpRequestActionBuilder getImmunizations(String patientUuid) {
.get("/openmrs/ws/fhir2/R4/Immunization?patient=" + patientUuid + "&_summary=data");
}

public HttpRequestActionBuilder getPrograms(String patientUuid) {
public HttpRequestActionBuilder getPrograms() {
return http("Get Programs of Patient")
.get("/openmrs/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))");
}

public HttpRequestActionBuilder getProgramEnrollment(String patientUuid) {
return http("Get Program Enrollment of Patient")
.get("openmrs/ws/rest/v1/programenrollment?patient=" + patientUuid+ "&v=custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,voided,state:(uuid,concept:(display))))");
}

public HttpRequestActionBuilder searchForDrug(String searchQuery) {
String customRepresentation = """
custom:(uuid,display,name,strength,
Original file line number Diff line number Diff line change
@@ -27,9 +27,7 @@
import static org.openmrs.performance.Constants.WEIGHT_KG;
import static org.openmrs.performance.utils.CommonUtils.extractConceptIds;



public class DoctorRegistry extends Registry<DoctorHttpService>{
public class DoctorRegistry extends Registry<DoctorHttpService> {

public DoctorRegistry() {
super(new DoctorHttpService());
@@ -103,19 +101,19 @@ public ChainBuilder openLabResultsTab(String patientUuid) {
public ChainBuilder openAllergiesTab(String patientUuid) {
return exec(httpService.getAllergies(patientUuid));
}

public ChainBuilder openAllergiesForm(){
public ChainBuilder openAllergiesForm() {
return exec(
httpService.getAllergens("Drug",DRUG_ALLERGEN_UUID),
httpService.getAllergens("Environment",ENVIRONMENTAL_ALLERGEN_UUID),
httpService.getAllergens("Food",FOOD_ALLERGEN_UUID),
httpService.getAllergens("Allergic Reactions",ALLERGY_REACTION_UUID)
httpService.getAllergens("Drug", DRUG_ALLERGEN_UUID),
httpService.getAllergens("Environment", ENVIRONMENTAL_ALLERGEN_UUID),
httpService.getAllergens("Food", FOOD_ALLERGEN_UUID),
httpService.getAllergens("Allergic Reactions", ALLERGY_REACTION_UUID)
);
}

public ChainBuilder recordAllergy(String patientUuid) {
public ChainBuilder recordAllergy(String patientUuid) {
return exec(
httpService.saveAllergy(patientUuid)
httpService.saveAllergy(patientUuid)
);
}

@@ -132,7 +130,10 @@ public ChainBuilder openAttachmentsTab(String patientUuid) {
.exec(httpService.getAllowedFileExtensions());
}

public ChainBuilder openProgramsTab(String patientUuid) {return exec(httpService.getPrograms(patientUuid));}
public ChainBuilder openProgramsTab(String patientUuid) {
return exec(httpService.getPrograms())
.exec(httpService.getProgramEnrollment(patientUuid));
}

public ChainBuilder openVisitsTab(String patientUuid) {
return exec(httpService.getVisitsOfPatient(patientUuid));
@@ -145,19 +146,19 @@ public ChainBuilder addDrugOrder(String patientUuid, String visitUuid, String cu
httpService.getActiveVisitOfPatient(patientUuid),
httpService.searchForDrug("asprin"),
httpService.searchForDrug("Tylenol"),
httpService.saveOrder(patientUuid, visitUuid, currentUserUuid, asprin_162_5mg, asprinConcept)
httpService.saveOrder(patientUuid, visitUuid, currentUserUuid, asprin_162_5mg, asprinConcept)
);

}

public ChainBuilder addVisitNote(String patientUuid, String currentUserUuid) {
String visitNoteText = "Patient visit note";
String certainty = "PROVISIONAL";
String encounterUuid = "#{encounterUuid}";

return exec(
httpService.saveVisitNote(patientUuid, currentUserUuid, visitNoteText),
httpService.saveDiagnosis(patientUuid, encounterUuid, DIABETIC_KETOSIS_CONCEPT, certainty, 1),
httpService.saveDiagnosis(patientUuid, encounterUuid, DIABETIC_FOOT_ULCER_CONCEPT, certainty, 2));
httpService.saveVisitNote(patientUuid, currentUserUuid, visitNoteText),
httpService.saveDiagnosis(patientUuid, encounterUuid, DIABETIC_KETOSIS_CONCEPT, certainty, 1),
httpService.saveDiagnosis(patientUuid, encounterUuid, DIABETIC_FOOT_ULCER_CONCEPT, certainty, 2));
}
}
Loading
Oops, something went wrong.