Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/testcase-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: TestCase Coverage Check

on:
pull_request:
types: [opened, synchronize]

permissions: {}

jobs:
build_and_check_coverage:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-

- name: Build with Maven
run: mvn clean verify

- name: Run Coverage Check
uses: madrapps/jacoco-report@v1.7.2
with:
paths: target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage Report
comment-type: pr_comment
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/com/iemr/mmu/controller/anc/ANCController.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.bind.annotation.PostMapping;
Expand Down Expand Up @@ -70,6 +71,7 @@ public class ANCController {
*/
@Operation(summary = "Save ANC nurse data")
@PostMapping(value = { "/save/nurseData" })
@PreAuthorize("hasRole('NURSE')")
public String saveBenANCNurseData(@RequestBody String requestObj) {
OutputResponse response = new OutputResponse();
try {
Expand Down Expand Up @@ -102,6 +104,7 @@ public String saveBenANCNurseData(@RequestBody String requestObj) {
*/
@Operation(summary = "Save ANC doctor data")
@PostMapping(value = { "/save/doctorData" })
@PreAuthorize(" hasRole('DOCTOR')")
public String saveBenANCDoctorData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String authorization) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -143,6 +146,7 @@ public String saveBenANCDoctorData(@RequestBody String requestObj,

@Operation(summary = "Get beneficiary visit details from nurse ANC")
@PostMapping(value = { "/getBenVisitDetailsFrmNurseANC" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
@Transactional(rollbackFor = Exception.class)
public String getBenVisitDetailsFrmNurseANC(
@Param(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
Expand Down Expand Up @@ -174,6 +178,7 @@ public String getBenVisitDetailsFrmNurseANC(
@Operation(summary = "Get beneficiary ANC care details from nurse ANC")
@PostMapping(value = { "/getBenANCDetailsFrmNurseANC" })
@Transactional(rollbackFor = Exception.class)
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenANCDetailsFrmNurseANC(
@Param(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -205,7 +210,7 @@ public String getBenANCDetailsFrmNurseANC(
*/
@Operation(summary = "Get beneficiary ANC history details from nurse to doctor ")
@PostMapping(value = { "/getBenANCHistoryDetails" })

@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenANCHistoryDetails(
@Param(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -236,6 +241,7 @@ public String getBenANCHistoryDetails(
*/
@Operation(summary = "Get beneficiary ANC vital details from nurse ANC")
@PostMapping(value = { "/getBenANCVitalDetailsFrmNurseANC" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenANCVitalDetailsFrmNurseANC(
@Param(value = "{\"benRegID\":\"Long\",\"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -267,7 +273,7 @@ public String getBenANCVitalDetailsFrmNurseANC(
*/
@Operation(summary = "Get beneficiary ANC examination details from nurse to doctor ")
@PostMapping(value = { "/getBenExaminationDetailsANC" })

@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenExaminationDetailsANC(
@Param(value = "{\"benRegID\":\"Long\",\"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -299,6 +305,7 @@ public String getBenExaminationDetailsANC(
@Operation(summary = "Get beneficiary doctor entered details")
@PostMapping(value = { "/getBenCaseRecordFromDoctorANC" })
@Transactional(rollbackFor = Exception.class)
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenCaseRecordFromDoctorANC(
@Param(value = "{\"benRegID\":\"Long\",\"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand All @@ -325,6 +332,7 @@ public String getBenCaseRecordFromDoctorANC(
@Operation(summary = "Check high risk pregnancy status for ANC beneficiary")
@PostMapping(value = { "/getHRPStatus" })
@Transactional(rollbackFor = Exception.class)
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getHRPStatus(
@Param(value = "{\"benRegID\":\"Long\",\"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -353,6 +361,7 @@ public String getHRPStatus(

@Operation(summary = "Update ANC care data in doctor screen")
@PostMapping(value = { "/update/ANCScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateANCCareNurse(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -383,6 +392,7 @@ public String updateANCCareNurse(@RequestBody String requestObj) {
*/
@Operation(summary = "Update ANC history data in doctor screen")
@PostMapping(value = { "/update/historyScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateANCHistoryNurse(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -412,6 +422,7 @@ public String updateANCHistoryNurse(@RequestBody String requestObj) {
*/
@Operation(summary = "Update ANC vital data in doctor screen")
@PostMapping(value = { "/update/vitalScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateANCVitalNurse(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -442,6 +453,7 @@ public String updateANCVitalNurse(@RequestBody String requestObj) {
*/
@Operation(summary = "Update ANC examination data in doctor screen")
@PostMapping(value = { "/update/examinationScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateANCExaminationNurse(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -472,6 +484,7 @@ public String updateANCExaminationNurse(@RequestBody String requestObj) {
*/
@Operation(summary = "Update ANC doctor data")
@PostMapping(value = { "/update/doctorData" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateANCDoctorData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String authorization) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.bind.annotation.PostMapping;
Expand Down Expand Up @@ -67,6 +68,7 @@ public void setCancerScreeningServiceImpl(CSServiceImpl cSServiceImpl) {
*/
@Operation(summary = "Save cancer screening nurse data")
@PostMapping(value = { "/save/nurseData" })
@PreAuthorize("hasRole('NURSE')")
public String saveBenCancerScreeningNurseData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String authorization) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -106,6 +108,7 @@ else if (nurseDataSaveSuccessFlag == 2)
*/
@Operation(summary = "Save cancer screening doctor data")
@PostMapping(value = { "/save/doctorData" })
@PreAuthorize("hasRole('DOCTOR')")
public String saveBenCancerScreeningDoctorData(@RequestBody String requestObj,
@RequestHeader String authorization) {
OutputResponse response = new OutputResponse();
Expand All @@ -132,6 +135,7 @@ public String saveBenCancerScreeningDoctorData(@RequestBody String requestObj,

@Operation(summary = "Get beneficiary visit details from nurse screen")
@PostMapping(value = { "/getBenDataFrmNurseToDocVisitDetailsScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenDataFrmNurseScrnToDocScrnVisitDetails(
@ApiParam(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -161,6 +165,7 @@ public String getBenDataFrmNurseScrnToDocScrnVisitDetails(
*/
@Operation(summary = "Get beneficiary cancer history details from nurse screen")
@PostMapping(value = { "/getBenDataFrmNurseToDocHistoryScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenDataFrmNurseScrnToDocScrnHistory(
@ApiParam(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -189,6 +194,7 @@ public String getBenDataFrmNurseScrnToDocScrnHistory(
*/
@Operation(summary = "Get beneficiary vital details from nurse screen")
@PostMapping(value = { "/getBenDataFrmNurseToDocVitalScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenDataFrmNurseScrnToDocScrnVital(
@ApiParam(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -218,6 +224,7 @@ public String getBenDataFrmNurseScrnToDocScrnVital(
*/
@Operation(summary = "Get beneficiary examination details from nurse screen")
@PostMapping(value = { "/getBenDataFrmNurseToDocExaminationScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenDataFrmNurseScrnToDocScrnExamination(
@ApiParam(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -247,6 +254,7 @@ public String getBenDataFrmNurseScrnToDocScrnExamination(
*/
@Operation(summary = "Get beneficiary cancer family history")
@PostMapping(value = { "/getBenCancerFamilyHistory" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenCancerFamilyHistory(
@ApiParam(value = "{\"benRegID\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -278,6 +286,7 @@ public String getBenCancerFamilyHistory(
*/
@Operation(summary = "Get beneficiary cancer personal history")
@PostMapping(value = { "/getBenCancerPersonalHistory" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenCancerPersonalHistory(
@ApiParam(value = "{\"benRegID\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -309,6 +318,7 @@ public String getBenCancerPersonalHistory(
*/
@Operation(summary = "Get beneficiary cancer personal diet history")
@PostMapping(value = { "/getBenCancerPersonalDietHistory" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenCancerPersonalDietHistory(
@ApiParam(value = "{\"benRegID\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -340,6 +350,7 @@ public String getBenCancerPersonalDietHistory(
*/
@Operation(summary = "Get beneficiary cancer obstetric history")
@PostMapping(value = { "/getBenCancerObstetricHistory" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String getBenCancerObstetricHistory(
@ApiParam(value = "{\"benRegID\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -370,6 +381,7 @@ public String getBenCancerObstetricHistory(
*/
@Operation(summary = "Get beneficiary doctor entered details")
@PostMapping(value = { "/getBenCaseRecordFromDoctorCS" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
@Transactional(rollbackFor = Exception.class)
public String getBenCaseRecordFromDoctorCS(
@ApiParam(value = "{\"benRegID\":\"Long\", \"visitCode\":\"Long\"}") @RequestBody String comingRequest) {
Expand All @@ -396,6 +408,7 @@ public String getBenCaseRecordFromDoctorCS(

@Operation(summary = "Update cancer screening history nurse data in doctor screen")
@PostMapping(value = { "/update/historyScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateCSHistoryNurse(
@ApiParam(value = "{\"historyDetails\": {\"familyHistory\":{\"diseases\": [{\"beneficiaryRegID\":\"Long\", \"benVisitID\":\"Long\", "
+ "\"providerServiceMapID\":\"Integer\", \"cancerDiseaseType\":\"String\", \"otherDiseaseType\":\"String\", \"familyMemberList\":\"List\", "
Expand Down Expand Up @@ -440,6 +453,7 @@ public String updateCSHistoryNurse(
*/
@Operation(summary = "Update beneficiary vital detail")
@PostMapping(value = { "/update/vitalScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String upodateBenVitalDetail(
@ApiParam(value = "{\"ID\": \"Long\", \"beneficiaryRegID\":\"Long\",\"benVisitID\":\"Long\","
+ "\"weight_Kg\":\"Double\", \"height_cm\":\"Double\", \"waistCircumference_cm\":\"Double\", \"bloodGlucose_Fasting\":\"Short\","
Expand Down Expand Up @@ -476,6 +490,7 @@ public String upodateBenVitalDetail(
*/
@Operation(summary = "Update beneficiary examination detail")
@PostMapping(value = { "/update/examinationScreen" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String upodateBenExaminationDetail(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down Expand Up @@ -505,6 +520,7 @@ public String upodateBenExaminationDetail(@RequestBody String requestObj) {
*/
@Operation(summary = "Update cancer diagnosis details by oncologist")
@PostMapping(value = { "/update/examinationScreen/diagnosis" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR') || hasRole('ONCOLOGIST')")
public String updateCancerDiagnosisDetailsByOncologist(
@ApiParam(value = "{\"beneficiaryRegID\":\"Long\", \"benVisitID\":\"Long\", \"visitCode\":\"Long\", "
+ "\"provisionalDiagnosisOncologist\":\"String\", \"modifiedBy\":\"string\"}") @RequestBody String requestObj) {
Expand Down Expand Up @@ -536,6 +552,7 @@ public String updateCancerDiagnosisDetailsByOncologist(
*/
@Operation(summary = "Update cancer screening doctor data")
@PostMapping(value = { "/update/doctorData" })
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR')")
public String updateCancerScreeningDoctorData(@RequestBody String requestObj) {

OutputResponse response = new OutputResponse();
Expand Down
Loading
Loading