2 lines
36 KiB
JavaScript
2 lines
36 KiB
JavaScript
![]() |
"use strict";angular.module("bahmni.common.conceptSet").factory("formService",["$http",function($http){var getFormList=function(encounterUuid){return $http.get(Bahmni.Common.Constants.latestPublishedForms,{params:{encounterUuid:encounterUuid}})},getAllForms=function(){return $http.get(Bahmni.Common.Constants.allFormsUrl,{params:{v:"custom:(version,name,uuid)"}})},getFormDetail=function(formUuid,params){return $http.get(Bahmni.Common.Constants.formUrl+"/"+formUuid,{params:params})};const getUrlWithUuid=function(url,patientUuid){return url.replace("{patientUuid}",patientUuid)};var getAllPatientForms=function(patientUuid,numberOfVisits,patientProgramUuid){const patientFormsUrl=getUrlWithUuid(Bahmni.Common.Constants.patientFormsUrl,patientUuid),params={numberOfVisits:numberOfVisits,formType:"v2",patientProgramUuid:patientProgramUuid};return $http.get(patientFormsUrl,{params:params})},getFormTranslations=function(url,form){return url&&url!==Bahmni.Common.Constants.formTranslationsUrl?$http.get(url):$http.get(Bahmni.Common.Constants.formTranslationsUrl,{params:form})},getFormTranslate=function(formName,formVersion,locale,formUuid){return $http.get(Bahmni.Common.Constants.formBuilderTranslationApi,{params:{formName:formName,formVersion:formVersion,locale:locale,formUuid:formUuid}})};return{getFormList:getFormList,getAllForms:getAllForms,getFormDetail:getFormDetail,getFormTranslations:getFormTranslations,getFormTranslate:getFormTranslate,getAllPatientForms:getAllPatientForms}}]),angular.module("bahmni.common.services").factory("pacsService",["$http",function($http){var search=function(patientId){var params={patientId:patientId};return $http.get("/openmrs/ws/rest/v1/pacs/studies",{method:"GET",params:params,withCredentials:!0})},getAccessionNumber=function(identifier){if(identifier.system.indexOf("urn:bahmni:accession")<0)return null;var parts=identifier.value.split("urn:oid:");return parts&&2===parts.length?parts[1]:""};return{search:search,getAccessionNumber:getAccessionNumber}}]),angular.module("bahmni.common.services").factory("virtualConsultService",["$http","$rootScope",function($http,$rootScope){var launchMeeting=function(uuid,link){$rootScope.$broadcast("event:launchVirtualConsult",{uuid:uuid,link:link})};return{launchMeeting:launchMeeting}}]),angular.module("bahmni.common.domain").service("visitService",["$http",function($http){this.getVisit=function(uuid,params){var parameters=params?params:"custom:(uuid,visitId,visitType,patient,encounters:(uuid,encounterType,voided,orders:(uuid,orderType,voided,concept:(uuid,set,name),),obs:(uuid,value,concept,obsDatetime,groupMembers:(uuid,concept:(uuid,name),obsDatetime,value:(uuid,name),groupMembers:(uuid,concept:(uuid,name),value:(uuid,name),groupMembers:(uuid,concept:(uuid,name),value:(uuid,name)))))))";return $http.get(Bahmni.Common.Constants.visitUrl+"/"+uuid,{params:{v:parameters}})},this.endVisit=function(visitUuid){return $http.post(Bahmni.Common.Constants.endVisitUrl+"?visitUuid="+visitUuid,{withCredentials:!0})},this.endVisitAndCreateEncounter=function(visitUuid,bahmniEncounterTransaction){return $http.post(Bahmni.Common.Constants.endVisitAndCreateEncounterUrl+"?visitUuid="+visitUuid,bahmniEncounterTransaction,{withCredentials:!0})},this.updateVisit=function(visitUuid,attributes){return $http.post(Bahmni.Common.Constants.visitUrl+"/"+visitUuid,attributes,{withCredentials:!0})},this.createVisit=function(visitDetails){return $http.post(Bahmni.Common.Constants.visitUrl,visitDetails,{withCredentials:!0})},this.getVisitSummary=function(visitUuid){return $http.get(Bahmni.Common.Constants.visitSummaryUrl,{params:{visitUuid:visitUuid},withCredentials:!0})},this.search=function(parameters){return $http.get(Bahmni.Common.Constants.visitUrl,{params:parameters,withCredentials:!0})},this.getVisitType=function(){return $http.get(Bahmni.Common.Constants.visitTypeUrl,{withCredentials:!0})}}]),angular.module("bahmni.common.domain").service("diagnosisService",["$http","$rootScope",function($http,$rootScope){var self=this;this.getAllFor=function(searchTerm,locale){var url=Bahmni.Common.Cons
|
||
|
var createDrugOrder=function(drugOrder){return Bahmni.Clinical.DrugOrder.create(drugOrder)},getActiveDrugOrdersFromServer=function(patientUuid,startDate,endDate){return $http.get(Bahmni.Common.Constants.bahmniDrugOrderUrl+"/active",{params:{patientUuid:patientUuid,startDate:startDate,endDate:endDate},withCredentials:!0})},getPrescribedAndActiveDrugOrders=function(patientUuid,numberOfVisits,getOtherActive,visitUuids,startDate,endDate,getEffectiveOrdersOnly){return $http.get(Bahmni.Common.Constants.bahmniDrugOrderUrl+"/prescribedAndActive",{params:{patientUuid:patientUuid,numberOfVisits:numberOfVisits,getOtherActive:getOtherActive,visitUuids:visitUuids,startDate:startDate,endDate:endDate,getEffectiveOrdersOnly:getEffectiveOrdersOnly,preferredLocale:$rootScope.currentUser.userProperties.defaultLocale},withCredentials:!0}).success(function(response){for(var key in response)response[key]=response[key].map(createDrugOrder)})},getConfig=function(){return $http.get(Bahmni.Common.Constants.drugOrderConfigurationUrl,{withCredentials:!0})},getProgramConfig=function(){var programConfig=appService.getAppDescriptor()?appService.getAppDescriptor().getConfigValue("program")||{}:{};return programConfig},getActiveDrugOrders=function(patientUuid,fromDate,toDate){var programConfig=getProgramConfig(),startDate=programConfig.showDetailsWithinDateRange?fromDate:null,endDate=programConfig.showDetailsWithinDateRange?toDate:null,deferred=$q.defer();return getActiveDrugOrdersFromServer(patientUuid,startDate,endDate).success(function(response){var activeDrugOrders=response.map(createDrugOrder);deferred.resolve(activeDrugOrders)}),deferred.promise},getPrescribedDrugOrders=function(patientUuid,includeActiveVisit,numberOfVisits,fromDate,toDate){var programConfig=getProgramConfig(),startDate=programConfig.showDetailsWithinDateRange?fromDate:null,endDate=programConfig.showDetailsWithinDateRange?toDate:null,deferred=$q.defer();return $http.get(Bahmni.Common.Constants.bahmniDrugOrderUrl,{method:"GET",params:{patientUuid:patientUuid,numberOfVisits:numberOfVisits,includeActiveVisit:includeActiveVisit,startDate:startDate,endDate:endDate},withCredentials:!0}).success(function(response){var activeDrugOrders=response.map(createDrugOrder);deferred.resolve(activeDrugOrders)}),deferred.promise},getNonCodedDrugConcept=function(){var deferred=$q.defer();return $http.get(Bahmni.Common.Constants.globalPropertyUrl,{method:"GET",params:{property:"drugOrder.drugOther"},withCredentials:!0,headers:{Accept:"text/plain"}}).success(function(conceptUuid){deferred.resolve(conceptUuid)}),deferred.promise},getAllDrugOrdersFor=function(patientUuid,conceptSetToBeIncluded,conceptSetToBeExcluded,isActive,patientProgramUuid){var deferred=$q.defer(),params={patientUuid:patientUuid};return conceptSetToBeIncluded&&(params.includeConceptSet=conceptSetToBeIncluded),conceptSetToBeExcluded&&(params.excludeConceptSet=conceptSetToBeExcluded),void 0!==isActive&&(params.isActive=isActive),patientProgramUuid&&(params.patientProgramUuid=patientProgramUuid),$http.get(Bahmni.Common.Constants.bahmniDrugOrderUrl+"/drugOrderDetails",{params:params,withCredentials:!0}).success(function(response){deferred.resolve(response)}),deferred.promise},voidDrugOrder=function(drugOrder){var deferred=$q.defer();return $http.delete([Bahmni.Common.Constants.ordersUrl,"/",drugOrder.uuid].join("")).success(function(response){deferred.resolve(response)}),deferred.promise};return{getActiveDrugOrders:getActiveDrugOrders,getConfig:getConfig,getPrescribedDrugOrders:getPrescribedDrugOrders,getPrescribedAndActiveDrugOrders:getPrescribedAndActiveDrugOrders,getNonCodedDrugConcept:getNonCodedDrugConcept,getAllDrugOrdersFor:getAllDrugOrdersFor,voidDrugOrder:voidDrugOrder}}]),Bahmni.Clinical.StateNameEvenTypeMap={"search.patientsearch":"VIEWED_CLINICAL_PATIENT_SEARCH","patient.dashboard.show":"VIEWED_CLINICAL_DASHBOARD","patient.dashboard.show.observations":"VIEWED_OBSERVATIONS_TAB","patient.dashboard.show.diagnosis":"VIEWED_DIAGNOSIS_TAB","patient.dashboard.show.treatment.page":"VIEWED_TREATMENT_TAB","patient.dashboard.show.dispo
|