All files / src/redux/questionnarie service.js

0% Statements 0/39
100% Branches 0/0
0% Functions 0/7
0% Lines 0/39
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208                                                                                                                                                                                                                                                                                                                                                                                                                               
import APIService from '../../lib/APIService';
import APIHelper from '../../helper/apihelper';
import { getJwt } from '../../utils/jwtUtils';
import { REGISTRY_UNIT_NAME } from '../../helper/constants';
import { BASE_URL_PRO, BASE_URL_STATS } from '../../helper/urlConstants';
 
const api = new APIHelper();
 
export const GET_QUESTIONNARIE_INSTANCES = `query($input: getQuestionnaireInstanceInput){
    getQuestionnaireInstance(input:$input){
        expiryDates
        questionnaireRowId
        noOfQuestionsToBeAnswered
        noOfQuestionsAnswered
        progressStatus
        createdAt
        questionnaireDefinition {
            forms
            questionnaireRowId
            name
            version
            dataSchema
            uiSchema
        }
    }
}`;
 
const GET_FORM_INSTANCES = `query($input: getQuestionnaireInstanceInput){
    getFormInstanceList(input:$input){
        formDefinition {
            sections
            dataSchema
            uiSchema
            expiryDurationInDays
        }
        data
        id
    }
}`;
 
const GET_SECTION_DEFINATIONS = `query($input: getSectionDefinationInput){
    getSectionDefinationList(input:$input){
        id
        uiSchema
        name
    }
}`;
 
export const GET_FORM_DEFINATION_WITH_DATA_AND_SECTION = `query($input: getFormDefinitionWithDataAndSectionInput){
    getFormDefinitionWithDataAndSection(input:$input){
      formDefinition{
        id
        sections
        isQuestionSetAtFormLevel
        isPublished
        name
        dataSchema
        uiSchema
        expiryDurationInDays
        updatedBy
        createdBy
        updatedAt
        createdAt
        version
      }
      formInstance{
        id
        questionnaireInstanceId
        isFreezed
        noOfQuestionsToBeAnswered
        noOfQuestionsAnswered
        progressStatus
        expiryDate
        updatedAt
        createdAt
        data
        version
        dataSchema
        uiSchema
      }
    }
}`;
 
const GET_QUESTIONNARIE = `query($input: getOutreachScheduledJobsInput){
    getOutreachScheduledJobs(input:$input){
      outreach_scheduled_jobs_id
      dispatch_scheduled_datetime
      expires_at
      outreach_definition_id
      questionnaire_display_name
      questionnaire_instance_id
      questionnaire_instance_meta_information
      is_dispatched
      dispatched_at
      dispatched_by
      questionnaire_status
      updated_at
      updated_by
      unit
      practiceid
      providerid
      patientuid
      patient_fullname
      mrn
      visituid
      locationid
      npi
      provider_fullname
      visitdate
      isactive
      questionnaire_definition_id
      year
      totalcount
    }
     
   }`;
 
// const BASE_URL1 = 'http://demo8650552.mockable.io/getPatientProfileInfo';
 
export const questionnarie = async params => {
    const requestOptions = {
        query: GET_QUESTIONNARIE,
        variables: params
    };
    const res = await APIService.post(BASE_URL_STATS, requestOptions);
    // const res = await APIService.post(BASE_URL, requestOptions);
    return res.data.data;
};
 
export const getQuestionnaireInstances = async params => {
    const requestOptions = {
        query: GET_QUESTIONNARIE_INSTANCES,
        variables: params
    };
    const res = await APIService.post(BASE_URL_PRO, requestOptions);
    return res.data.data.getQuestionnaireInstance;
};
 
export const getFormInstances = async params => {
    const requestOptions = {
        query: GET_FORM_INSTANCES,
        variables: params
    };
    const res = await APIService.post(BASE_URL_PRO, requestOptions);
    return res.data.data.getFormInstanceList;
};
 
export const getSectionDefinations = async params => {
    const requestOptions = {
        query: GET_SECTION_DEFINATIONS,
        variables: params
    };
    const res = await APIService.post(BASE_URL_PRO, requestOptions);
    return res.data;
};
 
export const getFormDefinitionWithDataAndSection = async params => {
    const requestOptions = {
        query: GET_FORM_DEFINATION_WITH_DATA_AND_SECTION,
        variables: params
    };
    const res = await APIService.post(BASE_URL_PRO, requestOptions);
    return res.data;
};
 
export const getPatientProfileInfo = async params => {
    // const res = await APIService.get(BASE_URL1);
    // return res.data;
    const headers = {
        'request-user-id': 7,
        'request-action': 'View'
    };
    const requestOptions = {
        query: GET_VISIT,
        variables: params
    };
    const res = await APIService.post('http://192.168.104.25:7006/patient', requestOptions, headers);
    return res.data.data.getPatientVisits;
};
 
// export const getVisits = params => {
//     const requestOption = api.getRequestOption(GET_VISIT, params, api.Actions.View, getJwt());
//     return api.PegasusAPI(api.Resources.patientVisit, requestOption, response => {
//         return response;
//     });
// };
 
export const setSelectedQuestionnaireIdToStore = async selectedQuestionnaireId => {
    return selectedQuestionnaireId;
};
 
const GET_VISIT = `query($input:getPatientVisitsInput){
    getPatientVisits(input:$input){
     firstname
      lastname
      midname
      mrn
      practiceid
      npi
      patientuid
      visitdate
      visituid
      gender
      emailid
      dob
    }
   }`;