-
Notifications
You must be signed in to change notification settings - Fork 43
Add the functionality to store and retrieve the chief complaints data #129
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
Conversation
…urse and doctor module
|
Caution Review failedThe pull request is closed. WalkthroughThe changes update the handling of chief complaints in quick consultation workflows. Chief complaint data is now sourced from individual complaint objects rather than the root JSON. Additional logging is introduced. The master data service for nurses now returns actual data for QuickConsultation visits. Chief complaint insertion and retrieval logic is revised to use updated key names, add extra properties, and improve deserialization. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant QuickConsultationServiceImpl
participant BenChiefComplaint
participant MasterDataService
Client->>QuickConsultationServiceImpl: Insert nurse data (with chiefComplaintList)
QuickConsultationServiceImpl->>BenChiefComplaint: For each chief complaint, set benVisitID & visitCode
QuickConsultationServiceImpl->>QuickConsultationServiceImpl: Save chief complaints
QuickConsultationServiceImpl->>MasterDataService: Get master data for nurse (visitCategoryID=7)
MasterDataService-->>QuickConsultationServiceImpl: Return actual master data
Client->>QuickConsultationServiceImpl: Get nurse-to-doctor visit details
QuickConsultationServiceImpl->>BenChiefComplaint: Deserialize chiefComplaintList JSON
QuickConsultationServiceImpl->>Client: Return response with chiefComplaintList (if non-empty)
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/java/com/iemr/hwc/data/quickConsultation/BenChiefComplaint.java (1)
376-379: Consider using debug level for diagnostic logs.While adding logging is good, using info level for debugging details like IDs may generate excessive logs in production. Consider using debug level instead.
-logger.info("Visit id="+obj.get("benVisitID")); -logger.info("Visit code="+obj.get("visitCode")); +logger.debug("Visit id="+obj.get("benVisitID")); +logger.debug("Visit code="+obj.get("visitCode"));src/main/java/com/iemr/hwc/service/quickConsultation/QuickConsultationServiceImpl.java (1)
500-501: Consider converting to ArrayList instead of Arrays.asList.Using Arrays.asList creates a fixed-size list backed by the array. If there's any chance the list might need modification later, consider using a new ArrayList instead.
-List<BenChiefComplaint> benChiefComplaints = Arrays.asList(complaintsArray); +List<BenChiefComplaint> benChiefComplaints = new ArrayList<>(Arrays.asList(complaintsArray));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
src/main/java/com/iemr/hwc/data/quickConsultation/BenChiefComplaint.java(4 hunks)src/main/java/com/iemr/hwc/service/common/master/CommonMasterServiceImpl.java(1 hunks)src/main/java/com/iemr/hwc/service/quickConsultation/QuickConsultationServiceImpl.java(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (8)
src/main/java/com/iemr/hwc/data/quickConsultation/BenChiefComplaint.java (4)
34-36: Good addition of proper logging.Adding SLF4J logger is a good practice for better log management and debugging capabilities.
348-349: Proper logger initialization.The logger is correctly initialized as private static final, following best practices.
362-366: Correct refactor to improve data structure handling.Commenting out the previous code that extracted benVisitID and visitCode from the root JSON object is the right approach, as the new implementation will extract these values from each individual complaint object.
380-384: Improved data extraction from individual complaint objects.This change properly sets benVisitID and visitCode from each individual complaint object rather than from the root JSON, which aligns with the updated JSON structure. This ensures each complaint is properly associated with the correct visit.
src/main/java/com/iemr/hwc/service/common/master/CommonMasterServiceImpl.java (1)
129-133: Good enhancement to provide actual master data for QuickConsultation.Replacing the static message with actual master data retrieval improves consistency across visit categories and provides necessary data for the QuickConsultation workflow. This change aligns well with the overall objective of enhancing chief complaints functionality.
src/main/java/com/iemr/hwc/service/quickConsultation/QuickConsultationServiceImpl.java (3)
249-259: Enhanced chief complaint handling with proper linking to visit data.The updated code correctly augments each chief complaint with benVisitID and visitCode, ensuring proper data linkage between complaints and visits. This change supports the PR objective of enhancing chief complaints data storage.
262-262: Improved validation for chief complaint saving.Adding a non-null and greater-than-zero check for benChiefComplaintID provides better validation for successful chief complaint data saving.
498-509: Improved chief complaint deserialization and conditional response inclusion.The updated code properly deserializes the chief complaints JSON into an array of BenChiefComplaint objects and conditionally includes them in the response map only if the list is not empty. This improves data handling and prevents returning empty collections.
| JsonArray chiefComplaintArray = jsnOBJ.getAsJsonArray("chiefComplaintList"); | ||
|
|
||
| for (JsonElement element : chiefComplaintArray) { | ||
| JsonObject complaint = element.getAsJsonObject(); | ||
| complaint.addProperty("benVisitID", benVisitID); | ||
| complaint.addProperty("visitCode", benVisitCode); | ||
| } | ||
|
|
||
| benChiefComplaintID = saveBeneficiaryChiefComplaint(jsnOBJ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Validate JSON array existence before processing.
The code currently assumes chiefComplaintArray is not null. Add a null check to prevent potential NullPointerException if the array is missing.
-JsonArray chiefComplaintArray = jsnOBJ.getAsJsonArray("chiefComplaintList");
-
-for (JsonElement element : chiefComplaintArray) {
- JsonObject complaint = element.getAsJsonObject();
- complaint.addProperty("benVisitID", benVisitID);
- complaint.addProperty("visitCode", benVisitCode);
-}
+if (jsnOBJ.has("chiefComplaintList") && !jsnOBJ.get("chiefComplaintList").isJsonNull()) {
+ JsonArray chiefComplaintArray = jsnOBJ.getAsJsonArray("chiefComplaintList");
+
+ for (JsonElement element : chiefComplaintArray) {
+ JsonObject complaint = element.getAsJsonObject();
+ complaint.addProperty("benVisitID", benVisitID);
+ complaint.addProperty("visitCode", benVisitCode);
+ }
+}🤖 Prompt for AI Agents
In
src/main/java/com/iemr/hwc/service/quickConsultation/QuickConsultationServiceImpl.java
around lines 251 to 259, the code assumes the JSON array chiefComplaintList
exists without checking for null, which can cause a NullPointerException. Add a
null check to verify that chiefComplaintArray is not null before iterating over
it. Only process the array elements if the array is present to prevent runtime
exceptions.
src/main/java/com/iemr/hwc/data/quickConsultation/BenChiefComplaint.java
Outdated
Show resolved
Hide resolved
src/main/java/com/iemr/hwc/data/quickConsultation/BenChiefComplaint.java
Outdated
Show resolved
Hide resolved
|


Description
Jira ID: AMM-1419
Add the functionality to include the chief complaints data to store and retrieve from nurse and doctor module.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Improvements