{"version":3,"sources":["apis/emr-data.ts","apis/payment-gateway.ts","models/phv.ts","apis/allergy.ts","rematch-models/account/selector.ts","rematch-models/allergy/selector.ts","rematch-models/app-state/selector.ts","rematch-models/check-out-question/selector.ts","rematch-models/encounter-patient-education/selector.ts","rematch-models/encounter-rx/selector.ts","rematch-models/encounter-rx-reconcile/selector.ts","rematch-models/insurance/selector.ts","rematch-models/patient-history/selector.ts","rematch-models/patient-portal-data/selector.ts","rematch-models/patient-rx/selector.ts","rematch-models/patient-vaccine/selector.ts","rematch-models/schedule/selector.ts","rematch-models/shared-selector.ts","rematch-models/statement/selector.ts","rematch-models/selector.ts","models/check-in-question.ts","models/check-out-question.ts","models/snomed-category.ts","utils/constant.ts","components/shared/Loading/Loading.tsx","components/shared/Loading/index.ts","utils/helper.ts","utils/numeric.ts","utils/validation-schema.ts","utils/mapper.ts","utils/print.ts","apis/insurance.ts","apis/patient-rx.ts","models/patient-history.ts","utils/formatter.ts","apis/patient-portal-data.ts","models/patient-rx.ts","configGlobal.ts","rematch-models/app-state/index.ts","rematch-models/account/index.ts","rematch-models/allergy/index.ts","rematch-models/cdc-cvx/index.ts","apis/check-in-question.ts","rematch-models/check-in-question/index.ts","apis/check-out-question.ts","rematch-models/check-out-question/index.ts","rematch-models/composite-allergy/index.ts","rematch-models/composite-drug/index.ts","rematch-models/counseling-type/index.ts","rematch-models/dosage-form-type/index.ts","apis/encounter-patient-education.ts","rematch-models/encounter-patient-education/index.ts","apis/encounter-rx.ts","rematch-models/encounter-rx/index.ts","apis/encounter-rx-reconcile.ts","rematch-models/encounter-rx-reconcile/index.ts","apis/facility.ts","rematch-models/facility/index.ts","rematch-models/icd10/index.ts","rematch-models/imaging-facility/index.ts","rematch-models/insurance/index.ts","rematch-models/item/index.ts","rematch-models/lab/index.ts","rematch-models/lab-corp-edifecs-standard-compendium/index.ts","rematch-models/lab-test-code/index.ts","rematch-models/message/index.ts","rematch-models/nlm-patient-education-definition/index.ts","apis/patient-history.ts","rematch-models/patient-history/index.ts","rematch-models/patient-portal-data/index.ts","rematch-models/patient-rx/index.ts","apis/patient-vaccine.ts","rematch-models/patient-vaccine/index.ts","apis/payer.ts","rematch-models/payer/index.ts","rematch-models/payment-card/index.ts","apis/pharmacy.ts","rematch-models/pharmacy/index.ts","rematch-models/procedure-type/index.ts","apis/provider.ts","rematch-models/provider/index.ts","rematch-models/quest-order-code/index.ts","apis/schedule.ts","rematch-models/schedule/index.ts","rematch-models/snomed/index.ts","rematch-models/snomed-category/index.ts","rematch-models/specialty/index.ts","rematch-models/statement/index.ts","apis/user.ts","rematch-models/user/index.ts","store.ts","App.tsx","appConfig.ts","Rollbar.tsx","index.tsx","utils/regex.ts","models/imps-base-model.ts","rematch-models/composite-allergy/selector.ts","rematch-models/composite-drug/selector.ts","rematch-models/icd10/selector.ts","rematch-models/snomed/selector.ts","rematch-models/dosage-form-type/selector.ts","rematch-models/facility/selector.ts","rematch-models/item/selector.ts","rematch-models/payer/selector.tsx","rematch-models/payment-card/selector.tsx","rematch-models/provider/selector.ts","rematch-models/user/selector.ts","utils/naming.ts","utils/index.ts","rematch-models/cdc-cvx/selector.ts","utils/converter.ts","rematch-models/counseling-type/selector.ts","rematch-models/imaging-facility/selector.ts","utils/calculator.ts","rematch-models/lab/selector.ts","rematch-models/lab-corp-edifecs-standard-compendium/selector.ts","rematch-models/lab-test-code/selector.ts","rematch-models/message/selector.ts","apis/messaging-msg.ts","rematch-models/nlm-patient-education-definition/selector.ts","rematch-models/pharmacy/selector.ts","models/patient-portal-data.ts","rematch-models/procedure-type/selector.ts","rematch-models/quest-order-code/selector.ts","rematch-models/snomed-category/selector.ts","rematch-models/specialty/selector.ts","apis/statement.ts"],"names":["locked","getSpecialties","getItems","getSnomedCategories","getDosageFormTypes","getCounselingTypes","getImagingFacilities","getLabs","getProcedureTypes","getCDCCVXs","getLabTestCodes","getAppConfig","a","axios","get","response","data","getCompositeAllergies","allergyIds","post","Array","from","Set","searchCompositeAllergies","text","window","console","log","getSnomeds","conceptIds","active","action","searchSnomeds","getCompositeDrugs","medIds","searchCompositeDrugs","getICD10s","codes","searchICD10s","getNLMPatientEducationDefinitions","ids","getQuestOrderCodes","testCDs","getLabCorpEdifecsStandardCompendiums","orderCode","getPublicKeyAsync","chargeAsync","amount","appointmentId","getPaymentCardsAsync","saveCardAsync","token","updatePrimaryCardAsync","cardId","PHVType","getLatestAllergies","getAppointmentAllergies","selectors","getAccountIdentity","state","identityName","getAccountLocked","getAccountName","name","getCoordinates","coordinates","getPatientId","impsId","getAppointmentAllergyIdsSelector","createSelector","byId","memoize","Object","keys","filter","x","map","sort","b","getAllergyHashSelector","reduce","prevValue","id","date","onsetDate","getAllergy","getAllergyHash","getAllergyIds","allIds","getAppointmentAllergyIds","getLoading","loadingKey","loading","getAppLockTimeout","appConfig","appLockTimeout","getMenuState","menuState","getSystemName","systemName","checkOutQuestionId","Number","slice","questionKey","getEncounterPatientEducationIdsSelector","getEncounterPatientEducation","getEncounterPatientEducationIds","checkAppointmentHasRxSelector","length","getEncounterRxIdsSelector","status","checkAppointmentHasRx","getEncounterRx","getEncounterRxIds","getEncounterRxReconcile","getEncounterRxReconcileHash","getInsurance","getInsuranceIds","getPatientHistoryHashSelector","type","historyType","HistoryType","DrugHistory","FallHistory","code","createdDate","refId","getPatientHistory","getPatientHistoryHash","getPatientHistoryIds","byType","byPassSet","PatientPortalDataType","DrugAbuseHistory","getPatientPortalDataHashSelector","byCode","preHash","keySet","getUTCCurrentDateRange","startDate","endDate","PatientPortalDataStatus","Pending","PatientPortalDataAction","Created","Deleted","Updated","Medication","relatedId","has","priority","ref","model","dataModel","medId","RxStatus","NotTaking","Taking","getPatientPortalDataNewsSelector","relatedCreatedDate","getPatientPortalDataNewCodesSelector","isPendingExistedSelector","getPatientPortalData","patientPortalData","getPatientPortalDataHash","getPatientPortalDataNews","getPatientPortalDataNewCodes","isDeleted","isPendingExisted","getPatientRxHashSelector","byMedId","getPatientRx","getPatientRxByMed","getPatientRxHash","getPatientRxIds","getPatientVaccineIdsSelector","getPatientVaccine","getPatientVaccineIds","specialtyId","time","find","specialtyIds","includes","providerId","facilityId","appointmentDate","appointmentTime","limited","patientHistorySet","DrinkingHistory","FamilyHistory","PastMedicalHistory","SocialHistory","SmokingHistory","specialTypeSet","getMergeDetail","patientPortalDataSelectors","patientPortalDatas","Allergy","allergySelectors","allergies","patientRxSelectors","patientRxes","patientHistorySelectors","patientHistories","String","split","getMergeModel","detail","getMergeField","field","getCurrentStatementId","statement","held","paidDone","getStatement","getStatementIds","CheckInQuestionKey","CheckOutQuestionKey","IMPSBaseModel","SnomedCategoryType","AuthenticateStatus","ResetPasswordStatus","KeyCode","Demographic","EmergencyContact","Pharmacy","Insurance","TelehealthVisit","VisitReason","VitalSign","Thanks","Payment","PaymentSucceeded","Followup","Completed","Finished","TimeFrameUnitType","emptyFunction","Loading","React","memo","style","position","top","left","transform","fontSize","color","className","setScroll","list","currentPosition","direction","current","liElements","children","item","viewHeight","clientHeight","offsetHeight","scrollTop","currentElement","offsetTop","numberView","value","precision","round","toFixed","lodash","sumBy","arr","indentity","substract","minuend","subtrahend","subtract","loginValidationSchema","yup","shape","accountName","required","matches","phoneRegExp","password","min","verifyValidationSchema","verificationCode","mapInsuranceType","P","S","T","implementBuildReport","pageHeader","splitPage","baseElement","newBaseElement","$","result","splitElement","element","redundantHeight","maxHeight","Math","floor","newChild","reverseHeight","elements","toArray","childElement","pop","scrollHeight","tagName","classList","contains","cloneChild","clone","empty","append","unshift","innerText","remove","headerElement","letter","letterContent","after","header","getPageHeaderFooter","i","removeEmptyPage","prepend","addPageHeaderFooter","printHTMLPages","contentIds","mywindow","open","contentHTML","contentId","contentElement","document","getElementById","innerHTML","write","head","intervalId","setInterval","html","clearInterval","print","close","getInsurancesAsync","getPatientRxes","PatientHistoryType","fullDateSet","yearDateSet","when","is","then","moreThan","icd10Code","nullable","historyDateFrom","historyDateTo","schema","test","isDayNotGreaterThan","yearFrom","yearTo","toString","familyHistoryRelationship","isSameDate","metadata","toLocal","moment","isSame","utc","local","unit","getUTCCurrentDate","utcDate","delta","add","number","format","destFormat","startOf","formatDate","momentDate","srcFormat","formatICD10","substring","formatName","firstName","lastName","withDegree","degree","formatAddress","address","city","zipcode","join","to","getPatientPortalDatas","createPatientPortalData","isArray","PatientRxSource","Unknown","dosageNumberTypeID","dosageFrequencyTypeID","dispense","global","jQuery","agent","navigator","userAgent","vendor","opera","isMobile","mobileRegExp","tabletRegExp","substr","appStates","createModel","reducers","setAppConfig","toggleMenuState","undefined","accounts","primary","lockAccount","update","storeByIMPSId","effects","dispatch","getLatestAllergiesAsync","compositeAllergies","phvs","this","getCompositeAllergiesAsync","allergyId","getPHVsAsync","Reaction","getAppointmentAllergiesAsync","appointment","cdcCVXs","storeByCVXCode","getCDCCVXsAsync","_","rootState","getCDCCVXIds","prev","cvxCode","getCheckInQuestions","checkInQuestions","byAppointmentId","isUpdated","checkIsUpdate","processedData","processData","getCheckInQuestionsAsync","every","initialByAppointmentId","questionDate","push","getCheckOutQuestions","checkOutQuestions","getCheckOutQuestionsAsync","searchedTextHash","storeByCompositeAllergyID","description","setSearched","notExistedIds","getOtherCompositeAllergyIds","searchCompositeAllergiesAsync","checkSearched","compositeAllergyID","compositeDrugs","byMedNameId","getCompositeDrugsAsync","getOtherCompositeDrugIds","searchCompositeDrugsAsync","initalByMedNameId","medStrength","medNameId","medDoseForm","medRoute","counselingTypes","getCounselingTypesAsync","getCounselingTypeIds","dosageFormTypes","displayOrder","getDosageFormTypesAsync","getDosageFormTypeIds","dosageFormDescription","getEncounterPatientEducations","encounterPatientEducations","getEncounterPatientEducationsAsync","nlmPatientEducationDefinitions","getNLMPatientEducationDefinitionsAsync","patientEducationDefinitionId","getAppointmentEncounterRxes","encounterRxes","getAppointmentEncounterRxesAsync","getEncounterRxReconciles","encounterRxReconciles","storeByPatientRxId","getEncounterRxReconcilesAsync","patientRxId","getFacilities","getOtherFacilities","facilities","storeData","getFacilitiesAsync","getOtherFacilityIds","getOtherFacilitiesAsync","existedIds","getFacilityIds","icd10s","storeByCode","getICD10sAsync","getOtherICD10Ids","searchICD10sAsync","textLower","toLowerCase","imagingFacilities","getImagingFacilitiesAsync","getImagingFacilityIds","insurances","insuranceType","items","allVisitStatusIds","allVisitTypeIds","byVisitStatusId","byVisitTypeId","storeByItemValue","getItemsAsync","getVisitStatusIds","getVisitTypeIds","listTypeId","itemValue","labs","getLabsAsync","getLabIds","labCorpEdifecsStandardCompendiums","shouldUpdateState","getLabCorpEdifecsStandardCompendiumsAsync","getOtherLabCorpEdifecsStandardCompendiumIds","labTestCodes","getLabTestCodesAsync","getLabTestCodeIds","messages","userIds","groupByUserId","createdDt","getMessagesAsync","payload","getMessages","rootMessageId","getUnreadMessagesAsync","getUnreadMessages","getRootMessagesAsync","getRootMessages","curr","belongToUserId","getOtherNLMPatientEducationDefinitionIds","getPatientHistories","n","icD10Code","storeByType","getPatientHistoriesAsync","snomeds","getSnomedsAsync","getPatientPortalDatasAsync","filterPatientHistoriesData","JsonParse","getPatientRxesAsync","dosageFrequencyTypes","dosageNumberTypes","getDosageFrequencyTypesAsync","getDosageNumberTypesAsync","getAppointmentPatientVaccines","patientVaccines","getAppointmentPatientVaccinesAsync","providers","getProvidersAsync","administeredByProviderId","getPayers","getOtherPayers","payers","getPayersAsync","getOtherPayerIds","getOtherPayersAsync","getPayerIds","paymentCards","primaryId","storeById","last4","getPaymentCardIds","success","message","searchPharmacies","pharmacies","byText","searchPharmaciesAsync","accountSelectors","forEach","distance","getDistanceFromLatLonInKm","latitude","longitude","locationLAT","locationLNG","procedureTypes","getProcedureTypesAsync","getProcedureTypeIds","getProviders","getOtherProviders","getOtherProviderIds","getOtherProvidersAsync","getProviderIds","questOrderCodes","storeByTestCD","getQuestOrderCodesAsync","getOtherQuestOrderCodeIds","testCD","getAllSchedules","requestDate","getSchedules","schedules","getAllSchedulesAsync","getSchedulesAsync","storeByConceptId","term","snomedCategories","getOtherSnomedIds","getSnomedCategoriesAsync","searchSnomedsAsync","initialById","conceptId","relatedIds","checkLoaded","recommendedAssessmentText","categoryTypeId","specialties","getSpecialtiesAsync","getSpecialtyIds","statements","statementDate","getStatementsAsync","alert","getStatementAsync","getUsers","users","system","getUsersAsync","getUserIds","currentKey","weeks","localStorage","startsWith","endsWith","removeItem","persistPlugin","createRematchPersist","key","whitelist","version","keyPrefix","createLoadingPlugin","store","init","models","plugins","Account","lazy","PatientPortal","App","Suspense","fallback","path","component","process","REACT_APP_URL_BILLING","ErrorDisplay","Rollbar","Provider","config","accessToken","captureUncaught","captureUnhandledRejections","environment","client","javascript","source_map_enabled","ErrorBoundary","fallbackUI","ReactDOM","render","emailRegExp","getCompositeAllergyIdsByTextSelector","getOtherCompositeAllergyIdsSelector","getCompositeAllergy","getCompositeAllergyIds","getCompositeAllergyIdsByText","getCompositeDrugFormulationsSelector","getCompositeDrugMedNameIdsByTextSelector","compositeDrug","medName","getCompositeDrugRouteSelector","getCompositeDrugStrengthSelector","values","medStrengthUnit","getOtherCompositeDrugIdsSelector","getCompositeDrug","getCompositeDrugByMedNameId","getCompositeDrugFormulations","getCompositeDrugIdHash","getCompositeDrugMedNameIdsByText","getCompositeDrugRoute","getCompositeDrugStrength","getOtherICD10IdsSelector","getICD10","getICD10Hash","getLoadingHash","getOtherSnomedIdsSelector","getSnomedIdsByTextSelector","getSnomed","getSnomedIds","getSnomedIdsByText","getDosageFormType","getOtherFacilityIdsSelector","getFacility","getVisitTypeIdsSelector","isNewPatient","itemText","getVisitStatus","getVisitType","getOtherPayerIdsSelector","getPayer","getPayerHash","getPaymentCard","getPrimaryCardId","getOtherProviderIdsBySpecialtyIdSelector","getProviderIdsBySpecialtyIdSelector","lastNameLowerA","lastNameLowerB","getOtherProviderIdsBySpecialtyId","getProvider","getProviderIdsBySpecialtyId","getUser","getUserHash","convertPascalCaseToCamelCase","e","convertNamePascalCaseToCamelCase","Error","firstWordEndIndex","search","firstLowserCaseIndex","getCDCCVX","mergeId","getMergeId","JSON","parse","getCounselingType","getImagingFacility","deg2rad","deg","PI","lat1","lon1","lat2","lon2","dLat","dLon","sin","cos","atan2","sqrt","getInhouseLabSelector","inHouse","getLabByNameSelector","nameLower","labName","getInhouseLab","getLab","getLabByName","getOtherLabCorpEdifecsStandardCompendiumIdsSelector","getLabCorpEdifecsStandardCompendium","getLabTestCode","getLatestMessageSelector","userId","getMessageIdsSelector","parentId","getRootMessageIdsSelector","getUnreadMessageIdsSelector","userUnreadMessageDict","read","getLatestMessage","getMessage","getMessageIds","getRootMessageIds","getUnreadMessageIds","createChatMessage","readMessages","getOtherNLMPatientEducationDefinitionIdsSelector","getNLMPatientEducationDefinition","getPharmacyIdsSelector","keywords","fT_cols","lower","t","indexOf","getPharmacy","getPharmacyHash","getPharmacyIds","getProcedureType","getOtherQuestOrderCodeIdsSelector","getQuestOrderCode","checkLoadedSelector","getSnomedCategory","getSnomedCategoryIds","getSpecialty","getPatientReceiptViewsAsync","getPatientReceiptAsync","receiptId","getCurrentStatementAsync","getCurrentStatement"],"mappings":"42BAoBMA,EAAS,CACXC,gBAAgB,EAChBC,UAAU,EACVC,qBAAqB,EACrBC,oBAAoB,EACpBC,oBAAoB,EACpBC,sBAAsB,EACtBC,SAAS,EACTC,mBAAmB,EACnBC,YAAY,EACZC,iBAAiB,GAGRC,EAAY,sCAAG,4BAAAC,EAAA,qEACDC,IAAMC,IAAN,4BADC,cAClBC,EADkB,yBAEjBA,EAASC,MAFQ,yCAAH,qDAKZf,EAAc,sCAAG,4BAAAW,EAAA,yDACtBZ,EAAOC,eADe,yCAEf,IAFe,cAItBD,EAAOC,gBAAiB,EAJF,SAKCY,IAAMC,IAAN,2BALD,cAKhBC,EALgB,OAMtBf,EAAOC,gBAAiB,EANF,kBAOfc,EAASC,MAPM,0CAAH,qDAWdd,EAAQ,sCAAG,4BAAAU,EAAA,yDAChBZ,EAAOE,SADS,yCAET,IAFS,cAIhBF,EAAOE,UAAW,EAJF,SAKOW,IAAMC,IAAN,sBALP,cAKVC,EALU,OAMhBf,E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B,SACb1kB,GADa,OAEFA,EAAM6B,U,2QCEZ8tB,EAA2B,sCAAG,4BAAA1yB,EAAA,qEAChBC,IAAMC,IAAI,uBADM,cACjCC,EADiC,yBAEhCA,EAASC,MAFuB,yCAAH,qDAK3BuyB,EAAsB,sCAAG,WAClCC,GADkC,eAAA5yB,EAAA,qEAGXC,IAAMC,IAAN,yBAA4B0yB,IAHjB,cAG5BzyB,EAH4B,yBAI3BA,EAASC,MAJkB,yCAAH,sDAOtByyB,EAAwB,sCAAG,4BAAA7yB,EAAA,qEACbC,IAAMC,IAAI,0BADG,cAC9BC,EAD8B,yBAE7BA,EAASC,MAFoB,yCAAH,qDAKxBwnB,EAAkB,sCAAG,4BAAA5nB,EAAA,qEACPC,IAAMC,IAAI,kBADH,cACxBC,EADwB,yBAEvBA,EAASC,MAFc,yCAAH,qDAKlB0nB,EAAiB,sCAAG,WAAOxjB,GAAP,eAAAtE,EAAA,qEACNC,IAAMC,IAAN,yBAA4BoE,IADtB,cACvBnE,EADuB,yBAEtBA,EAASC,MAFa,yCAAH,sDAKjB0yB,EAAmB,sCAAG,4BAAA9yB,EAAA,qEACRC,IAAMC,IAAN,0BADQ,cACzBC,EADyB,yBAExBA,EAASC,MAFe,yCAAH,uD","file":"static/js/main.591e7ad3.chunk.js","sourcesContent":["import axios from 'axios';\r\nimport { AppConfig } from '../models/app-config';\r\nimport { CDCCVX } from '../models/cdc-cvx';\r\nimport { CompositeAllergy } from '../models/composite-allergy';\r\nimport { CompositeDrug } from '../models/composite-drug';\r\nimport { CounselingType } from '../models/counseling-type';\r\nimport { DosageFormType } from '../models/dosage-form-type';\r\nimport { ICD10 } from '../models/icd10';\r\nimport { ImagingFacility } from '../models/imaging-facility';\r\nimport { ItemModel } from '../models/item';\r\nimport { Lab } from '../models/lab';\r\nimport { LabCorpEdifecsStandardCompendium } from '../models/lab-corp-edifecs-standard-compendium';\r\nimport { LabTestCode } from '../models/lab-test-code';\r\nimport { NLMPatientEducationDefinition } from '../models/nlm-patient-education-definition';\r\nimport { ProcedureType } from '../models/procedure-type';\r\nimport { QuestOrderCode } from '../models/quest-order-code';\r\nimport { Snomed } from '../models/snomed';\r\nimport { SnomedCategory } from '../models/snomed-category';\r\nimport { SpecialtyModel } from '../models/specialty';\r\n\r\nconst locked = {\r\n getSpecialties: false,\r\n getItems: false,\r\n getSnomedCategories: false,\r\n getDosageFormTypes: false,\r\n getCounselingTypes: false,\r\n getImagingFacilities: false,\r\n getLabs: false,\r\n getProcedureTypes: false,\r\n getCDCCVXs: false,\r\n getLabTestCodes: false\r\n};\r\n\r\nexport const getAppConfig = async (): Promise> => {\r\n const response = await axios.get(`/api/emr-data/app-config`);\r\n return response.data;\r\n};\r\n\r\nexport const getSpecialties = async (): Promise> => {\r\n if (locked.getSpecialties) {\r\n return [];\r\n } else {\r\n locked.getSpecialties = true;\r\n const response = await axios.get(`/api/emr-data/specialty`);\r\n locked.getSpecialties = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getItems = async (): Promise> => {\r\n if (locked.getItems) {\r\n return [];\r\n } else {\r\n locked.getItems = true;\r\n const response = await axios.get(`/api/emr-data/item`);\r\n locked.getItems = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getCompositeAllergies = async (\r\n allergyIds: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/emr-data/composite-allergy',\r\n Array.from(new Set(allergyIds))\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const searchCompositeAllergies = async (text: string): Promise> => {\r\n try {\r\n const response = await axios.get(`/api/emr-data/composite-allergy/search?text=${text}`);\r\n return response.data;\r\n } catch (e) {\r\n window.console.log(e);\r\n return [];\r\n }\r\n};\r\n\r\nexport const getSnomeds = async (conceptIds: number[], active: boolean): Promise> => {\r\n const action = active ? 'active-snomed' : 'snomed';\r\n const response = await axios.post(`/api/emr-data/${action}`, conceptIds);\r\n return response.data;\r\n};\r\n\r\nexport const searchSnomeds = async (text: string): Promise> => {\r\n try {\r\n const response = await axios.get(`/api/emr-data/snomed/search?text=${text}`);\r\n return response.data;\r\n } catch (e) {\r\n window.console.log(e);\r\n return [];\r\n }\r\n};\r\n\r\nexport const getSnomedCategories = async (): Promise> => {\r\n if (locked.getSnomedCategories) {\r\n return [];\r\n } else {\r\n locked.getSnomedCategories = true;\r\n const response = await axios.get(`/api/emr-data/snomed-category`);\r\n locked.getSnomedCategories = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getCompositeDrugs = async (\r\n medIds: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/emr-data/composite-drug',\r\n Array.from(new Set(medIds))\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const searchCompositeDrugs = async (text: string): Promise> => {\r\n try {\r\n const response = await axios.get(`/api/emr-data/composite-drug/search?text=${text}`);\r\n return response.data;\r\n } catch (e) {\r\n window.console.log(e);\r\n return [];\r\n }\r\n};\r\n\r\nexport const getDosageFormTypes = async (): Promise> => {\r\n if (locked.getDosageFormTypes) {\r\n return [];\r\n } else {\r\n locked.getDosageFormTypes = true;\r\n const response = await axios.get(`/api/emr-data/dosage-form-type`);\r\n locked.getDosageFormTypes = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getICD10s = async (\r\n codes: string[]\r\n): Promise> => {\r\n const response = await axios.post(\r\n '/api/emr-data/icd10',\r\n Array.from(new Set(codes))\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const searchICD10s = async (text: string): Promise> => {\r\n try {\r\n const response = await axios.get(`/api/emr-data/icd10/search?text=${text}`);\r\n return response.data;\r\n } catch (e) {\r\n window.console.log(e);\r\n return [];\r\n }\r\n};\r\n\r\nexport const getNLMPatientEducationDefinitions = async (ids: number[]): Promise> => {\r\n const response = await axios.post(`/api/emr-data/nlm-patient-education-definition`, ids);\r\n return response.data;\r\n};\r\n\r\nexport const getCounselingTypes = async (): Promise> => {\r\n if (locked.getCounselingTypes) {\r\n return [];\r\n } else {\r\n locked.getCounselingTypes = true;\r\n const response = await axios.get(`/api/emr-data/counseling-type`);\r\n locked.getCounselingTypes = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getImagingFacilities = async (): Promise> => {\r\n if (locked.getImagingFacilities) {\r\n return [];\r\n } else {\r\n locked.getImagingFacilities = true;\r\n const response = await axios.get(`/api/emr-data/imaging-facility`);\r\n locked.getImagingFacilities = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getLabs = async (): Promise> => {\r\n if (locked.getLabs) {\r\n return [];\r\n } else {\r\n locked.getLabs = true;\r\n const response = await axios.get(`/api/emr-data/lab`);\r\n locked.getLabs = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getProcedureTypes = async (): Promise> => {\r\n if (locked.getProcedureTypes) {\r\n return [];\r\n } else {\r\n locked.getProcedureTypes = true;\r\n const response = await axios.get(`/api/emr-data/procedure-type`);\r\n locked.getProcedureTypes = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getCDCCVXs = async (): Promise> => {\r\n if (locked.getCDCCVXs) {\r\n return [];\r\n } else {\r\n locked.getCDCCVXs = true;\r\n const response = await axios.get(`/api/emr-data/cdc-cvx`);\r\n locked.getCDCCVXs = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getLabTestCodes = async (): Promise> => {\r\n if (locked.getLabTestCodes) {\r\n return [];\r\n } else {\r\n locked.getLabTestCodes = true;\r\n const response = await axios.get(`/api/emr-data/lab-test-code`);\r\n locked.getLabTestCodes = false;\r\n return response.data;\r\n }\r\n};\r\n\r\nexport const getQuestOrderCodes = async (testCDs: string[]): Promise> => {\r\n const response = await axios.post(`/api/emr-data/quest-order-code`, testCDs);\r\n return response.data;\r\n};\r\n\r\nexport const getLabCorpEdifecsStandardCompendiums = async (orderCode: string[]): Promise> => {\r\n const response = await axios.post(`/api/emr-data/lab-corp-edifecs-standard-compendium`, orderCode);\r\n return response.data;\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n PaymentCard,\r\n PaymentCardListResult\r\n} from '../models/payment-card';\r\nimport { ServiceResult } from '../models/service-result';\r\n\r\nexport const getPublicKeyAsync = async (): Promise => {\r\n const response = await axios.get('/api/payment-gateway/public-key');\r\n return response.data;\r\n};\r\n\r\nexport const chargeAsync = async (\r\n amount: number,\r\n appointmentId?: number\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/payment-gateway/charge',\r\n {\r\n amount,\r\n appointmentId\r\n }\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const getPaymentCardsAsync = async (): Promise => {\r\n const response = await axios.get('/api/payment-gateway/payment-card');\r\n return response.data;\r\n};\r\n\r\nexport const saveCardAsync = async (\r\n token: string\r\n): Promise> => {\r\n const response = await axios.post(\r\n '/api/payment-gateway/save-card',\r\n { token }\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const updatePrimaryCardAsync = async (cardId: string): Promise => {\r\n const response = await axios.post(\r\n '/api/payment-gateway/update-primary-card',\r\n { cardId }\r\n );\r\n return response.data;\r\n};\r\n","export enum PHVType {\r\n Reaction = 6\r\n}\r\n\r\nexport interface PHV {\r\n listType: Undefinable;\r\n conceptCode: Undefinable;\r\n conceptName: Undefinable;\r\n}\r\n","import axios from 'axios';\r\nimport { Allergy, AllergyModel } from '../models/allergy';\r\n\r\nexport const getAllergiesAsync = async (): Promise => {\r\n const response = await axios.get('/api/allergy');\r\n return response.data;\r\n};\r\n\r\nexport const getLatestAllergies = async (): Promise> => {\r\n const response = await axios.get(`/api/allergy/latest`);\r\n return response.data;\r\n};\r\n\r\nexport const getAppointmentAllergies = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/allergy/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n","import { State } from '.';\r\n\r\nexport const selectors = {\r\n getAccountIdentity: (\r\n state: State\r\n ): string => state.identityName,\r\n getAccountLocked: (\r\n state: State\r\n ): boolean => state.locked,\r\n getAccountName: (\r\n state: State\r\n ): string => state.name,\r\n getCoordinates: (\r\n state: State\r\n ): Undefinable => state.coordinates,\r\n getPatientId: (\r\n state: State\r\n ): number => state.impsId,\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Allergy } from '../../models/allergy';\r\n\r\nconst getAppointmentAllergyIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId && appointmentId === byId[x]!.appointmentId)\r\n .map(x => +x)\r\n .sort((a, b) => a - b)\r\n )\r\n);\r\n\r\nconst getAllergyHashSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => Object\r\n .keys(byId)\r\n .reduce(\r\n (prevValue, x) => {\r\n prevValue[x] = {\r\n id: x,\r\n date: byId[x]!.onsetDate\r\n } as PatientPortalDataMerge;\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getAllergy: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getAllergyHash: (\r\n state: State\r\n ): Dictionary => getAllergyHashSelector(state),\r\n getAllergyIds: (\r\n state: State\r\n ): number[] => state.allIds,\r\n getAppointmentAllergyIds: (\r\n state: State,\r\n appointmentId: Undefinable\r\n ): number[] => getAppointmentAllergyIdsSelector(state)(appointmentId),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { State } from '.';\r\n\r\nexport const selectors = {\r\n getAppLockTimeout: (\r\n state: State\r\n ): number => (state.appConfig && state.appConfig.appLockTimeout) || 0,\r\n getMenuState: (\r\n state: State\r\n ): boolean => state.menuState,\r\n getSystemName: (\r\n state: State\r\n ): Undefinable => state.appConfig && state.appConfig.systemName\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n CheckOutQuestion,\r\n CheckOutQuestionKey\r\n} from '../../models/check-out-question';\r\n\r\nconst getCheckOutQuestionIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId === byId[x]!.appointmentId)\r\n .map(x => +x)\r\n )\r\n);\r\n\r\nconst getCurrentCheckOutQuestionKeySelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => {\r\n const checkOutQuestionId = Object\r\n .keys(byId)\r\n .filter(x => appointmentId === byId[x]!.appointmentId)\r\n .sort((a, b) => Number(a) - Number(b))\r\n .slice(-1)[0];\r\n return byId[checkOutQuestionId || ''] && byId[checkOutQuestionId || '']!.questionKey;\r\n })\r\n);\r\n\r\nexport const selectors = {\r\n getCheckOutQuestion: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getCheckOutQuestionIds: (\r\n state: State,\r\n appointmentId: Undefinable\r\n ): number[] => getCheckOutQuestionIdsSelector(state)(appointmentId),\r\n getCurrentCheckOutQuestionKey: (\r\n state: State,\r\n appointmentId: Undefinable\r\n ): Undefinable => getCurrentCheckOutQuestionKeySelector(state)(appointmentId),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { EncounterPatientEducation } from '../../models/encounter-patient-education';\r\n\r\nconst getEncounterPatientEducationIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId && byId[x]!.appointmentId === appointmentId)\r\n .map(x => +x)\r\n .sort((a, b) => a - b)\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getEncounterPatientEducation: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getEncounterPatientEducationIds: (\r\n state: State,\r\n id: Undefinable\r\n ): number[] => getEncounterPatientEducationIdsSelector(state)(id),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n EncounterRx,\r\n EncounterRxStatus\r\n} from '../../models/encounter-rx';\r\n\r\nconst checkAppointmentHasRxSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId && byId[x]!.appointmentId === appointmentId)\r\n .length > 0\r\n )\r\n);\r\n\r\nconst getEncounterRxIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => memoize((\r\n status: EncounterRxStatus\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId && byId[x]!.appointmentId === appointmentId && byId[x]!.status === status)\r\n .map(x => +x)\r\n .sort((a, b) => a - b)\r\n ))\r\n);\r\n\r\nexport const selectors = {\r\n checkAppointmentHasRx: (\r\n state: State,\r\n appointmentId: Undefinable\r\n ): boolean => checkAppointmentHasRxSelector(state)(appointmentId),\r\n getEncounterRx: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getEncounterRxIds: (\r\n state: State,\r\n appointmentId: Undefinable,\r\n status: EncounterRxStatus\r\n ): number[] => getEncounterRxIdsSelector(state)(appointmentId)(status),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { State } from '.';\r\nimport { EncounterRxReconcile } from '../../models/encounter-rx-reconcile';\r\n\r\nexport const selectors = {\r\n getEncounterRxReconcile: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getEncounterRxReconcileHash: (\r\n state: State\r\n ): Dictionary => state.byId,\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { State } from '.';\r\nimport { Insurance } from '../../models/insurance';\r\n\r\nexport const selectors = {\r\n getInsurance: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getInsuranceIds: (\r\n state: State\r\n ): number[] => state.allIds,\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n HistoryType,\r\n PatientHistory,\r\n} from '../../models/patient-history';\r\n\r\nconst getPatientHistoryHashSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n type: HistoryType\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => byId[x]!.historyType === type)\r\n .reduce(\r\n (prevValue, x) => {\r\n if (type === HistoryType.DrugHistory || type === HistoryType.FallHistory) {\r\n prevValue[byId[x]!.code] = {\r\n id: byId[x]!.code,\r\n date: byId[x]!.createdDate,\r\n refId: x\r\n } as PatientPortalDataMerge;\r\n } else {\r\n prevValue[x] = {\r\n id: x,\r\n date: byId[x]!.createdDate\r\n } as PatientPortalDataMerge;\r\n }\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n )\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getPatientHistory: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getPatientHistoryHash: (\r\n state: State,\r\n type: HistoryType\r\n ): Dictionary => getPatientHistoryHashSelector(state)(type),\r\n getPatientHistoryIds: (\r\n state: State,\r\n type: HistoryType\r\n ): Undefinable => state.byType[type]\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n PatientPortalData,\r\n PatientPortalDataAction,\r\n PatientPortalDataStatus,\r\n PatientPortalDataType\r\n} from '../../models/patient-portal-data';\r\nimport {\r\n PatientRx,\r\n RxStatus\r\n} from '../../models/patient-rx';\r\nimport { getUTCCurrentDateRange } from '../../utils/formatter';\r\n\r\nconst byPassSet = new Set([\r\n PatientPortalDataType.DrugAbuseHistory,\r\n PatientPortalDataType.FallHistory\r\n]);\r\n\r\nconst getPatientPortalDataHashSelector = createSelector(\r\n (state: State) => state.byCode,\r\n (byCode: Dictionary) => memoize((\r\n type: Undefinable\r\n ) => memoize((\r\n preHash: Undefinable>\r\n ) => {\r\n const keySet = new Set(Object.keys(preHash || {}));\r\n const [startDate, endDate] = getUTCCurrentDateRange('YYYY-MM-DDTHH:mm:ss');\r\n return Object\r\n .keys(byCode)\r\n .filter(x => type === byCode[x]!.type && PatientPortalDataStatus.Pending === byCode[x]!.status && (\r\n PatientPortalDataAction.Created === byCode[x]!.action ||\r\n PatientPortalDataAction.Deleted === byCode[x]!.action || (\r\n PatientPortalDataAction.Updated === byCode[x]!.action && (\r\n byCode[x]!.type !== PatientPortalDataType.Medication || (\r\n startDate <= byCode[x]!.createdDate &&\r\n endDate > byCode[x]!.createdDate\r\n )\r\n )\r\n )\r\n ))\r\n .reduce(\r\n (prevValue, x) => {\r\n const id = byCode[x]!.relatedId || '';\r\n // get created or matched with current entities\r\n if (\r\n byPassSet.has(byCode[x]!.type) ||\r\n !id ||\r\n byCode[x]!.action === PatientPortalDataAction.Created ||\r\n keySet.has(id)\r\n ) {\r\n let priority: Undefinable;\r\n let ref: Undefinable;\r\n let refId: Undefinable;\r\n if (type === PatientPortalDataType.Medication) {\r\n const model = byCode[x]!.dataModel as PatientRx;\r\n refId = model.medId;\r\n priority = model.status === RxStatus.NotTaking ? 1 : 0;\r\n ref = model.status === RxStatus.Taking || model.status === RxStatus.NotTaking;\r\n }\r\n prevValue[id] = {\r\n id: id,\r\n refId: refId,\r\n action: byCode[x]!.action,\r\n date: byCode[x]!.createdDate,\r\n priority: priority,\r\n ref: ref\r\n } as PatientPortalDataMerge;\r\n }\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n );\r\n }))\r\n);\r\n\r\nconst getPatientPortalDataNewsSelector = createSelector(\r\n (state: State) => state.byCode,\r\n (byCode: Dictionary) => memoize((\r\n type: Undefinable\r\n ) => Object\r\n .keys(byCode)\r\n .map(x => byCode[x]!)\r\n .filter(x =>\r\n x.type === type &&\r\n x.status === PatientPortalDataStatus.Pending &&\r\n x.action === PatientPortalDataAction.Created\r\n )\r\n .sort((a, b) => a.relatedCreatedDate > b.relatedCreatedDate ? 1 : -1)\r\n )\r\n);\r\n\r\nconst getPatientPortalDataNewCodesSelector = createSelector(\r\n (state: State) => state.byCode,\r\n (byCode: Dictionary) => memoize((\r\n type: Undefinable\r\n ) => Object\r\n .keys(byCode)\r\n .filter(x =>\r\n byCode[x]!.type === type &&\r\n byCode[x]!.status === PatientPortalDataStatus.Pending &&\r\n byCode[x]!.action === PatientPortalDataAction.Created\r\n )\r\n .sort((a, b) => byCode[a]!.relatedCreatedDate > byCode[b]!.relatedCreatedDate ? 1 : -1)\r\n )\r\n);\r\n\r\nconst isPendingExistedSelector = createSelector(\r\n (state: State) => state.byCode,\r\n (byCode: Dictionary) => memoize((\r\n type: Undefinable\r\n ) => Object\r\n .keys(byCode)\r\n .filter(x =>\r\n byCode[x]!.type === type &&\r\n byCode[x]!.status === PatientPortalDataStatus.Pending &&\r\n byCode[x]!.action !== PatientPortalDataAction.Deleted\r\n )\r\n .length > 0\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getPatientPortalData: (\r\n state: State,\r\n type: Undefinable,\r\n relatedId?: string | number,\r\n code?: Undefinable\r\n ): Undefinable => {\r\n const patientPortalData = state.byCode[code || `${type || ''}---${relatedId || ''}`];\r\n if (patientPortalData && patientPortalData.status === PatientPortalDataStatus.Pending) {\r\n if (PatientPortalDataType.Medication === patientPortalData.type) {\r\n const [startDate, endDate] = getUTCCurrentDateRange('YYYY-MM-DDTHH:mm:ss');\r\n if (PatientPortalDataAction.Created === patientPortalData.action || (\r\n PatientPortalDataAction.Updated === patientPortalData.action &&\r\n startDate <= patientPortalData.createdDate &&\r\n endDate > patientPortalData.createdDate\r\n )) {\r\n return patientPortalData;\r\n }\r\n } else {\r\n return patientPortalData;\r\n }\r\n }\r\n return undefined;\r\n },\r\n getPatientPortalDataHash: (\r\n state: State,\r\n type: Undefinable,\r\n preHash?: Dictionary\r\n ): Dictionary => getPatientPortalDataHashSelector(state)(type)(preHash),\r\n getPatientPortalDataNews: (\r\n state: State,\r\n type: Undefinable\r\n ): PatientPortalData[] => getPatientPortalDataNewsSelector(state)(type),\r\n getPatientPortalDataNewCodes: (\r\n state: State,\r\n type: Undefinable\r\n ): string[] => getPatientPortalDataNewCodesSelector(state)(type),\r\n isDeleted: (\r\n state: State,\r\n type: Undefinable,\r\n relatedId?: string\r\n ): boolean => {\r\n const patientPortalData = state.byCode[`${type || ''}---${relatedId || ''}`];\r\n return !!(patientPortalData && patientPortalData.action === PatientPortalDataAction.Deleted);\r\n },\r\n isPendingExisted: (\r\n state: State,\r\n type: Undefinable\r\n ): boolean => isPendingExistedSelector(state)(type)\r\n};\r\n","import { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n PatientRx,\r\n RxStatus\r\n} from '../../models/patient-rx';\r\n\r\nconst getPatientRxHashSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (byMedId: Dictionary) => Object\r\n .keys(byMedId)\r\n .reduce(\r\n (prevValue, x) => {\r\n prevValue[x] = {\r\n id: x,\r\n refId: byMedId[x]!.medId,\r\n action: '',\r\n date: byMedId[x]!.createdDate,\r\n priority: byMedId[x]!.status === RxStatus.NotTaking ? 1 : 0,\r\n ref: byMedId[x]!.status === RxStatus.Taking || byMedId[x]!.status === RxStatus.NotTaking\r\n } as PatientPortalDataMerge;\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getPatientRx: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getPatientRxByMed: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byMedId[id || ''],\r\n getPatientRxHash: (\r\n state: State\r\n ): Dictionary => getPatientRxHashSelector(state),\r\n getPatientRxIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { PatientVaccine } from '../../models/patient-vaccine';\r\n\r\nconst getPatientVaccineIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n appointmentId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => appointmentId && byId[x]!.appointmentId === appointmentId)\r\n .map(x => +x)\r\n .sort((a, b) => a - b)\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getPatientVaccine: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getPatientVaccineIds: (\r\n state: State,\r\n appointmentId: Undefinable\r\n ): number[] => getPatientVaccineIdsSelector(state)(appointmentId),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Schedule } from '../../models/schedule';\r\n\r\nconst getScheduleSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n specialtyId: Undefinable\r\n ) => memoize((\r\n date: Undefinable\r\n ) => memoize((\r\n time: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .map(x => byId[x]!)\r\n .find(x =>\r\n x.date === date &&\r\n x.time === time &&\r\n (!specialtyId || x.specialtyIds.includes(specialtyId))\r\n )\r\n )))\r\n);\r\n\r\nconst getTimesSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n providerId: Undefinable\r\n ) => memoize((\r\n date: string\r\n ) => memoize((\r\n facilityId: Undefinable\r\n ) => memoize((\r\n specialtyId: Undefinable\r\n ) => memoize((\r\n appointmentDate: Undefinable\r\n ) => memoize((\r\n appointmentTime: Undefinable\r\n ) => Array.from(new Set(Object\r\n .keys(byId)\r\n .filter(x =>\r\n (!providerId || byId[x]!.providerId === providerId) &&\r\n byId[x]!.date === date &&\r\n (!facilityId || byId[x]!.facilityId === facilityId) &&\r\n (!specialtyId || byId[x]!.specialtyIds.includes(specialtyId)) &&\r\n (!appointmentDate || byId[x]!.date === appointmentDate) &&\r\n (!appointmentTime || byId[x]!.time === appointmentTime) &&\r\n !byId[x]!.limited\r\n )\r\n .map(x => byId[x]!.time)\r\n .sort((a, b) => a > b ? 1 : -1)\r\n ))))))))\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n payload: {\r\n providerId?: number,\r\n date: Undefinable\r\n }\r\n ): boolean => state.loading[[payload.providerId || '', payload.date || ''].join('-')] || false,\r\n getSchedule: (\r\n state: State,\r\n payload: {\r\n providerId?: number,\r\n specialtyId?: number,\r\n date: Undefinable,\r\n time: Undefinable\r\n }\r\n ): Undefinable => payload.providerId ?\r\n state.byId[[payload.providerId, payload.date || '', payload.time || ''].join('---')] :\r\n getScheduleSelector(state)(payload.specialtyId)(payload.date)(payload.time),\r\n getScheduleHash: (\r\n state: State\r\n ): Dictionary => state.byId,\r\n getTimes: (\r\n state: State,\r\n payload: {\r\n providerId?: number,\r\n date: string,\r\n facilityId?: number,\r\n specialtyId?: number,\r\n appointmentDate?: string,\r\n appointmentTime?: string\r\n }\r\n ): string[] => getTimesSelector(state)(payload.providerId)(payload.date)(payload.facilityId)(payload.specialtyId)(payload.appointmentDate)(payload.appointmentTime),\r\n};\r\n","import { RootState } from '../store';\r\nimport {\r\n allergySelectors,\r\n patientHistorySelectors,\r\n patientPortalDataSelectors,\r\n patientRxSelectors\r\n} from './selector';\r\nimport {\r\n PatientPortalDataAction,\r\n PatientPortalDataType\r\n} from '../models/patient-portal-data';\r\n\r\nconst patientHistorySet = new Set([\r\n PatientPortalDataType.DrinkingHistory,\r\n PatientPortalDataType.FamilyHistory,\r\n PatientPortalDataType.PastMedicalHistory,\r\n PatientPortalDataType.SocialHistory,\r\n PatientPortalDataType.SmokingHistory\r\n]);\r\n\r\nconst specialTypeSet = new Set([\r\n PatientPortalDataType.DrugAbuseHistory,\r\n PatientPortalDataType.FallHistory\r\n]);\r\n\r\ninterface MergeDetail {\r\n action: PatientPortalDataAction;\r\n model?: Undefinable;\r\n}\r\n\r\nconst getMergeDetail = (\r\n state: RootState,\r\n type: Undefinable,\r\n id: Undefinable\r\n): Undefinable> => {\r\n const patientPortalData = patientPortalDataSelectors.getPatientPortalData(state.patientPortalDatas, type, id);\r\n if (patientPortalData) {\r\n return {\r\n action: patientPortalData.action,\r\n ...patientPortalData.action !== PatientPortalDataAction.Deleted && { model: patientPortalData.dataModel as T }\r\n };\r\n } else {\r\n const action = id ? PatientPortalDataAction.Updated : PatientPortalDataAction.Created;\r\n if (type === PatientPortalDataType.Allergy) {\r\n return {\r\n action: action,\r\n model: allergySelectors.getAllergy(state.allergies, id) as Undefinable\r\n };\r\n } else if (type === PatientPortalDataType.Medication) {\r\n return {\r\n action: action,\r\n model: patientRxSelectors.getPatientRxByMed(state.patientRxes, id) as Undefinable\r\n };\r\n } else if (type && patientHistorySet.has(type)) {\r\n return {\r\n action: action,\r\n model: patientHistorySelectors.getPatientHistory(state.patientHistories, id) as Undefinable\r\n };\r\n } else if (type && specialTypeSet.has(type)) {\r\n return {\r\n action: action,\r\n model: patientHistorySelectors.getPatientHistory(state.patientHistories, String(id || '').split('---')[1]) as Undefinable\r\n };\r\n }\r\n }\r\n};\r\n\r\nconst getMergeModel = (\r\n state: RootState,\r\n type: Undefinable,\r\n id: Undefinable\r\n): Undefinable => {\r\n const detail = getMergeDetail(state, type, id);\r\n return detail && detail.model;\r\n};\r\n\r\nconst getMergeField = (\r\n state: RootState,\r\n type: Undefinable,\r\n id: Undefinable,\r\n field: keyof T\r\n): Undefinable => {\r\n const model = getMergeModel(state, type, id);\r\n return model && model[String(field)];\r\n};\r\n\r\nexport const selectors = {\r\n getMergeDetail: getMergeDetail,\r\n getMergeField: getMergeField,\r\n getMergeModel: getMergeModel\r\n};\r\n","import { State } from '.';\r\nimport { Statement } from '../../models/statement';\r\n\r\nexport const selectors = {\r\n getCurrentStatementId: (state: State) => {\r\n const {\r\n allIds,\r\n byId\r\n } = state;\r\n const statement = byId[allIds[allIds.length - 1] || ''];\r\n if (statement && !statement.held && !statement.paidDone) {\r\n return statement.id;\r\n } else {\r\n return undefined;\r\n }\r\n },\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getStatement: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getStatementIds: (\r\n state: State\r\n ): string[] => state.allIds\r\n};\r\n","export { selectors as accountSelectors } from './account/selector';\r\nexport { selectors as allergySelectors } from './allergy/selector';\r\nexport { selectors as appStateSelectors } from './app-state/selector';\r\nexport { selectors as cdcCVXSelectors } from './cdc-cvx/selector';\r\nexport { selectors as checkInQuestionSelectors } from './check-in-question/selector';\r\nexport { selectors as checkOutQuestionSelectors } from './check-out-question/selector';\r\nexport { selectors as compositeAllergySelectors } from './composite-allergy/selector';\r\nexport { selectors as compositeDrugSelectors } from './composite-drug/selector';\r\nexport { selectors as counselingTypeSelectors } from './counseling-type/selector';\r\nexport { selectors as dosageFormTypeSelectors } from './dosage-form-type/selector';\r\nexport { selectors as encounterPatientEducationSelectors } from './encounter-patient-education/selector';\r\nexport { selectors as encounterRxSelectors } from './encounter-rx/selector';\r\nexport { selectors as encounterRxReconcileSelectors } from './encounter-rx-reconcile/selector';\r\nexport { selectors as facilitySelectors } from './facility/selector';\r\nexport { selectors as icd10Selectors } from './icd10/selector';\r\nexport { selectors as imagingFacilitySelectors } from './imaging-facility/selector';\r\nexport { selectors as insuranceSelectors } from './insurance/selector';\r\nexport { selectors as itemSelectors } from './item/selector';\r\nexport { selectors as labSelectors } from './lab/selector';\r\nexport { selectors as labCorpEdifecsStandardCompendiumSelectors } from './lab-corp-edifecs-standard-compendium/selector';\r\nexport { selectors as labTestCodeSelectors } from './lab-test-code/selector';\r\nexport { selectors as messageSelectors } from './message/selector';\r\nexport { selectors as nlmPatientEducationDefinitionSelectors } from './nlm-patient-education-definition/selector';\r\nexport { selectors as patientHistorySelectors } from './patient-history/selector';\r\nexport { selectors as patientPortalDataSelectors } from './patient-portal-data/selector';\r\nexport { selectors as patientRxSelectors } from './patient-rx/selector';\r\nexport { selectors as patientVaccineSelectors } from './patient-vaccine/selector';\r\nexport { selectors as payerSelectors } from './payer/selector';\r\nexport { selectors as paymentCardSelectors } from './payment-card/selector';\r\nexport { selectors as pharmacySelectors } from './pharmacy/selector';\r\nexport { selectors as procedureTypeSelectors } from './procedure-type/selector';\r\nexport { selectors as providerSelectors } from './provider/selector';\r\nexport { selectors as questOrderCodeSelectors } from './quest-order-code/selector';\r\nexport { selectors as scheduleSelectors } from './schedule/selector';\r\nexport { selectors as sharedSelectors } from './shared-selector';\r\nexport { selectors as snomedSelectors } from './snomed/selector';\r\nexport { selectors as snomedCategorySelectors } from './snomed-category/selector';\r\nexport { selectors as specialtySelectors } from './specialty/selector';\r\nexport { selectors as statementSelectors } from './statement/selector';\r\nexport { selectors as userSelectors } from './user/selector';\r\n","import BaseModel from './base-model';\r\nimport { ServiceResult } from './service-result';\r\nimport { formatDate } from '../utils/formatter';\r\n\r\nexport enum CheckInQuestionKey {\r\n None = '',\r\n Allergy = 'allergy',\r\n Demographic = 'demographic',\r\n EmergencyContact = 'emergency-contact',\r\n FamilyHistory = 'family-history',\r\n Insurance = 'insurance',\r\n Medication = 'medication',\r\n PastMedicalHistory = 'past-medical-history',\r\n Pharmacy = 'pharmacy',\r\n SocialHistory = 'social-history',\r\n TelehealthVisit = 'telehealth-visit',\r\n Thanks = 'thanks',\r\n VisitReason = 'visit-reason',\r\n VitalSign = 'vital-sign'\r\n}\r\n\r\nexport class CheckInQuestion extends BaseModel {\r\n appointmentId: number;\r\n\r\n questionKey: CheckInQuestionKey = CheckInQuestionKey.None;\r\n questionDetail: string = '';\r\n questionDate: string = '';\r\n\r\n answerKey: string = '';\r\n answerDetail: Undefinable;\r\n answerDate: string = '';\r\n answerDetailDate: Undefinable;\r\n\r\n constructor(\r\n appointmentId: number,\r\n questionKey: CheckInQuestionKey\r\n ) {\r\n super();\r\n this.appointmentId = appointmentId;\r\n this.questionKey = questionKey;\r\n this.questionDate = formatDate({\r\n destFormat: 'YYYY-MM-DDTHH:mm:ss',\r\n current: true\r\n });\r\n }\r\n}\r\n\r\nexport type CheckInQuestionResult = ServiceResult;\r\n","import IMPSBaseModel from './imps-base-model';\r\nimport { ServiceResult } from './service-result';\r\nimport { formatDate } from '../utils/formatter';\r\n\r\nexport enum CheckOutQuestionKey {\r\n None = '',\r\n Followup = 'followup',\r\n Payment = 'payment',\r\n PaymentSucceeded = 'payment-succeeded',\r\n Completed = 'completed',\r\n Finished = 'finished'\r\n}\r\n\r\nexport class CheckOutQuestion extends IMPSBaseModel {\r\n appointmentId: number;\r\n\r\n questionKey: CheckOutQuestionKey = CheckOutQuestionKey.None;\r\n questionDetail: string = '';\r\n questionDate: string = '';\r\n\r\n answerKey: string = '';\r\n answerDetail: Undefinable;\r\n answerDate: string = '';\r\n answerDetailDate: Undefinable;\r\n\r\n constructor(\r\n appointmentId: number,\r\n questionKey: CheckOutQuestionKey\r\n ) {\r\n super();\r\n this.appointmentId = appointmentId;\r\n this.questionKey = questionKey;\r\n this.questionDate = formatDate({\r\n destFormat: 'YYYY-MM-DDTHH:mm:ss',\r\n current: true\r\n });\r\n }\r\n}\r\n\r\nexport type CheckOutQuestionResult = ServiceResult;\r\n","export enum SnomedCategoryType {\r\n DrugAbuseHistory = 1,\r\n FallHistory = 2\r\n}\r\n\r\nexport interface SnomedCategory {\r\n code: number;\r\n categoryTypeId: SnomedCategoryType;\r\n recommendedAssessmentText: Undefinable;\r\n}\r\n","import { CheckInQuestionKey } from '../models/check-in-question';\r\nimport { CheckOutQuestionKey } from '../models/check-out-question';\r\nimport { HistoryType } from '../models/patient-history';\r\nimport { PatientPortalDataType } from '../models/patient-portal-data';\r\nimport { SnomedCategoryType } from '../models/snomed-category';\r\n\r\nexport enum AuthenticateStatus {\r\n LOCKED = 'Locked',\r\n INVALID = 'Invalid',\r\n VALID = 'Valid',\r\n ONE_PATIENT = 'One_Patient',\r\n VERIFY_EMAIL = 'Verify_Email',\r\n VERIFY_PHONE = 'Verify_Phone',\r\n PASSWORD_EXPIRED = 'Password_Expired',\r\n}\r\n\r\nexport enum ResetPasswordStatus {\r\n CREATE_PASSWORD = 'Create_Password',\r\n EXPIRED = 'Expired',\r\n RESET_PASSWORD = 'Reset_Password',\r\n NONE = 'None'\r\n}\r\n\r\nexport const checkInQuestionKeys: CheckInQuestionKey[] = [\r\n CheckInQuestionKey.Demographic,\r\n CheckInQuestionKey.EmergencyContact,\r\n CheckInQuestionKey.Pharmacy,\r\n CheckInQuestionKey.Insurance,\r\n CheckInQuestionKey.TelehealthVisit,\r\n CheckInQuestionKey.VisitReason,\r\n CheckInQuestionKey.VitalSign,\r\n CheckInQuestionKey.PastMedicalHistory,\r\n CheckInQuestionKey.Allergy,\r\n CheckInQuestionKey.Medication,\r\n CheckInQuestionKey.FamilyHistory,\r\n CheckInQuestionKey.SocialHistory,\r\n CheckInQuestionKey.Thanks\r\n];\r\n\r\nexport const checkOutQuestionKeys: CheckOutQuestionKey[] = [\r\n CheckOutQuestionKey.Payment,\r\n CheckOutQuestionKey.PaymentSucceeded,\r\n CheckOutQuestionKey.Followup,\r\n CheckOutQuestionKey.Completed,\r\n CheckOutQuestionKey.Finished,\r\n CheckOutQuestionKey.Completed\r\n];\r\n\r\nexport enum KeyCode {\r\n TAB = 9,\r\n UP_ARROW = 38,\r\n DOWN_ARROW = 40,\r\n ENTER = 13,\r\n BACKSPACE = 8,\r\n DELETE = 46\r\n}\r\n\r\nexport const historyTypeToPatientPortalDataType = {\r\n [HistoryType.PastMedicalHistory]: PatientPortalDataType.PastMedicalHistory,\r\n [HistoryType.FamilyHistory]: PatientPortalDataType.FamilyHistory,\r\n [HistoryType.SocialHistory]: PatientPortalDataType.SocialHistory,\r\n [HistoryType.SmokingHistory]: PatientPortalDataType.SmokingHistory,\r\n [HistoryType.DrinkingHistory]: PatientPortalDataType.DrinkingHistory,\r\n [HistoryType.DrugHistory]: PatientPortalDataType.DrugAbuseHistory,\r\n [HistoryType.FallHistory]: PatientPortalDataType.FallHistory\r\n} as Dictionary;\r\n\r\nexport const historyTypeToSnomedCategoryType = {\r\n [HistoryType.DrugHistory]: SnomedCategoryType.DrugAbuseHistory,\r\n [HistoryType.FallHistory]: SnomedCategoryType.FallHistory\r\n};\r\n\r\nexport enum TimeFrameUnitType {\r\n Scheduled = 0,\r\n Now = 10,\r\n Day = 20,\r\n Week = 30,\r\n Month = 40,\r\n Year = 55\r\n}\r\n\r\nexport const TimeFrameUnitTypeName = {\r\n 0: 'scheduled',\r\n 10: 'now',\r\n 20: 'day',\r\n 30: 'week',\r\n 40: 'month',\r\n 55: 'year'\r\n};\r\n\r\nexport const emptyFunction = () => ({});\r\n","import React from 'react';\r\n\r\nconst Loading: React.FC = React.memo(() => (\r\n \r\n \r\n \r\n));\r\n\r\nexport default Loading;\r\n","export { default } from './Loading';\r\n","export const setScroll = (\r\n list: React.RefObject,\r\n currentPosition: number,\r\n direction: 'up' | 'down' | ''\r\n) => {\r\n if (list.current) {\r\n const liElements = list.current.children.item(0)!.children;\r\n const viewHeight = list.current.clientHeight;\r\n const offsetHeight = list.current.scrollTop;\r\n\r\n if (direction === 'down') {\r\n const currentElement = liElements.item(currentPosition) as ScrollElement;\r\n if (currentElement.offsetTop + currentElement.clientHeight > offsetHeight + viewHeight) {\r\n list.current.scrollTop = currentElement.offsetTop + currentElement.clientHeight - viewHeight;\r\n } else if (currentElement.offsetTop + currentElement.clientHeight <= offsetHeight) {\r\n list.current.scrollTop = currentElement.offsetTop;\r\n }\r\n } else if (direction === 'up') {\r\n const currentElement = liElements.item(currentPosition) as ScrollElement;\r\n if (currentElement.offsetTop + currentElement.clientHeight <= offsetHeight) {\r\n list.current.scrollTop = currentElement.offsetTop;\r\n } else if (currentElement.offsetTop + currentElement.clientHeight > offsetHeight + viewHeight) {\r\n list.current.scrollTop = currentElement.offsetTop + currentElement.clientHeight - viewHeight;\r\n }\r\n }\r\n }\r\n};\r\n","import lodash from 'lodash';\r\n\r\nexport const numberView = (\r\n value: Undefinable,\r\n precision: number = 2\r\n) => round(value, precision).toFixed(precision);\r\n\r\nexport const round = (\r\n value: Undefinable,\r\n precision: number = 2\r\n) => lodash.round(Number(value || ''), precision);\r\n\r\nexport const sum = (arr: Undefinable[]): number => {\r\n return lodash.sum(arr);\r\n};\r\n\r\nexport const sumBy = (\r\n arr: Undefinable[],\r\n indentity: string\r\n): number => lodash.sumBy(arr, indentity);\r\n\r\nexport const substract = (\r\n minuend: Undefinable,\r\n subtrahend: Undefinable\r\n): number => lodash.subtract(Number(minuend || ''), Number(subtrahend || ''));\r\n","import * as yup from 'yup';\r\nimport { phoneRegExp } from './regex';\r\n\r\nexport const loginValidationSchema = yup.object().shape({\r\n accountName: yup.string()\r\n .required('Phone number is required.')\r\n .matches(phoneRegExp, 'Must be phone number format.'),\r\n password: yup.string()\r\n .required('Password is required.')\r\n .min(6, 'Please enter at least 6 characters.')\r\n});\r\n\r\nexport const verifyValidationSchema = yup.object().shape({\r\n verificationCode: yup.string()\r\n .length(6, 'Please enter 6 digits.')\r\n});\r\n","export const mapInsuranceType = (type: Undefinable) => {\r\n const insuranceTypeHash = {\r\n P: 'Primary',\r\n S: 'Secondary',\r\n T: 'Tertiary'\r\n };\r\n return insuranceTypeHash[type || ''] || '';\r\n};\r\n","export const implementBuildReport = () => {\r\n let pageHeader: JQuery;\r\n // let pageFooter: JQuery;\r\n\r\n const getPageHeaderFooter = (element: JQuery) => {\r\n let header = element.find('.header');\r\n pageHeader = header.clone();\r\n header.remove();\r\n let footer = element.find('.print-footer');\r\n // pageFooter = footer.clone();\r\n footer.remove();\r\n };\r\n\r\n const splitElement = (\r\n baseElement: JQuery,\r\n element: JQuery,\r\n redundantHeight: number\r\n ): {\r\n reverseHeight: number,\r\n newChild: HTMLElement[]\r\n } => {\r\n let maxHeight = Math.floor(baseElement[0].clientHeight);\r\n let newChild = [] as HTMLElement[];\r\n let reverseHeight = redundantHeight;\r\n let elements = element.children().toArray();\r\n while (reverseHeight > 0 && elements.length > 0) {\r\n let childElement = elements.pop()!;\r\n let childHeight = childElement.scrollHeight;\r\n if (\r\n reverseHeight < childHeight &&\r\n childElement.children.length > 0 &&\r\n childElement.tagName !== 'TR' &&\r\n !childElement.classList.contains('nosplit')\r\n ) {\r\n let cloneChild = $(childElement).clone().empty();\r\n let result = splitElement(baseElement, $(childElement), reverseHeight);\r\n cloneChild.append(result.newChild);\r\n reverseHeight = result.reverseHeight;\r\n newChild.unshift(cloneChild[0]);\r\n if (!childElement.innerText) {\r\n childElement.remove();\r\n }\r\n } else {\r\n childElement.remove();\r\n reverseHeight = baseElement[0].scrollHeight - maxHeight;\r\n newChild.unshift(childElement);\r\n }\r\n if (!childElement.innerText && elements.length === 1 && elements[0].classList.contains('field-header')) {\r\n let headerElement = elements.pop()!;\r\n headerElement.remove();\r\n newChild.unshift(headerElement);\r\n }\r\n }\r\n return { reverseHeight, newChild };\r\n };\r\n\r\n const splitPage = (baseElement: JQuery) => {\r\n const newBaseElement = $(baseElement[0].children[0]) as JQuery;\r\n let redundantHeight = newBaseElement[0].scrollHeight - Math.floor(newBaseElement[0].clientHeight);\r\n let result = splitElement(newBaseElement, newBaseElement, redundantHeight);\r\n if (result.newChild.length > 0) {\r\n const letter = $('
');\r\n const letterContent = $('
');\r\n letterContent.append(result.newChild);\r\n letter.append(letterContent);\r\n baseElement.after(letter);\r\n splitPage(letter);\r\n }\r\n };\r\n\r\n const removeEmptyPage = (element: JQuery) => {\r\n for (let i = element.length - 1; i >= 0; i--) {\r\n if (!element[i].innerText) {\r\n element[i].remove();\r\n }\r\n }\r\n };\r\n\r\n const addPageHeaderFooter = (element: JQuery) => {\r\n for (let i = 0; i < element.length; i++) {\r\n if (element[i].children.item(0)) {\r\n $(element[i].children.item(0)!).prepend(pageHeader.clone());\r\n }\r\n $(element[i]).append('
Page ' + (i + 1) + ' of ' + element.length + '
');\r\n }\r\n };\r\n\r\n return () => {\r\n getPageHeaderFooter($('.letter'));\r\n splitPage($('.letter'));\r\n removeEmptyPage($('.letter'));\r\n addPageHeaderFooter($('.letter'));\r\n };\r\n};\r\n\r\nexport const printHTML = (payload: {\r\n titleId?: string,\r\n contentId: string\r\n}) => {\r\n const mywindow = window.open('', 'PRINT', 'height=800,width=1200');\r\n if (mywindow) {\r\n const titleElement = payload.titleId && document.getElementById(payload.titleId);\r\n const contentElement = document.getElementById(payload.contentId);\r\n mywindow.document.write(\r\n `${document.head.innerHTML}`,\r\n `\r\n \r\n ${titleElement ? `

${titleElement.innerHTML}

` : ''}\r\n ${contentElement ? contentElement.innerHTML : ''}\r\n \r\n `\r\n );\r\n\r\n // wait document loaded\r\n const intervalId = mywindow.setInterval(\r\n () => {\r\n const html = mywindow.document.children.item(0);\r\n if (html && html.children.length === 2) {\r\n window.clearInterval(intervalId);\r\n mywindow.print();\r\n mywindow.close();\r\n }\r\n },\r\n 200\r\n );\r\n }\r\n};\r\n\r\nexport const printHTMLPages = (\r\n contentIds: string[]\r\n) => {\r\n const mywindow = window.open('', 'PRINT', `height=600,width=1200`);\r\n if (mywindow) {\r\n let contentHTML = '';\r\n for (let contentId of contentIds) {\r\n const contentElement = document.getElementById(contentId);\r\n if (contentElement) {\r\n contentHTML +=\r\n `\r\n
\r\n ${contentElement.innerHTML}\r\n
\r\n `;\r\n }\r\n }\r\n\r\n mywindow.document.write(\r\n `${document.head.innerHTML}`,\r\n `${contentHTML}`\r\n );\r\n\r\n // wait document loaded\r\n const intervalId = mywindow.setInterval(\r\n () => {\r\n const html = mywindow.document.children.item(0);\r\n if (html && html.children.length === 2) {\r\n window.clearInterval(intervalId);\r\n mywindow.print();\r\n mywindow.close();\r\n }\r\n },\r\n 1000\r\n );\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport { Insurance } from '../models';\r\n\r\nexport const getInsurancesAsync = async (): Promise => {\r\n const response = await axios.get(`/api/patient-insurance`);\r\n return response.data;\r\n};\r\n\r\nexport const getInsuranceCopay = async (): Promise> => {\r\n const response = await axios.get(`/api/patient-insurance/copay`);\r\n return response.data;\r\n};\r\n","import axios from 'axios';\r\nimport { PatientRx, PatientRxModel } from '../models/patient-rx';\r\n\r\nexport const getPatientRxes = async (): Promise> => {\r\n const response = await axios.get(`/api/patient-rx`);\r\n return response.data;\r\n};\r\n\r\nexport const getPatientRxesAsync = async (): Promise => {\r\n const response = await axios.get('/api/patient-rx');\r\n return response.data;\r\n};\r\n","import * as yup from 'yup';\r\nimport { PatientPortalDataAction } from './patient-portal-data';\r\nimport { isDayNotGreaterThan } from '../utils/formatter';\r\n\r\nexport enum HistoryType {\r\n PastMedicalHistory = 0,\r\n SocialHistory = 2,\r\n FamilyHistory = 3,\r\n SmokingHistory = 4,\r\n DrugHistory = 5,\r\n FallHistory = 6,\r\n DrinkingHistory = 7\r\n}\r\n\r\nexport enum PatientHistoryType {\r\n PastMedicalHistory = 0,\r\n SocialHistory = 2,\r\n FamilyHistory = 3,\r\n SmokingHistory = 4,\r\n DrugHistory = 5,\r\n FallHistory = 6,\r\n DrinkingHistory = 7\r\n}\r\n\r\nexport class PatientHistoryModel {\r\n id: number = 0;\r\n\r\n historyType: PatientHistoryType = PatientHistoryType.PastMedicalHistory;\r\n\r\n description?: string;\r\n code: number = 0;\r\n icd10Code?: string;\r\n historyDateFrom?: string;\r\n historyDateTo?: string;\r\n yearFrom?: number;\r\n yearTo?: number;\r\n\r\n // for family history\r\n familyHistoryRelationship?: number;\r\n familyHistoryAgeOnset?: number;\r\n familyHistoryIsDeceased?: boolean;\r\n familyHistoryCauseOfDeath?: boolean;\r\n\r\n createdDate: string = '';\r\n\r\n constructor(\r\n type: PatientHistoryType,\r\n code?: number\r\n ) {\r\n this.historyType = type;\r\n\r\n if (code) {\r\n this.code = code;\r\n }\r\n }\r\n}\r\n\r\nexport class PatientHistory {\r\n id: number = 0;\r\n impsId: number = 0;\r\n\r\n historyType: HistoryType = HistoryType.PastMedicalHistory;\r\n\r\n description: Undefinable;\r\n code: number = 0;\r\n icd10Code: Undefinable;\r\n historyDateFrom: Undefinable;\r\n historyDateTo: Undefinable;\r\n yearFrom: Undefinable;\r\n yearTo: Undefinable;\r\n\r\n // for family history\r\n familyHistoryRelationship: Undefinable;\r\n familyHistoryAgeOnset: Undefinable;\r\n familyHistoryIsDeceased: Undefinable;\r\n familyHistoryCauseOfDeath: Undefinable;\r\n\r\n createdDate: string = '';\r\n\r\n constructor(type: HistoryType, code?: number) {\r\n this.historyType = type;\r\n\r\n if (code) {\r\n this.code = code;\r\n }\r\n }\r\n}\r\n\r\nexport interface PatientHistoryExtend extends PatientHistory {\r\n relatedId: Undefinable;\r\n action: Undefinable;\r\n}\r\n\r\nexport const fullDateSet = new Set([HistoryType.PastMedicalHistory, HistoryType.SocialHistory]);\r\nexport const yearDateSet = new Set([\r\n HistoryType.SmokingHistory,\r\n HistoryType.DrugHistory,\r\n HistoryType.FallHistory,\r\n HistoryType.DrinkingHistory\r\n]);\r\n\r\nexport const patientHistoryValidationSchema = yup.object().shape(\r\n {\r\n code: yup\r\n .number()\r\n .when(\r\n 'historyType',\r\n {\r\n is: (value: HistoryType) =>\r\n value !== HistoryType.SmokingHistory &&\r\n value !== HistoryType.DrinkingHistory &&\r\n value !== HistoryType.PastMedicalHistory &&\r\n value !== HistoryType.FamilyHistory\r\n ,\r\n then: yup\r\n .number()\r\n .moreThan(0, 'History name is required.')\r\n .required('History name is required.')\r\n }\r\n ),\r\n icd10Code: yup\r\n .string()\r\n .nullable()\r\n .when(\r\n 'historyType',\r\n {\r\n is: (value: HistoryType) => value === HistoryType.PastMedicalHistory || value === HistoryType.FamilyHistory,\r\n then: yup\r\n .string()\r\n .required('History name is required.')\r\n }\r\n ),\r\n historyDateFrom: yup\r\n .string()\r\n .nullable()\r\n .when(\r\n ['historyType', 'historyDateTo'],\r\n (\r\n historyType: HistoryType,\r\n historyDateTo: Undefinable,\r\n schema: yup.Schema\r\n ) => {\r\n if (fullDateSet.has(historyType)) {\r\n return schema.test(\r\n 'history_date_from',\r\n 'From date must be equal or less than To date',\r\n (historyDateFrom: Undefinable) => {\r\n return isDayNotGreaterThan(historyDateFrom, historyDateTo, 'MM/DD/YYYY');\r\n }\r\n );\r\n }\r\n }\r\n ),\r\n historyDateTo: yup\r\n .string()\r\n .nullable()\r\n .when(\r\n ['historyType', 'historyDateFrom'],\r\n (\r\n historyType: HistoryType,\r\n historyDateFrom: Undefinable,\r\n schema: yup.Schema\r\n ) => {\r\n if (fullDateSet.has(historyType)) {\r\n return schema.test(\r\n 'history_date_to',\r\n 'To date must be equal or greater than From date',\r\n (historyDateTo: Undefinable) => {\r\n return isDayNotGreaterThan(historyDateFrom, historyDateTo, 'MM/DD/YYYY');\r\n }\r\n );\r\n }\r\n }\r\n ),\r\n yearFrom: yup\r\n .number()\r\n .nullable()\r\n .when(\r\n ['historyType', 'yearTo'],\r\n (\r\n historyType: HistoryType,\r\n yearTo: Undefinable,\r\n schema: yup.Schema\r\n ) => {\r\n if (yearDateSet.has(historyType)) {\r\n return schema.test(\r\n 'year_from',\r\n 'From date must be equal or less than To date',\r\n (yearFrom: Undefinable) => {\r\n return isDayNotGreaterThan((yearFrom || '').toString(), (yearTo || '').toString());\r\n }\r\n );\r\n }\r\n }\r\n ),\r\n yearTo: yup\r\n .number()\r\n .nullable()\r\n .when(\r\n ['historyType', 'yearFrom'],\r\n (\r\n historyType: HistoryType,\r\n yearFrom: Undefinable,\r\n schema: yup.Schema\r\n ) => {\r\n if (yearDateSet.has(historyType)) {\r\n return schema.test(\r\n 'year_to',\r\n 'From date must be equal or less than To date',\r\n (yearTo: Undefinable) => {\r\n return isDayNotGreaterThan((yearFrom || '').toString(), (yearTo || '').toString());\r\n }\r\n );\r\n }\r\n }\r\n ),\r\n familyHistoryRelationship: yup\r\n .number()\r\n .nullable()\r\n .when(\r\n 'historyType',\r\n {\r\n is: (value: HistoryType) => value === HistoryType.FamilyHistory,\r\n then: yup.number()\r\n .moreThan(0, 'Family member is required.')\r\n .required('Family member is required.'),\r\n }\r\n )\r\n },\r\n [['historyDateFrom', 'historyDateTo'], ['yearFrom', 'yearTo']]\r\n);\r\n","import moment, { DurationInputArg2 } from 'moment';\r\n\r\nexport const isSameDate = (metadata: {\r\n date: Undefinable,\r\n unit: DurationInputArg2,\r\n toLocal?: boolean;\r\n}): boolean => {\r\n if (metadata.toLocal) {\r\n return moment().isSame(moment.utc(metadata.date).local(), metadata.unit);\r\n } else {\r\n return moment().isSame(moment(metadata.date), metadata.unit);\r\n }\r\n};\r\n\r\nexport const getCurrentDate = (destFormat?: Undefinable): string => {\r\n return moment().format(destFormat || 'YYYY-MM-DDTHH:mm:ss');\r\n};\r\n\r\nexport const getUTCCurrentDate = (metadata: {\r\n destFormat?: Undefinable,\r\n delta?: {\r\n number: number;\r\n unit: DurationInputArg2;\r\n };\r\n}): string => {\r\n const utcDate = moment().utc();\r\n if (metadata.delta) {\r\n utcDate.add(metadata.delta.number, metadata.delta.unit);\r\n }\r\n return utcDate.format(metadata.destFormat || 'YYYY-MM-DDTHH:mm:ss');\r\n};\r\n\r\nexport const getUTCCurrentDateRange = (destFormat: string): string[] => {\r\n const startDate = moment().startOf('day');\r\n const endDate = moment(startDate).add(1, 'day');\r\n const utcStartDate = moment(startDate).utc().format(destFormat);\r\n const utcEndDate = moment(endDate).utc().format(destFormat);\r\n return [utcStartDate, utcEndDate];\r\n};\r\n\r\nexport const formatDate = (metadata: {\r\n date?: Undefinable | Date | null;\r\n destFormat?: string;\r\n srcFormat?: string;\r\n delta?: {\r\n number: number;\r\n unit: moment.DurationInputArg2;\r\n };\r\n current?: boolean;\r\n toLocal?: boolean;\r\n}) => {\r\n let destFormat = metadata.destFormat || 'YYYY-MM-DDTHH:mm:ss';\r\n let momentDate: Undefinable;\r\n if (metadata.date) {\r\n momentDate = metadata.srcFormat ?\r\n moment(\r\n metadata.date,\r\n metadata.srcFormat\r\n ) :\r\n moment(metadata.date);\r\n if (metadata.delta) {\r\n momentDate = momentDate.add(\r\n metadata.delta.number,\r\n metadata.delta.unit\r\n );\r\n }\r\n } else if (\r\n metadata &&\r\n metadata.current\r\n ) {\r\n momentDate = moment();\r\n if (metadata.delta) {\r\n momentDate = momentDate.add(\r\n metadata.delta.number,\r\n metadata.delta.unit\r\n );\r\n }\r\n }\r\n\r\n if (momentDate) {\r\n if (metadata.toLocal) {\r\n return moment\r\n .utc(momentDate.format('YYYY-MM-DDTHH:mm:ss'))\r\n .local()\r\n .format(destFormat);\r\n } else {\r\n return momentDate.format(destFormat);\r\n }\r\n } else {\r\n return '';\r\n }\r\n};\r\n\r\nexport const formatICD10 = (\r\n code?: string\r\n) => {\r\n if (\r\n !code ||\r\n code.length <= 3\r\n ) {\r\n return code;\r\n }\r\n\r\n return `${code.substring(0, 3)}.${code.substring(3)}`;\r\n};\r\n\r\nexport const formatName = (\r\n firstName: Undefinable,\r\n lastName: Undefinable\r\n) => {\r\n return firstName ? `${lastName || ''}, ${firstName || ''}` : (lastName || '');\r\n};\r\n\r\nexport const withDOB = (\r\n name: string,\r\n dob: Undefinable\r\n) => {\r\n if (dob) {\r\n const convertedDOB = moment(dob, 'YYYY-MM-DD').format('MM/DD/YY');\r\n return `${name} (${convertedDOB})`;\r\n } else {\r\n return name;\r\n }\r\n};\r\n\r\nexport const withDegree = (\r\n name: string,\r\n degree: Undefinable\r\n) => {\r\n if (degree) {\r\n return `${name}, ${degree}`;\r\n } else {\r\n return name;\r\n }\r\n};\r\n\r\nexport const formatAddress = (\r\n address: Undefinable,\r\n city: Undefinable,\r\n state: Undefinable,\r\n zipcode: Undefinable\r\n) => {\r\n const data = [address || '', city || '', state || ''].filter(x => x);\r\n return `${data.join(', ')} ${zipcode || ''}`;\r\n};\r\n\r\nexport const formatPhone = (\r\n phoneNumber: Undefinable,\r\n type: 'mask' | 'unmask'\r\n) => {\r\n if (phoneNumber) {\r\n const pureNumber = phoneNumber\r\n .replace(/\\(/g, '')\r\n .replace(/\\)/g, '')\r\n .replace(/-/g, '')\r\n .replace(/\\s/g, '')\r\n .replace(/_/g, '');\r\n if (type === 'mask') {\r\n return `(${pureNumber.substr(0, 3)}) ${pureNumber.substr(3, 3)}-${pureNumber.substr(6)}`;\r\n } else if (type === 'unmask') {\r\n return pureNumber;\r\n }\r\n }\r\n\r\n return phoneNumber || '';\r\n};\r\n\r\n// always return true if one of 2 fields is missing\r\nexport const isDayNotGreaterThan = (\r\n from: Undefinable,\r\n to: Undefinable,\r\n format?: string\r\n): boolean => {\r\n if (from && to) {\r\n if (format) {\r\n const formatFrom = formatDate({\r\n date: from,\r\n srcFormat: format,\r\n destFormat: 'YYYYMMDD'\r\n });\r\n const formatTo = formatDate({\r\n date: to,\r\n srcFormat: format,\r\n destFormat: 'YYYYMMDD'\r\n });\r\n return formatFrom <= formatTo;\r\n } else {\r\n return Number(from) <= Number(to);\r\n }\r\n } else {\r\n return true;\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n PatientPortalData,\r\n PatientPortalDataListResult,\r\n PatientPortalDataType\r\n} from '../models/patient-portal-data';\r\n\r\nexport const getPatientPortalDatas = async (type: Undefinable): Promise> => {\r\n const response = await axios.get(`/api/patient-portal-data/type${type ? `/${type}` : ''}`);\r\n return response.data;\r\n};\r\n\r\nexport const createPatientPortalData = async (patientPortalData: MixType): Promise => {\r\n const data = Array.isArray(patientPortalData) ? patientPortalData : [patientPortalData];\r\n const response = await axios.post(`/api/patient-portal-data`, data);\r\n return response.data;\r\n};\r\n","import * as yup from 'yup';\r\nimport IMPSBaseModel from './imps-base-model';\r\n\r\nexport enum RxStatus {\r\n Taking = 1,\r\n NotTaking = 2,\r\n Unknown = 3\r\n}\r\n\r\nexport enum PatientRxSource {\r\n EncounterRx,\r\n PatientRx\r\n}\r\n\r\nexport const RxStatusTexts = {\r\n [RxStatus.Taking]: 'TAKING',\r\n [RxStatus.NotTaking]: 'NOT TAKING',\r\n [RxStatus.Unknown]: 'UNKNOWN'\r\n};\r\n\r\nexport class PatientRxModel {\r\n id: number = 0;\r\n\r\n source: PatientRxSource;\r\n\r\n medId: number = 0;\r\n\r\n dosageNumberTypeID?: number = 2;\r\n dosageFrequencyTypeID?: number = 2;\r\n\r\n status?: RxStatus = RxStatus.Taking;\r\n\r\n sigForm?: string;\r\n}\r\n\r\nexport class PatientRx extends IMPSBaseModel {\r\n medId: number = 0;\r\n dispense: number = 0;\r\n refills: number = 0;\r\n daysSupply: Undefinable = 7;\r\n durationType: Undefinable;\r\n\r\n dosageNumberTypeID: Undefinable = 2;\r\n dosageFrequencyTypeID: Undefinable = 2;\r\n\r\n status: Undefinable = RxStatus.Taking;\r\n\r\n sigForm: Undefinable;\r\n dispenseForm: Undefinable;\r\n\r\n createdDate: string;\r\n\r\n startDate: Undefinable;\r\n reasonType: Undefinable;\r\n reasonText: Undefinable;\r\n}\r\n\r\nexport const patientRxValidationSchema = yup.object().shape({\r\n medId: yup\r\n .number()\r\n .moreThan(0, 'Drug name is required.')\r\n .required('Drug name is required.'),\r\n dosageNumberTypeID: yup\r\n .number()\r\n .moreThan(0, 'Required.')\r\n .required('Required.'),\r\n dosageFrequencyTypeID: yup\r\n .number()\r\n .moreThan(0, 'Frequency is required.')\r\n .required('Frequency is required.'),\r\n dispense: yup\r\n .number()\r\n .moreThan(0, 'Dispense is required.')\r\n .required('Dispense is required.'),\r\n});\r\n","import * as jQuery from 'jquery';\r\nimport {\r\n mobileRegExp,\r\n tabletRegExp\r\n} from './utils/regex';\r\n\r\nconst jQueryString = 'jQuery';\r\nconst $String = '$';\r\nglobal[jQueryString] = jQuery;\r\nglobal[$String] = jQuery;\r\n\r\nconst agent = navigator.userAgent || navigator.vendor || window.opera;\r\nwindow.isMobile = () => mobileRegExp.test(agent) || tabletRegExp.test(agent.substr(0, 4));\r\n","import { createModel } from '@rematch/core';\r\nimport { AppConfig } from '../../models/app-config';\r\n\r\nexport interface State {\r\n appConfig: Undefinable;\r\n menuState: boolean;\r\n}\r\n\r\nexport const appStates = createModel({\r\n state: {\r\n menuState: false,\r\n },\r\n reducers: {\r\n setAppConfig: (\r\n state: State,\r\n data: Undefinable\r\n ): State => ({\r\n ...state,\r\n appConfig: data\r\n }),\r\n toggleMenuState: (\r\n state: State,\r\n data?: boolean\r\n ): State => ({\r\n ...state,\r\n menuState: data === undefined ? !state.menuState : data\r\n })\r\n }\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { UserPatient } from '../../models/user-patient';\r\n\r\nexport interface State {\r\n identityName: string;\r\n impsId: number;\r\n name: string;\r\n primary: boolean;\r\n coordinates: Undefinable;\r\n locked: boolean;\r\n}\r\n\r\nexport const accounts = createModel({\r\n state: {\r\n identityName: '',\r\n impsId: 0,\r\n name: '',\r\n primary: false,\r\n coordinates: {},\r\n locked: false\r\n },\r\n reducers: {\r\n lockAccount: (\r\n state: State,\r\n locked: boolean\r\n ): State => ({\r\n ...state,\r\n locked: locked\r\n }),\r\n update: (\r\n state: State,\r\n data: UserPatient\r\n ): State => ({\r\n ...state,\r\n ...data\r\n })\r\n }\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { Allergy } from '../../models/allergy';\r\nimport { PHVType } from '../../models/phv';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport {\r\n getAppointmentAllergies,\r\n getLatestAllergies\r\n} from '../../apis/allergy';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const allergies = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => (byId[a]!.onsetDate || '') > (byId[b]!.onsetDate || '') ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getLatestAllergiesAsync() {\r\n const {\r\n compositeAllergies,\r\n phvs\r\n } = dispatch;\r\n this.loading('getLatestAllergiesAsync', true);\r\n try {\r\n const data = await getLatestAllergies();\r\n this.update(data, 'getLatestAllergiesAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n compositeAllergies.getCompositeAllergiesAsync(data.map(x => x.allergyId));\r\n phvs.getPHVsAsync(PHVType.Reaction);\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getLatestAllergiesAsync', false);\r\n }\r\n },\r\n async getAppointmentAllergiesAsync(appointment: number) {\r\n const {\r\n compositeAllergies,\r\n phvs\r\n } = dispatch;\r\n this.loading('getAppointmentAllergiesAsync', true);\r\n try {\r\n const data = await getAppointmentAllergies(appointment);\r\n this.update(data, 'getAppointmentAllergiesAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n compositeAllergies.getCompositeAllergiesAsync(data.map(x => x.allergyId));\r\n phvs.getPHVsAsync(PHVType.Reaction);\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getAppointmentAllergiesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { CDCCVX } from '../../models/cdc-cvx';\r\nimport { getCDCCVXs } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const cdcCVXs = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: CDCCVX[],\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByCVXCode(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCDCCVXsAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getCDCCVXIds(rootState.cdcCVXs).length === 0) {\r\n try {\r\n const data = await getCDCCVXs();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst storeByCVXCode = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.cvxCode] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.cvxCode]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n CheckInQuestion,\r\n CheckInQuestionResult\r\n} from '../models/check-in-question';\r\n\r\nexport const getCheckInQuestions = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/check-in-question/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n\r\nexport const createCheckInQuestion = async (checkInQuestion: CheckInQuestion): Promise => {\r\n const response = await axios.post(`/api/check-in-question`, checkInQuestion);\r\n return response.data;\r\n};\r\n\r\nexport const updateCheckInQuestion = async (checkInQuestion: CheckInQuestion): Promise => {\r\n const response = await axios.put(`/api/check-in-question`, checkInQuestion);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { CheckInQuestion } from '../../models/check-in-question';\r\nimport { getCheckInQuestions } from '../../apis/check-in-question';\r\n\r\ninterface ProcessData {\r\n byAppointmentId: Dictionary;\r\n byId: Dictionary;\r\n}\r\n\r\nexport interface State {\r\n byAppointmentId: Dictionary;\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const checkInQuestions = createModel({\r\n state: {\r\n byAppointmentId: {},\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const isUpdated = checkIsUpdate(state.byId, data);\r\n const processedData = processData(state.byAppointmentId, data, isUpdated);\r\n return {\r\n ...state,\r\n byAppointmentId: {\r\n ...state.byAppointmentId,\r\n ...processedData.byAppointmentId\r\n },\r\n byId: {\r\n ...state.byId,\r\n ...processedData.byId\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCheckInQuestionsAsync(appointmentId: number) {\r\n this.loading('getCheckInQuestionsAsync', true);\r\n try {\r\n const data = await getCheckInQuestions(appointmentId);\r\n this.update(data, 'getCheckInQuestionsAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getCheckInQuestionsAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const checkIsUpdate = (\r\n byId: Dictionary,\r\n data: Undefinable>\r\n): boolean => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.every(x => byId[x.id]);\r\n } else {\r\n return !!byId[data.id];\r\n }\r\n } else {\r\n return true;\r\n }\r\n};\r\n\r\nexport const processData = (\r\n initialByAppointmentId: Dictionary,\r\n data: Undefinable>,\r\n isUpdated: boolean\r\n): ProcessData => {\r\n const byAppointmentId = {} as Dictionary;\r\n const byId = {} as Dictionary;\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n data.sort((a, b) => a.questionDate > b.questionDate ? 1 : -1);\r\n for (let i = 0; i < data.length; i++) {\r\n byId[data[i].id] = data[i];\r\n if (!isUpdated) {\r\n if (!byAppointmentId[data[i].appointmentId]) {\r\n byAppointmentId[data[i].appointmentId] = initialByAppointmentId[data[i].appointmentId] || [];\r\n }\r\n byAppointmentId[data[i].appointmentId]!.push(data[i].id);\r\n }\r\n }\r\n } else {\r\n byId[data.id] = data;\r\n if (!isUpdated) {\r\n byAppointmentId[data.appointmentId] = [...initialByAppointmentId[data.appointmentId] || [], data.id];\r\n }\r\n }\r\n }\r\n return {\r\n byAppointmentId,\r\n byId\r\n };\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n CheckOutQuestion,\r\n CheckOutQuestionResult\r\n} from '../models/check-out-question';\r\n\r\nexport const getCheckOutQuestions = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/check-out-question/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n\r\nexport const createCheckOutQuestion = async (checkOutQuestion: CheckOutQuestion): Promise => {\r\n const response = await axios.post(`/api/check-out-question`, checkOutQuestion);\r\n return response.data;\r\n};\r\n\r\nexport const updateCheckOutQuestion = async (checkOutQuestion: CheckOutQuestion): Promise => {\r\n const response = await axios.put(`/api/check-out-question`, checkOutQuestion);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { CheckOutQuestion } from '../../models/check-out-question';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getCheckOutQuestions } from '../../apis/check-out-question';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const checkOutQuestions = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n return {\r\n ...state,\r\n ...data && {\r\n byId: {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n }\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCheckOutQuestionsAsync(appointmentId: number) {\r\n this.loading('getCheckOutQuestionsAsync', true);\r\n try {\r\n const data = await getCheckOutQuestions(appointmentId);\r\n this.update(data, 'getCheckOutQuestionsAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getCheckOutQuestionsAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { CompositeAllergy } from '../../models/composite-allergy';\r\nimport {\r\n getCompositeAllergies,\r\n searchCompositeAllergies\r\n} from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n searchedTextHash: Dictionary;\r\n}\r\n\r\nexport const compositeAllergies = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {},\r\n searchedTextHash: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByCompositeAllergyID(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => byId[a]!.description > byId[b]!.description ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n }),\r\n setSearched: (state: State, text: string): State => ({\r\n ...state,\r\n searchedTextHash: {\r\n ...state.searchedTextHash,\r\n [text]: true\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCompositeAllergiesAsync(ids: Undefinable[], rootState: RootState) {\r\n const notExistedIds = selectors.getOtherCompositeAllergyIds(rootState.compositeAllergies, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getCompositeAllergies(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async searchCompositeAllergiesAsync(text: string, rootState: RootState) {\r\n const loading = selectors.getLoading(rootState.compositeAllergies, `searchCompositeAllergiesAsync---${text}`);\r\n if (!loading && !selectors.checkSearched(rootState.compositeAllergies, text)) {\r\n this.loading(`searchCompositeAllergiesAsync---${text}`, true);\r\n const data = await searchCompositeAllergies(text);\r\n this.update(data, `searchCompositeAllergiesAsync---${text}`);\r\n this.loading(`searchCompositeAllergiesAsync---${text}`, false);\r\n this.setSearched(text);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const storeByCompositeAllergyID = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.compositeAllergyID] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.compositeAllergyID]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { CompositeDrug } from '../../models/composite-drug';\r\nimport {\r\n getCompositeDrugs,\r\n searchCompositeDrugs\r\n} from '../../apis/emr-data';\r\n\r\ninterface ProcessedData {\r\n byCode: Dictionary;\r\n byMedId: Dictionary;\r\n byMedNameId: Dictionary;\r\n}\r\n\r\nexport interface State {\r\n byCode: Dictionary; // code: medNameId + medDoseForm + medStrength + medRoute (if medStrength empty => medical-supply + medNameId)\r\n byMedId: Dictionary;\r\n byMedNameId: Dictionary;\r\n loading: Dictionary;\r\n searchedTextHash: Dictionary;\r\n}\r\n\r\nexport const compositeDrugs = createModel({\r\n state: {\r\n byCode: {},\r\n byMedId: {},\r\n byMedNameId: {},\r\n loading: {},\r\n searchedTextHash: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const processedData = processData(data, state.byMedNameId);\r\n return {\r\n ...state,\r\n byCode: {\r\n ...state.byCode,\r\n ...processedData.byCode\r\n },\r\n byMedId: {\r\n ...state.byMedId,\r\n ...processedData.byMedId\r\n },\r\n byMedNameId: {\r\n ...state.byMedNameId,\r\n ...processedData.byMedNameId\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (state: State, loadingKey: string, loading: boolean): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n }),\r\n setSearched: (state: State, text: string): State => ({\r\n ...state,\r\n searchedTextHash: {\r\n ...state.searchedTextHash,\r\n [text]: true\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCompositeDrugsAsync(ids: Undefinable[], rootState: RootState) {\r\n const notExistedIds = selectors.getOtherCompositeDrugIds(rootState.compositeDrugs, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getCompositeDrugs(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async searchCompositeDrugsAsync(text: string, rootState: RootState) {\r\n const loading = selectors.getLoading(rootState.compositeDrugs, `searchCompositeDrugsAsync---${text}`);\r\n if (!loading && !selectors.checkSearched(rootState.compositeDrugs, text)) {\r\n this.loading(`searchCompositeDrugsAsync---${text}`, true);\r\n const data = await searchCompositeDrugs(text);\r\n this.update(data, `searchCompositeDrugsAsync---${text}`);\r\n this.loading(`searchCompositeDrugsAsync---${text}`, false);\r\n this.setSearched(text);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const processData = (\r\n data: Undefinable>,\r\n initalByMedNameId: Dictionary\r\n): ProcessedData => {\r\n const byCode = {} as Dictionary;\r\n const byMedId = {} as Dictionary;\r\n const byMedNameId = {} as Dictionary;\r\n\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n for (let i = 0; i < data.length; i++) {\r\n if (data[i].medStrength) {\r\n byCode[[data[i].medNameId, data[i].medDoseForm, data[i].medStrength, data[i].medRoute].join('---')] = data[i].medId;\r\n } else {\r\n byCode[`medical-supply---${data[i].medNameId}`] = data[i].medId;\r\n }\r\n byMedId[data[i].medId] = data[i];\r\n if (!byMedNameId[data[i].medNameId]) {\r\n byMedNameId[data[i].medNameId] = [...initalByMedNameId[data[i].medId] || []];\r\n }\r\n byMedNameId[data[i].medNameId]!.push(data[i].medId);\r\n }\r\n } else {\r\n if (data.medStrength) {\r\n byCode[[data.medNameId, data.medDoseForm, data.medStrength, data.medRoute].join('---')] = data.medId;\r\n } else {\r\n byCode[`medical-supply---${data.medNameId}`] = data.medId;\r\n }\r\n byMedId[data.medId] = data;\r\n byMedNameId[data.medNameId] = [data.medNameId];\r\n }\r\n }\r\n\r\n return {\r\n byCode,\r\n byMedId,\r\n byMedNameId\r\n };\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { CounselingType } from '../../models/counseling-type';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getCounselingTypes } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const counselingTypes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: CounselingType[],\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getCounselingTypesAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getCounselingTypeIds(rootState.counselingTypes).length === 0) {\r\n try {\r\n const data = await getCounselingTypes();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { DosageFormType } from '../../models/dosage-form-type';\r\nimport { getDosageFormTypes } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: string[]; // id: description\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const dosageFormTypes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...processData(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object\r\n .keys(byId)\r\n .sort((a, b) => byId[a]!.displayOrder - byId[b]!.displayOrder),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getDosageFormTypesAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (\r\n !selectors.getLoading(rootState.dosageFormTypes, 'getDosageFormTypesAsync') &&\r\n selectors.getDosageFormTypeIds(rootState.dosageFormTypes).length === 0\r\n ) {\r\n this.loading('getDosageFormTypesAsync', true);\r\n try {\r\n const data = await getDosageFormTypes();\r\n this.update(data, 'getDosageFormTypesAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getDosageFormTypesAsync', false);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const processData = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.dosageFormDescription] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.dosageFormDescription]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport { EncounterPatientEducation } from '../models/encounter-patient-education';\r\n\r\nexport const getEncounterPatientEducations = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/encounter-patient-education/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { Dispatch } from '../../store';\r\nimport { EncounterPatientEducation } from '../../models/encounter-patient-education';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getEncounterPatientEducations } from '../../apis/encounter-patient-education';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const encounterPatientEducations = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getEncounterPatientEducationsAsync(appointmentId: number) {\r\n const { nlmPatientEducationDefinitions } = dispatch as Dispatch;\r\n this.loading('getEncounterPatientEducationsAsync', true);\r\n try {\r\n const data = await getEncounterPatientEducations(appointmentId);\r\n this.update(data, 'getEncounterPatientEducationsAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n nlmPatientEducationDefinitions.getNLMPatientEducationDefinitionsAsync(data.map(x => x.patientEducationDefinitionId));\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getEncounterPatientEducationsAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { EncounterRx } from '../models/encounter-rx';\r\n\r\nexport const getAppointmentEncounterRxes = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/encounter-rx/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { Dispatch } from '../../store';\r\nimport { EncounterRx } from '../../models/encounter-rx';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getAppointmentEncounterRxes } from '../../apis/encounter-rx';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const encounterRxes = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getAppointmentEncounterRxesAsync(appointmentId: number) {\r\n const {\r\n compositeDrugs\r\n } = dispatch as Dispatch;\r\n this.loading('getAppointmentEncounterRxesAsync', true);\r\n try {\r\n const data = await getAppointmentEncounterRxes(appointmentId);\r\n this.update(data, 'getAppointmentEncounterRxesAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n compositeDrugs.getCompositeDrugsAsync(data.map(x => x.medId));\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getAppointmentEncounterRxesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { EncounterRxReconcile } from '../models/encounter-rx-reconcile';\r\n\r\nexport const getEncounterRxReconciles = async (ids: number[]): Promise> => {\r\n const response = await axios.post(`/api/encounter-rx-reconcile`, ids);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { EncounterRxReconcile } from '../../models/encounter-rx-reconcile';\r\nimport { getEncounterRxReconciles } from '../../apis/encounter-rx-reconcile';\r\n\r\nexport interface State {\r\n byId: Dictionary; // id: patientRxId\r\n loading: Dictionary;\r\n}\r\n\r\nexport const encounterRxReconciles = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => ({\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeByPatientRxId(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n }),\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getEncounterRxReconcilesAsync(ids: number[]) {\r\n if (ids.length > 0) {\r\n this.loading('getEncounterRxReconcilesAsync', true);\r\n try {\r\n const data = await getEncounterRxReconciles(ids);\r\n this.update(data, 'getEncounterRxReconcilesAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getEncounterRxReconcilesAsync', false);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const storeByPatientRxId = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.patientRxId] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.patientRxId]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport { FacilityModel } from '../models/facility';\r\n\r\nexport const getFacilities = async (\r\n ids: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/facility',\r\n ids\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const getOtherFacilities = async (\r\n ids: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/facility/other',\r\n ids\r\n );\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { FacilityModel } from '../../models/facility';\r\nimport { storeData } from '../../utils/converter';\r\nimport {\r\n getFacilities,\r\n getOtherFacilities\r\n} from '../../apis/facility';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const facilities = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'id')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => byId[a]!.name > byId[b]!.name ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getFacilitiesAsync(ids: Undefinable[], rootState: RootState) {\r\n const notExistedIds = selectors.getOtherFacilityIds(rootState.facilities, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getFacilities(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async getOtherFacilitiesAsync(_: {}, rootState: RootState) {\r\n const existedIds = selectors.getFacilityIds(rootState.facilities);\r\n try {\r\n const data = await getOtherFacilities(existedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { ICD10 } from '../../models/icd10';\r\nimport {\r\n getICD10s,\r\n searchICD10s\r\n} from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n byCode: Dictionary;\r\n loading: Dictionary;\r\n searchedTextHash: Dictionary;\r\n}\r\n\r\nexport const icd10s = createModel({\r\n state: {\r\n byCode: {},\r\n loading: {},\r\n searchedTextHash: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => ({\r\n ...state,\r\n byCode: {\r\n ...state.byCode,\r\n ...storeByCode(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n }),\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n }),\r\n setSearched: (state: State, text: string): State => ({\r\n ...state,\r\n searchedTextHash: {\r\n ...state.searchedTextHash,\r\n [text]: true\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getICD10sAsync(\r\n codes: Undefinable[],\r\n rootState: RootState\r\n ) {\r\n const notExistedIds = selectors.getOtherICD10Ids(rootState.icd10s, codes);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getICD10s(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async searchICD10sAsync(text: string, rootState: RootState) {\r\n if (\r\n !selectors.getLoading(rootState.icd10s, `searchICD10sAsync---${text}`) &&\r\n !selectors.checkSearched(rootState.icd10s, text)\r\n ) {\r\n const textLower = text.toLowerCase();\r\n this.loading(`searchICD10sAsync---${textLower}`, true);\r\n try {\r\n const data = await searchICD10s(textLower);\r\n this.update(data, `searchICD10sAsync---${textLower}`);\r\n this.setSearched(textLower);\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(`searchICD10sAsync---${textLower}`, false);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst storeByCode = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.code] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.code]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { ImagingFacility } from '../../models/imaging-facility';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getImagingFacilities } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const imagingFacilities = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: ImagingFacility[],\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getImagingFacilitiesAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getImagingFacilityIds(rootState.imagingFacilities).length === 0) {\r\n try {\r\n const data = await getImagingFacilities();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { Insurance } from '../../models/insurance';\r\nimport { storeData } from '../../utils';\r\nimport { getInsurancesAsync } from '../../apis/insurance';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const insurances = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n action?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'id')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object\r\n .keys(byId)\r\n .sort((a, b) => byId[a]!.insuranceType > byId[b]!.insuranceType ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...action && {\r\n loading: {\r\n ...state.loading,\r\n [action]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n action: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [action]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getInsurancesAsync() {\r\n this.loading('getInsurancesAsync', true);\r\n try {\r\n const data = await getInsurancesAsync();\r\n this.update(data, 'getInsurancesAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getInsurancesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { ItemModel } from '../../models/item';\r\nimport { getItems } from '../../apis/emr-data';\r\n\r\ninterface ProcessData {\r\n byVisitStatusId: Dictionary;\r\n byVisitTypeId: Dictionary;\r\n}\r\n\r\nexport interface State {\r\n allVisitStatusIds: number[];\r\n allVisitTypeIds: number[];\r\n byVisitStatusId: Dictionary;\r\n byVisitTypeId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const items = createModel({\r\n state: {\r\n allVisitStatusIds: [],\r\n allVisitTypeIds: [],\r\n byVisitStatusId: {},\r\n byVisitTypeId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: ItemModel[],\r\n action?: string\r\n ): State => {\r\n const processedData = storeByItemValue(data);\r\n const byVisitStatusId = {\r\n ...state.byVisitStatusId,\r\n ...processedData.byVisitStatusId\r\n };\r\n const byVisitTypeId = {\r\n ...state.byVisitTypeId,\r\n ...processedData.byVisitTypeId\r\n };\r\n\r\n return {\r\n ...state,\r\n allVisitStatusIds: Object.keys(byVisitStatusId).map(x => +x),\r\n allVisitTypeIds: Object.keys(byVisitTypeId).map(x => +x),\r\n byVisitStatusId: byVisitStatusId,\r\n byVisitTypeId: byVisitTypeId,\r\n ...action && {\r\n loading: {\r\n ...state.loading,\r\n [action]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n action: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [action]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getItemsAsync(_: Undefinable<{}>, rootState: RootState) {\r\n if (selectors.getVisitStatusIds(rootState.items).length === 0 &&\r\n selectors.getVisitTypeIds(rootState.items).length === 0) {\r\n try {\r\n const data = await getItems();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const storeByItemValue = (arr: Undefinable): ProcessData => {\r\n const byVisitStatusId = {} as Dictionary;\r\n const byVisitTypeId = {} as Dictionary;\r\n if (arr) {\r\n for (let i = 0; i < arr.length; i++) {\r\n if (arr[i].listTypeId === 1) {\r\n byVisitTypeId[arr[i].itemValue] = arr[i];\r\n } else if (arr[i].listTypeId === 2) {\r\n byVisitStatusId[arr[i].itemValue] = arr[i];\r\n }\r\n }\r\n }\r\n return {\r\n byVisitStatusId,\r\n byVisitTypeId\r\n };\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { Lab } from '../../models/lab';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getLabs } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const labs = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Lab[],\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getLabsAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getLabIds(rootState.labs).length === 0) {\r\n try {\r\n const data = await getLabs();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { LabCorpEdifecsStandardCompendium } from '../../models/lab-corp-edifecs-standard-compendium';\r\nimport {\r\n shouldUpdateState,\r\n storeData\r\n} from '../../utils/converter';\r\nimport { getLabCorpEdifecsStandardCompendiums } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const labCorpEdifecsStandardCompendiums = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: LabCorpEdifecsStandardCompendium[],\r\n loadingKey?: string\r\n ): State => {\r\n if (shouldUpdateState(data, loadingKey)) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeData(data, 'orderCode')\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getLabCorpEdifecsStandardCompendiumsAsync(\r\n ids: Undefinable[],\r\n rootState: RootState\r\n ) {\r\n const notExistedIds = selectors.getOtherLabCorpEdifecsStandardCompendiumIds(rootState.labCorpEdifecsStandardCompendiums, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getLabCorpEdifecsStandardCompendiums(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { LabTestCode } from '../../models/lab-test-code';\r\nimport {\r\n shouldUpdateState,\r\n storeData\r\n} from '../../utils/converter';\r\nimport { getLabTestCodes } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: string[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const labTestCodes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: LabTestCode[],\r\n loadingKey?: string\r\n ): State => {\r\n if (shouldUpdateState(data, loadingKey)) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'testCode')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getLabTestCodesAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getLabTestCodeIds(rootState.labTestCodes).length === 0) {\r\n try {\r\n const data = await getLabTestCodes();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { Message } from '../../models/message';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport {\r\n getMessages,\r\n getRootMessages,\r\n getUnreadMessages\r\n} from '../../apis/messaging-msg';\r\n\r\nexport interface State {\r\n userIds: string[];\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const messages = createModel({\r\n state: {\r\n userIds: [],\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: MixType,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n userIds: groupByUserId(byId),\r\n allIds: Object\r\n .keys(byId)\r\n .sort((a, b) => byId[a]!.createdDt > byId[b]!.createdDt ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getMessagesAsync(\r\n payload: {\r\n rootMessageId?: number,\r\n time?: Undefinable\r\n },\r\n rootState: RootState\r\n ) {\r\n if (!selectors.getLoading(rootState.messages, 'getMessagesAsync')) {\r\n if (!payload.time) {\r\n this.loading('getMessagesAsync', true);\r\n }\r\n try {\r\n const data = await getMessages(payload.rootMessageId, payload.time);\r\n this.update(data, !payload.time && 'getMessagesAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n if (!payload.time) {\r\n this.loading('getMessagesAsync', false);\r\n }\r\n }\r\n }\r\n },\r\n async getUnreadMessagesAsync() {\r\n try {\r\n const data = await getUnreadMessages();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n },\r\n async getRootMessagesAsync() {\r\n this.loading('getRootMessagesAsync', true);\r\n try {\r\n const data = await getRootMessages();\r\n this.update(data, 'getRootMessagesAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getRootMessagesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const groupByUserId = (byId: Dictionary): string[] => {\r\n const data = Object.keys(byId).reduce(\r\n (prevValue, curr) => {\r\n const belongToUserId = byId[curr]!.belongToUserId || 'system';\r\n if (!prevValue[belongToUserId] || prevValue[belongToUserId]! < byId[curr]!.createdDt) {\r\n prevValue[belongToUserId] = byId[curr]!.createdDt;\r\n }\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n );\r\n return Object.keys(data).sort((a, b) => data[a]! < data[b]! ? 1 : -1);\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { NLMPatientEducationDefinition } from '../../models/nlm-patient-education-definition';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getNLMPatientEducationDefinitions } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const nlmPatientEducationDefinitions = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: MixType,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getNLMPatientEducationDefinitionsAsync(\r\n ids: Undefinable[],\r\n rootState: RootState\r\n ) {\r\n const notExistedIds = selectors.getOtherNLMPatientEducationDefinitionIds(rootState.nlmPatientEducationDefinitions, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getNLMPatientEducationDefinitions(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { PatientHistory, PatientHistoryModel } from '../models/patient-history';\r\n\r\nexport const getPatientHistories = async (): Promise => {\r\n const response = await axios.get('/api/patient-history');\r\n return response.data && response.data.map(n => ({ // TODO: camel case \r\n ...n,\r\n icd10Code: n.icd10Code || n.icD10Code\r\n }));\r\n};\r\n\r\nexport const getPatientHistoriesAsync = async (): Promise => {\r\n const response = await axios.get('/api/patient-history');\r\n return response.data && response.data.map(n => ({ // TODO: camel case \r\n ...n,\r\n icd10Code: n.icd10Code || n.icD10Code\r\n }));\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport {\r\n HistoryType,\r\n PatientHistory\r\n} from '../../models/patient-history';\r\nimport { getPatientHistories } from '../../apis/patient-history';\r\n\r\ninterface ProcessData {\r\n byType: Dictionary;\r\n byId: Dictionary;\r\n}\r\n\r\nexport interface State {\r\n byType: Dictionary;\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const patientHistories = createModel({\r\n state: {\r\n byType: {},\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable,\r\n loadingKey?: string\r\n ): State => {\r\n const processedData = storeByType(data);\r\n return {\r\n ...state,\r\n byType: {\r\n ...state.byType,\r\n ...processedData.byType\r\n },\r\n byId: {\r\n ...state.byId,\r\n ...processedData.byId\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getPatientHistoriesAsync(type: Undefinable) {\r\n const {\r\n icd10s,\r\n snomeds\r\n } = dispatch;\r\n const loadingKey = type === undefined ? 'getPatientHistoriesAsync' : `getPatientHistoriesAsync---${type}`;\r\n this.loading(loadingKey, true);\r\n try {\r\n const data = await getPatientHistories();\r\n this.update(data, loadingKey);\r\n\r\n // Collect related data\r\n if (data) {\r\n snomeds.getSnomedsAsync({\r\n conceptIds: data.filter(x => x.historyType === HistoryType.SocialHistory).map(x => x.code),\r\n active: true\r\n });\r\n snomeds.getSnomedsAsync({\r\n conceptIds: data.filter(x =>\r\n x.historyType !== HistoryType.FamilyHistory &&\r\n x.historyType !== HistoryType.PastMedicalHistory &&\r\n x.historyType !== HistoryType.DrinkingHistory &&\r\n x.historyType !== HistoryType.SmokingHistory\r\n ).map(x => x.code),\r\n active: false\r\n });\r\n icd10s.getICD10sAsync(data.filter(x =>\r\n x.historyType === HistoryType.FamilyHistory ||\r\n x.historyType === HistoryType.PastMedicalHistory\r\n ).map(x => x.icd10Code));\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(loadingKey, true);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const storeByType = (arr: Undefinable): ProcessData => {\r\n const byType = {} as Dictionary;\r\n const byId = {} as Dictionary;\r\n if (arr) {\r\n arr.sort((a, b) => a.createdDate > b.createdDate ? 1 : -1);\r\n for (let i = 0; i < arr.length; i++) {\r\n byId[arr[i].id] = arr[i];\r\n\r\n if (!byType[arr[i].historyType]) {\r\n byType[arr[i].historyType] = [];\r\n }\r\n byType[arr[i].historyType]!.push(arr[i].id);\r\n }\r\n }\r\n return {\r\n byType,\r\n byId\r\n };\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { Dispatch } from '../../store';\r\nimport { Allergy } from '../../models/allergy';\r\nimport { PatientHistory } from '../../models/patient-history';\r\nimport {\r\n PatientPortalData,\r\n PatientPortalDataType\r\n} from '../../models/patient-portal-data';\r\nimport { PatientRx } from '../../models/patient-rx';\r\nimport { JsonParse } from '../../utils/converter';\r\nimport { getPatientPortalDatas } from '../../apis/patient-portal-data';\r\n\r\nexport interface State {\r\n byCode: Dictionary; // code: type + related id\r\n loading: Dictionary;\r\n}\r\n\r\nexport const patientPortalDatas = createModel({\r\n state: {\r\n byCode: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => ({\r\n ...state,\r\n byCode: {\r\n ...state.byCode,\r\n ...processData(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n }),\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getPatientPortalDatasAsync(type?: PatientPortalDataType) {\r\n const {\r\n compositeAllergies,\r\n compositeDrugs,\r\n icd10s,\r\n snomeds\r\n } = dispatch as Dispatch;\r\n this.loading('getPatientPortalDatasAsync', false);\r\n try {\r\n const data = await getPatientPortalDatas(type);\r\n this.update(data, 'getPatientPortalDatasAsync');\r\n\r\n if (data) {\r\n const patientHistories = filterPatientHistoriesData(data);\r\n snomeds.getSnomedsAsync({\r\n conceptIds: patientHistories\r\n .filter(x => x.type === PatientPortalDataType.SocialHistory)\r\n .map(x => JsonParse(x.metadata).code),\r\n active: true\r\n });\r\n snomeds.getSnomedsAsync({\r\n conceptIds: patientHistories.filter(x =>\r\n x.type !== PatientPortalDataType.FamilyHistory &&\r\n x.type !== PatientPortalDataType.PastMedicalHistory &&\r\n x.type !== PatientPortalDataType.DrinkingHistory &&\r\n x.type !== PatientPortalDataType.SmokingHistory\r\n ).map(x => JsonParse(x.metadata).code),\r\n active: false\r\n });\r\n icd10s.getICD10sAsync(patientHistories.filter(x =>\r\n x.type === PatientPortalDataType.FamilyHistory ||\r\n x.type === PatientPortalDataType.PastMedicalHistory\r\n ).map(x => JsonParse(x.metadata).icd10Code));\r\n\r\n const allergies = data.filter(x => x.type === PatientPortalDataType.Allergy);\r\n compositeAllergies.getCompositeAllergiesAsync(allergies.map(x => JsonParse(x.metadata).allergyId));\r\n\r\n const patientRxes = data.filter(x => x.type === PatientPortalDataType.Medication);\r\n compositeDrugs.getCompositeDrugsAsync(patientRxes.map(x => JsonParse(x.metadata).medId));\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getPatientPortalDatasAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst processData = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n data.sort((a, b) => a.relatedCreatedDate > b.relatedCreatedDate ? 1 : -1);\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[`${x.type || ''}---${x.relatedId || ''}`] = {\r\n ...x,\r\n dataModel: JsonParse(x.metadata)\r\n };\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [`${data.type || ''}---${data.relatedId || ''}`]: {\r\n ...data,\r\n dataModel: JsonParse(data.metadata)\r\n }\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n\r\nconst filterPatientHistoriesData = (data: PatientPortalData[]): PatientPortalData[] => {\r\n return data.filter(x =>\r\n x.type === PatientPortalDataType.PastMedicalHistory ||\r\n x.type === PatientPortalDataType.FamilyHistory ||\r\n x.type === PatientPortalDataType.SocialHistory ||\r\n x.type === PatientPortalDataType.SmokingHistory ||\r\n x.type === PatientPortalDataType.DrinkingHistory ||\r\n x.type === PatientPortalDataType.DrugAbuseHistory ||\r\n x.type === PatientPortalDataType.FallHistory\r\n );\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { PatientRx } from '../../models/patient-rx';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getPatientRxes } from '../../apis/patient-rx';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n byMedId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const patientRxes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n byMedId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => byId[a]!.createdDate > byId[b]!.createdDate ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n byMedId: {\r\n ...state.byMedId,\r\n ...processData(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getPatientRxesAsync() {\r\n const {\r\n compositeDrugs,\r\n dosageFrequencyTypes,\r\n dosageNumberTypes\r\n } = dispatch;\r\n this.loading('getPatientRxesAsync', true);\r\n try {\r\n const data = await getPatientRxes();\r\n this.update(data, 'getPatientRxesAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n compositeDrugs.getCompositeDrugsAsync(data.map(x => x.medId));\r\n }\r\n dosageFrequencyTypes.getDosageFrequencyTypesAsync();\r\n dosageNumberTypes.getDosageNumberTypesAsync();\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getPatientRxesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n\r\nexport const processData = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.medId] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.medId]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n","import axios from 'axios';\r\nimport { PatientVaccine } from '../models/patient-vaccine';\r\n\r\nexport const getAppointmentPatientVaccines = async (appointmentId: number): Promise> => {\r\n const response = await axios.get(`/api/patient-vaccine/appointment/${appointmentId}`);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { Dispatch } from '../../store';\r\nimport { PatientVaccine } from '../../models/patient-vaccine';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getAppointmentPatientVaccines } from '../../apis/patient-vaccine';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const patientVaccines = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getAppointmentPatientVaccinesAsync(appointmentId: number) {\r\n const {\r\n cdcCVXs,\r\n providers\r\n } = dispatch as Dispatch;\r\n this.loading('getAppointmentPatientVaccinesAsync', true);\r\n try {\r\n const data = await getAppointmentPatientVaccines(appointmentId);\r\n this.update(data, 'getAppointmentPatientVaccinesAsync');\r\n\r\n // Collect related data\r\n if (data) {\r\n providers.getProvidersAsync(data.map(x => x.administeredByProviderId));\r\n }\r\n cdcCVXs.getCDCCVXsAsync();\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getAppointmentPatientVaccinesAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { Payer } from '../models/payer';\r\n\r\nexport const getPayers = async (ids: number[]): Promise => {\r\n const response = await axios.post(`/api/payer`, ids);\r\n return response.data;\r\n};\r\n\r\nexport const getOtherPayers = async (ids: number[]): Promise => {\r\n const response = await axios.post(`/api/payer/other`, ids);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { Payer } from '../../models/payer';\r\nimport { storeData } from '../../utils';\r\nimport {\r\n getPayers,\r\n getOtherPayers\r\n} from '../../apis/payer';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const payers = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Payer[],\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'id')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => (byId[a]!.name || '') > (byId[b]!.name || '') ? 1 : -1)\r\n .map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getPayersAsync(ids: Undefinable[], rootState: RootState) {\r\n const notExistedIds = selectors.getOtherPayerIds(rootState.payers, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getPayers(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async getOtherPayersAsync(_: {}, rootState: RootState) {\r\n const existedIds = selectors.getPayerIds(rootState.payers);\r\n this.loading('getOtherPayersAsync', true);\r\n try {\r\n const data = await getOtherPayers(existedIds);\r\n this.update(data, 'getOtherPayersAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getOtherPayersAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { PaymentCard } from '../../models/payment-card';\r\nimport { storeById } from '../../utils/converter';\r\nimport {\r\n getPaymentCardsAsync,\r\n updatePrimaryCardAsync\r\n} from '../../apis/payment-gateway';\r\n\r\nexport interface State {\r\n allIds: string[];\r\n primaryId: string;\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const paymentCards = createModel({\r\n state: {\r\n allIds: [],\r\n primaryId: '',\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: PaymentCard[],\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeById(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).sort((a, b) => byId[a]!.last4 > byId[b]!.last4 ? 1 : -1),\r\n primaryId: Object.keys(byId).find(x => byId[x]!.primary) || '',\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getPaymentCardsAsync(_: Undefinable<{}>, rootState: RootState) {\r\n if (selectors.getPaymentCardIds(rootState.paymentCards).length === 0 &&\r\n !selectors.getLoading(rootState.paymentCards, 'getPaymentCardsAsync')\r\n ) {\r\n this.loading('getPaymentCardsAsync', true);\r\n try {\r\n const data = await getPaymentCardsAsync();\r\n this.update(data, 'getPaymentCardsAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getPaymentCardsAsync', false);\r\n }\r\n }\r\n },\r\n async updatePrimaryCardAsync(cardId: string) {\r\n this.loading('updatePrimaryCardAsync', true);\r\n try {\r\n const response = await updatePrimaryCardAsync(cardId);\r\n if (response.success) {\r\n this.update(response.data, 'updatePrimaryCardAsync');\r\n } else {\r\n window.console.log(response.message);\r\n this.loading('updatePrimaryCardAsync', false);\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('updatePrimaryCardAsync', false);\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { Pharmacy } from '../models/pharmacy';\r\n\r\nexport const searchPharmacies = async (text: string): Promise> => {\r\n try {\r\n const response = await axios.get(`/api/pharmacy/search?text=${text}`);\r\n return response.data;\r\n } catch (e) {\r\n window.console.log(e);\r\n return [];\r\n }\r\n};\r\n\r\nexport const getPharmacy = async (id: string): Promise> => {\r\n const response = await axios.get(`/api/pharmacy/${id}`);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { accountSelectors } from '../selector';\r\nimport { RootState } from '../../store';\r\nimport { Pharmacy } from '../../models/pharmacy';\r\nimport { storeById } from '../../utils/converter';\r\nimport { searchPharmacies } from '../../apis/pharmacy';\r\nimport { getDistanceFromLatLonInKm } from '../../utils/calculator';\r\n\r\nexport interface State {\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const pharmacies = createModel({\r\n state: {\r\n byText: {},\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable,\r\n loadingKey?: string\r\n ): State => ({\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeById(data)\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n }),\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async searchPharmaciesAsync(text: string, rootState: RootState) {\r\n const textLower = text.toLowerCase();\r\n const loadingKey = `searchPharmaciesAsync---${textLower}`;\r\n\r\n // const existedPharmacyIds = selectors.getPharmacyIds(rootState.pharmacies, textLower);\r\n\r\n const loading = selectors.getLoading(rootState.pharmacies, loadingKey);\r\n // const searched = !!existedPharmacyIds && existedPharmacyIds.length > 0;\r\n\r\n // if (!loading && !searched) {\r\n if (!loading) {\r\n this.loading(loadingKey, true);\r\n try {\r\n const data = await searchPharmacies(text);\r\n if (data) {\r\n const coordinates = accountSelectors.getCoordinates(rootState.accounts);\r\n // calculate distance\r\n data.forEach(x => {\r\n x.distance = getDistanceFromLatLonInKm(\r\n coordinates && coordinates.latitude,\r\n coordinates && coordinates.longitude,\r\n x.locationLAT,\r\n x.locationLNG\r\n );\r\n });\r\n }\r\n this.update(data, loadingKey);\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(loadingKey, false);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { ProcedureType } from '../../models/procedure-type';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getProcedureTypes } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const procedureTypes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: ProcedureType[],\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getProcedureTypesAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (selectors.getProcedureTypeIds(rootState.procedureTypes).length === 0) {\r\n try {\r\n const data = await getProcedureTypes();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { ProviderModel } from '../models/provider';\r\n\r\nexport const getProviders = async (\r\n ids: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/provider',\r\n ids\r\n );\r\n return response.data;\r\n};\r\n\r\nexport const getOtherProviders = async (\r\n ids: number[]\r\n): Promise => {\r\n const response = await axios.post(\r\n '/api/provider/other',\r\n ids\r\n );\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { ProviderModel } from '../../models/provider';\r\nimport { storeData } from '../../utils/converter';\r\nimport {\r\n getProviders,\r\n getOtherProviders\r\n} from '../../apis/provider';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const providers = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: ProviderModel[],\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'id')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .map(x => +x)\r\n .sort((a, b) => a - b),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getProvidersAsync(ids: Undefinable[], rootState: RootState) {\r\n const notExistedIds = selectors.getOtherProviderIds(rootState.providers, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getProviders(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async getOtherProvidersAsync(_: {}, rootState: RootState) {\r\n const existedIds = selectors.getProviderIds(rootState.providers);\r\n try {\r\n const data = await getOtherProviders(existedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { QuestOrderCode } from '../../models/quest-order-code';\r\nimport { getQuestOrderCodes } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: string[]; // id: testCD\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const questOrderCodes = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: QuestOrderCode[],\r\n loadingKey?: string\r\n ): State => {\r\n const hasData = Array.isArray(data) ? data.length > 0 : data;\r\n if (hasData || loadingKey) {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByTestCD(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getQuestOrderCodesAsync(\r\n ids: Undefinable[],\r\n rootState: RootState\r\n ) {\r\n const notExistedIds = selectors.getOtherQuestOrderCodeIds(rootState.questOrderCodes, ids);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getQuestOrderCodes(notExistedIds);\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst storeByTestCD = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n if (x.testCD) {\r\n prev[x.testCD] = x;\r\n }\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n if (data.testCD) {\r\n return {\r\n [data.testCD]: data\r\n } as Dictionary;\r\n }\r\n }\r\n }\r\n return {} as Dictionary;\r\n};\r\n","import axios from 'axios';\r\nimport { Schedule } from '../models/schedule';\r\nimport { formatDate } from '../utils/formatter';\r\n\r\nexport const getAllSchedules = async (date: string): Promise => {\r\n const requestDate = formatDate({ date: date, destFormat: 'YYYY-MM-DD', srcFormat: 'YYYYMMDD' });\r\n const response = await axios.get(`/api/schedule/date/${requestDate}`);\r\n return response.data;\r\n};\r\n\r\nexport const getSchedules = async (providerId: number, date: string): Promise => {\r\n const requestDate = formatDate({ date: date, destFormat: 'YYYY-MM-DD', srcFormat: 'YYYYMMDD' });\r\n const response = await axios.get(`/api/schedule/provider/${providerId}/date/${requestDate}`);\r\n return response.data;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { Schedule } from '../../models/schedule';\r\nimport {\r\n shouldUpdateState,\r\n storeData\r\n} from '../../utils/converter';\r\nimport {\r\n getAllSchedules,\r\n getSchedules\r\n} from '../../apis/schedule';\r\n\r\nexport interface State {\r\n byId: Dictionary; // provider + date + time\r\n loading: Dictionary;\r\n}\r\n\r\nexport const schedules = createModel({\r\n state: {\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: MixType,\r\n loadingKey?: string\r\n ): State => {\r\n if (shouldUpdateState(data, loadingKey)) {\r\n return {\r\n ...state,\r\n byId: {\r\n ...state.byId,\r\n ...storeData(data, ['providerId', 'date', 'time'])\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n } else {\r\n return state;\r\n }\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getAllSchedulesAsync(date: string) {\r\n const loadingKey = `-${date}`;\r\n this.loading(loadingKey, true);\r\n try {\r\n const data = await getAllSchedules(date);\r\n this.update(data, loadingKey);\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(loadingKey, false);\r\n }\r\n },\r\n async getSchedulesAsync(payload: { providerId: number, date: string }) {\r\n const loadingKey = [payload.providerId, payload.date].join('-');\r\n this.loading(loadingKey, true);\r\n try {\r\n const data = await getSchedules(payload.providerId, payload.date);\r\n this.update(data, loadingKey);\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(loadingKey, false);\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport {\r\n Dispatch,\r\n RootState\r\n} from '../../store';\r\nimport { Snomed } from '../../models/snomed';\r\nimport {\r\n getSnomeds,\r\n searchSnomeds\r\n} from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: string[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n searchedTextHash: Dictionary;\r\n}\r\n\r\nexport const snomeds = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {},\r\n searchedTextHash: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByConceptId(state.byId, data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => (byId[a]!.term || '') > (byId[b]!.term || '') ? 1 : -1)\r\n .map(x => x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n }),\r\n setSearched: (state: State, text: string): State => ({\r\n ...state,\r\n searchedTextHash: {\r\n ...state.searchedTextHash,\r\n [text]: true\r\n }\r\n })\r\n },\r\n effects: dispatch => ({\r\n async getSnomedsAsync(\r\n payload: {\r\n conceptIds: Undefinable[];\r\n active: boolean;\r\n },\r\n rootState: RootState\r\n ) {\r\n const { snomedCategories } = dispatch as Dispatch;\r\n const notExistedIds = selectors.getOtherSnomedIds(rootState.snomeds, payload.conceptIds);\r\n if (notExistedIds.length > 0) {\r\n try {\r\n const data = await getSnomeds(notExistedIds, payload.active);\r\n this.update(data);\r\n\r\n // Collect related data\r\n snomedCategories.getSnomedCategoriesAsync();\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n },\r\n async searchSnomedsAsync(text: string, rootState: RootState) {\r\n const loading = selectors.getLoading(rootState.snomeds, `searchSnomedsAsync---${text}`);\r\n if (!loading && !selectors.checkSearched(rootState.snomeds, text)) {\r\n this.loading(`searchSnomedsAsync---${text}`, true);\r\n const data = await searchSnomeds(text);\r\n this.update(data, `searchSnomedsAsync---${text}`);\r\n this.loading(`searchSnomedsAsync---${text}`, false);\r\n this.setSearched(text);\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst storeByConceptId = (initialById: Dictionary, data: Undefinable>): Dictionary => {\r\n const byId = {} as Dictionary;\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n for (let i = 0; i < data.length; i++) {\r\n if (byId[data[i].conceptId]) {\r\n byId[data[i].conceptId]!.relatedIds!.push(data[i].id);\r\n } else {\r\n byId[data[i].conceptId] = {\r\n ...initialById[data[i].conceptId],\r\n ...data[i],\r\n relatedIds: [data[i].id]\r\n };\r\n }\r\n }\r\n } else {\r\n byId[data.conceptId] = {\r\n ...initialById[data.conceptId],\r\n ...data,\r\n relatedIds: [data.id]\r\n };\r\n }\r\n }\r\n return byId;\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { SnomedCategory } from '../../models/snomed-category';\r\nimport { getSnomedCategories } from '../../apis/emr-data';\r\n\r\ninterface ProcessData {\r\n byType: Dictionary;\r\n byId: Dictionary;\r\n}\r\n\r\nexport interface State {\r\n byType: Dictionary;\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const snomedCategories = createModel({\r\n state: {\r\n byType: {},\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable,\r\n loadingKey?: string\r\n ): State => {\r\n const processedData = processData(data);\r\n return {\r\n ...state,\r\n byType: {\r\n ...state.byType,\r\n ...processedData.byType\r\n },\r\n byId: {\r\n ...state.byId,\r\n ...processedData.byId\r\n },\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getSnomedCategoriesAsync(_: Undefinable<{}>, rootState: RootState) {\r\n if (!selectors.checkLoaded(rootState.snomedCategories)) {\r\n try {\r\n const data = await getSnomedCategories();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n\r\nconst processData = (data: Undefinable>): ProcessData => {\r\n const byType = {} as Dictionary;\r\n const byId = {} as Dictionary;\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n data.sort((a, b) => (a.recommendedAssessmentText || '') > (b.recommendedAssessmentText || '') ? 1 : -1);\r\n for (let i = 0; i < data.length; i++) {\r\n if (!byType[data[i].categoryTypeId]) {\r\n byType[data[i].categoryTypeId] = [];\r\n }\r\n byType[data[i].categoryTypeId]!.push(data[i].code);\r\n byId[data[i].code] = data[i];\r\n }\r\n } else {\r\n byType[data.categoryTypeId] = [data.code];\r\n byId[data.code] = data;\r\n }\r\n }\r\n\r\n return {\r\n byType,\r\n byId\r\n };\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { SpecialtyModel } from '../../models/specialty';\r\nimport { storeData } from '../../utils/converter';\r\nimport { getSpecialties } from '../../apis/emr-data';\r\n\r\nexport interface State {\r\n allIds: number[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const specialties = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: SpecialtyModel[],\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeData(data, 'id')\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId).map(x => +x),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getSpecialtiesAsync(_: Undefinable<{}>, rootState: RootState) {\r\n if (selectors.getSpecialtyIds(rootState.specialties).length === 0) {\r\n try {\r\n const data = await getSpecialties();\r\n this.update(data);\r\n } catch (e) {\r\n window.console.log(e);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import { createModel } from '@rematch/core';\r\nimport { Statement } from '../../models/statement';\r\nimport { storeById } from '../../utils/converter';\r\nimport {\r\n getStatementAsync,\r\n getStatementsAsync\r\n} from '../../apis/statement';\r\n\r\nexport interface State {\r\n allIds: string[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const statements = createModel({\r\n state: {\r\n allIds: [],\r\n byId: {},\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: Undefinable>,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeById(data)\r\n };\r\n return {\r\n ...state,\r\n ...Object.keys(byId).length > state.allIds.length && {\r\n allIds: Object.keys(byId)\r\n .sort((a, b) => byId[a]!.statementDate > byId[b]!.statementDate ? 1 : -1)\r\n },\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getStatementsAsync() {\r\n this.loading('getStatementsAsync', true);\r\n try {\r\n const response = await getStatementsAsync();\r\n if (response.success) {\r\n this.update(response.data, 'getStatementsAsync');\r\n } else {\r\n window.console.log(response.message);\r\n window.alert('Get statement failed');\r\n this.loading('getStatementsAsync', false);\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getStatementsAsync', false);\r\n }\r\n },\r\n async getStatementAsync(id: string) {\r\n this.loading(`getStatementAsync---${id}`, true);\r\n try {\r\n const response = await getStatementAsync(id);\r\n if (response.success) {\r\n this.update(response.data, `getStatementAsync---${id}`);\r\n } else {\r\n window.console.log(response.message);\r\n window.alert('Get statement failed');\r\n this.loading(`getStatementAsync---${id}`, false);\r\n }\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading(`getStatementAsync---${id}`, false);\r\n }\r\n }\r\n })\r\n});\r\n","import axios from 'axios';\r\nimport { User } from '../models/user';\r\n\r\nconst locked = {\r\n getUsers: false\r\n};\r\n\r\nexport const getUsers = async (): Promise> => {\r\n if (!locked.getUsers) {\r\n locked.getUsers = true;\r\n const response = await axios.get(`/api/user`);\r\n locked.getUsers = false;\r\n return response.data;\r\n }\r\n};\r\n","import { createModel } from '@rematch/core';\r\nimport { selectors } from './selector';\r\nimport { RootState } from '../../store';\r\nimport { User } from '../../models/user';\r\nimport { storeByIMPSId } from '../../utils/converter';\r\nimport { getUsers } from '../../apis/user';\r\n\r\nexport interface State {\r\n allIds: string[];\r\n byId: Dictionary;\r\n loading: Dictionary;\r\n}\r\n\r\nexport const users = createModel({\r\n state: {\r\n allIds: ['system'],\r\n byId: {\r\n system: {\r\n impsId: 'system',\r\n lastName: 'Prominis' // temp\r\n } as User\r\n },\r\n loading: {}\r\n },\r\n reducers: {\r\n update: (\r\n state: State,\r\n data: MixType,\r\n loadingKey?: string\r\n ): State => {\r\n const byId = {\r\n ...state.byId,\r\n ...storeByIMPSId(data)\r\n };\r\n return {\r\n ...state,\r\n allIds: Object.keys(byId),\r\n byId: byId,\r\n ...loadingKey && {\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: false\r\n }\r\n }\r\n };\r\n },\r\n loading: (\r\n state: State,\r\n loadingKey: string,\r\n loading: boolean\r\n ): State => ({\r\n ...state,\r\n loading: {\r\n ...state.loading,\r\n [loadingKey]: loading\r\n }\r\n })\r\n },\r\n effects: () => ({\r\n async getUsersAsync(\r\n _: Undefinable<{}>,\r\n rootState: RootState\r\n ) {\r\n if (\r\n !selectors.getLoading(rootState.users, 'getUsersAsync') &&\r\n selectors.getUserIds(rootState.users).length <= 1\r\n ) {\r\n this.loading('getUsersAsync', true);\r\n try {\r\n const data = await getUsers();\r\n this.update(data, 'getUsersAsync');\r\n } catch (e) {\r\n window.console.log(e);\r\n this.loading('getUsersAsync', false);\r\n }\r\n }\r\n }\r\n })\r\n});\r\n","import moment from 'moment';\r\nimport {\r\n\tinit,\r\n\tRematchRootState,\r\n} from '@rematch/core';\r\nimport createLoadingPlugin from '@rematch/loading';\r\nimport createRematchPersist from '@rematch/persist';\r\nimport * as models from './rematch-models';\r\n\r\nconst currentKey = String(moment().weeks());\r\nconst keyPrefix = 'store';\r\n\r\n// clear old store\r\nconst obsoleteKeys = Object.keys(window.localStorage).filter(x => x.startsWith(keyPrefix) && !x.endsWith(currentKey));\r\nobsoleteKeys.forEach(x => window.localStorage.removeItem(x));\r\n\r\nconst persistPlugin = createRematchPersist({\r\n\tkey: currentKey,\r\n\twhitelist: [\r\n\t\t'cdcCVXs',\r\n\t\t'compositeAllergies',\r\n\t\t'compositeDrugs',\r\n\t\t'icd10s',\r\n\t\t'nlmPatientEducationDefinitions',\r\n\t\t'phvs',\r\n\t\t'questOrderCodes',\r\n\t\t'snomeds',\r\n\t\t'specialties'\r\n\t],\r\n\t// throttle: 5000,\r\n\tversion: 1,\r\n\tkeyPrefix: keyPrefix\r\n});\r\n\r\nconst loading = createLoadingPlugin({\r\n\twhitelist: [\r\n\t\t'appointments/getPastAppointmentsAsync',\r\n\t\t'appointments/getUpcomingAppointmentsAsync'\r\n\t]\r\n});\r\n\r\nexport const store = init({\r\n\tmodels: models,\r\n\tplugins: [\r\n\t\tloading,\r\n\t\tpersistPlugin\r\n\t]\r\n});\r\n\r\nexport type Store = typeof store;\r\nexport type Dispatch = typeof store.dispatch;\r\nexport type RootState = RematchRootState;\r\n","import React from 'react';\r\nimport {\r\n BrowserRouter,\r\n Route,\r\n Switch,\r\n} from 'react-router-dom';\r\nimport Loading from './components/shared/Loading';\r\nconst Account = React.lazy(() => import('./pages/account'));\r\nconst PatientPortal = React.lazy(() => import('./pages/patient-portal'));\r\n// const PortalGateway = React.lazy(() => import('./pages/portal-gateway'));\r\n\r\nconst App: React.FC = React.memo(() => (\r\n \r\n }>\r\n \r\n \r\n {/* */}\r\n \r\n \r\n \r\n \r\n));\r\n\r\nexport default App;\r\n","export const appConfig = {\r\n BILLING_ADDRESS: process.env.REACT_APP_URL_BILLING,\r\n ROLLBAR_ACCESS_TOKEN: process.env.REACT_APP_ROLLBAR_ACCESS_TOKEN,\r\n};\r\n","import React from 'react';\r\nimport {\r\n ErrorBoundary,\r\n Provider,\r\n} from '@rollbar/react';\r\nimport { appConfig } from './appConfig';\r\n\r\nconst ErrorDisplay: React.FC = React.memo(() => (\r\n

Something went wrong.

\r\n));\r\n\r\nconst Rollbar: React.FC = React.memo(({\r\n children,\r\n}) => (\r\n \r\n \r\n {children}\r\n \r\n \r\n));\r\n\r\nexport default Rollbar;\r\n","/// \r\n/// \r\n\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { Provider } from 'react-redux';\r\nimport { store } from './store';\r\nimport App from './App';\r\nimport Rollbar from './Rollbar';\r\nimport './configGlobal';\r\n\r\nReactDOM.render(\r\n (\r\n \r\n \r\n \r\n \r\n \r\n ),\r\n document.getElementById('root'),\r\n);\r\n","export const mobileRegExp = /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;\r\nexport const tabletRegExp = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i;\r\n\r\nexport const phoneRegExp = /((\\\\+[1-9]{1,4}[ \\\\-]*)|(\\\\([0-9]{2,3}\\\\)[ \\\\-]*)|([0-9]{2,4})[ \\\\-]*)*?[0-9]{3,4}?[ \\\\-]*[0-9]{3,4}?/;\r\nexport const emailRegExp = /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/;\r\n","export default class IMPSBaseModel {\r\n impsId: number = 0;\r\n}\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { CompositeAllergy } from '../../models/composite-allergy';\r\n\r\nconst getCompositeAllergyIdsByTextSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n text: Undefinable\r\n ) => {\r\n const textLower = (text || '').toLowerCase();\r\n return Object\r\n .keys(byId)\r\n .filter(x => byId[x] && byId[x]!.description.toLowerCase().startsWith(textLower))\r\n .map(x => +x);\r\n })\r\n);\r\n\r\nconst getOtherCompositeAllergyIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as number[])\r\n);\r\n\r\nexport const selectors = {\r\n checkSearched: (\r\n state: State,\r\n text: string\r\n ): boolean => state.searchedTextHash[text] || false,\r\n getCompositeAllergy: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getCompositeAllergyIds: (\r\n state: State\r\n ): number[] => state.allIds,\r\n getCompositeAllergyIdsByText: (\r\n state: State,\r\n text: Undefinable\r\n ): number[] => getCompositeAllergyIdsByTextSelector(state)(text),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherCompositeAllergyIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => getOtherCompositeAllergyIdsSelector(state)(ids)\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { CompositeDrug } from '../../models/composite-drug';\r\n\r\nconst getCompositeDrugFormulationsSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (state: State) => state.byMedNameId,\r\n (byMedId: Dictionary, byMedNameId: Dictionary) => memoize((\r\n medNameId: Undefinable\r\n ) => memoize((\r\n medStrength: Undefinable\r\n ) => Array.from(new Set((byMedNameId[medNameId || ''] || [])\r\n .filter(x => byMedId[x]!.medStrength === medStrength)\r\n .map(x => byMedId[x]!.medDoseForm)))\r\n ))\r\n);\r\n\r\nconst getCompositeDrugMedNameIdsByTextSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (state: State) => state.byMedNameId,\r\n (byMedId: Dictionary, byMedNameId: Dictionary) => memoize((\r\n text: Undefinable\r\n ) => {\r\n const textLower = (text || '').toLowerCase();\r\n return Object.keys(byMedNameId)\r\n .filter(x => {\r\n const compositeDrug = byMedId[Array.from(byMedNameId[x]!)[0] || ''];\r\n return compositeDrug && compositeDrug.medName.toLowerCase().startsWith(textLower);\r\n })\r\n .map(x => +x);\r\n })\r\n);\r\n\r\nconst getCompositeDrugRouteSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (state: State) => state.byMedNameId,\r\n (byMedId: Dictionary, byMedNameId: Dictionary) => memoize((\r\n medNameId: Undefinable\r\n ) => memoize((\r\n medStrength: Undefinable\r\n ) => memoize((\r\n medDoseForm: Undefinable\r\n ) => Array.from(new Set((byMedNameId[medNameId || ''] || [])\r\n .filter(x => byMedId[x]!.medStrength === medStrength && byMedId[x]!.medDoseForm === medDoseForm)\r\n .map(x => byMedId[x]!.medRoute)))\r\n )))\r\n);\r\n\r\nconst getCompositeDrugStrengthSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (state: State) => state.byMedNameId,\r\n (byMedId: Dictionary, byMedNameId: Dictionary) => memoize((\r\n medNameId: Undefinable\r\n ) => Object.values((byMedNameId[medNameId || ''] || [])\r\n .filter(x => byMedId[x]!.medStrength)\r\n .reduce(\r\n (prevValue, curr) => {\r\n if (byMedId[curr]!.medStrength) {\r\n prevValue[byMedId[curr]!.medStrength!] = [byMedId[curr]!.medStrength || '', byMedId[curr]!.medStrengthUnit || ''];\r\n }\r\n return prevValue;\r\n },\r\n {}\r\n )) as string[][]\r\n )\r\n);\r\n\r\nconst getOtherCompositeDrugIdsSelector = createSelector(\r\n (state: State) => state.byMedId,\r\n (byMedId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byMedId[x]) as number[])\r\n);\r\n\r\nexport const selectors = {\r\n checkSearched: (\r\n state: State,\r\n text: string\r\n ): boolean => state.searchedTextHash[text] || false,\r\n getCompositeDrug: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byMedId[id || ''],\r\n getCompositeDrugByMedNameId: (\r\n state: State,\r\n medNameId: Undefinable\r\n ): Undefinable => state.byMedId[(state.byMedNameId[medNameId || ''] || [])[0] || ''],\r\n getCompositeDrugFormulations: (\r\n state: State,\r\n medNameId: Undefinable,\r\n medStrength: Undefinable\r\n ): string[] => getCompositeDrugFormulationsSelector(state)(medNameId)(medStrength),\r\n getCompositeDrugIdHash: (\r\n state: State\r\n ): Dictionary => state.byCode,\r\n getCompositeDrugMedNameIdsByText: (\r\n state: State,\r\n text: Undefinable\r\n ): number[] => getCompositeDrugMedNameIdsByTextSelector(state)(text),\r\n getCompositeDrugRoute: (\r\n state: State,\r\n medNameId: Undefinable,\r\n medStrength: Undefinable,\r\n medDoseForm: Undefinable\r\n ): string[] => getCompositeDrugRouteSelector(state)(medNameId)(medStrength)(medDoseForm),\r\n getCompositeDrugStrength: (\r\n state: State,\r\n medNameId: Undefinable\r\n ): string[][] => getCompositeDrugStrengthSelector(state)(medNameId),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherCompositeDrugIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => getOtherCompositeDrugIdsSelector(state)(ids)\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { ICD10 } from '../../models/icd10';\r\n\r\nconst getOtherICD10IdsSelector = createSelector(\r\n (state: State) => state.byCode,\r\n (byCode: Dictionary) => memoize((\r\n codes: Undefinable[]\r\n ) => codes.filter(x => x && !byCode[x]) as string[])\r\n);\r\n\r\nexport const selectors = {\r\n checkSearched: (\r\n state: State,\r\n text: string\r\n ): boolean => state.searchedTextHash[text] || false,\r\n getICD10: (\r\n state: State,\r\n code: Undefinable\r\n ): Undefinable => state.byCode[code || ''],\r\n getICD10Hash: (\r\n state: State\r\n ): Dictionary => state.byCode,\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getLoadingHash: (\r\n state: State\r\n ): Dictionary => state.loading,\r\n getOtherICD10Ids: (\r\n state: State,\r\n codes: Undefinable[]\r\n ): string[] => getOtherICD10IdsSelector(state)(codes)\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Snomed } from '../../models/snomed';\r\n\r\nconst getOtherSnomedIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n conceptIds: Undefinable[]\r\n ) => conceptIds.filter(x => x && !byId[x]) as number[])\r\n);\r\n\r\nconst getSnomedIdsByTextSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n text: Undefinable\r\n ) => {\r\n const textLower = (text || '').toLowerCase();\r\n return Object\r\n .keys(byId)\r\n .filter(x => byId[x] && (byId[x]!.term || '').toLowerCase().startsWith(textLower))\r\n .map(x => +x);\r\n })\r\n);\r\n\r\nexport const selectors = {\r\n checkSearched: (\r\n state: State,\r\n text: string\r\n ): boolean => state.searchedTextHash[text] || false,\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherSnomedIds: (\r\n state: State,\r\n conceptIds: Undefinable[]\r\n ): number[] => getOtherSnomedIdsSelector(state)(conceptIds),\r\n getSnomed: (\r\n state: State,\r\n code: Undefinable\r\n ): Undefinable => state.byId[code || ''],\r\n getSnomedIds: (\r\n state: State\r\n ): string[] => state.allIds,\r\n getSnomedIdsByText: (\r\n state: State,\r\n text: string\r\n ): number[] => getSnomedIdsByTextSelector(state)(text)\r\n};\r\n","import { State } from '.';\r\nimport { DosageFormType } from '../../models/dosage-form-type';\r\n\r\nexport const selectors = {\r\n getDosageFormType: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getDosageFormTypeIds: (\r\n state: State\r\n ): string[] => state.allIds,\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { FacilityModel } from '../../models/facility';\r\n\r\nconst getOtherFacilityIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as number[])\r\n);\r\n\r\nexport const selectors = {\r\n getFacility: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getFacilityIds: (\r\n state: State\r\n ): number[] => state.allIds,\r\n getOtherFacilityIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => getOtherFacilityIdsSelector(state)(ids)\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { ItemModel } from '../../models/item';\r\n\r\nconst getVisitTypeIdsSelector = createSelector(\r\n (state: State) => state.byVisitTypeId,\r\n (byVisitTypeId: Dictionary) => memoize((\r\n isNewPatient: boolean\r\n ) => Object\r\n .keys(byVisitTypeId)\r\n .filter(x => isNewPatient === (byVisitTypeId[x]!.itemText || '').startsWith('new patient'))\r\n .map(x => +x)\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getVisitStatus: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byVisitStatusId[id || ''],\r\n getVisitStatusIds: (\r\n state: State\r\n ): number[] => state.allVisitStatusIds,\r\n getVisitType: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byVisitTypeId[id || ''],\r\n getVisitTypeIds: (\r\n state: State,\r\n isNewPatient?: boolean\r\n ): number[] => typeof isNewPatient === 'undefined' ?\r\n state.allVisitTypeIds :\r\n getVisitTypeIdsSelector(state)(isNewPatient)\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Payer } from '../../models/payer';\r\n\r\nconst getOtherPayerIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as number[])\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherPayerIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => getOtherPayerIdsSelector(state)(ids),\r\n getPayer: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getPayerHash: (\r\n state: State\r\n ): Dictionary => state.byId,\r\n getPayerIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import { State } from '.';\r\nimport { PaymentCard } from '../../models/payment-card';\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getPaymentCard: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id === 'primary' ? state.primaryId : (id || '')],\r\n getPaymentCardIds: (\r\n state: State\r\n ): string[] => state.allIds,\r\n getPrimaryCardId: (\r\n state: State\r\n ): string => state.primaryId\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { ProviderModel } from '../../models/provider';\r\n\r\nconst getOtherProviderIdsBySpecialtyIdSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n specialtyId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => specialtyId && !byId[x]!.specialtyIds.includes(specialtyId))\r\n .map(x => +x)\r\n )\r\n);\r\n\r\nconst getProviderIdsBySpecialtyIdSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n specialtyId: Undefinable\r\n ) => Object\r\n .keys(byId)\r\n .filter(x => !specialtyId || byId[x]!.specialtyIds.includes(specialtyId))\r\n .sort((a, b) => {\r\n const lastNameLowerA = (byId[a]!.lastName || '').toLowerCase();\r\n const lastNameLowerB = (byId[b]!.lastName || '').toLowerCase();\r\n if (lastNameLowerA === lastNameLowerB) {\r\n return (byId[a]!.firstName || '').toLowerCase() > (byId[b]!.firstName || '').toLowerCase() ? 1 : -1;\r\n } else {\r\n return lastNameLowerA > lastNameLowerB ? 1 : -1;\r\n }\r\n })\r\n .map(x => +x)\r\n )\r\n);\r\n\r\nexport const selectors = {\r\n getOtherProviderIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => ids.filter(x => x && !state.byId[x]) as number[],\r\n getOtherProviderIdsBySpecialtyId: (\r\n state: State,\r\n specialtyId: Undefinable\r\n ): number[] => getOtherProviderIdsBySpecialtyIdSelector(state)(specialtyId),\r\n getProvider: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getProviderIds: (\r\n state: State\r\n ): number[] => state.allIds,\r\n getProviderIdsBySpecialtyId: (\r\n state: State,\r\n specialtyId: Undefinable\r\n ): number[] => getProviderIdsBySpecialtyIdSelector(state)(specialtyId)\r\n};\r\n","import { State } from '.';\r\nimport { User } from '../../models/user';\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getUser: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getUserHash: (\r\n state: State\r\n ): Dictionary => state.byId,\r\n getUserIds: (\r\n state: State\r\n ): string[] => state.allIds\r\n};\r\n","export function convertPascalCaseToCamelCase(data: {}): {} {\r\n if (!data) {\r\n return data;\r\n }\r\n if (typeof (data) !== 'object') {\r\n return data;\r\n }\r\n if (Array.isArray(data)) {\r\n return data.map(e => convertPascalCaseToCamelCase(e));\r\n }\r\n\r\n let result = {};\r\n for (let key of Object.keys(data)) {\r\n result[convertNamePascalCaseToCamelCase(key)] = convertPascalCaseToCamelCase(data[key]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nexport function convertNamePascalCaseToCamelCase(name: string) {\r\n if (typeof (name) !== 'string') {\r\n throw new Error('Invalid argument');\r\n }\r\n\r\n if (!name.length) {\r\n return name;\r\n }\r\n\r\n let firstWordEndIndex = name.search(/[^A-Z][A-Z]/);\r\n\r\n if (firstWordEndIndex >= 0) { // Found 2nd word\r\n return name.slice(0, firstWordEndIndex + 1).toLowerCase() // First word\r\n + name.slice(firstWordEndIndex + 1); // Remaining \r\n }\r\n\r\n // else: so we known it must be either First, DOB or DOBFirst?\r\n let firstLowserCaseIndex = name.search(/[a-z]/);\r\n\r\n if (firstLowserCaseIndex < 0) { // So, it is DOB\r\n return name.toLowerCase();\r\n }\r\n\r\n if (firstLowserCaseIndex === 1) { // So, it is First\r\n return name.toLowerCase();\r\n }\r\n\r\n // Else: It is DOBFirst\r\n return name.slice(0, firstLowserCaseIndex - 1).toLowerCase() // First word\r\n + name.slice(firstLowserCaseIndex - 1); // Remaining\r\n}\r\n","export * from './calculator';\r\nexport * from './constant';\r\nexport * from './converter';\r\nexport * from './formatter';\r\nexport * from './helper';\r\nexport * from './local-storage';\r\nexport * from './mapper';\r\nexport * from './naming';\r\nexport * from './numeric';\r\nexport * from './print';\r\nexport * from './regex';\r\nexport * from './validation';\r\nexport * from './validation-schema';\r\n","import { State } from '.';\r\nimport { CDCCVX } from '../../models/cdc-cvx';\r\n\r\nexport const selectors = {\r\n getCDCCVX: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getCDCCVXIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import BaseModel from '../models/base-model';\r\nimport IMPSBaseModel from '../models/imps-base-model';\r\n\r\nexport const shouldUpdateState = (\r\n data: Undefinable>,\r\n loadingKey: Undefinable\r\n) => loadingKey || (Array.isArray(data) ? data.length > 0 : !!data);\r\n\r\nexport const storeData = (\r\n data: Undefinable>,\r\n key: keyof T | (keyof T)[]\r\n): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n const mergeId = getMergeId(x, key);\r\n if (mergeId) {\r\n prev[mergeId] = x;\r\n }\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n const mergeId = getMergeId(data, key);\r\n if (mergeId) {\r\n return {\r\n [mergeId]: data\r\n } as Dictionary;\r\n }\r\n }\r\n }\r\n return {} as Dictionary;\r\n};\r\n\r\nexport const storeById = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.id] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.id]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n\r\nexport const storeByIdConvert = (data: Undefinable>, convertFunc: (param: T) => K): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.id] = convertFunc(x);\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.id]: convertFunc(data)\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n\r\nexport const storeByIMPSId = (data: Undefinable>): Dictionary => {\r\n if (data) {\r\n if (Array.isArray(data)) {\r\n return data.reduce(\r\n (prev, x) => {\r\n prev[x.impsId] = x;\r\n return prev;\r\n },\r\n {} as Dictionary\r\n );\r\n } else {\r\n return {\r\n [data.impsId]: data\r\n } as Dictionary;\r\n }\r\n } else {\r\n return {} as Dictionary;\r\n }\r\n};\r\n\r\nexport const JsonParse = (data: Undefinable | null): T => {\r\n return JSON.parse(data || '{}') as T;\r\n};\r\n\r\nconst getMergeId = (\r\n data: T,\r\n key: keyof T | (keyof T)[]\r\n): string => {\r\n if (Array.isArray(key)) {\r\n return key.map(x => data[x] || '').join('---');\r\n } else {\r\n return String(data[key] || '');\r\n }\r\n};\r\n","import { State } from '.';\r\nimport { CounselingType } from '../../models/counseling-type';\r\n\r\nexport const selectors = {\r\n getCounselingType: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getCounselingTypeIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import { State } from '.';\r\nimport { ImagingFacility } from '../../models/imaging-facility';\r\n\r\nexport const selectors = {\r\n getImagingFacility: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getImagingFacilityIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","const deg2rad = (deg: number): number => {\r\n return deg * (Math.PI / 180);\r\n};\r\n\r\nexport const getDistanceFromLatLonInKm = (\r\n lat1: Undefinable,\r\n lon1: Undefinable,\r\n lat2: Undefinable,\r\n lon2: Undefinable\r\n): Undefinable => {\r\n if (lat1 && lon1 && lat2 && lon2) {\r\n const R = 6371; // Radius of the earth in km\r\n const dLat = deg2rad(lat2 - lat1);\r\n const dLon = deg2rad(lon2 - lon1);\r\n const a =\r\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\r\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\r\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\r\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\r\n const d = R * c; // Distance in km\r\n return d;\r\n }\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Lab } from '../../models/lab';\r\n\r\nconst getInhouseLabSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => Object\r\n .values(byId)\r\n .find(x => x && x.inHouse)\r\n);\r\n\r\nconst getLabByNameSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n name: string\r\n ) => {\r\n const nameLower = name.toLowerCase();\r\n return Object\r\n .values(byId)\r\n .find(x => x!.labName && x!.labName.toLowerCase() === nameLower);\r\n })\r\n);\r\n\r\nexport const selectors = {\r\n getInhouseLab: (\r\n state: State\r\n ): Undefinable => getInhouseLabSelector(state),\r\n getLab: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getLabByName: (\r\n state: State,\r\n name: string\r\n ): Undefinable => getLabByNameSelector(state)(name),\r\n getLabIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { LabCorpEdifecsStandardCompendium } from '../../models/lab-corp-edifecs-standard-compendium';\r\n\r\nconst getOtherLabCorpEdifecsStandardCompendiumIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as string[])\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherLabCorpEdifecsStandardCompendiumIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): string[] => getOtherLabCorpEdifecsStandardCompendiumIdsSelector(state)(ids),\r\n getLabCorpEdifecsStandardCompendium: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || '']\r\n};\r\n","import { State } from '.';\r\nimport { LabTestCode } from '../../models/lab-test-code';\r\n\r\nexport const selectors = {\r\n getLabTestCode: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getLabTestCodeIds: (\r\n state: State\r\n ): string[] => state.allIds\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Message } from '../../models/message';\r\n\r\nconst getLatestMessageSelector = createSelector(\r\n (state: State) => state.allIds,\r\n (state: State) => state.byId,\r\n (allIds: number[], byId: Dictionary) => memoize((\r\n userId: Undefinable\r\n ) => {\r\n const ids = allIds.filter(x => byId[x] && (userId === byId[x]!.belongToUserId));\r\n return byId[ids[ids.length - 1] || ''];\r\n })\r\n);\r\n\r\nconst getMessageIdsSelector = createSelector(\r\n (state: State) => state.allIds,\r\n (state: State) => state.byId,\r\n (allIds: number[], byId: Dictionary) => memoize((\r\n rootMessageId: Undefinable\r\n ) => allIds.filter(x => byId[x] && (rootMessageId === x || rootMessageId === byId[x]!.parentId)))\r\n);\r\n\r\nconst getRootMessageIdsSelector = createSelector(\r\n (state: State) => state.allIds,\r\n (state: State) => state.byId,\r\n (allIds: number[], byId: Dictionary) => allIds\r\n .filter(x => byId[x] && !byId[x]!.parentId)\r\n .sort((a, b) => b - a)\r\n);\r\n\r\nconst getUnreadMessageIdsSelector = createSelector(\r\n (state: State) => state.allIds,\r\n (state: State) => state.byId,\r\n (allIds: number[], byId: Dictionary) => {\r\n const userUnreadMessageDict = allIds.reduce(\r\n (prevValue, curr) => {\r\n if (!byId[curr]!.read) {\r\n prevValue[byId[curr]!.belongToUserId] = byId[curr]!;\r\n }\r\n return prevValue;\r\n },\r\n {} as Dictionary\r\n );\r\n return Object\r\n .keys(userUnreadMessageDict)\r\n .map(x => userUnreadMessageDict[x]!.impsId)\r\n .sort((a, b) => b - a);\r\n }\r\n);\r\n\r\nexport const selectors = {\r\n getLatestMessage: (\r\n state: State,\r\n userId: Undefinable\r\n ): Undefinable => getLatestMessageSelector(state)(userId),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getMessage: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getMessageIds: (\r\n state: State,\r\n rootMessageId: Undefinable\r\n ): number[] => getMessageIdsSelector(state)(rootMessageId),\r\n getRootMessageIds: (\r\n state: State,\r\n ): number[] => getRootMessageIdsSelector(state),\r\n getUnreadMessageIds: (\r\n state: State\r\n ): number[] => getUnreadMessageIdsSelector(state),\r\n getUserIds: (\r\n state: State\r\n ): string[] => state.userIds\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n Message,\r\n MessageResult,\r\n MessageListResult\r\n} from '../models/message';\r\n\r\nconst locked = {\r\n getMessages: false,\r\n getUnreadMessages: false\r\n};\r\n\r\nexport const sendRequestRefills = async (medIds: number[]): Promise => {\r\n await axios.post(`/api/messaging-msg/send-request-refill`, medIds);\r\n};\r\n\r\nexport const createChatMessage = async (message: Message): Promise => {\r\n const response = await axios.post(`/api/messaging-msg/chat`, message);\r\n return response.data;\r\n};\r\n\r\nexport const getMessages = async (\r\n rootMessageId: Undefinable,\r\n time: Undefinable\r\n): Promise> => {\r\n if (!locked.getMessages) {\r\n locked.getMessages = true;\r\n try {\r\n const response = await axios.get(`/api/messaging-msg/params?rootMessageId=${rootMessageId}&time=${time}`);\r\n locked.getMessages = false;\r\n return response.data;\r\n } catch (e) {\r\n locked.getMessages = false;\r\n throw e;\r\n }\r\n }\r\n};\r\n\r\nexport const getUnreadMessages = async (): Promise> => {\r\n if (!locked.getUnreadMessages) {\r\n locked.getUnreadMessages = true;\r\n try {\r\n const response = await axios.get(`/api/messaging-msg/unread`);\r\n locked.getUnreadMessages = false;\r\n return response.data;\r\n } catch (e) {\r\n locked.getUnreadMessages = false;\r\n throw e;\r\n }\r\n }\r\n};\r\n\r\nexport const readMessages = async (rootMessageId: number): Promise => {\r\n const response = await axios.post(`/api/messaging-msg/read/${rootMessageId}`);\r\n return response.data;\r\n};\r\n\r\nexport const getRootMessages = async (): Promise> => {\r\n const response = await axios.get(`/api/messaging-msg/root-message`);\r\n return response.data;\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { NLMPatientEducationDefinition } from '../../models/nlm-patient-education-definition';\r\n\r\nconst getOtherNLMPatientEducationDefinitionIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as number[])\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherNLMPatientEducationDefinitionIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): number[] => getOtherNLMPatientEducationDefinitionIdsSelector(state)(ids),\r\n getNLMPatientEducationDefinition: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || '']\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { Pharmacy } from '../../models/pharmacy';\r\n\r\nconst getPharmacyIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n text: Undefinable\r\n ) => {\r\n const keywords = (text || '').toLowerCase().split(' ').filter(x => x);\r\n return Object\r\n .keys(byId)\r\n .filter(x => {\r\n if (byId[x]!.fT_cols) {\r\n const lower = byId[x]!.fT_cols!.toLowerCase();\r\n return keywords.every(t => lower.indexOf(t) > -1);\r\n } else {\r\n return false;\r\n }\r\n });\r\n })\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getLoadingHash: (\r\n state: State\r\n ): Dictionary => state.loading,\r\n getPharmacy: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getPharmacyHash: (\r\n state: State\r\n ): Dictionary => state.byId,\r\n getPharmacyIds: (\r\n state: State,\r\n text: Undefinable\r\n ): Undefinable => getPharmacyIdsSelector(state)(text)\r\n};\r\n","import IMPSBaseModel from './imps-base-model';\r\nimport { ServiceResult } from './service-result';\r\n\r\nexport enum PatientPortalDataType {\r\n // Appointment\r\n VisitReason = 'VisitReason',\r\n\r\n // Patient information\r\n PatientPhoneNumber = 'PatientPhoneNumber',\r\n PatienEmergencyContact = 'PatienEmergencyContact',\r\n PatientInsurance = 'PatientInsurance',\r\n PatientPharmacy = 'PatientPharmacy',\r\n\r\n // Medical information\r\n Allergy = 'Allergy',\r\n DrinkingHistory = 'DrinkingHistory',\r\n DrugAbuseHistory = 'DrugAbuseHistory',\r\n FamilyHistory = 'FamilyHistory',\r\n FallHistory = 'FallHistory',\r\n Medication = 'Medication',\r\n PastMedicalHistory = 'PastMedicalHistory',\r\n SmokingHistory = 'SmokingHistory',\r\n SocialHistory = 'SocialHistory',\r\n VitalSign = 'VitalSign'\r\n}\r\n\r\nexport enum PatientPortalDataStatus {\r\n Accepted = 'Accepted',\r\n Pending = 'Pending',\r\n Rejected = 'Rejected'\r\n}\r\n\r\nexport enum PatientPortalDataAction {\r\n Created = 'Created',\r\n Deleted = 'Deleted',\r\n Updated = 'Updated'\r\n}\r\n\r\nexport class PatientPortalData extends IMPSBaseModel {\r\n appointmentId: Undefinable;\r\n relatedId: Undefinable;\r\n type: PatientPortalDataType;\r\n status: PatientPortalDataStatus;\r\n action: PatientPortalDataAction;\r\n metadata: string;\r\n dataModel: Object;\r\n\r\n createdDate: string;\r\n\r\n relatedCreatedDate: string;\r\n}\r\n\r\nexport type PatientPortalDataListResult = ServiceResult;\r\n","import { State } from '.';\r\nimport { ProcedureType } from '../../models/procedure-type';\r\n\r\nexport const selectors = {\r\n getProcedureType: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getProcedureTypeIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import { memoize } from 'lodash';\r\nimport { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport { QuestOrderCode } from '../../models/quest-order-code';\r\n\r\nconst getOtherQuestOrderCodeIdsSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => memoize((\r\n ids: Undefinable[]\r\n ) => ids.filter(x => x && !byId[x]) as string[])\r\n);\r\n\r\nexport const selectors = {\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getOtherQuestOrderCodeIds: (\r\n state: State,\r\n ids: Undefinable[]\r\n ): string[] => getOtherQuestOrderCodeIdsSelector(state)(ids),\r\n getQuestOrderCode: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || '']\r\n};\r\n","import { createSelector } from 'reselect';\r\nimport { State } from '.';\r\nimport {\r\n SnomedCategory,\r\n SnomedCategoryType\r\n} from '../../models/snomed-category';\r\n\r\nconst checkLoadedSelector = createSelector(\r\n (state: State) => state.byId,\r\n (byId: Dictionary) => Object.keys(byId).length > 0\r\n);\r\n\r\nexport const selectors = {\r\n checkLoaded: (\r\n state: State\r\n ): boolean => checkLoadedSelector(state),\r\n getLoading: (\r\n state: State,\r\n loadingKey: string\r\n ): boolean => state.loading[loadingKey] || false,\r\n getSnomedCategory: (\r\n state: State,\r\n code: Undefinable\r\n ): Undefinable => state.byId[code || ''],\r\n getSnomedCategoryIds: (\r\n state: State,\r\n type: SnomedCategoryType\r\n ): Undefinable => state.byType[type]\r\n};\r\n","import { State } from '.';\r\nimport { SpecialtyModel } from '../../models/specialty';\r\n\r\nexport const selectors = {\r\n getSpecialty: (\r\n state: State,\r\n id: Undefinable\r\n ): Undefinable => state.byId[id || ''],\r\n getSpecialtyIds: (\r\n state: State\r\n ): number[] => state.allIds\r\n};\r\n","import axios from 'axios';\r\nimport {\r\n PatientReceiptModel,\r\n PatientReceiptViewModel,\r\n PtStatementModel\r\n} from '../models';\r\nimport {\r\n Statement,\r\n StatementResult,\r\n StatementListResult\r\n} from '../models/statement';\r\n\r\nexport const getPatientReceiptViewsAsync = async (): Promise => {\r\n const response = await axios.get('/api/statement/view');\r\n return response.data;\r\n};\r\n\r\nexport const getPatientReceiptAsync = async (\r\n receiptId: string\r\n): Promise => {\r\n const response = await axios.get(`/api/statement/${receiptId}`);\r\n return response.data;\r\n};\r\n\r\nexport const getCurrentStatementAsync = async (): Promise> => {\r\n const response = await axios.get('/api/statement/current');\r\n return response.data;\r\n};\r\n\r\nexport const getStatementsAsync = async (): Promise => {\r\n const response = await axios.get('/api/statement');\r\n return response.data;\r\n};\r\n\r\nexport const getStatementAsync = async (id: string): Promise => {\r\n const response = await axios.get(`/api/statement/${id}`);\r\n return response.data;\r\n};\r\n\r\nexport const getCurrentStatement = async (): Promise> => {\r\n const response = await axios.get(`/api/statement/current`);\r\n return response.data;\r\n};\r\n"],"sourceRoot":""}