Skip to content

Commit

Permalink
Merge pull request #115 from bcgov/BCMOHAD-25467-AddFacCivicAddress
Browse files Browse the repository at this point in the history
add Facility  Civic Address to File upload.
  • Loading branch information
lysonle authored Sep 16, 2024
2 parents 2d38953 + b6751c8 commit 76d10cd
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ public class SourceData {
private String pcnClinicStatus;

@Column(name="hds_effective_start_date")
private String hdsEffectiveStartDate;
private String hdsEffectiveStartDate;

@Column(name="fac_civic_address")
private String facCivicAddress;

@Column(name="fac_address_unit")
private String facAddressUnit;
Expand Down Expand Up @@ -186,7 +189,5 @@ public class SourceData {
private Date updatedAt;

@Column(name="updated_by")
private String updatedBy;


private String updatedBy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.web.multipart.MultipartFile;

public interface FileService {
boolean hasCsvFormat(MultipartFile file, String tableName);
void processAndSaveData(MultipartFile file, Long controlTableId, String authenticateUserId);
boolean hasCsvFormat(MultipartFile file, String tableName);
void processAndSaveData(MultipartFile file, Long controlTableId, String authenticateUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private static SourceData createSourceData(Long controlTableId, String doNotLoad
String hdsProviderIdentifierType1, String hdsProviderIdentifierType2,
String hdsProviderIdentifierType3, String hdsMspFacilityNumber,
String hdsType, String hdsSubType,
String hdsName,
String hdsName,
String hdsPreferredNameFlag, String hdsEmail, String hdsWebsite,
String hdsBusTelAreaCode, String hdsBusTelNumber, String hdsTelExtension,
String hdsCellAreaCode, String hdsCellNumber, String hdsFaxAreaCode, String hdsFaxNumber,
Expand All @@ -148,7 +148,8 @@ private static SourceData createSourceData(Long controlTableId, String doNotLoad
String pcnPciFlag,
String sourceStatus,
String pcnClinicStatus,
String hdsEffectiveStartDate,
String hdsEffectiveStartDate,
String facCivicAddress,
String facAddressUnit,
String facBuildingName,
String physicalAddr1, String physicalAddr2, String physicalAddr3,
Expand All @@ -161,7 +162,7 @@ private static SourceData createSourceData(Long controlTableId, String doNotLoad
String mailPcode, String mailCountry,
Date createdAt, String createdBy, Date updatedAt, String updatedBy) {
return SourceData.builder()
.controlTableId(controlTableId)
.controlTableId(controlTableId)
.doNotLoadFlag(doNotLoadFlag)
.stakeholder(stakeholder)
.stakeholderId(stakeholderId)
Expand Down Expand Up @@ -193,6 +194,7 @@ private static SourceData createSourceData(Long controlTableId, String doNotLoad
.sourceStatus(sourceStatus)
.pcnClinicStatus(pcnClinicStatus)
.hdsEffectiveStartDate(hdsEffectiveStartDate)
.facCivicAddress(facCivicAddress)
.facAddressUnit(facAddressUnit)
.facBuildingName(facBuildingName)
.physicalAddr1(physicalAddr1)
Expand Down Expand Up @@ -258,7 +260,8 @@ private List<SourceData> csvToSourceData(InputStream inputStream, Long controlTa
csvRecords.get("PCN_PCI_FLAG"),
csvRecords.get("SOURCE_STATUS"),
csvRecords.get("PCN_CLINIC_STATUS"),
csvRecords.get("HDS_EFFECTIVE_START_DATE"),
csvRecords.get("HDS_EFFECTIVE_START_DATE"),
csvRecords.get("FAC_CIVIC_ADDRESS"),
csvRecords.get("FAC_ADDRESS_UNIT"),
csvRecords.get("FAC_BUILDING_NAME"),
csvRecords.get("PHYSICAL_ADDR1"),
Expand Down Expand Up @@ -309,62 +312,63 @@ private void copyInputSourceDataToProcessData(Long controlTableId, String authen
Iterable<SourceData> inputSourceData = sourceDataRepository.getAllSourceDataByControlTableId(controlTableId);

for (SourceData s : inputSourceData ) {
ProcessData processData = new ProcessData();
processData.setId(s.getId());
processData.setControlTableId(s.getControlTableId());
processData.setDoNotLoadFlag(s.getDoNotLoadFlag());
processData.setStakeholderId(s.getStakeholderId());
processData.setStakeholder(s.getStakeholder());
processData.setHdsIpcId(s.getHdsIpcId());
processData.setHdsCpnId(s.getHdsCpnId());
processData.setHdsProviderIdentifier1(s.getHdsProviderIdentifier1());
processData.setHdsProviderIdentifier2(s.getHdsProviderIdentifier2());
processData.setHdsProviderIdentifier3(s.getHdsProviderIdentifier3());
processData.setHdsProviderIdentifierType1(s.getHdsProviderIdentifierType1());
processData.setHdsProviderIdentifierType2(s.getHdsProviderIdentifierType2());
processData.setHdsProviderIdentifierType3(s.getHdsProviderIdentifierType3());
processData.setHdsMspFacilityNumber(s.getHdsMspFacilityNumber());
processData.setHdsType(s.getHdsType());
processData.setHdsSubType(s.getHdsSubType());
processData.setHdsName(s.getHdsName());
processData.setHdsPreferredNameFlag(s.getHdsPreferredNameFlag());
processData.setHdsEmail(s.getHdsEmail());
processData.setHdsWebsite(s.getHdsWebsite());
processData.setHdsBusTelAreaCode(s.getHdsBusTelAreaCode());
processData.setHdsBusTelNumber(s.getHdsBusTelNumber());
processData.setHdsTelExtension(s.getHdsTelExtension());
processData.setHdsCellAreaCode(s.getHdsCellAreaCode());
processData.setHdsCellNumber(s.getHdsCellNumber());
processData.setHdsFaxAreaCode(s.getHdsFaxAreaCode());
processData.setHdsFaxNumber(s.getHdsFaxNumber());
processData.setPcnServiceDeliveryType(s.getPcnServiceDeliveryType());
processData.setPcnClinicType(s.getPcnClinicType());
processData.setPcnPciFlag(s.getPcnPciFlag());
processData.setSourceStatus(s.getSourceStatus());
processData.setPcnClinicStatus(s.getPcnClinicStatus());
processData.setHdsEffectiveStartDate(s.getHdsEffectiveStartDate());
processData.setFacAddressUnit(s.getFacAddressUnit());
processData.setFacBuildingName(s.getFacBuildingName());
processData.setPhysicalAddr1(s.getPhysicalAddr1());
processData.setPhysicalAddr2(s.getPhysicalAddr2());
processData.setPhysicalAddr3(s.getPhysicalAddr3());
processData.setPhysicalAddr4(s.getPhysicalAddr4());
processData.setPhysicalCity(s.getPhysicalCity());
processData.setPhysicalProvince(s.getPhysicalProvince());
processData.setPhysicalPcode(s.getPhysicalPcode());
processData.setPhysicalCountry(s.getPhysicalCountry());
processData.setPhysicalAddrPrpsTypeCd(s.getPhysicalAddrPrpsTypeCd());
processData.setMailAddr1(s.getMailAddr1());
processData.setMailAddr2(s.getMailAddr2());
processData.setMailAddr3(s.getMailAddr3());
processData.setMailAddr4(s.getMailAddr4());
processData.setMailCity(s.getMailCity());
processData.setMailBc(s.getMailBc());
processData.setMailPcode(s.getMailPcode());
processData.setMailCountry(s.getMailCountry());
processData.setMailAddrValidationStatus("");
processData.setCreatedAt(s.getCreatedAt());
processData.setCreatedBy(authenticateUserId);
ProcessData processData = new ProcessData();
processData.setId(s.getId());
processData.setControlTableId(s.getControlTableId());
processData.setDoNotLoadFlag(s.getDoNotLoadFlag());
processData.setStakeholderId(s.getStakeholderId());
processData.setStakeholder(s.getStakeholder());
processData.setHdsIpcId(s.getHdsIpcId());
processData.setHdsCpnId(s.getHdsCpnId());
processData.setHdsProviderIdentifier1(s.getHdsProviderIdentifier1());
processData.setHdsProviderIdentifier2(s.getHdsProviderIdentifier2());
processData.setHdsProviderIdentifier3(s.getHdsProviderIdentifier3());
processData.setHdsProviderIdentifierType1(s.getHdsProviderIdentifierType1());
processData.setHdsProviderIdentifierType2(s.getHdsProviderIdentifierType2());
processData.setHdsProviderIdentifierType3(s.getHdsProviderIdentifierType3());
processData.setHdsMspFacilityNumber(s.getHdsMspFacilityNumber());
processData.setHdsType(s.getHdsType());
processData.setHdsSubType(s.getHdsSubType());
processData.setHdsName(s.getHdsName());
processData.setHdsPreferredNameFlag(s.getHdsPreferredNameFlag());
processData.setHdsEmail(s.getHdsEmail());
processData.setHdsWebsite(s.getHdsWebsite());
processData.setHdsBusTelAreaCode(s.getHdsBusTelAreaCode());
processData.setHdsBusTelNumber(s.getHdsBusTelNumber());
processData.setHdsTelExtension(s.getHdsTelExtension());
processData.setHdsCellAreaCode(s.getHdsCellAreaCode());
processData.setHdsCellNumber(s.getHdsCellNumber());
processData.setHdsFaxAreaCode(s.getHdsFaxAreaCode());
processData.setHdsFaxNumber(s.getHdsFaxNumber());
processData.setPcnServiceDeliveryType(s.getPcnServiceDeliveryType());
processData.setPcnClinicType(s.getPcnClinicType());
processData.setPcnPciFlag(s.getPcnPciFlag());
processData.setSourceStatus(s.getSourceStatus());
processData.setPcnClinicStatus(s.getPcnClinicStatus());
processData.setHdsEffectiveStartDate(s.getHdsEffectiveStartDate());
processData.setFacCivicAddr(s.getFacCivicAddress());
processData.setFacAddressUnit(s.getFacAddressUnit());
processData.setFacBuildingName(s.getFacBuildingName());
processData.setPhysicalAddr1(s.getPhysicalAddr1());
processData.setPhysicalAddr2(s.getPhysicalAddr2());
processData.setPhysicalAddr3(s.getPhysicalAddr3());
processData.setPhysicalAddr4(s.getPhysicalAddr4());
processData.setPhysicalCity(s.getPhysicalCity());
processData.setPhysicalProvince(s.getPhysicalProvince());
processData.setPhysicalPcode(s.getPhysicalPcode());
processData.setPhysicalCountry(s.getPhysicalCountry());
processData.setPhysicalAddrPrpsTypeCd(s.getPhysicalAddrPrpsTypeCd());
processData.setMailAddr1(s.getMailAddr1());
processData.setMailAddr2(s.getMailAddr2());
processData.setMailAddr3(s.getMailAddr3());
processData.setMailAddr4(s.getMailAddr4());
processData.setMailCity(s.getMailCity());
processData.setMailBc(s.getMailBc());
processData.setMailPcode(s.getMailPcode());
processData.setMailCountry(s.getMailCountry());
processData.setMailAddrValidationStatus("");
processData.setCreatedAt(s.getCreatedAt());
processData.setCreatedBy(authenticateUserId);

// set default values
if (controlTable.getLoadTypeHds()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name='source_data' and column_name='fac_civic_address'
) THEN
ALTER TABLE source_data
ADD COLUMN fac_civic_address VARCHAR(240);
END IF;
END$$;

DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name='process_data' and column_name='databc_input_civic_address'
) THEN
ALTER TABLE process_data
ADD COLUMN databc_input_civic_address VARCHAR(240);
END IF;
END$$;

DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name='process_data' and column_name='databc_output_civic_address'
) THEN
ALTER TABLE process_data
ADD COLUMN databc_output_civic_address VARCHAR(240);
END IF;
END$$;

DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM table_column_info
WHERE table_name='SOURCE_DATA' and column_name='FAC_CIVIC_ADDRESS'
) THEN
INSERT INTO table_column_info(table_name, column_name, header_name,variable_name, title) VALUES (
'SOURCE_DATA', 'FAC_CIVIC_ADDRESS', 'FAC_CIVIC_ADDRESS', 'facCivicAddress','Facility Civic Address'
);
END IF;
END$$;

0 comments on commit 76d10cd

Please sign in to comment.