From 833d8b9da3e4cac8affed8473e1047abfaf9f17c Mon Sep 17 00:00:00 2001 From: 5Amogh Date: Wed, 4 Mar 2026 13:51:17 +0530 Subject: [PATCH] feat: amm-2175 ecg abnormal findings feature added --- .../common/master/CommonMasterController.java | 10 ++ .../labModule/ECGAbnormalFindingMaster.java | 136 ++++++++++++++++++ .../tm/data/labModule/LabResultEntry.java | 31 ++++ .../ECGAbnormalFindingMasterRepo.java | 35 +++++ .../master/CommonMasterServiceImpl.java | 13 ++ .../common/master/CommonMaterService.java | 2 + .../LabTechnicianServiceImpl.java | 14 ++ .../iemr/tm/utils/IntegerListConverter.java | 52 +++++++ .../iemr/tm/utils/StringListConverter.java | 53 +++++++ 9 files changed, 346 insertions(+) create mode 100644 src/main/java/com/iemr/tm/data/labModule/ECGAbnormalFindingMaster.java create mode 100644 src/main/java/com/iemr/tm/repo/labModule/ECGAbnormalFindingMasterRepo.java create mode 100644 src/main/java/com/iemr/tm/utils/IntegerListConverter.java create mode 100644 src/main/java/com/iemr/tm/utils/StringListConverter.java diff --git a/src/main/java/com/iemr/tm/controller/common/master/CommonMasterController.java b/src/main/java/com/iemr/tm/controller/common/master/CommonMasterController.java index 61015517..bfa5bbaa 100644 --- a/src/main/java/com/iemr/tm/controller/common/master/CommonMasterController.java +++ b/src/main/java/com/iemr/tm/controller/common/master/CommonMasterController.java @@ -106,4 +106,14 @@ public String DoctorMasterData(@PathVariable("visitCategoryID") Integer visitCat return response.toString(); } + @Operation(summary = "Get ECG abnormal findings master data") + @GetMapping(value = "/ecgAbnormalFindings", produces = MediaType.APPLICATION_JSON) + public String getECGAbnormalFindings() { + logger.info("getECGAbnormalFindings ..."); + OutputResponse response = new OutputResponse(); + response.setResponse(commonMasterServiceImpl.getECGAbnormalFindings()); + logger.info("ECG abnormal findings" + response.toString()); + return response.toString(); + } + } diff --git a/src/main/java/com/iemr/tm/data/labModule/ECGAbnormalFindingMaster.java b/src/main/java/com/iemr/tm/data/labModule/ECGAbnormalFindingMaster.java new file mode 100644 index 00000000..38464f08 --- /dev/null +++ b/src/main/java/com/iemr/tm/data/labModule/ECGAbnormalFindingMaster.java @@ -0,0 +1,136 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see https://www.gnu.org/licenses/. +*/ +package com.iemr.tm.data.labModule; + +import java.sql.Timestamp; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +import com.google.gson.annotations.Expose; + +@Entity +@Table(name = "m_ecgAbnormalFindings") +public class ECGAbnormalFindingMaster { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Expose + @Column(name = "FindingID") + private Integer findingID; + + @Expose + @Column(name = "FindingName") + private String findingName; + + @Expose + @Column(name = "Deleted", insertable = false, updatable = false) + private Boolean deleted; + + @Expose + @Column(name = "Processed", insertable = false, updatable = false) + private String processed; + + @Expose + @Column(name = "CreatedBy") + private String createdBy; + + @Expose + @Column(name = "CreatedDate", insertable = false, updatable = false) + private Timestamp createdDate; + + @Expose + @Column(name = "ModifiedBy") + private String modifiedBy; + + @Expose + @Column(name = "LastModDate", insertable = false) + private Timestamp lastModDate; + + public Integer getFindingID() { + return findingID; + } + + public void setFindingID(Integer findingID) { + this.findingID = findingID; + } + + public String getFindingName() { + return findingName; + } + + public void setFindingName(String findingName) { + this.findingName = findingName; + } + + public Boolean getDeleted() { + return deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + + public String getProcessed() { + return processed; + } + + public void setProcessed(String processed) { + this.processed = processed; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Timestamp getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Timestamp createdDate) { + this.createdDate = createdDate; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public Timestamp getLastModDate() { + return lastModDate; + } + + public void setLastModDate(Timestamp lastModDate) { + this.lastModDate = lastModDate; + } +} \ No newline at end of file diff --git a/src/main/java/com/iemr/tm/data/labModule/LabResultEntry.java b/src/main/java/com/iemr/tm/data/labModule/LabResultEntry.java index 481459ef..f7696a1b 100644 --- a/src/main/java/com/iemr/tm/data/labModule/LabResultEntry.java +++ b/src/main/java/com/iemr/tm/data/labModule/LabResultEntry.java @@ -32,6 +32,7 @@ import java.util.Map; import jakarta.persistence.Column; +import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; @@ -42,6 +43,7 @@ import jakarta.persistence.Transient; import com.google.gson.annotations.Expose; +import com.iemr.tm.utils.IntegerListConverter; @Entity @Table(name = "t_lab_testresult") @@ -97,6 +99,11 @@ public class LabResultEntry { @Expose private String remarks; + @Expose + @Column(name = "abnormal_findings", columnDefinition = "json") + @Convert(converter = IntegerListConverter.class) + private List abnormalFindings; + @Transient private List> compList; @@ -278,6 +285,7 @@ public static ArrayList getLabResultEntry(ArrayList(); compDetails.put("testComponentID", obj.getTestComponentID()); @@ -306,6 +314,13 @@ public static ArrayList getLabResultEntry(ArrayList(); componentList.add(compDetails); tmpOBJ.setComponentList(componentList); @@ -341,6 +356,14 @@ public static ArrayList getLabResultEntry(ArrayList getAbnormalFindings() { + return abnormalFindings; + } + + public void setAbnormalFindings(List abnormalFindings) { + this.abnormalFindings = abnormalFindings; + } + public Boolean getDeleted() { return deleted; } diff --git a/src/main/java/com/iemr/tm/repo/labModule/ECGAbnormalFindingMasterRepo.java b/src/main/java/com/iemr/tm/repo/labModule/ECGAbnormalFindingMasterRepo.java new file mode 100644 index 00000000..7384bde6 --- /dev/null +++ b/src/main/java/com/iemr/tm/repo/labModule/ECGAbnormalFindingMasterRepo.java @@ -0,0 +1,35 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see https://www.gnu.org/licenses/. +*/ +package com.iemr.tm.repo.labModule; + +import java.util.List; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import com.iemr.tm.data.labModule.ECGAbnormalFindingMaster; + +@Repository +public interface ECGAbnormalFindingMasterRepo extends CrudRepository { + + List findByDeleted(Boolean deleted); +} \ No newline at end of file diff --git a/src/main/java/com/iemr/tm/service/common/master/CommonMasterServiceImpl.java b/src/main/java/com/iemr/tm/service/common/master/CommonMasterServiceImpl.java index 3cde34ec..51164545 100644 --- a/src/main/java/com/iemr/tm/service/common/master/CommonMasterServiceImpl.java +++ b/src/main/java/com/iemr/tm/service/common/master/CommonMasterServiceImpl.java @@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.iemr.tm.service.labtechnician.LabTechnicianServiceImpl; + @Service public class CommonMasterServiceImpl implements CommonMaterService { @@ -34,12 +36,18 @@ public class CommonMasterServiceImpl implements CommonMaterService { private NCDScreeningMasterServiceImpl ncdScreeningServiceImpl; private QCMasterDataServiceImpl qCMasterDataServiceImpl; private NCDCareMasterDataServiceImpl ncdCareMasterDataServiceImpl; + private LabTechnicianServiceImpl labTechnicianServiceImpl; @Autowired public void setNcdCareMasterDataServiceImpl(NCDCareMasterDataServiceImpl ncdCareMasterDataServiceImpl) { this.ncdCareMasterDataServiceImpl = ncdCareMasterDataServiceImpl; } + @Autowired + public void setLabTechnicianServiceImpl(LabTechnicianServiceImpl labTechnicianServiceImpl) { + this.labTechnicianServiceImpl = labTechnicianServiceImpl; + } + @Autowired public void setqCMasterDataServiceImpl(QCMasterDataServiceImpl qCMasterDataServiceImpl) { this.qCMasterDataServiceImpl = qCMasterDataServiceImpl; @@ -221,4 +229,9 @@ public String getMasterDataForDoctor(Integer visitCategoryID, Integer providerSe return doctorMasterData; } + @Override + public String getECGAbnormalFindings() { + return labTechnicianServiceImpl.getECGAbnormalFindings(); + } + } diff --git a/src/main/java/com/iemr/tm/service/common/master/CommonMaterService.java b/src/main/java/com/iemr/tm/service/common/master/CommonMaterService.java index 2ead8b46..c7cc514a 100644 --- a/src/main/java/com/iemr/tm/service/common/master/CommonMaterService.java +++ b/src/main/java/com/iemr/tm/service/common/master/CommonMaterService.java @@ -30,4 +30,6 @@ public interface CommonMaterService { public String getMasterDataForDoctor(Integer visitCategoryID, Integer providerServiceMapID, String gender, Integer facilityID, Integer vanID); + public String getECGAbnormalFindings(); + } diff --git a/src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java b/src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java index 994a6d34..20a73b51 100644 --- a/src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java +++ b/src/main/java/com/iemr/tm/service/labtechnician/LabTechnicianServiceImpl.java @@ -35,9 +35,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.JsonObject; +import com.iemr.tm.data.labModule.ECGAbnormalFindingMaster; import com.iemr.tm.data.labModule.LabResultEntry; import com.iemr.tm.data.labModule.WrapperLabResultEntry; import com.iemr.tm.data.labtechnician.V_benLabTestOrderedDetails; +import com.iemr.tm.repo.labModule.ECGAbnormalFindingMasterRepo; import com.iemr.tm.repo.labModule.LabResultEntryRepo; import com.iemr.tm.repo.labtechnician.V_benLabTestOrderedDetailsRepo; import com.iemr.tm.service.benFlowStatus.CommonBenStatusFlowServiceImpl; @@ -47,6 +49,7 @@ public class LabTechnicianServiceImpl implements LabTechnicianService { private V_benLabTestOrderedDetailsRepo v_benLabTestOrderedDetailsRepo; private LabResultEntryRepo labResultEntryRepo; + private ECGAbnormalFindingMasterRepo ecgAbnormalFindingMasterRepo; private CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl; @Autowired @@ -59,6 +62,11 @@ public void setLabResultEntryRepo(LabResultEntryRepo labResultEntryRepo) { this.labResultEntryRepo = labResultEntryRepo; } + @Autowired + public void setEcgAbnormalFindingMasterRepo(ECGAbnormalFindingMasterRepo ecgAbnormalFindingMasterRepo) { + this.ecgAbnormalFindingMasterRepo = ecgAbnormalFindingMasterRepo; + } + @Autowired public void setV_benLabTestOrderedDetailsRepo(V_benLabTestOrderedDetailsRepo v_benLabTestOrderedDetailsRepo) { this.v_benLabTestOrderedDetailsRepo = v_benLabTestOrderedDetailsRepo; @@ -417,6 +425,7 @@ public Integer saveLabTestResult(WrapperLabResultEntry wrapperLabResults) { LabResultEntry labCompResult = new LabResultEntry(); labCompResult.setPrescriptionID(labResult.getPrescriptionID()); labCompResult.setProcedureID(labResult.getProcedureID()); + labCompResult.setAbnormalFindings(labResult.getAbnormalFindings()); if (null != comp.get("testComponentID") && !comp.get("testComponentID").toString().isEmpty() && ((null != comp.get("testResultValue") && !comp.get("testResultValue").toString().isEmpty()) @@ -502,4 +511,9 @@ public String getLabResultForVisitcode(Long benRegID, Long visitCode) { ArrayList labResultList = getLabResultDataForBen(benRegID, visitCode); return new Gson().toJson(labResultList); } + + public String getECGAbnormalFindings() { + List findings = ecgAbnormalFindingMasterRepo.findByDeleted(false); + return new Gson().toJson(findings); + } } diff --git a/src/main/java/com/iemr/tm/utils/IntegerListConverter.java b/src/main/java/com/iemr/tm/utils/IntegerListConverter.java new file mode 100644 index 00000000..6c5899bc --- /dev/null +++ b/src/main/java/com/iemr/tm/utils/IntegerListConverter.java @@ -0,0 +1,52 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see https://www.gnu.org/licenses/. +*/ +package com.iemr.tm.utils; + +import java.util.List; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +@Converter +public class IntegerListConverter implements AttributeConverter, String> { + + private final Gson gson = new Gson(); + + @Override + public String convertToDatabaseColumn(List attribute) { + if (attribute == null || attribute.isEmpty()) { + return null; + } + return gson.toJson(attribute); + } + + @Override + public List convertToEntityAttribute(String dbData) { + if (dbData == null || dbData.trim().isEmpty()) { + return null; + } + return gson.fromJson(dbData, new TypeToken>(){}.getType()); + } +} \ No newline at end of file diff --git a/src/main/java/com/iemr/tm/utils/StringListConverter.java b/src/main/java/com/iemr/tm/utils/StringListConverter.java new file mode 100644 index 00000000..f5989236 --- /dev/null +++ b/src/main/java/com/iemr/tm/utils/StringListConverter.java @@ -0,0 +1,53 @@ +/* +* AMRIT – Accessible Medical Records via Integrated Technology +* Integrated EHR (Electronic Health Records) Solution +* +* Copyright (C) "Piramal Swasthya Management and Research Institute" +* +* This file is part of AMRIT. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see https://www.gnu.org/licenses/. +*/ +package com.iemr.tm.utils; + +import java.util.Arrays; +import java.util.List; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +@Converter +public class StringListConverter implements AttributeConverter, String> { + + private final Gson gson = new Gson(); + + @Override + public String convertToDatabaseColumn(List attribute) { + if (attribute == null || attribute.isEmpty()) { + return null; + } + return gson.toJson(attribute); + } + + @Override + public List convertToEntityAttribute(String dbData) { + if (dbData == null || dbData.trim().isEmpty()) { + return null; + } + return gson.fromJson(dbData, new TypeToken>(){}.getType()); + } +} \ No newline at end of file