Skip to content

Commit

Permalink
Merge pull request #2 from Manishch22/develop
Browse files Browse the repository at this point in the history
Updated code for patient resource
  • Loading branch information
sjkarthik authored Jan 8, 2024
2 parents 4d9d1d3 + 7b6f975 commit 7adf26d
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.mosip.kernel.core.util.StringUtils;
import io.mosip.opencrvs.constant.LoggingConstants;
import io.mosip.opencrvs.dto.DecryptedEventDto;
import io.mosip.opencrvs.dto.DecryptedEventDto.Event.Context.Entry.Resource.Identifier;
import io.mosip.opencrvs.dto.DecryptedEventDto.Event.Context.Entry.Resource.Identifier.Type.Coding;
import io.mosip.opencrvs.dto.ReceiveDto;
import io.mosip.opencrvs.error.ErrorCode;
Expand Down Expand Up @@ -71,7 +72,7 @@ public ReceiveDto buildIdJson(DecryptedEventDto opencrvsRequestBody){
task = entry.resource;
} else if(child==null && "Patient".equals(entry.resource.resourceType)){
child = entry.resource;
} else if(child!=null && "Patient".equals(entry.resource.resourceType)){
} else if(child!=null && "Patient".equals(entry.resource.resourceType)&&isPatientMother(entry.resource.identifier)){
mother = entry.resource;
}
if (child!=null && mother!=null && task!=null) break;
Expand Down Expand Up @@ -125,6 +126,17 @@ public ReceiveDto buildIdJson(DecryptedEventDto opencrvsRequestBody){

return returner;
}

public boolean isPatientMother(List<Identifier> identifier) {
for(Identifier ident : identifier) {
for(Coding coding : ident.type.coding) {
if("NATIONAL_ID".equals(coding.code)){
return true;
}
}
}
return false;
}

public String getOpencrvsBRNFromPatientBody(DecryptedEventDto.Event.Context.Entry.Resource patient){
for(DecryptedEventDto.Event.Context.Entry.Resource.Identifier identifier : patient.identifier){
Expand Down

0 comments on commit 7adf26d

Please sign in to comment.