public async Task <IActionResult> GetMotherDetail(FetchMotherRequest fmData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Retrieve mother detail with baby detail - {JsonConvert.SerializeObject(fmData)}"); var motherResponse = await _profileService.RetrieveMother(fmData); return(Ok(new MotherProfileResponse { Status = motherResponse.Status, Message = motherResponse.Message, data = motherResponse.data, })); }
public ProfileMotherDetails RetrieveMother(FetchMotherRequest fmData) { string stProc = FetchParticularMotherProfile; var pList = new List <SqlParameter>() { new SqlParameter("@HospitalId", fmData.hospitalId), new SqlParameter("@MothersRchSubHospID", fmData.motherInput ?? fmData.motherInput), }; var motherDetail = UtilityDL.FillData <MotherProfile>(stProc, pList); var babyDetail = UtilityDL.FillData <MotherBabiesDetail>(stProc, pList); var mother = new ProfileMotherDetails(); mother.motherDetail = motherDetail; mother.babyDetail = babyDetail; return(mother); }
public async Task <MotherProfileResponse> RetrieveMother(FetchMotherRequest fmData) { var motherResponse = new MotherProfileResponse(); try { if (fmData.motherInput == "") { motherResponse.Status = "true"; motherResponse.Message = "Enter SubjectId or RCH Id or Hospital File Id"; } else if (fmData.hospitalId <= 0) { motherResponse.Status = "false"; motherResponse.Message = "Invalid hospital"; } else { var motherDetail = _profileData.RetrieveMother(fmData); var moms = new List <MOMProfile>(); var motherUniqueSubjectId = ""; foreach (var mother in motherDetail.motherDetail) { var mom = new MOMProfile(); if (motherUniqueSubjectId != mother.motherSubjectId) { var baby = motherDetail.babyDetail.Where(sd => sd.motherSubjectId == mother.motherSubjectId).ToList(); mom.motherSubjectId = mother.motherSubjectId; mom.dateofRegistration = mother.dateofRegistration; mom.districtId = mother.districtId; mom.hospitalNo = mother.hospitalNo; mom.motherFirstName = mother.motherFirstName; mom.motherLastName = mother.motherLastName; mom.dob = mother.dob; mom.age = mother.age; mom.rchId = mother.rchId; mom.g = mother.g; mom.p = mother.p; mom.l = mother.l; mom.a = mother.a; mom.motherGovIdTypeId = mother.motherGovIdTypeId; mom.motherGovIdDetail = mother.motherGovIdDetail; mom.motherContactNo = mother.motherContactNo; mom.gpla = mother.gpla; mom.ecNumber = mother.ecNumber; mom.address1 = mother.address1; mom.address2 = mother.address2; mom.address3 = mother.address3; mom.stateId = mother.stateId; mom.stateName = mother.stateName; mom.districtName = mother.districtName; mom.pincode = mother.pincode; mom.religionName = mother.religionName; mom.casteName = mother.casteName; mom.communityName = mother.communityName; mom.fatherFirstName = mother.fatherFirstName; mom.fatherLastName = mother.fatherLastName; mom.fatherContactNo = mother.fatherContactNo; mom.guardianFirstName = mother.guardianFirstName; mom.guardianLastName = mother.guardianLastName; mom.guardianContactNo = mother.guardianContactNo; mom.motherHospitalName = mother.motherHospitalName; mom.motherHospitalAddress = mother.motherHospitalAddress; mom.motherHospitalContactNo = mother.motherHospitalContactNo; if (baby[0].babySubjectId == null) { mom.babyDetail = null; } else { mom.babyDetail = baby; } motherUniqueSubjectId = mother.motherSubjectId; moms.Add(mom); } } motherResponse.Status = "true"; motherResponse.Message = string.Empty; motherResponse.data = moms; } } catch (Exception e) { motherResponse.Status = "false"; motherResponse.Message = e.Message; } return(motherResponse); }