Skip to content
Merged
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
6 changes: 6 additions & 0 deletions src/main/java/com/iemr/common/CommonApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

import com.iemr.common.utils.IEMRApplBeans;

Expand All @@ -39,6 +40,11 @@ public IEMRApplBeans instantiateBeans() {
return new IEMRApplBeans();
}

@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}

public static void main(String[] args) {
SpringApplication.run(CommonApplication.class, args);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.iemr.common.controller.esanjeevani;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.iemr.common.service.esanjeevani.ESanjeevaniService;
import com.iemr.common.utils.response.OutputResponse;

import io.swagger.annotations.ApiOperation;

@CrossOrigin
@RestController
@RequestMapping(value = "/esanjeevani", headers = "Authorization")
public class ESanjeevaniController {

@Autowired
private ESanjeevaniService eSanjeevaniService;

private Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@CrossOrigin
@ApiOperation(value = "Register patient in E-Sanjeevani and send portal url to route", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/getESanjeevaniUrl/{beneficiaryReqId}" }, method = { RequestMethod.GET })
public String registerESanjeevaniPatient(@PathVariable Long beneficiaryReqId) {
OutputResponse response = new OutputResponse();
try {
logger.info("E-Sangeevani register for benRegId - " + beneficiaryReqId);
String res = eSanjeevaniService.registerPatient(beneficiaryReqId);
if (res != null)
response.setResponse(res);
else
response.setError(5000, "Error while fetching E-sanjeevani route URL");
} catch (Exception e) {
response.setError(5000, "Error while fetching E-sanjeevani route URL" + e.toString());
}

return response.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ private String getConcurrentCheckSessionObjectAgainstUser(String userName) {

private void createUserMapping(User mUser, JSONObject resMap, JSONObject serviceRoleMultiMap,
JSONObject serviceRoleMap, JSONArray serviceRoleList, JSONObject previlegeObj) {
System.out.println(mUser);
String fName = mUser.getFirstName();
String lName = mUser.getLastName();
String mName = mUser.getMiddleName();
Expand Down Expand Up @@ -264,8 +265,11 @@ private void createUserMapping(User mUser, JSONObject resMap, JSONObject service
previlegeObj.getJSONObject(serv).put("agentID", m_UserServiceRoleMapping.getAgentID());
previlegeObj.getJSONObject(serv).put("agentPassword", m_UserServiceRoleMapping.getAgentPassword());
}
JSONArray roles = previlegeObj.getJSONObject(serv).getJSONArray("roles");
roles.put(new JSONObject(m_UserServiceRoleMapping.getM_Role().toString()));
JSONArray roles = previlegeObj.getJSONObject(serv).getJSONArray("roles");
// roles.put(new JSONObject(m_UserServiceRoleMapping.getM_Role().toString()));
JSONObject roleObject = new JSONObject(m_UserServiceRoleMapping.getM_Role().toString());
roleObject.put("isSanjeevani", m_UserServiceRoleMapping.getIsSanjeevani());
roles.put(roleObject);
}
Iterator<String> keySet = serviceRoleMultiMap.keys();
while (keySet.hasNext()) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/iemr/common/data/users/Role.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public class Role
@Expose
@Transient
private String agentID;

@Expose
@Transient
private Boolean isSanjeevani;

// protected Role() {
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ public class UserServiceRoleMapping
@Expose
@Column(name = "isOutbound")
private Boolean outbound;

@Expose
@Column(name = "isSanjeevani")
private Boolean isSanjeevani;


// @Expose
Expand Down Expand Up @@ -297,7 +301,7 @@ public String toString()

public static UserServiceRoleMapping initializeUserRoleMappingObjs(Long USRMappingID, Long UserID, Integer roleID,
Role m_Role, Integer providerServiceMapID, ProviderServiceMapping m_ProviderServiceMapping,
String agentID,Boolean inbound, Boolean outbound, String agentPassword, Integer workingLocationID,
String agentID,Boolean inbound, Boolean outbound, Boolean isSanjeevani, String agentPassword, Integer workingLocationID,
ProviderServiceAddressMapping providerServiceAddressMapping)
{
UserServiceRoleMapping userRoleMapping = new UserServiceRoleMapping();
Expand All @@ -312,6 +316,7 @@ public static UserServiceRoleMapping initializeUserRoleMappingObjs(Long USRMappi
userRoleMapping.agentID = agentID;
userRoleMapping.inbound = inbound;
userRoleMapping.outbound = outbound;
userRoleMapping.isSanjeevani = isSanjeevani;
userRoleMapping.agentPassword = agentPassword;
userRoleMapping.workingLocationID = workingLocationID;
userRoleMapping.m_Role.setWorkingLocationID(workingLocationID);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.iemr.common.model.esanjeevani;

import lombok.Data;

@Data
public class ESanjeevaniPatientAddress {

public String addressLine1;
public String addressType;
public String addressUse;
public int blockCode;
public String blockDisplay;
public int cityCode;
public String cityDisplay;
public String countryCode;
public String countryDisplay;
public int districtCode;
public String districtDisplay;
public String postalCode;
public int stateCode;
public String stateDisplay;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.iemr.common.model.esanjeevani;

import lombok.Data;

@Data
public class ESanjeevaniPatientContactDetail {

public boolean contactPointStatus;
public String contactPointType;
public String contactPointUse;
public String contactPointValue;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.iemr.common.model.esanjeevani;

import java.util.ArrayList;
import java.util.Date;

import org.springframework.stereotype.Component;

import lombok.Data;

@Data
public class ESanjeevaniPatientRegistration {

public String abhaAddress;
public String abhaNumber;
public int age;
public String birthdate;
public String displayName;
public String firstName;
public String middleName;
public String lastName;
public int genderCode;
public String genderDisplay;
public boolean isBlock;
public String source;

public ArrayList<ESanjeevaniPatientAddress> lstPatientAddress;
public ArrayList<ESanjeevaniPatientContactDetail> lstPatientContactDetail;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.iemr.common.model.esanjeevani;

import lombok.Data;

@Data
public class ESanjeevaniProviderAuth {

private String userName;
private String password;
private String salt;
private String source;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.iemr.common.repo.esanjeevani;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.stereotype.Repository;

import com.iemr.common.data.door_to_door_app.V_doortodooruserdetails;
@Repository
@RestResource(exported = false)
public interface ESanjeevaniRepo extends CrudRepository<V_doortodooruserdetails, Integer>{

@Query(nativeQuery = true, value = "SELECT BenDetailsId AS benDetailsId, BenAddressId AS benAddressId, BenContactsId AS benContactsId FROM db_identity.i_beneficiarymapping WHERE BenRegId = :benRegID")
public List<Object[]> getBeneficiaryMappingIds(@Param("benRegID") Long benRegID);


@Query(nativeQuery = true, value = "SELECT FirstName, LastName, MiddleName, Gender, DOB FROM db_identity.i_beneficiarydetails WHERE BeneficiaryDetailsId = :benDetailsId")
public List<Object[]> getBeneficiaryDeatils(@Param("benDetailsId") BigInteger benDetailsId);

@Query(nativeQuery = true, value = "SELECT PreferredPhoneNum FROM db_identity.i_beneficiarycontacts WHERE BenContactsID = :benContactId")
public String getBeneficiaryContactDetails(@Param("benContactId") BigInteger benContactId);

@Query(nativeQuery = true, value = "SELECT CurrCountryId, CurrCountry, CurrStateId, CurrState, CurrDistrictId, CurrDistrict, CurrSubDistrictId, CurrSubDistrict, "
+ "CurrAddrLine1, CurrPinCode FROM db_identity.i_beneficiaryaddress WHERE BenAddressID = :benAddressId")
public List<Object[]> getBeneficiaryAddressDetails(@Param("benAddressId") BigInteger benAddressId);

@Query(nativeQuery = true, value = "SELECT HealthID AS healthId, HealthIDNumber AS healthIdNumber FROM db_iemr.m_benhealthidmapping WHERE BeneficiaryRegID = :benRegID")
public List<Object[]> getBeneficiaryHealthIdDeatils(@Param("benRegID") Long benRegID);

@Query(nativeQuery = true, value = "SELECT GovtStateID FROM db_iemr.m_state WHERE StateID = :stateId ")
public Integer getGovStateId(@Param("stateId") Integer stateId);

@Query(nativeQuery = true, value = "SELECT GovtDistrictID FROM db_iemr.m_district WHERE DistrictID = :districtId ")
public Integer getGovDistrictId(@Param("districtId") Integer districtId);

@Query(nativeQuery = true, value = "SELECT GovSubDistrictID FROM db_iemr.m_districtbranchmapping WHERE DistrictBranchID = :subDistrictId ")
public Integer getGovSubDistrictId(@Param("subDistrictId") Integer subDistrictId);

@Query(nativeQuery = true, value = "SELECT CountryCode FROM db_iemr.m_country WHERE CountryID = :countryID ")
public String getGovCountyId(@Param("countryID") Integer countryID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public interface UserRoleMappingRepository extends CrudRepository<UserServiceRoleMapping, Long>
{
@Query("select map.USRMappingID, map.UserID, map.RoleID, map.m_Role, map.providerServiceMapID, "
+ "map.agentID, map.inbound, map.outbound, map.agentPassword, map.workingLocationID, map.providerServiceAddressMapping from "
+ "map.agentID, map.inbound, map.outbound, map.isSanjeevani, map.agentPassword, map.workingLocationID, map.providerServiceAddressMapping from "
+ "UserServiceRoleMapping map left join map.m_ProviderServiceMapping psm left join psm.serviceProvider sp "
+ "left join map.m_Role left join map.providerServiceAddressMapping "
+ "where map.Deleted = false and UserID = :UserID and sp.statusID in (1,2) "
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.iemr.common.service.esanjeevani;

public interface ESanjeevaniService {

public String registerPatient(Long benRegId) throws Exception;
}
Loading