Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.iemr.tm</groupId>
<artifactId>tm-api</artifactId>
<version>3.6.2</version>
<version>3.9.0</version>
<packaging>war</packaging>

<name>TM-API</name>
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/com/iemr/tm/data/nurse/BeneficiaryVisitDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ public class BeneficiaryVisitDetail {
@Column(name = "VisitFlowStatusFlag", insertable = false)
private @SQLInjectionSafe String visitFlowStatusFlag;

@Expose
@Column(name = "NurseID")
private Long nurseID;

@Expose
@Column(name = "DoctorID")
private Long doctorID;

@Expose
@Column(name = "PharmacistID")
private Long pharmacistID;

@Expose
@Column(name = "LabTechnicianID")
private Long labTechnicianID;

@Expose
@Column(name = "VanSerialNo")
private Long vanSerialNo;
Expand Down Expand Up @@ -444,6 +460,38 @@ public void setVisitFlowStatusFlag(String visitFlowStatusFlag) {
this.visitFlowStatusFlag = visitFlowStatusFlag;
}

public Long getNurseID() {
return nurseID;
}

public void setNurseID(Long nurseID) {
this.nurseID = nurseID;
}

public Long getDoctorID() {
return doctorID;
}

public void setDoctorID(Long doctorID) {
this.doctorID = doctorID;
}

public Long getPharmacistID() {
return pharmacistID;
}

public void setPharmacistID(Long pharmacistID) {
this.pharmacistID = pharmacistID;
}

public Long getLabTechnicianID() {
return labTechnicianID;
}

public void setLabTechnicianID(Long labTechnicianID) {
this.labTechnicianID = labTechnicianID;
}

public ProviderServiceMapping getProviderServiceMapping() {
return providerServiceMapping;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/iemr/tm/repo/login/UserLoginRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public interface UserLoginRepo extends CrudRepository<Users, Long> {
@Query(" SELECT u FROM Users u WHERE u.userID = :userID AND u.Deleted = false ")
public Users getUserByUserID(@Param("userID") Long userID);

@Query(" SELECT u FROM Users u WHERE u.userName = :UserName AND u.Deleted = false ")
public Users getUserByUsername(@Param("UserName") String username);

@Query(nativeQuery = true,value = "select rolename from m_role where roleid in (select roleid from m_userservicerolemapping where userid=:userID)")
List<String> getRoleNamebyUserId(@Param("userID") Long userID);

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/iemr/tm/repo/nurse/BenVisitDetailRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,16 @@ public int updateFileID(@Param("fileIDs") String fileIDs, @Param("regID") Long r
@Query(nativeQuery = true, value = " SELECT v.visitCode FROM t_benvisitdetail v WHERE v.beneficiaryRegID=:benRegId AND v.providerServiceMapID=:psmId ORDER BY BenVisitID DESC LIMIT 1 ")
public Long getVisitCode(@Param("benRegId") Long benRegId, @Param("psmId") Integer psmId);

// store responsible doctor's user ID against the visit
@Transactional
@Modifying
@Query("UPDATE BeneficiaryVisitDetail set doctorID = :doctorID where visitCode = :visitCode ")
public Integer updateDoctorID(@Param("doctorID") Long doctorID, @Param("visitCode") Long visitCode);

// store responsible lab technician's user ID against the visit
@Transactional
@Modifying
@Query("UPDATE BeneficiaryVisitDetail set labTechnicianID = :labTechnicianID where visitCode = :visitCode ")
public Integer updateLabTechnicianID(@Param("labTechnicianID") Long labTechnicianID, @Param("visitCode") Long visitCode);

}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,33 @@ public class CommonDoctorServiceImpl {
@Autowired
private PNCDiagnosisRepo pNCDiagnosisRepo;
@Autowired
private com.iemr.tm.repo.nurse.BenVisitDetailRepo benVisitDetailRepo;
@Autowired
private com.iemr.tm.repo.login.UserLoginRepo userLoginRepo;

/**
* Resolve the numeric user ID of the responsible staff member from the username
* captured in createdBy. Returns null if it cannot be resolved so an unknown
* staff member never blocks the flow.
*/
private Long resolveUserId(String username) {
if (username == null || username.trim().isEmpty())
return null;
com.iemr.tm.data.login.Users user = userLoginRepo.getUserByUsername(username.trim());
return user != null ? user.getUserID() : null;
}

/**
* Store the responsible doctor's user ID on the visit record, taken from createdBy.
*/
private void storeDoctorIDOnVisit(CommonUtilityClass commonUtilityClass) {
if (commonUtilityClass == null || commonUtilityClass.getVisitCode() == null)
return;
Long doctorID = resolveUserId(commonUtilityClass.getCreatedBy());
if (doctorID != null)
benVisitDetailRepo.updateDoctorID(doctorID, commonUtilityClass.getVisitCode());
}
@Autowired
private PrescriptionDetailRepo prescriptionDetailRepo;
@Autowired
private NCDCareDiagnosisRepo NCDCareDiagnosisRepo;
Expand Down Expand Up @@ -717,6 +744,9 @@ public int updateBenFlowtableAfterDocDataSave(CommonUtilityClass commonUtilityCl
Long tmpBenVisitID = commonUtilityClass.getBenVisitID();
Long tmpbeneficiaryRegID = commonUtilityClass.getBeneficiaryRegID();

// Store the responsible doctor's user ID against the visit
storeDoctorIDOnVisit(commonUtilityClass);

if (commonUtilityClass != null && commonUtilityClass.getVisitCategoryID() != null
&& commonUtilityClass.getVisitCategoryID() == 4) {
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo
Expand Down Expand Up @@ -862,6 +892,9 @@ public int updateBenFlowtableAfterDocDataUpdate(CommonUtilityClass commonUtility
Long tmpBenVisitID = commonUtilityClass.getBenVisitID();
Long tmpbeneficiaryRegID = commonUtilityClass.getBeneficiaryRegID();

// Store the responsible doctor's user ID against the visit
storeDoctorIDOnVisit(commonUtilityClass);

// Foetal monitor related update in visitcode and lab flag
if (commonUtilityClass != null && commonUtilityClass.getVisitCategoryID() != null
&& commonUtilityClass.getVisitCategoryID() == 4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@
private Integer TMReferredWL;

private BenVisitDetailRepo benVisitDetailRepo;

@org.springframework.beans.factory.annotation.Autowired

Check warning on line 152 in src/main/java/com/iemr/tm/service/common/transaction/CommonNurseServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_TM-API&issues=AZ-OdbQPY0BtzQkzDKfQ&open=AZ-OdbQPY0BtzQkzDKfQ&pullRequest=156
private com.iemr.tm.repo.login.UserLoginRepo userLoginRepo;

/**
* Resolve the numeric user ID of the responsible staff member from the username
* captured in createdBy. Returns null if it cannot be resolved so an unknown
* staff member never blocks the save.
*/
private Long resolveUserId(String username) {
if (username == null || username.trim().isEmpty())
return null;
com.iemr.tm.data.login.Users user = userLoginRepo.getUserByUsername(username.trim());
return user != null ? user.getUserID() : null;
}

private BenChiefComplaintRepo benChiefComplaintRepo;
private BenMedHistoryRepo benMedHistoryRepo;
private BencomrbidityCondRepo bencomrbidityCondRepo;
Expand Down Expand Up @@ -413,6 +429,10 @@
}
beneficiaryVisitDetail.setReportFilePath(sb.toString());

// Store the responsible nurse's user ID (resolved from the createdBy username)
if (beneficiaryVisitDetail.getNurseID() == null)
beneficiaryVisitDetail.setNurseID(resolveUserId(beneficiaryVisitDetail.getCreatedBy()));

response = benVisitDetailRepo.save(beneficiaryVisitDetail);

if (response != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
private ECGAbnormalFindingMasterRepo ecgAbnormalFindingMasterRepo;
private CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl;

@org.springframework.beans.factory.annotation.Autowired

Check warning on line 55 in src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_TM-API&issues=AZ-OdbTSY0BtzQkzDKfR&open=AZ-OdbTSY0BtzQkzDKfR&pullRequest=156
private com.iemr.tm.repo.nurse.BenVisitDetailRepo benVisitDetailRepo;
@org.springframework.beans.factory.annotation.Autowired

Check warning on line 57 in src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_TM-API&issues=AZ-OdbTSY0BtzQkzDKfS&open=AZ-OdbTSY0BtzQkzDKfS&pullRequest=156
private com.iemr.tm.repo.login.UserLoginRepo userLoginRepo;

/**
* Resolve the numeric user ID of the responsible staff member from the username
* captured in createdBy. Returns null if it cannot be resolved.
*/
private Long resolveUserId(String username) {
if (username == null || username.trim().isEmpty())
return null;
com.iemr.tm.data.login.Users user = userLoginRepo.getUserByUsername(username.trim());
return user != null ? user.getUserID() : null;
}

@Autowired
public void setCommonBenStatusFlowServiceImpl(CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl) {
this.commonBenStatusFlowServiceImpl = commonBenStatusFlowServiceImpl;
Expand Down Expand Up @@ -360,6 +376,12 @@
labResultSaveFlag = saveLabTestResult(wrapperLabResults);

if (labResultSaveFlag == 1) {
// Store the responsible lab technician's user ID against the visit
if (wrapperLabResults.getVisitCode() != null) {
Long labTechnicianID = resolveUserId(wrapperLabResults.getCreatedBy());
if (labTechnicianID != null)
benVisitDetailRepo.updateLabTechnicianID(labTechnicianID, wrapperLabResults.getVisitCode());
}
int i = updateBenFlowStatusFlagAfterLabResultEntry(wrapperLabResults.getLabCompleted(),
wrapperLabResults.getBenFlowID(), wrapperLabResults.getBeneficiaryRegID(),
wrapperLabResults.getVisitID(), wrapperLabResults.getNurseFlag(),
Expand Down
Loading