Skip to content

Commit 8ced854

Browse files
authored
Fix the issue in fetching the value for fields (#257)
* fix: Add jsonProperty to map with the request body to fix the issue in getting the value for income, education and occupation * fix: remove commented code
1 parent b2aecd8 commit 8ced854

2 files changed

Lines changed: 40 additions & 16 deletions

File tree

src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import com.fasterxml.jackson.annotation.JsonFormat;
3737
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
38+
import com.fasterxml.jackson.annotation.JsonProperty;
3839
import com.google.gson.JsonObject;
3940
import com.google.gson.annotations.Expose;
4041
import com.iemr.common.model.user.TitleModel;
@@ -211,16 +212,19 @@ public class BeneficiaryModel implements Comparable<BeneficiaryModel> {
211212
@Expose
212213
private Integer occupationId;
213214
@Expose
215+
@JsonProperty("occupationOther")
214216
private String occupationName;
215217
@Expose
216218
private String occupation;
217219
@Expose
220+
@JsonProperty("incomeName")
218221
private String incomeStatus;
219222
@Expose
220223
private BigInteger religionId;
221224
@Expose
222225
private String religion;
223226
@Expose
227+
@JsonProperty("educationQualificationName")
224228
private String education;
225229
@Expose
226230
private Integer providerServiceMapID;

src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.springframework.scheduling.annotation.Async;
3838
import org.springframework.stereotype.Service;
3939

40-
import com.fasterxml.jackson.databind.ObjectMapper;
4140
import com.google.gson.Gson;
4241
import com.iemr.common.data.beneficiary.Beneficiary;
4342
import com.iemr.common.data.mctshistory.MctsOutboundCallDetail;
@@ -112,7 +111,6 @@ private void updateBeneficiaryID(String beneficiaryID, Long beneficiaryRegID) {
112111
@Override
113112
public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String auth) throws IEMRException {
114113
Integer updatedRows = 0;
115-
116114
IdentityEditDTO identityEditDTO = identityBenEditMapper.BenToIdentityEditMapper(benificiaryDetails);
117115
setDemographicDetails(identityEditDTO,benificiaryDetails);
118116

@@ -122,11 +120,9 @@ public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String aut
122120
benificiaryDetails.getCreatedBy()));
123121
}
124122
identityEditDTO.setDob(benificiaryDetails.getDOB());
125-
// identityEditDTO.setOtherFields(benificiaryDetails.getOtherFields());
126-
// String jsoninput=new Gson().toJson(identityEditDTO);
127123
updatedRows = identityBeneficiaryService.editIdentityEditDTO(identityEditDTO, auth,
128124
benificiaryDetails.getIs1097());
129-
125+
130126
return updatedRows;
131127
}
132128

@@ -140,11 +136,22 @@ else if(null != benificiaryDetails.getI_bendemographics().getReligion())
140136
identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligion());
141137
else
142138
identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligionName());
143-
if(null != benificiaryDetails.getOccupation())
144-
identityEditDTO.setOccupationName(benificiaryDetails.getOccupation());
145-
else
146-
identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation());
147-
identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName());
139+
140+
if (null != benificiaryDetails.getOccupation()) {
141+
identityEditDTO.setOccupationName(benificiaryDetails.getOccupation());
142+
} else if (null != benificiaryDetails.getI_bendemographics() &&
143+
null != benificiaryDetails.getI_bendemographics().getOccupation()) {
144+
identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation());
145+
} else {
146+
identityEditDTO.setOccupationName(benificiaryDetails.getOccupationName());
147+
}
148+
149+
if (null != benificiaryDetails.getEducation()) {
150+
identityEditDTO.setEducation(benificiaryDetails.getEducation());
151+
} else if (null != benificiaryDetails.getI_bendemographics() &&
152+
null != benificiaryDetails.getI_bendemographics().getEducationName()) {
153+
identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName());
154+
}
148155
if(null != benificiaryDetails.getIncomeStatus())
149156
identityEditDTO.setIncomeStatus(benificiaryDetails.getIncomeStatus());
150157
else
@@ -206,12 +213,25 @@ else if(null != beneficiaryModel.getI_bendemographics().getReligion())
206213
identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligion());
207214
else
208215
identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligionName());
209-
if(null != beneficiaryModel.getOccupation())
210-
identityDTO.setOccupationName(beneficiaryModel.getOccupation());
211-
else
212-
identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation());
213-
if(null != beneficiaryModel.getI_bendemographics().getEducationName())
214-
identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName());
216+
217+
if (null != beneficiaryModel.getOccupation()) {
218+
identityDTO.setOccupationName(beneficiaryModel.getOccupation());
219+
} else if (null != beneficiaryModel.getI_bendemographics() &&
220+
null != beneficiaryModel.getI_bendemographics().getOccupation()) {
221+
identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation());
222+
} else {
223+
identityDTO.setOccupationName(beneficiaryModel.getOccupationName());
224+
}
225+
226+
if (null != beneficiaryModel.getEducation()) {
227+
identityDTO.setEducation(beneficiaryModel.getEducation());
228+
} else if (null != beneficiaryModel.getI_bendemographics() &&
229+
null != beneficiaryModel.getI_bendemographics().getEducationName()) {
230+
identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName());
231+
}
232+
233+
234+
215235
if(null != beneficiaryModel.getIncomeStatus())
216236
identityDTO.setIncomeStatus(beneficiaryModel.getIncomeStatus());
217237
else

0 commit comments

Comments
 (0)