Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
18e89ea
Fix the DataSync with SyncFailureReason (#121)
vanitha1822 Sep 24, 2025
f2a546f
Update pom.xml
5Amogh Sep 25, 2025
3f52227
Fix the partial datasync issue (#122)
vanitha1822 Sep 26, 2025
f232c1c
Fix Sync Issue to Ensure Full Completion (#123)
vanitha1822 Oct 2, 2025
3db94c9
fix: update van serial no (#124)
vanitha1822 Oct 3, 2025
d621130
fix: ui change (#125)
vanitha1822 Oct 3, 2025
f1efb4d
fix: Doctor signature was not coming in to ncd care visittype
snehar-nd Oct 6, 2025
5e5e078
fix: add the createby and createat
vishwab1 Oct 6, 2025
869c023
Merge pull request #126 from PSMRI/sn/3.5.1
vishwab1 Oct 6, 2025
f1ebcf4
Fix the BenChiefcomplaint issue (#127)
vanitha1822 Oct 7, 2025
e8f40d7
Update pom.xml (#128)
vanitha1822 Oct 9, 2025
b1e6a4a
fix: van serial no (#130)
vanitha1822 Oct 10, 2025
0c5481d
fix: aam-1896 prescribed quantity was not coming in the casesheet
snehar-nd Oct 14, 2025
12e1ddd
Merge pull request #131 from PSMRI/sn/3.5.1
snehar-nd Oct 15, 2025
f83cd43
API changes in Signature enhancement for Casesheet (#133)
vishwab1 Oct 30, 2025
c9f6a59
fix:update doctor data with sign
vishwab1 Oct 30, 2025
606c45d
Merge pull request #134 from PSMRI/vb/signature
vishwab1 Oct 30, 2025
0fd1bb5
fix: amm-1919 fix for update doctor data for higher refferal data
snehar-nd Oct 31, 2025
d81128f
Merge pull request #135 from PSMRI/sn/3.5.1
snehar-nd Oct 31, 2025
95475bd
fix: created date updation issue (#136)
vanitha1822 Nov 4, 2025
406331a
fix: Added proper space in the string
snehar-nd Dec 9, 2025
6f2922e
Merge pull request #144 from PSMRI/sn/3.5.1
snehar-nd Dec 9, 2025
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.mmu</groupId>
<artifactId>mmu-api</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<packaging>war</packaging>

<name>MMU-API</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ public class BeneficiaryFlowStatus {
@Expose
@Column(name = "isCaseSheetdownloaded")
private Boolean isCaseSheetdownloaded;


@Expose
@Column(name = "doctor_signature_flag")
private Boolean doctorSignatureFlag = false;

Comment on lines +278 to +281
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | πŸ”΄ Critical

🧩 Analysis chain

Persisting doctorSignatureFlag: ensure schema + nullability are aligned

Looks fine. If nulls aren’t expected, mark the column non-nullable and confirm the migration adds it with a safe default.

Please verify:

  • A DB migration adds i_ben_flow_outreach.doctor_signature_flag with a default false and without breaking existing rows.
  • Any native/JPQL projections include this column consistently.

🏁 Script executed:

#!/bin/bash
# Find migrations and projections for doctor_signature_flag
rg -n "doctor_signature_flag" -g "!**/target/**"
rg -nP "getBenDetailsForLeftSidePanel|BeneficiaryFlowStatusRepo" -C3

Length of output: 35304


#!/bin/bash
# Get the full @Query definition for getBenDetailsForLeftSidePanel
sed -n '75,84p' src/main/java/com/iemr/mmu/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java

# Find the static mapper method that converts Object[] to BeneficiaryFlowStatus
rg -nA15 "getBeneficiaryFlowStatusForLeftPanel" src/main/java/com/iemr/mmu/data/benFlowStatus/BeneficiaryFlowStatus.java

# Search for migration files
fd -e sql -e java | xargs rg -l "doctor_signature_flag" | grep -iE "(migration|flyway|liquibase|schema)" || echo "No migration files found"

---

</parameter>
</invoke>

---

🏁 Script executed:

```shell
#!/bin/bash
# 1. Get full @Query definition for getBenDetailsForLeftSidePanel
echo "=== Full query definition ==="
sed -n '75,84p' src/main/java/com/iemr/mmu/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java

# 2. Find the static mapper method getBeneficiaryFlowStatusForLeftPanel
echo -e "\n=== Mapper method ==="
rg -nA20 "getBeneficiaryFlowStatusForLeftPanel" src/main/java/com/iemr/mmu/data/benFlowStatus/BeneficiaryFlowStatus.java

# 3. Search for migration/schema files containing doctor_signature_flag
echo -e "\n=== Migration files ==="
find . -type f \( -name "*.sql" -o -name "*.java" -o -name "*.yml" -o -name "*.yaml" \) -path "*/migration*" -o -path "*/db/*" | head -20

# 4. Search across all files for doctor_signature_flag in migrations
echo -e "\n=== Files referencing doctor_signature_flag ==="
rg -l "doctor_signature_flag" --type-list | head -20

Length of output: 749


🏁 Script executed:

#!/bin/bash
# 1. Get full @Query definition for getBenDetailsForLeftSidePanel
echo "=== Full query definition ==="
sed -n '75,84p' src/main/java/com/iemr/mmu/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java

# 2. Find the static mapper method getBeneficiaryFlowStatusForLeftPanel with context
echo -e "\n=== Mapper method ==="
rg -nA25 "getBeneficiaryFlowStatusForLeftPanel" src/main/java/com/iemr/mmu/data/benFlowStatus/BeneficiaryFlowStatus.java

# 3. Search for migration/schema files
echo -e "\n=== Migration and schema files ==="
find . -type f \( -name "*.sql" -o -name "*V*.java" \) | grep -iE "(migration|flyway|db)" | head -20

# 4. Search for doctor_signature_flag in all files
echo -e "\n=== All references to doctor_signature_flag ==="
rg "doctor_signature_flag" -n

Length of output: 2554


Fix unsafe Boolean cast and add missing database migration

The mapper at line 378 uses an unsafe direct cast: (Boolean) objArr[21]. JDBC drivers return Integer or Short (0/1) for boolean columns, not Boolean type. This will throw a ClassCastException at runtime.

Additionally, no database migration file was found in the repository. The schema migration for doctor_signature_flag must be included in the PR.

Required fixes:

  1. Mapper (line 378): Replace direct Boolean cast with safe conversion:

    if (objArr.length > 21 && objArr[21] != null) {
        Number numValue = (Number) objArr[21];
        obj.setDoctorSignatureFlag(numValue.intValue() != 0);
    }
  2. Database migration: Add a Flyway/Liquibase migration file that adds the doctor_signature_flag column with TINYINT(1) type, default 0, and NOT NULL constraint to the i_ben_flow_outreach table. Ensure it handles existing rows safely (e.g., via UPDATE statement).

πŸ€– Prompt for AI Agents
In src/main/java/com/iemr/mmu/data/benFlowStatus/BeneficiaryFlowStatus.java
around lines 278-281 (and the mapper usage around line 378), fix the unsafe
direct cast of objArr[21] to Boolean by treating the value as a Number (e.g.,
check null, cast to Number, then set doctorSignatureFlag = num.intValue() != 0)
to avoid ClassCastException from JDBC returning Integer/Short; additionally add
a database migration (Flyway or Liquibase) that alters table i_ben_flow_outreach
to add column doctor_signature_flag TINYINT(1) NOT NULL DEFAULT 0 and include a
safe UPDATE for existing rows if needed so the schema and code remain in sync.

@Transient
private I_bendemographics i_bendemographics;
@Transient
Expand Down Expand Up @@ -368,8 +372,11 @@ public static BeneficiaryFlowStatus getBeneficiaryFlowStatusForLeftPanel(ArrayLi
(String) objArr[3], (String) objArr[4], (Integer) objArr[5], (Short) objArr[6],
(String) objArr[7], (String) objArr[8], (String) objArr[9], (Long) objArr[10],
(String) objArr[11], (String) objArr[12], (String) objArr[13], (Long) objArr[14],
(Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
(Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
(String) objArr[19], (String) objArr[20]);
if (objArr.length > 21) {
obj.setDoctorSignatureFlag((Boolean) objArr[21]);
}
Comment on lines +377 to +379
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Robust Boolean extraction from native result to avoid ClassCastException

Direct cast to Boolean can blow up when JDBC returns 0/1 (Number). Parse defensively and avoid the magic index.

Apply:

-                if (objArr.length > 21) {
-                    obj.setDoctorSignatureFlag((Boolean) objArr[21]);
-                }
+                if (objArr.length > 21) {
+                    Object v = objArr[21];
+                    Boolean flag = (v instanceof Boolean) ? (Boolean) v
+                            : (v instanceof Number) ? (((Number) v).intValue() != 0)
+                            : (v != null ? Boolean.parseBoolean(v.toString()) : null);
+                    obj.setDoctorSignatureFlag(flag);
+                }

Optionally, replace 21 with a named constant tied to the SELECT list to prevent drift.

}
}
return obj;
Expand Down Expand Up @@ -972,4 +979,14 @@ public void setAuth(String auth) {
Auth = auth;
}

// Add getter
public Boolean getDoctorSignatureFlag() {
return doctorSignatureFlag;
}

// Add setter
public void setDoctorSignatureFlag(Boolean doctorSignatureFlag) {
this.doctorSignatureFlag = doctorSignatureFlag;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.google.gson.annotations.Expose;
import lombok.Data;

import lombok.Data;

@Entity
@Data
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/iemr/mmu/data/ncdcare/NCDCareDiagnosis.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Table(name = "t_ncddiagnosis")
public class NCDCareDiagnosis {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY )
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Expose
@Column(name = "ID")
private Long ID;
Expand Down Expand Up @@ -142,20 +142,18 @@ public class NCDCareDiagnosis {
@Transient
@Expose
private String externalInvestigation;

@Expose
@Transient
private ArrayList<SCTDescription> provisionalDiagnosisList;

@Expose
@Transient
private String diagnosisProvided;

@Expose
@Transient
private String diagnosisProvided_SCTCode;



public String getDiagnosisProvided() {
return diagnosisProvided;
Expand Down Expand Up @@ -383,7 +381,7 @@ public void setVanID(Integer vanID) {

public NCDCareDiagnosis(Long beneficiaryRegID, Long benVisitID, Integer providerServiceMapID, Long prescriptionID,
String ncdCareCondition, String ncdComplication, String ncdCareType, Long visitCode,
String externalInvestigation, String ncdCareConditionOther) {
String externalInvestigation, String ncdCareConditionOther, String createdBy, Timestamp createdDate) {
super();
this.beneficiaryRegID = beneficiaryRegID;
this.benVisitID = benVisitID;
Expand All @@ -395,14 +393,17 @@ public NCDCareDiagnosis(Long beneficiaryRegID, Long benVisitID, Integer provider
this.visitCode = visitCode;
this.externalInvestigation = externalInvestigation;
this.ncdScreeningConditionOther = ncdCareConditionOther;
this.createdBy = createdBy;
this.createdDate = createdDate;
}

public static NCDCareDiagnosis getNCDCareDiagnosisDetails(ArrayList<Object[]> resList) {
NCDCareDiagnosis cOBJ = null;
if (null != resList && resList.size() > 0) {
Object[] obj = resList.get(0);
cOBJ = new NCDCareDiagnosis((Long) obj[0], (Long) obj[1], (Integer) obj[2], (Long) obj[3], (String) obj[4],
(String) obj[5], (String) obj[6], (Long) obj[7], null, (String) obj[8]);
(String) obj[5], (String) obj[6], (Long) obj[7], null, (String) obj[8], (String) obj[9],
(Timestamp) obj[10]);

}
return cOBJ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ArrayList<BeneficiaryFlowStatus> getNurseWorklistNew(
+ " t.VisitCategory = :visitCategory, t.nurseFlag = :nurseFlag, t.doctorFlag = :docFlag, "
+ " t.labIteration = :labIteration, t.lab_technician_flag = 0, t.radiologist_flag = :radiologistFlag, "
+ " t.oncologist_flag = :oncologistFlag, t.benVisitDate = now(), "
+ " t.visitCode = :benVisitCode, t.processed = 'U', t.vanID =:vanID "
+ " t.visitCode = :benVisitCode, t.processed = 'U', t.vanID =:vanID, t.vanSerialNo=:benFlowID "
+ " WHERE t.benFlowID = :benFlowID AND t.beneficiaryRegID = :benRegID " + " AND nurseFlag = 1 ")
public int updateBenFlowStatusAfterNurseActivity(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benVisitID") Long benVisitID,
Expand All @@ -74,9 +74,12 @@ public int updateBenFlowStatusTMReferred(@Param("benFlowID") Long benFlowID, @Pa
@Param("specialistFlag") Short specialistFlag, @Param("pharmacistflag") Short pharmacistflag);

@Query("SELECT t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
+ " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
+ " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum FROM BeneficiaryFlowStatus t "
+ " Where t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
+ " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, "
+ " t.benVisitID, t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, "
+ " t.fatherName, t.preferredPhoneNum, t.doctorSignatureFlag " // <-- added here
+ " FROM BeneficiaryFlowStatus t "
+ " WHERE t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")

public ArrayList<Object[]> getBenDetailsForLeftSidePanel(@Param("benRegID") Long benRegID,
@Param("benFlowID") Long benFlowID);

Expand Down Expand Up @@ -147,37 +150,51 @@ public ArrayList<BeneficiaryFlowStatus> getLabWorklistNew(
@Param("providerServiceMapId") Integer providerServiceMapId, @Param("fromDate") Timestamp fromDate,
@Param("vanID") Integer vanID);


@Transactional
@Modifying
@Query("UPDATE BeneficiaryFlowStatus t set t.doctorFlag = :docFlag , t.pharmacist_flag = :pharmaFlag, "
+ " t.oncologist_flag = :oncologistFlag, t.consultationDate = now(), t.processed = 'U', "
+ " t.specialist_flag = :tcSpecialistFlag, t.tCSpecialistUserID = :tcSpecialistUserID, t.tCRequestDate = :tcDate "
+ " WHERE t.benFlowID = :benFlowID AND " + " t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID ")
@Query("UPDATE BeneficiaryFlowStatus t set t.doctorFlag = :docFlag, "
+ "t.pharmacist_flag = :pharmaFlag, t.doctorSignatureFlag = :signatureFlag, "
+ "t.oncologist_flag = :oncologistFlag, t.consultationDate = now(), t.processed = 'U', "
+ "t.specialist_flag = :tcSpecialistFlag, t.tCSpecialistUserID = :tcSpecialistUserID, "
+ "t.tCRequestDate = :tcDate WHERE t.benFlowID = :benFlowID AND "
+ "t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID")
public int updateBenFlowStatusAfterDoctorActivity(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benID") Long benID, @Param("docFlag") Short docFlag,
@Param("pharmaFlag") Short pharmaFlag, @Param("oncologistFlag") Short oncologistFlag,
@Param("tcSpecialistFlag") Short tcSpecialistFlag, @Param("tcSpecialistUserID") int tcSpecialistUserID,
@Param("tcDate") Timestamp tcDate);
@Transactional
@Modifying
@Query("UPDATE BeneficiaryFlowStatus t set t.doctorFlag = :docFlag , t.pharmacist_flag = :pharmaFlag, "
+ " t.oncologist_flag = :oncologistFlag, t.consultationDate = now(), t.processed = 'U', "
+ " t.tCSpecialistUserID = :tcSpecialistUserID, t.tCRequestDate = :tcDate "
+ " WHERE t.benFlowID = :benFlowID AND " + " t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID ")
public int updateBenFlowStatusAfterDoctorActivityWDF(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benID") Long benID, @Param("docFlag") Short docFlag,
@Param("pharmaFlag") Short pharmaFlag, @Param("oncologistFlag") Short oncologistFlag,
@Param("tcSpecialistUserID") int tcSpecialistUserID,
@Param("tcDate") Timestamp tcDate);
@Param("benRegID") Long benRegID, @Param("benID") Long benID,
@Param("docFlag") Short docFlag, @Param("pharmaFlag") Short pharmaFlag,
@Param("oncologistFlag") Short oncologistFlag,
@Param("tcSpecialistFlag") Short tcSpecialistFlag,
@Param("tcSpecialistUserID") int tcSpecialistUserID,
@Param("tcDate") Timestamp tcDate,
@Param("signatureFlag") Boolean signatureFlag);

@Transactional
@Modifying
@Query("UPDATE BeneficiaryFlowStatus t set t.pharmacist_flag = :pharmaFlag, "
+ " t.oncologist_flag = :oncologistFlag, t.processed = 'U', t.specialist_flag = :tcSpecialistFlag "
+ " WHERE t.benFlowID = :benFlowID AND t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID ")
public int updateBenFlowStatusAfterDoctorActivityTCSpecialist(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benID") Long benID, @Param("pharmaFlag") Short pharmaFlag,
@Param("oncologistFlag") Short oncologistFlag, @Param("tcSpecialistFlag") Short tcSpecialistFlag);
@Query("UPDATE BeneficiaryFlowStatus t set t.doctorFlag = :docFlag, "
+ "t.pharmacist_flag = :pharmaFlag, t.doctorSignatureFlag = :signatureFlag, "
+ "t.oncologist_flag = :oncologistFlag, t.consultationDate = now(), t.processed = 'U', "
+ "t.tCSpecialistUserID = :tcSpecialistUserID, t.tCRequestDate = :tcDate "
+ "WHERE t.benFlowID = :benFlowID AND t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID")
public int updateBenFlowStatusAfterDoctorActivityWDF(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benID") Long benID,
@Param("docFlag") Short docFlag, @Param("pharmaFlag") Short pharmaFlag,
@Param("oncologistFlag") Short oncologistFlag,
@Param("tcSpecialistUserID") int tcSpecialistUserID,
@Param("tcDate") Timestamp tcDate,
@Param("signatureFlag") Boolean signatureFlag);

@Transactional
@Modifying
@Query("UPDATE BeneficiaryFlowStatus t set t.pharmacist_flag = :pharmaFlag, "
+ "t.doctorSignatureFlag = :signatureFlag, "
+ "t.oncologist_flag = :oncologistFlag, t.processed = 'U', t.specialist_flag = :tcSpecialistFlag "
+ "WHERE t.benFlowID = :benFlowID AND t.beneficiaryRegID = :benRegID AND t.beneficiaryID = :benID")
public int updateBenFlowStatusAfterDoctorActivityTCSpecialist(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benID") Long benID,
@Param("pharmaFlag") Short pharmaFlag,
@Param("oncologistFlag") Short oncologistFlag,
@Param("tcSpecialistFlag") Short tcSpecialistFlag,
@Param("signatureFlag") Boolean signatureFlag);

@Transactional
@Modifying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
import java.math.BigInteger;
import java.util.ArrayList;

import org.springframework.data.jpa.repository.Modifying;
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;

import com.iemr.mmu.data.labModule.LabResultEntry;

import jakarta.transaction.Transactional;

@Repository
public interface LabResultEntryRepo extends CrudRepository<LabResultEntry, BigInteger> {
@Query("SELECT procedureID FROM LabResultEntry WHERE beneficiaryRegID = :benRegID AND "
Expand All @@ -46,4 +49,9 @@
ArrayList<Object[]> getLast_3_visitForLabTestDone(@Param("benRegID") Long benRegID,
@Param("visitCode") Long visitCode);

@Transactional
@Modifying
@Query(" UPDATE LabResultEntry set vanSerialNo = :ID WHERE ID = :ID")
int updateVanSerialNo(@Param("ID") BigInteger ID);

Check warning on line 55 in src/main/java/com/iemr/mmu/repo/labModule/LabResultEntryRepo.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AZnMhh2jQKzRHga7eZlS&open=AZnMhh2jQKzRHga7eZlS&pullRequest=129
Comment on lines +52 to +55
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | πŸ”΄ Critical

🧩 Analysis chain

LGTM! Verify return value handling in service layer.

The updateVanSerialNo method correctly implements the post-persistence pattern for populating vanSerialNo with the entity ID. The JPQL query syntax and annotations are appropriate.

However, ensure that calling code in the service layer checks the return value to confirm successful updates, especially since this operation occurs after the initial save.

Run the following script to verify that callers handle the return value:


🏁 Script executed:

#!/bin/bash
# Description: Check if callers of updateVanSerialNo verify the return value

# Search for calls to updateVanSerialNo
rg -nP -A 2 'updateVanSerialNo\s*\(' --type=java

Length of output: 4394


Handle updateVanSerialNo return value All service-layer calls to updateVanSerialNo ignore the returned row count; capture the int result and verify it’s >0, handling failures (e.g., throw or log) as appropriate.

πŸ€– Prompt for AI Agents
In src/main/java/com/iemr/mmu/repo/labModule/LabResultEntryRepo.java around
lines 52 to 55, service-layer callers currently ignore the int return value from
updateVanSerialNo; update those service methods to capture the returned row
count, verify it is > 0, and handle failures by either logging an error and/or
throwing a meaningful exception (e.g., EntityNotUpdatedException) when the
result is 0 or negative; ensure the service method signatures and callers
propagate or handle the exception appropriately and add unit tests to cover the
failure path.


}
5 changes: 5 additions & 0 deletions src/main/java/com/iemr/mmu/repo/nurse/BenVisitDetailRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public int updateFileID(@Param("fileIDs") String fileIDs, @Param("regID") Long r
@Query("SELECT MAX(bvd.createdDate) from BeneficiaryVisitDetail bvd WHERE bvd.beneficiaryRegID = :benRegID AND bvd.visitReason = :visitreason AND bvd.visitCategory = :visitcategory ")
public String getMaxCreatedDate(@Param("benRegID") Long benRegID, @Param("visitreason") String visitreason,@Param("visitcategory") String visitcategory);

@Transactional
@Modifying
@Query(" UPDATE BeneficiaryVisitDetail set vanSerialNo = :benVisitID WHERE benVisitID = :benVisitID")
int updateVanSerialNo(@Param("benVisitID") Long benVisitID);

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public interface NCDCareDiagnosisRepo extends CrudRepository<NCDCareDiagnosis, Long> {

@Query(" SELECT beneficiaryRegID, benVisitID, providerServiceMapID, prescriptionID, "
+ " ncdScreeningCondition, ncdComplication, ncdCareType, visitCode, ncdScreeningConditionOther "
+ " ncdScreeningCondition, ncdComplication, ncdCareType, visitCode, ncdScreeningConditionOther, createdBy, createdDate "
+ " from NCDCareDiagnosis ba " + " WHERE ba.beneficiaryRegID = :benRegID"
+ " AND ba.visitCode = :visitCode AND ba.deleted = false " + " ORDER BY createdDate desc")
public ArrayList<Object[]> getNCDCareDiagnosisDetails(@Param("benRegID") Long benRegID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ public ArrayList<Object[]> getBenChiefComplaints(@Param("benRegID") Long benRegI
@Query(" Delete from BenChiefComplaint WHERE beneficiaryRegID = :benRegID AND visitCode = :visitCode")
public int deleteExistingBenChiefComplaints(@Param("benRegID") Long benRegID, @Param("visitCode") Long visitCode);

@Transactional
@Modifying
@Query(" UPDATE BenChiefComplaint set vanSerialNo = :benChiefComplaintID WHERE benChiefComplaintID = :benChiefComplaintID")
int updateVanSerialNo(@Param("benChiefComplaintID") Long benChiefComplaintID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ public ArrayList<Object[]> getLabTestOrderDetails(@Param("benRegID") Long benReg
@Query(" Delete from LabTestOrderDetail WHERE beneficiaryRegID = :benRegID AND benVisitID = :benVisitID ")
public int deleteExistingLabTestOrderDetail(@Param("benRegID") Long benRegID, @Param("benVisitID") Long benVisitID);

@Transactional
@Modifying
@Query(" UPDATE LabTestOrderDetail set vanSerialNo = :labTestOrderID WHERE labTestOrderID = :labTestOrderID")
int updateVanSerialNo(@Param("labTestOrderID") Long labTestOrderID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,10 @@ public int updatePrescription(@Param("diagnosisProvided") String diagnosisProvid
@Param("diagnosisProvided_SCTCode") String diagnosisProvided_SCTCode,
@Param("diagnosisProvided_SCTTerm") String diagnosisProvided_SCTTerm);

@Transactional
@Modifying
@Query(" UPDATE PrescriptionDetail set vanSerialNo = :prescriptionID WHERE prescriptionID = :prescriptionID")
int updateVanSerialNo(@Param("prescriptionID") Long prescriptionID);


}
Loading
Loading