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 @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.mmu</groupId>
<artifactId>mmu-api</artifactId>
<version>3.6.2</version>
<version>3.9.0</version>
<packaging>war</packaging>

<name>MMU-API</name>
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/com/iemr/mmu/data/nurse/BeneficiaryVisitDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ public class BeneficiaryVisitDetail {
@Column(name = "VisitFlowStatusFlag", insertable = false)
private 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 @@ -535,4 +551,36 @@ public void setFiles(ArrayList<Map<String, String>> files) {
this.files = files;
}

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;
}

}
3 changes: 3 additions & 0 deletions src/main/java/com/iemr/mmu/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/mmu/repo/nurse/BenVisitDetailRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,16 @@ public int updateFileID(@Param("fileIDs") String fileIDs, @Param("regID") Long r
@Query(" UPDATE BeneficiaryVisitDetail set vanSerialNo = :benVisitID WHERE benVisitID = :benVisitID")
int updateVanSerialNo(@Param("benVisitID") Long benVisitID);

// 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 @@ -115,6 +115,34 @@ public class CommonDoctorServiceImpl {
@Autowired
private CookieUtil cookieUtil;

@Autowired
private com.iemr.mmu.repo.nurse.BenVisitDetailRepo benVisitDetailRepo;
@Autowired
private com.iemr.mmu.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.mmu.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
public void setSnomedServiceImpl(SnomedServiceImpl snomedServiceImpl) {
this.snomedServiceImpl = snomedServiceImpl;
Expand Down Expand Up @@ -778,6 +806,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);

// checking if test is prescribed
if (isTestPrescribed) {
docFlag = (short) 2;
Expand Down Expand Up @@ -840,6 +871,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);

if (commonUtilityClass.getIsSpecialist() != null && commonUtilityClass.getIsSpecialist() == true) {
if (isTestPrescribed)
tcSpecialistFlag = (short) 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ public class CommonNurseServiceImpl implements CommonNurseService {
private Integer TMReferredWL;
@Autowired
private BenVisitDetailRepo benVisitDetailRepo;

@Autowired
private com.iemr.mmu.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.mmu.data.login.Users user = userLoginRepo.getUserByUsername(username.trim());
return user != null ? user.getUserID() : null;
}

@Autowired
private BenChiefComplaintRepo benChiefComplaintRepo;
@Autowired
Expand Down Expand Up @@ -258,6 +274,10 @@ public Long saveBeneficiaryVisitDetails(BeneficiaryVisitDetail beneficiaryVisitD
}
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);
benVisitDetailRepo.updateVanSerialNo(response.getBenVisitID());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ public class LabTechnicianServiceImpl implements LabTechnicianService {
private LabResultEntryRepo labResultEntryRepo;
private CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl;

@Autowired
private com.iemr.mmu.repo.nurse.BenVisitDetailRepo benVisitDetailRepo;
@Autowired
private com.iemr.mmu.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.mmu.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 @@ -345,6 +361,12 @@ public Integer saveLabTestResult(JsonObject requestOBJ) throws Exception {
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