NINS_CODE/bahmniapps/clinical/clinical.min.1abb047b.js

22 lines
675 KiB
JavaScript
Raw Normal View History

2024-12-12 22:37:39 +06:00
"use strict";var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},function(){var hostUrl=localStorage.getItem("host")?"https://"+localStorage.getItem("host"):"",rootDir=localStorage.getItem("rootDir")||"",RESTWS=hostUrl+"/openmrs/ws/rest",RESTWS_V1=hostUrl+"/openmrs/ws/rest/v1",BAHMNI_CORE=RESTWS_V1+"/bahmnicore",EMRAPI=RESTWS+"/emrapi",BACTERIOLOGY=RESTWS_V1,BASE_URL=hostUrl+"/bahmni_config/openmrs/apps/",CUSTOM_URL=hostUrl+"/implementation_config/openmrs/apps/",IE_APPS_API=RESTWS_V1+"/bahmniie",serverErrorMessages=[{serverMessage:"Cannot have more than one active order for the same orderable and care setting at same time",clientMessage:"One or more drugs you are trying to order are already active. Please change the start date of the conflicting drug or remove them from the new prescription."},{serverMessage:"[Order.cannot.have.more.than.one]",clientMessage:"One or more drugs you are trying to order are already active. Please change the start date of the conflicting drug or remove them from the new prescription."}],representation="custom:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass))))",unAuthenticatedReferenceDataMap={"/openmrs/ws/rest/v1/location?tags=Login+Location&s=byTags&v=default":"LoginLocations","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=locale.allowed.list":"LocaleList"},authenticatedReferenceDataMap={"/openmrs/ws/rest/v1/idgen/identifiertype":"IdentifierTypes","/openmrs/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form":"AddressHierarchyLevels","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=mrs.genders":"Genders","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.encountersession.duration":"encounterSessionDuration","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.relationshipTypeMap":"RelationshipTypeMap","/openmrs/ws/rest/v1/bahmnicore/config/bahmniencounter?callerContext=REGISTRATION_CONCEPTS":"RegistrationConcepts","/openmrs/ws/rest/v1/relationshiptype?v=custom:(aIsToB,bIsToA,uuid)":"RelationshipType","/openmrs/ws/rest/v1/personattributetype?v=custom:(uuid,name,sortWeight,description,format,concept)":"PersonAttributeType","/openmrs/ws/rest/v1/entitymapping?mappingType=loginlocation_visittype&s=byEntityAndMappingType":"LoginLocationToVisitTypeMapping","/openmrs/ws/rest/v1/bahmnicore/config/patient":"PatientConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Consultation+Note&v=custom:(uuid,name,answers)":"ConsultationNote","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Lab+Order+Notes&v=custom:(uuid,name)":"LabOrderNotes","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Impression&v=custom:(uuid,name)":"RadiologyImpressionConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=All_Tests_and_Panels&v=custom:(uuid,name:(uuid,name),setMembers:(uuid,name:(uuid,name)))":"AllTestsAndPanelsConcept","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Dosage+Frequency&v=custom:(uuid,name,answers)":"DosageFrequencyConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Dosage+Instructions&v=custom:(uuid,name,answers)":"DosageInstructionConfig","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.encounterType.default":"DefaultEncounterType","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Stopped+Order+Reason&v=custom:(uuid,name,answers)":"StoppedOrderReasonConfig","/openmrs/ws/rest/v1/ordertype":"OrderType","/openmrs/ws/rest/v1/bahmnicore/config/drugOrders":"DrugOrderConfig","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=drugOrder.drugOther":"NonCodedDrugConcept"};authenticatedReferenceDataMap["/openmrs/ws/rest/v1/entitymapping?mappingType=location_encountertype&s=byEntityAndMappingType&entityUuid="+(localStorage.getItem("LoginInformation")?JSON.parse(localStorage.getItem("LoginInformation")).currentLocation.uuid:"")]="LoginLocationToEncounterTypeMapping",Bahmni.Common.Constants={hostURL:hostUrl,dateFormat:"dd/mm/yyyy",dateDisplayFormat:"DD
return a&&!h&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!("function"==typeof r&&r instanceof r&&"function"==typeof e&&e instanceof e)&&(a=!1)),o.delete(n),a}function mr(n){for(var t=n.name+"",r=Gu[t],e=cu.call(Gu,t)?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function wr(){var n=yn.iteratee||Je,n=n===Je?xt:n;return arguments.length?n(arguments[0],arguments[1]):n}function Ar(n){n=De(n);for(var t=n.length;t--;){var r,e=n[t];r=n[t][1],r=r===r&&!xe(r),e[2]=r}return n}function Or(n,t){var r=null==n?Z:n[t];return me(r)?r:Z}function kr(n){return su.call(n)}function Er(n,t,r){if(null==n)return!1;var e=r(n,t);return e||Cr(t)||(t=Nt(t),n=$r(n,t),null!=n&&(t=Kr(t),e=r(n,t))),r=n?n.length:Z,e||!!r&&be(r)&&U(t,r)&&(No(n)||ke(n)||pe(n))}function Ir(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&cu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Sr(n){return Mr(n)?{}:(n=n.constructor,Vu(de(n)?n.prototype:Z))}function Rr(r,e,u){var o=r.constructor;switch(e){case"[object ArrayBuffer]":return Gt(r);case"[object Boolean]":case"[object Date]":return new o(+r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e=r.buffer,new r.constructor(u?Gt(e):e,r.byteOffset,r.length);case"[object Map]":return u=r.constructor,s(M(r),n,new u);case"[object Number]":case"[object String]":return new o(r);case"[object RegExp]":return u=new r.constructor(r.source,hn.exec(r)),u.lastIndex=r.lastIndex,u;case"[object Set]":return u=r.constructor,s($(r),t,new u);case"[object Symbol]":return vu?Object(Tu.call(r)):{}}}function Wr(n){var t=n?n.length:Z;return be(t)&&(No(n)||ke(n)||pe(n))?j(t,String):null}function Br(n,t,r){if(!xe(r))return!1;var e=typeof t;return!!("number"==e?_e(r)&&U(t,r.length):"string"==e&&t in r)&&se(r[t],n)}function Cr(n,t){return"number"==typeof n||!No(n)&&(rn.test(n)||!tn.test(n)||null!=t&&n in Object(t))}function Ur(n){var t=typeof n;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!==n||null==n}function zr(n){var t=mr(n),r=yn[t];return"function"==typeof r&&t in An.prototype&&(n===r||(t=to(r),!!t&&n===t[0]))}function Mr(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||iu)}function Lr(n,t,r,e,u,o){return xe(n)&&xe(t)&&(o.set(t,n),Ot(n,t,Z,Lr,o)),n}function $r(n,t){return 1==t.length?n:Me(n,zt(t,0,-1))}function Fr(n){var t=[];return ze(n).replace(en,function(n,r,e,u){t.push(e?u.replace(ln,"$1"):r||n)}),t}function Nr(n){return ge(n)?n:[]}function Dr(n){return"function"==typeof n?n:Ve}function Zr(n){if(n instanceof An)return n.clone();var t=new wn(n.__wrapped__,n.__chain__);return t.__actions__=Yt(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function qr(n,t,r){var e=n?n.length:0;return e?(t=r||t===Z?1:We(t),zt(n,0>t?0:t,e)):[]}function Pr(n,t,r){var e=n?n.length:0;return e?(t=r||t===Z?1:We(t),t=e-t,zt(n,0,0>t?0:t)):[]}function Tr(n){return n?n[0]:Z}function Kr(n){var t=n?n.length:0;return t?n[t-1]:Z}function Gr(n,t){return n&&n.length&&t&&t.length?Wt(n,t):n}function Vr(n){return n?zu.call(n):n}function Jr(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){return ge(n)?(t=Wu(n.length,t),!0):void 0}),j(t,function(t){return a(n,St(t))})}function Yr(n,t){if(!n||!n.length)return[];var e=Jr(n);return null==t?e:a(e,function(n){return r(t,Z,n)})}function Hr(n){return n=yn(n),n.__chain__=!0,n}function Qr(n,t){return t(n)}function Xr(){return this}function ne(n,t){return"function"==typeof t&&No(n)?u(n,t):Ju(n,Dr(t))}function te(n,t){var r;if("function"==typeof t&&No(n)){for(r=n.length;r--&&!1!==t(n[r],r,n););r=n}else r=Yu(n,Dr(t));return r}function re(n,t){return(No(n)?a:mt)(n,wr(t,3))}function ee(n,t){var r=-1,e=Re(n),u=e.length,o=u-1;for(t=nt(We(t),0,u);++r<t;){var u=Ct(r,o),i=e[u];e[u]=e[r],e[r]=i}return e.length=t,e}function ue(n,t,r){return t=r?Z:t,t=n&&null==t?n.length:t,yr(n,128,Z,Z,Z
if(r>=o)return n;if(o=r-F(e),1>o)return e;if(r=i?i.slice(0,o).join(""):n.slice(0,o),u===Z)return r+e;if(i&&(o+=r.length-o),Oe(u)){if(n.slice(o).search(u)){var f=r;for(u.global||(u=eu(u.source,ze(hn.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===Z?o:c)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),u>-1&&(r=r.slice(0,u)));return r+e},yn.unescape=function(n){return(n=ze(n))&&Y.test(n)?n.replace(V,N):n},yn.uniqueId=function(n){var t=++au;return ze(n)+t},yn.upperCase=ai,yn.upperFirst=ii,yn.each=ne,yn.eachRight=te,yn.first=Tr,Ye(yn,function(){var n={};return at(yn,function(t,r){cu.call(yn.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),yn.VERSION="4.3.0",u("bind bindKey curry curryRight partial partialRight".split(" "),function(n){yn[n].placeholder=yn}),u(["drop","take"],function(n,t){An.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new An(this);r=r===Z?1:Wu(We(r),0);var u=this.clone();return e?u.__takeCount__=Bu(r,u.__takeCount__):u.__views__.push({size:Bu(r,4294967295),type:n+(0>u.__dir__?"Right":"")}),u},An.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),u(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;An.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:wr(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),u(["head","last"],function(n,t){var r="take"+(t?"Right":"");An.prototype[n]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");An.prototype[n]=function(){return this.__filtered__?new An(this):this[r](1)}}),An.prototype.compact=function(){return this.filter(Ve)},An.prototype.find=function(n){return this.filter(n).head()},An.prototype.findLast=function(n){return this.reverse().find(n)},An.prototype.invokeMap=le(function(n,t){return"function"==typeof n?new An(this):this.map(function(r){return dt(r,n,t)})}),An.prototype.reject=function(n){return n=wr(n,3),this.filter(function(t){return!n(t)})},An.prototype.slice=function(n,t){n=We(n);var r=this;return r.__filtered__&&(n>0||0>t)?new An(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==Z&&(t=We(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},An.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},An.prototype.toArray=function(){return this.take(4294967295)},at(An.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=yn[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(yn.prototype[t]=function(){var t=this.__wrapped__,i=e?[1]:arguments,f=t instanceof An,c=i[0],a=f||No(t),s=function(n){return n=u.apply(yn,l([n],i)),e&&h?n[0]:n};a&&r&&"function"==typeof c&&1!=c.length&&(f=a=!1);var h=this.__chain__,p=!!this.__actions__.length,c=o&&!h,f=f&&!p;return!o&&a?(t=f?t:new An(this),t=n.apply(t,i),t.__actions__.push({func:Qr,args:[s],thisArg:Z}),new wn(t,h)):c&&f?n.apply(this,i):(t=this.thru(s),c?e?t.value()[0]:t.value():t)})}),u("pop push shift sort splice unshift".split(" "),function(n){var t=ou[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);yn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),at(An.prototype,function(n,t){var r=yn[t];if(r){var e=r.name+"";(Gu[e]||(Gu[e]=[])).push({name:t,func:r})}}),Gu[lr(Z,2).name]=[{name:"wrapper",func:Z}],An.prototype.clone=function(){var n=new An(this.__wrapped__);return n.__actions__=Yt(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Yt(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Yt(this.__views__),n},An.prototype.reverse=function(){if(this.__filtered__){var n=new An(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n},An.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=No(t),u=0>r,o=e?t.length:0;n=0;for(var i=o,f=this.__views__,c=-1,a=f.length;++c<a;){var l=f[c],s=l.size;switch(l.type){case"drop":n+=s;break;case"dropRight":i-=s;break;case"take":i=Bu(i,n+s);break;ca
return _.includes(this.favouriteObsTemplates,conceptName)},this.toggleFavoriteObsTemplate=function(conceptName){this.isFavouriteObsTemplate(conceptName)?this.favouriteObsTemplates=_.without(this.favouriteObsTemplates,conceptName):this.favouriteObsTemplates.push(conceptName)},this.isFavouriteWard=function(wardName){return _.includes(this.favouriteWards,wardName)},this.toggleFavoriteWard=function(wardName){this.isFavouriteWard(wardName)?this.favouriteWards=_.without(this.favouriteWards,wardName):this.favouriteWards.push(wardName)}},angular.module("authentication").service("userService",["$rootScope","$http","$q",function($rootScope,$http,$q){var getUserFromServer=function(userName){return $http.get(Bahmni.Common.Constants.userUrl,{method:"GET",params:{username:userName,v:"custom:(username,uuid,person:(uuid,),privileges:(name,retired),userProperties)"},cache:!1})};this.getUser=function(userName){var deferrable=$q.defer();return getUserFromServer(userName).success(function(data){deferrable.resolve(data)}).error(function(){deferrable.reject("Unable to get user data")}),deferrable.promise},this.savePreferences=function(){var deferrable=$q.defer(),user=$rootScope.currentUser.toContract();return $http.post(Bahmni.Common.Constants.userUrl+"/"+user.uuid,{uuid:user.uuid,userProperties:user.userProperties},{withCredentials:!0}).then(function(response){$rootScope.currentUser.userProperties=response.data.userProperties,deferrable.resolve()}),deferrable.promise};var getProviderFromServer=function(uuid){return $http.get(Bahmni.Common.Constants.providerUrl,{method:"GET",params:{user:uuid},cache:!1})};this.getProviderForUser=function(uuid){var deferrable=$q.defer();return getProviderFromServer(uuid).success(function(data){if(data.results.length>0){var providerName=data.results[0].display.split("-")[1];data.results[0].name=providerName?providerName.trim():providerName,deferrable.resolve(data)}else deferrable.reject("UNABLE_TO_GET_PROVIDER_DATA")}).error(function(){deferrable.reject("UNABLE_TO_GET_PROVIDER_DATA")}),deferrable.promise},this.getPasswordPolicies=function(){return $http.get(Bahmni.Common.Constants.passwordPolicyUrl,{method:"GET",withCredentials:!0})},this.allowedDomains=function(redirectUrl){var deferrable=$q.defer();return $http.get(Bahmni.Common.Constants.loginConfig,{method:"GET",cache:!0}).success(function(data){deferrable.resolve(data.whiteListedDomains)}).error(function(){deferrable.resolve([])}),deferrable.promise}}]),angular.module("authentication").config(["$httpProvider",function($httpProvider){var interceptor=["$rootScope","$q",function($rootScope,$q){function success(response){return response}function error(response){return 401===response.status&&$rootScope.$broadcast("event:auth-loginRequired"),$q.reject(response)}return{response:success,responseError:error}}];$httpProvider.interceptors.push(interceptor)}]).run(["$rootScope","$window","$timeout",function($rootScope,$window,$timeout){$rootScope.$on("event:auth-loginRequired",function(){$timeout(function(){$window.location="../home/index.html#/login"})})}]).service("sessionService",["$rootScope","$http","$q","$bahmniCookieStore","userService",function($rootScope,$http,$q,$bahmniCookieStore,userService){var sessionResourcePath=Bahmni.Common.Constants.RESTWS_V1+"/session?v=custom:(uuid)",getAuthFromServer=function(username,password,otp){var btoa=otp?username+":"+password+":"+otp:username+":"+password;return $http.get(sessionResourcePath,{headers:{Authorization:"Basic "+window.btoa(btoa)},cache:!1})};this.resendOTP=function(username,password){var btoa=username+":"+password;return $http.get(sessionResourcePath+"&resendOTP=true",{headers:{Authorization:"Basic "+window.btoa(btoa)},cache:!1})};var createSession=function(username,password,otp){var deferrable=$q.defer();return destroySessionFromServer().success(function(){getAuthFromServer(username,password,otp).then(function(response){204==response.status&&deferrable.resolve({firstFactAuthorization:!0}),deferrable.resolve(response.data)},function(response){401==response.status?deferrable.reject("LOGIN_LABEL_WRONG_OTP_MESSAG
return{restrict:"A",link:function(scope,element,attrs){_.isEmpty(attrs.ngSrc)&&element.attr("src",attrs.fallbackSrc),element.bind("error",function(){element.attr("src",attrs.fallbackSrc)})}}}),angular.module("bahmni.common.patient").directive("stopEventPropagation",function(){return{link:function(scope,elem,attrs){elem.on(attrs.stopEventPropagation,function(e){e.stopPropagation()})}}}),angular.module("bahmni.common.patientSearch",["bahmni.common.patient","infinite-scroll"]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.PatientSearch=Bahmni.Common.PatientSearch||{},Bahmni.Common.PatientSearch.Constants={searchExtensionTileViewType:"tile",searchExtensionTabularViewType:"tabular",tabularViewIgnoreHeadingsList:["display","uuid","image","$$hashKey","activeVisitUuid","hasBeenAdmitted","forwardUrl","programUuid","enrollment"],identifierHeading:["ID","Id","id","identifier","DQ_COLUMN_TITLE_ACTION"],nameHeading:["NAME","Name","name"],patientTileHeight:100,patientTileWidth:100,printIgnoreHeadingsList:["DQ_COLUMN_TITLE_ACTION"],tileLoadRatio:.5},Bahmni.Common.PatientSearch.Search=function(searchTypes){function mapPatient(patient){return(patient.name||patient.givenName||patient.familyName)&&(patient.name=patient.name||patient.givenName+(patient.familyName?" "+patient.familyName:"")),patient.display=_.map(self.searchColumns,function(column){return patient[column]}).join(" - "),patient.image=Bahmni.Common.Constants.patientImageUrlByPatientUuid+patient.uuid,patient}var self=this;self.searchTypes=searchTypes||[],self.searchType=this.searchTypes[0],self.searchParameter="",self.noResultsMessage=null,self.searchResults=[],self.activePatients=[],self.navigated=!1,self.links=self.searchType&&self.searchType.links?self.searchType.links:[],self.searchColumns=self.searchType&&self.searchType.searchColumns?self.searchType.searchColumns:["identifier","name"],angular.forEach(searchTypes,function(searchType){searchType.patientCount="..."}),self.switchSearchType=function(searchType){self.noResultsMessage=null,self.isSelectedSearch(searchType)||(self.searchParameter="",self.navigated=!0,self.searchType=searchType,self.activePatients=[],self.searchResults=[],self.links=self.searchType&&self.searchType.links?self.searchType.links:[],self.searchColumns=self.searchType&&self.searchType.searchColumns?self.searchType.searchColumns:["identifier","name"]),self.markPatientEntry()},self.markPatientEntry=function(){self.startPatientSearch=!0,window.setTimeout(function(){self.startPatientSearch=!1})},self.patientsCount=function(){return self.activePatients.length},self.updatePatientList=function(patientList){self.activePatients=patientList.map(mapPatient),self.searchResults=self.activePatients},self.updateSearchResults=function(patientList){self.updatePatientList(patientList),0===self.activePatients.length&&""!=self.searchParameter?self.noResultsMessage="NO_RESULTS_FOUND":self.noResultsMessage=null},self.hasSingleActivePatient=function(){return 1===self.activePatients.length},self.filterPatients=function(matchingCriteria){matchingCriteria=matchingCriteria?matchingCriteria:matchesNameOrId,self.searchResults=self.searchParameter?self.activePatients.filter(matchingCriteria):self.activePatients},self.filterPatientsByIdentifier=function(){self.filterPatients(matchesId)},self.isSelectedSearch=function(searchType){return self.searchType&&self.searchType.id==searchType.id},self.isCurrentSearchLookUp=function(){return self.searchType&&self.searchType.handler},self.isTileView=function(){return self.searchType&&self.searchType.view===Bahmni.Common.PatientSearch.Constants.searchExtensionTileViewType},self.isTabularView=function(){return self.searchType&&self.searchType.view===Bahmni.Common.PatientSearch.Constants.searchExtensionTabularViewType},self.showPatientCountOnSearchParameter=function(searchType){return showPatientCount(searchType)&&self.searchParameter};var matchesNameOrId=function(patient){return patient.display.toLowerCase().indexOf(self.searchParameter.toLowerCase())!==-1},matchesId=function(patient){return patient.identifier.toLowerCase().
observation.groupMembers=removeNewObservationsWhichAreVoided(observation.groupMembers)}),_.reject(observations,function(observation){return observation.isNew()&&observation.voided})};self.filter=function(observations){var wrappedObservations=observations.map(Observation.wrap),filteredObservations=removeNewObservationsWithoutValue(wrappedObservations);return filteredObservations=removeNewObservationsWhichAreVoided(filteredObservations),voidExistingObservationWithOutValue(filteredObservations),filteredObservations}};var Observation=function(observationData){angular.extend(this,observationData),this.isNew=function(){return!this.uuid},this.isExisting=function(){return!this.isNew()},this.hasValue=function(){return void 0!==this.value&&null!==this.value&&""!==this.value},this.hasMemberWithValue=function(){return this.groupMembers.some(function(groupMember){return groupMember.hasValue()||groupMember.hasMemberWithValue()})},this.isGroup=function(){return this.groupMembers.length>0},this.isLeaf=function(){return!this.isGroup()},this.isGroupWithOnlyVoidedMembers=function(){return this.isGroup()&&this.groupMembers.every(function(groupMember){return groupMember.voided})},this.isLeafNodeWithOutValue=function(){return this.isLeaf()&&!this.hasValue()},this.canBeVoided=function(){return this.isExisting()&&(this.isLeafNodeWithOutValue()||this.isGroupWithOnlyVoidedMembers())}};Observation.wrap=function(observationData){var observation=new Observation(observationData);return observation.groupMembers=observation.groupMembers?observation.groupMembers.map(Observation.wrap):[],observation}}(),angular.module("bahmni.common.gallery",[]),angular.module("bahmni.common.gallery").directive("bmGalleryPane",["$rootScope","$document","observationsService","encounterService","spinner","configurations","ngDialog",function($rootScope,$document,observationsService,encounterService,spinner,configurations,ngDialog){function close(){$("body #gallery-pane").remove(),$body.removeClass("gallery-open"),keyboardJS.releaseKey("right"),keyboardJS.releaseKey("left")}var $body=$document.find("body");$rootScope.$on("$stateChangeStart",function(){close()});var link=function($scope,element){$scope.galleryElement=element,$body.prepend($scope.galleryElement).addClass("gallery-open"),keyboardJS.on("right",function(){$scope.$apply(function(){$scope.getTotalLength()>1&&$scope.showNext()})}),keyboardJS.on("left",function(){$scope.$apply(function(){$scope.getTotalLength()>1&&$scope.showPrev()})})},controller=function($scope){$scope.imageIndex=$scope.imagePosition.index?$scope.imagePosition.index:0,$scope.albumTag=$scope.imagePosition.tag?$scope.imagePosition.tag:"defaultTag",$scope.showImpression=!1,$scope.isActive=function(index,tag){return $scope.imageIndex==index&&$scope.albumTag==tag};var getAlbumIndex=function(){return _.findIndex($scope.albums,function(album){return album.tag==$scope.albumTag})};$scope.showPrev=function(){var albumIndex=getAlbumIndex();if($scope.imageIndex>0)--$scope.imageIndex;else{0==albumIndex&&(albumIndex=$scope.albums.length);var previousAlbum=$scope.albums[albumIndex-1];0==previousAlbum.images.length&&$scope.showPrev(albumIndex-1),$scope.albumTag=previousAlbum.tag,$scope.imageIndex=previousAlbum.images.length-1}},$scope.showNext=function(){var albumIndex=getAlbumIndex();if($scope.imageIndex<$scope.albums[albumIndex].images.length-1)++$scope.imageIndex;else{albumIndex==$scope.albums.length-1&&(albumIndex=-1);var nextAlbum=$scope.albums[albumIndex+1];0==nextAlbum.images.length&&$scope.showNext(albumIndex+1),$scope.albumTag=nextAlbum.tag,$scope.imageIndex=0}},$scope.isPdf=function(image){return image.src&&image.src.indexOf(".pdf")>0},$scope.getTotalLength=function(){var totalLength=0;return angular.forEach($scope.albums,function(album){totalLength+=album.images.length}),totalLength},$scope.getCurrentIndex=function(){for(var currentIndex=1,i=0;i<getAlbumIndex();i++)currentIndex+=$scope.albums[i].images.length;return currentIndex+parseInt($scope.imageIndex)},$scope.close=function(){close($scope)},$scope.toggleImpression=function(){$scope.showImpression=
controller:function($scope,backlinkService){$scope.backLinks=backlinkService.getAllUrls(),$scope.$on("$stateChangeSuccess",function(event,state){state.data&&state.data.backLinks&&(backlinkService.setUrls(state.data.backLinks),$scope.backLinks=backlinkService.getAllUrls())}),$scope.$on("$destroy",function(){window.onbeforeunload=void 0})},restrict:"E"}}),angular.module("bahmni.common.uiHelper").directive("providerDirective",function(){var template='<span><span ng-if=":: creatorName && providerName && (creatorName != providerName)">{{::creatorName}} {{"ON_BEHALF_OF_TRANSLATION_KEY"|translate}} </span>{{::providerName}} <span ng-if=":: providerDate"> {{::providerDate | bahmniTime}} </span></span>';return{restrict:"EA",replace:!0,scope:{creatorName:"@",providerName:"@",providerDate:"=?"},template:template}}),angular.module("bahmni.common.uiHelper").directive("focusOn",["$timeout",function($timeout){return function(scope,elem,attrs){Modernizr.ios||scope.$watch(attrs.focusOn,function(value){value&&$timeout(function(){$(elem).focus()})})}}]),angular.module("bahmni.common.uiHelper").directive("scrollToObsElement",function(){return function(scope,elem,attrs){if(attrs.scrollToObsElement&&scope.observation.scrollToElement){$(elem).focus();var scrollPosition=$(elem).offset().top-window.innerHeight/2;if($("#scrollOnEdit")[0]){var container=$("#scrollOnEdit"),scrollTo=elem;scrollPosition=scrollTo.offset().top+container.scrollTop()-(container.offset().top+container.offset().top/2),container.animate({scrollTop:scrollPosition},900)}else $(window).animate({scrollTop:scrollPosition},900);scope.observation.scrollToElement=!1}}}),angular.module("bahmni.common.uiHelper").directive("dateConverter",[function(){return{require:"ngModel",link:function(scope,element,attrs,ngModelController){var DateUtil=Bahmni.Common.Util.DateUtil;ngModelController.$parsers.push(function(date){return DateUtil.parse(date)}),ngModelController.$formatters.push(function(date){return DateUtil.parse(DateUtil.getDateWithoutTime(date))})}}}]),angular.module("bahmni.common.uiHelper").directive("compileHtml",["$compile",function($compile){return function(scope,element,attrs){scope.$watch(function(scope){return scope.$eval(attrs.compileHtml)},function(value){element.html(value),$compile(element.contents())(scope)})}}]),angular.module("bahmni.common.uiHelper").controller("MessageController",["$scope","messagingService",function($scope,messagingService){$scope.messages=messagingService.messages,$scope.getMessageText=function(level){var string="";return $scope.messages[level].forEach(function(message){string=string.concat(message.value)}),string},$scope.hideMessage=function(level){messagingService.hideMessages(level)},$scope.isErrorMessagePresent=function(){return $scope.messages.error.length>0},$scope.isInfoMessagePresent=function(){return $scope.messages.info.length>0}}]),angular.module("bahmni.common.uiHelper").service("messagingService",["$rootScope","$timeout",function($rootScope,$timeout){this.messages={error:[],info:[]};var self=this;$rootScope.$on("event:serverError",function(event,errorMessage){self.showMessage("error",errorMessage,"serverError")}),this.showMessage=function(level,message,errorEvent){var messageObject={value:"",isServerError:!1};messageObject.value=message,errorEvent?messageObject.isServerError=!0:"info"==level&&this.createTimeout("info",4e3);var index=_.findIndex(this.messages[level],function(msg){return msg.value==messageObject.value});index>=0&&this.messages[level].splice(index,1),this.messages[level].push(messageObject)},this.createTimeout=function(level,time){$timeout(function(){self.messages[level]=[]},time,!0)},this.hideMessages=function(level){self.messages[level].length=0},this.clearAll=function(){self.messages.error=[],self.messages.info=[]}}]),angular.module("bahmni.common.uiHelper").service("confirmBox",["$rootScope","ngDialog",function($rootScope,ngDialog){var dialog,confirmBox=function(config){var confirmBoxScope=$rootScope.$new();confirmBoxScope.close=function(){ngDialog.close(dialog.id),confirmBoxScope.$destroy()},confirmBoxScope.scope=c
}},validateChildNode=function(childNode,parentNode){var errorMessage;if(childNode.possibleAnswers&&!childNode.possibleAnswers.length){if("function"==typeof childNode.isValueInAbsoluteRange&&!childNode.isValueInAbsoluteRange())return errorMessage="The value you entered (red field) is outside the range of allowable values for that record. Please check the value.",{message:errorMessage,status:!0};if(childNode.isNumeric()){if(!childNode.isValidNumeric())return errorMessage="Please enter Integer value, decimal value is not allowed",{message:errorMessage,status:!0};if(parentNode){if(!childNode.isValidNumericValue()||!parentNode.isValidNumericValue())return errorMessage="Please enter Numeric values",{message:errorMessage,status:!0}}else if(!childNode.isValidNumericValue())return errorMessage="Please enter Numeric values",{message:errorMessage,status:!0}}}return{status:!1}};validationHandler.add(validateObservationTree);var cleanUpListenerShowPrevious=$scope.$on("event:showPrevious"+conceptSetName,function(){return spinner.forPromise(observationsService.fetch($scope.patient.uuid,$scope.conceptSetName,null,$scope.numberOfVisits,null,!0),id).then(function(response){var recentObservations=ObservationUtil.flattenObsToArray(response.data),conceptSetObservation=$scope.observations.filter(function(observation){return observation.conceptSetName===$scope.conceptSetName});ObservationUtil.flattenObsToArray(conceptSetObservation).forEach(function(obs){var correspondingRecentObs=_.filter(recentObservations,function(recentObs){return obs.concept.uuid===recentObs.concept.uuid});null!=correspondingRecentObs&&correspondingRecentObs.length>0&&(correspondingRecentObs.sort(function(obs1,obs2){return new Date(obs2.encounterDateTime)-new Date(obs1.encounterDateTime)}),obs.previous=correspondingRecentObs.map(function(previousObs){return{value:Bahmni.Common.Domain.ObservationValueMapper.map(previousObs),date:previousObs.observationDateTime}}))})})}),deregisterAddMore=$scope.$root.$on("event:addMore",function(event,observation){updateFormConditions([observation],observation)}),deregisterObservationUpdated=$scope.$root.$on("event:observationUpdated-"+conceptSetName,function(event,conceptName,rootObservation){var formName=rootObservation.concept.name,formCondition=Bahmni.ConceptSet.FormConditions.rules&&Bahmni.ConceptSet.FormConditions.rules[conceptName];if(formCondition){var flattenedObs=ObservationUtil.flattenObsToArray([rootObservation]);runFormConditionForObs(!0,formName,formCondition,conceptName,flattenedObs)}});$scope.$on("$destroy",function(){deregisterObservationUpdated(),deregisterAddMore(),cleanUpListenerShowPrevious()})};return{restrict:"E",scope:{conceptSetName:"=",observations:"=?",required:"=?",showTitle:"&",validationHandler:"&",patient:"=",conceptSetFocused:"=?",collapseInnerSections:"=?",atLeastOneValueIsSet:"=?",sectionId:"="},templateUrl:"../common/concept-set/views/conceptSet.html",controller:controller}}]),angular.module("bahmni.common.conceptSet").directive("formControls",["formService","spinner","$timeout","$translate",function(formService,spinner,$timeout,$translate){var loadedFormDetails={},loadedFormTranslations={},unMountReactContainer=function(formUuid){var reactContainerElement=angular.element(document.getElementById(formUuid));reactContainerElement.on("$destroy",function(){unMountForm(document.getElementById(formUuid))})},controller=function($scope){var formUuid=$scope.form.formUuid,formVersion=$scope.form.formVersion,formName=$scope.form.formName,formObservations=$scope.form.observations,collapse=$scope.form.collapseInnerSections&&$scope.form.collapseInnerSections.value,validateForm=$scope.validateForm||!1,locale=$translate.use();loadedFormDetails[formUuid]?$timeout(function(){$scope.form.events=loadedFormDetails[formUuid].events,$scope.form.component=renderWithControls(loadedFormDetails[formUuid],formObservations,formUuid,collapse,$scope.patient,validateForm,locale,loadedFormTranslations[formUuid]),unMountReactContainer($scope.form.formUuid)},0,!1):spinner.forPromise(formService.getFormDetail(formUuid,{v:"custom:(resources
var obs=newObservation(concept,answer,conceptSetConfig);return memberOfCollection.push(obs),obs},removeObsFrom=function(answer){var obs=newObservation(concept,answer,conceptSetConfig);_.remove(memberOfCollection,function(member){return!!member.value&&obs.value.displayString==member.value.displayString})};this.selectAnswer=function(answer){var obs=self.selectedObs[answer.name];obs?(obs.value=answer,obs.voided=!1):(obs=createObsFrom(answer),self.add(obs))};var unselectAnswer=function(answer){var obs=self.selectedObs[answer.name];obs&&obs.uuid?(obs.value=null,obs.voided=!0):(removeObsFrom(answer),delete self.selectedObs[answer.name])},newObservation=function(concept,value,conceptSetConfig){var observation=buildObservation(concept);return new Bahmni.ConceptSet.Observation(observation,{value:value},conceptSetConfig,[])},buildObservation=function(concept){return{concept:concept,units:concept.units,label:concept.shortName||concept.name,possibleAnswers:self.concept.answers,groupMembers:[],comment:null}};this.getValues=function(){var values=[];return _.values(self.selectedObs).forEach(function(obs){obs.value&&values.push(obs.value.shortName||obs.value.name)}),values},this.isComputed=function(){return"Computed"===this.concept.conceptClass},this.getDataTypeName=function(){return this.concept.dataType},this._isDateTimeDataType=function(){return"Datetime"===this.getDataTypeName()},this.isNumeric=function(){return"Numeric"===this.getDataTypeName()},this.isText=function(){return"Text"===this.getDataTypeName()},this.isCoded=function(){return"Coded"===this.getDataTypeName()}},Bahmni.ConceptSet.SpecimenTypeObservation=function(observation,allSamples){angular.extend(this,observation),this.allSamples=allSamples,this.getPossibleAnswers=function(){return this.allSamples},this.hasValueOf=function(answer){return observation.type&&observation.type.uuid===answer.uuid},this.toggleSelection=function(answer){this.hasValueOf(answer)?observation.type=null:observation.type=answer}},Bahmni.ConceptSet.BooleanObservation=function(observation,conceptUIConfig){angular.extend(this,observation),this.isBoolean=!0,this.conceptUIConfig=conceptUIConfig[this.concept.name]||{},this.cloneNew=function(){var clone=new Bahmni.ConceptSet.BooleanObservation(angular.copy(observation),conceptUIConfig);return clone.value=void 0,clone.comment=void 0,clone.uuid=null,clone.disabled=this.disabled,clone};var possibleAnswers=[{displayString:"OBS_BOOLEAN_YES_KEY",value:!0},{displayString:"OBS_BOOLEAN_NO_KEY",value:!1}];this.getPossibleAnswers=function(){return possibleAnswers},this.hasValueOf=function(answer){return this.value===answer.value},this.toggleSelection=function(answer){this.value===answer.value?this.value=null:this.value=answer.value},this.isFormElement=function(){return!0},this.getControlType=function(){return"buttonselect"},this.isRequired=function(){return this.disabled=!!this.disabled&&this.disabled,this.getConceptUIConfig().required===!0&&this.disabled===!1},this.isComputedAndEditable=function(){return"Computed/Editable"===this.concept.conceptClass},this.atLeastOneValueSet=function(){return void 0!=this.value},this.isValid=function(checkRequiredFields,conceptSetRequired){if(this.error)return!1;var notYetSet=function(value){return"undefined"==typeof value||null==value};if(checkRequiredFields){if(conceptSetRequired&&this.isRequired()&&notYetSet(this.value))return!1;if(this.isRequired()&&notYetSet(this.value))return!1}return!0},this.canHaveComment=function(){return!this.getConceptUIConfig().disableAddNotes||!this.getConceptUIConfig().disableAddNotes},this.getConceptUIConfig=function(){return this.conceptUIConfig},this.canAddMore=function(){return 1==this.getConceptUIConfig().allowAddMore},this.isComputed=function(){return"Computed"===this.concept.conceptClass},this.getDataTypeName=function(){return this.concept.dataType},this.hasValue=function(){var value=this.value;return value===!1||(0===value||!(""===value||!value)&&(!(value instanceof Array)||value.length>0))},this.isNumeric=function(){return"Numeric"===this.getDataTypeName()},this.isText=function(){return"Text"=
var value;if("Boolean"===this.type||this.concept&&"Boolean"===this.concept.dataType)return this.value===!0?"OBS_BOOLEAN_YES_KEY":"OBS_BOOLEAN_NO_KEY";if("Datetime"===this.type||this.concept&&"Datetime"===this.concept.dataType){var date=Bahmni.Common.Util.DateUtil.parseDatetime(this.value);return null!=date?Bahmni.Common.Util.DateUtil.formatDateWithTime(date):""}if(this.conceptConfig&&this.conceptConfig.displayMonthAndYear&&(value=Bahmni.Common.Util.DateUtil.getDateInMonthsAndYears(this.value),null!=value))return value;if("Date"===this.type||this.concept&&"Date"===this.concept.dataType)return this.value?Bahmni.Common.Util.DateUtil.formatDateWithoutTime(this.value):"";if(this.isLocationRef())return this.complexData.display;if(this.isProviderRef())return this.complexData.display;value=this.value;var displayValue=value&&(value.shortName||value.name&&(value.name.name||value.name)||value);return this.duration&&(displayValue=displayValue+" "+this.getDurationDisplayValue()),displayValue},getDurationDisplayValue:function(){var durationForDisplay=Bahmni.Common.Util.DateUtil.convertToUnits(this.duration);return"since "+durationForDisplay.value+" "+durationForDisplay.unitName}},Observation}(),Bahmni.Common.Obs.MultiSelectObservation=function(){var MultiSelectObservation=function(groupMembers,conceptConfig){this.type="multiSelect",this.concept=groupMembers[0].concept,this.encounterDateTime=groupMembers[0].encounterDateTime,this.groupMembers=groupMembers,this.conceptConfig=conceptConfig,this.observationDateTime=getLatestObservationDateTime(this.groupMembers),this.providers=groupMembers[0].providers,this.creatorName=groupMembers[0].creatorName},getLatestObservationDateTime=function(groupMembers){var latestObservationDateTime=groupMembers[0].observationDateTime;return groupMembers.forEach(function(member){latestObservationDateTime=latestObservationDateTime<member.observationDateTime?member.observationDateTime:latestObservationDateTime}),latestObservationDateTime};return MultiSelectObservation.prototype={isFormElement:function(){return!0},getDisplayValue:function(){var getName=Bahmni.Common.Domain.ObservationValueMapper.getNameFor.Object;return _.map(this.groupMembers,getName).join(", ")}},MultiSelectObservation}(),Bahmni.Common.Obs.GridObservation=function(){var conceptMapper=new Bahmni.Common.Domain.ConceptMapper,GridObservation=function(obs,conceptConfig){angular.extend(this,obs),this.type="grid",this.conceptConfig=conceptConfig},getObservationDisplayValue=function(observation){if(observation.isBoolean||"Boolean"===observation.type)return observation.value===!0?"OBS_BOOLEAN_YES_KEY":"OBS_BOOLEAN_NO_KEY";if(!observation.value)return"";if("object"==typeof observation.value.name){var valueConcept=conceptMapper.map(observation.value);return valueConcept.shortName||valueConcept.name}return observation.value.shortName||observation.value.name||observation.value};return GridObservation.prototype={isFormElement:function(){return!0},getDisplayValue:function(){var gridObservationDisplayValue=_.compact(_.map(this.groupMembers,function(member){return getObservationDisplayValue(member)})).join(", ");return gridObservationDisplayValue||this.value}},GridObservation}(),Bahmni.Common.Obs.ImageObservation=function(observation,concept,provider){this.concept=concept,this.imageObservation=observation,this.dateTime=observation.observationDateTime,this.provider=provider},Bahmni.Common.Obs.ObservationMapper=function(){var conceptMapper=new Bahmni.Common.Domain.ConceptMapper;this.map=function(bahmniObservations,allConceptsConfig,dontSortByObsDateTime){var mappedObservations=mapObservations(bahmniObservations,allConceptsConfig,dontSortByObsDateTime);return mapUIObservations(mappedObservations,allConceptsConfig)};var mapObservations=function(bahmniObservations,allConceptsConfig,dontSortByObsDateTime){var mappedObservations=[];return bahmniObservations=dontSortByObsDateTime?_.flatten(bahmniObservations):Bahmni.Common.Obs.ObservationUtil.sortSameConceptsWithObsDateTime(bahmniObservations),$.each(bahmniObservations,function(i,bahmniObservation){var conceptConfig=b
return _.toLower(conceptName)===_.toLower(_.get(observation,"concept.name"))})})),$scope.config.persistOrderOfConcepts?$scope.bahmniObservations=(new Bahmni.Common.DisplayControl.Observation.GroupingFunctions).persistOrderOfConceptNames(observations):$scope.bahmniObservations=(new Bahmni.Common.DisplayControl.Observation.GroupingFunctions).groupByEncounterDate(observations),_.isEmpty($scope.bahmniObservations)?($scope.noObsMessage=$translate.instant(Bahmni.Common.Constants.messageForNoObservation),$scope.$emit("no-data-present-event")):$scope.showGroupDateTime?$scope.bahmniObservations[0].isOpen=!0:_.forEach($scope.bahmniObservations,function(bahmniObs){bahmniObs.isOpen=!0});var formObservations=_.filter(observations,function(obs){return obs.formFieldPath});formObservations.length>0&&formRecordTreeBuildService.build($scope.bahmniObservations,$scope.hasNoHierarchy)},fetchObservations=function(){if($scope.config.formType===Bahmni.Common.Constants.formBuilderDisplayControlType){var getFormNameAndVersion=Bahmni.Common.Util.FormFieldPathUtil.getFormNameAndVersion;encounterService.findByEncounterUuid($scope.config.encounterUuid,{includeAll:!1}).then(function(reponse){var encounterTransaction=reponse.data,observationsForSelectedForm=_.filter(encounterTransaction.observations,function(obs){if(obs.formFieldPath){var obsFormNameAndVersion=getFormNameAndVersion(obs.formFieldPath);return obsFormNameAndVersion.formName===$scope.config.formName}});mapObservation(observationsForSelectedForm)}),$scope.title=$scope.config.formDisplayName}else if($scope.observations)mapObservation($scope.observations,$scope.config),$scope.isFulfilmentDisplayControl=!0;else if($scope.config.observationUuid)$scope.initialization=observationsService.getByUuid($scope.config.observationUuid).then(function(response){mapObservation([response.data],$scope.config)});else if($scope.config.encounterUuid){var fetchForEncounter=observationsService.fetchForEncounter($scope.config.encounterUuid,$scope.config.conceptNames);$scope.initialization=fetchForEncounter.then(function(response){mapObservation(response.data,$scope.config)})}else $scope.enrollment?$scope.initialization=observationsService.fetchForPatientProgram($scope.enrollment,$scope.config.conceptNames,$scope.config.scope,$scope.config.obsIgnoreList).then(function(response){mapObservation(response.data,$scope.config)}):$scope.initialization=observationsService.fetch($scope.patient.uuid,$scope.config.conceptNames,$scope.config.scope,$scope.config.numberOfVisits,$scope.visitUuid,$scope.config.obsIgnoreList,null).then(function(response){mapObservation(response.data,$scope.config)})};$scope.translateAttributeName=function(attribute){var keyName=attribute.toUpperCase().replace(/\s\s+/g," ").replace(/[^a-zA-Z0-9 _]/g,"").trim().replace(/ /g,"_"),translationKey=keyName,translation=$translate.instant(translationKey);return translation==translationKey?translation:translation},$scope.toggle=function(element){element.isOpen=!element.isOpen},$scope.isClickable=function(){return $scope.isOnDashboard&&$scope.section.expandedViewConfig&&($scope.section.expandedViewConfig.pivotTable||$scope.section.expandedViewConfig.observationGraph)},fetchObservations(),$scope.dialogData={patient:$scope.patient,section:$scope.section}},link=function($scope,element){$scope.initialization&&spinner.forPromise($scope.initialization,element)};return{restrict:"E",controller:controller,link:link,templateUrl:"../common/displaycontrols/observation/views/observationDisplayControl.html",scope:{patient:"=",visitUuid:"@",section:"=?",config:"=",title:"=sectionTitle",isOnDashboard:"=?",observations:"=?",message:"=?",enrollment:"=?",hasNoHierarchy:"@"}}}]),angular.module("bahmni.common.displaycontrol.observation").controller("AllObservationDetailsController",["$scope",function($scope){$scope.patient=$scope.ngDialogData.patient,$scope.section=$scope.ngDialogData.section,$scope.config=$scope.ngDialogData.section?$scope.ngDialogData.section.expandedViewConfig:{}}]),Bahmni.Common=Bahmni.Common||{},Bahmni.Common.DisplayControl=Bahmni.Common.DisplayControl||{},B
return bahmniOrder.concept.shortName||bahmniOrder.concept.name},$scope.openImage=function(bahmniOrder){bahmniOrder.pacsStudyUrl||messagingService.showMessage("info","NO_PACS_STUDY_FOR_ORDER");var url=bahmniOrder.pacsStudyUrl||bahmniOrder.pacsImageUrl;$window.open(url,"_blank")},$scope.initialization=init()},link=function($scope,element){spinner.forPromise($scope.initialization,element)};return{restrict:"E",controller:controller,link:link,templateUrl:"../common/displaycontrols/pacsOrders/views/pacsOrders.html",scope:{patient:"=",section:"=",orderType:"=",orderUuid:"=",config:"=",visitUuid:"="}}}]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.DisplayControl=Bahmni.Common.DisplayControl||{},Bahmni.Common.DisplayControl.Custom=Bahmni.Common.DisplayControl.Custom||{},angular.module("bahmni.common.displaycontrol.custom",[]),angular.module("bahmni.common.displaycontrol.custom").directive("customDisplayControl",[function(){return{restrict:"E",template:'<div compile-html="config.template"></div>',scope:{patient:"=",visitUuid:"=",section:"=",config:"=",enrollment:"=",params:"=",visitSummary:"="}}}]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.UIControls=Bahmni.Common.UIControls||{},angular.module("bahmni.common.uicontrols",[]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.UIControls=Bahmni.Common.UIControls||{},Bahmni.Common.UIControls.ProgramManagement=Bahmni.Common.UIControls.ProgramManagement||{},angular.module("bahmni.common.uicontrols.programmanagment",[]),angular.module("bahmni.common.uicontrols.programmanagment").controller("ManageProgramController",["$scope","retrospectiveEntryService","$window","programService","spinner","messagingService","$stateParams","$q","confirmBox",function($scope,retrospectiveEntryService,$window,programService,spinner,messagingService,$stateParams,$q,confirmBox){var DateUtil=Bahmni.Common.Util.DateUtil;$scope.programSelected={},$scope.workflowStateSelected={},$scope.allPrograms=[],$scope.programWorkflowStates=[],$scope.workflowStatesWithoutCurrentState=[],$scope.outComesForProgram=[],$scope.configName=$stateParams.configName,$scope.today=DateUtil.getDateWithoutTime(DateUtil.now());var id="#programEnrollmentContainer",updateActiveProgramsList=function(){spinner.forPromise(programService.getPatientPrograms($scope.patient.uuid).then(function(programs){$scope.activePrograms=programs.activePrograms,_.each($scope.activePrograms,function(patientProgram){populateDefaultSelectedState(patientProgram)}),$scope.activePrograms.showProgramSection=!0,$scope.endedPrograms=programs.endedPrograms,$scope.endedPrograms.showProgramSection=!0}).then(function(){formatProgramDates()}),id)},populateDefaultSelectedState=function(patientProgram){var activePatientProgramState=getActivePatientProgramState(patientProgram.states);patientProgram.selectedState=activePatientProgramState?activePatientProgramState.state:null},formatProgramDates=function(){_.each($scope.activePrograms,function(activeProgram){activeProgram.fromDate=Bahmni.Common.Util.DateUtil.parseLongDateToServerFormat(activeProgram.dateEnrolled),activeProgram.toDate=Bahmni.Common.Util.DateUtil.parseLongDateToServerFormat(activeProgram.dateCompleted)}),_.each($scope.endedPrograms,function(endedProgram){endedProgram.fromDate=Bahmni.Common.Util.DateUtil.parseLongDateToServerFormat(endedProgram.dateEnrolled),endedProgram.toDate=Bahmni.Common.Util.DateUtil.parseLongDateToServerFormat(endedProgram.dateCompleted)})},getCurrentDate=function(){var retrospectiveDate=retrospectiveEntryService.getRetrospectiveDate();return DateUtil.parseLongDateToServerFormat(retrospectiveDate)},init=function(){spinner.forPromise(programService.getAllPrograms().then(function(programs){$scope.allPrograms=programs,$scope.allPrograms.showProgramSection=!0}),id),spinner.forPromise(programService.getProgramAttributeTypes().then(function(programAttributeTypes){$scope.programAttributeTypes=programAttributeTypes}),id),$scope.programSelected=null,$scope.patientProgramAttributes={},$scope.programEnrollmentDate=null,updateActiveProgram
response.fraction={label:result,value:mantissa}),response};if(this.encounterDate=encounterDate?encounterDate:now,this.asNeeded=this.asNeeded||!1,this.route=this.route||void 0,this.durationUnit=this.durationUnit||inputOptionsConfig.defaultDurationUnit,this.simpleDrugForm=this.simpleDrugForm||inputOptionsConfig.simpleDrugForm||!1,this.instructions=this.instructions||inputOptionsConfig.defaultInstructions,this.autoExpireDate=this.autoExpireDate||void 0,this.frequencyType=this.frequencyType||Bahmni.Clinical.Constants.dosingTypes.uniform,this.uniformDosingType=this.uniformDosingType||{},this.uniformDosingType.dose&&config.getDoseFractions&&!_.isEmpty(config.getDoseFractions())){var destructredNumber=destructureReal(this.uniformDosingType.dose);this.uniformDosingType.dose=0===destructredNumber.dose?"":destructredNumber.dose,destructredNumber.fraction&&(this.uniformDosingType.doseFraction=destructredNumber.fraction)}this.variableDosingType=this.variableDosingType||{},this.durationInDays=this.durationInDays||0,this.isDiscontinuedAllowed=this.isDiscontinuedAllowed||!0,this.isEditAllowed=this.isEditAllowed||!0,this.quantityEnteredViaEdit=this.quantityEnteredViaEdit||!1,this.quantityEnteredManually=this.quantityEnteredManually||!1,this.quantityUnitEnteredManually=this.quantityUnitEnteredManually||!1,this.isBeingEdited=this.isBeingEdited||!1,this.orderAttributes=[],this.isNonCodedDrug=this.isNonCodedDrug||!1,this.isDurationRequired=!inputOptionsConfig.duration||0!=inputOptionsConfig.duration.required,inputOptionsConfig.defaultStartDate!==!1||this.effectiveStartDate?this.effectiveStartDate=this.effectiveStartDate||this.encounterDate:this.effectiveStartDate=null,this.isUniformFrequency=!0,this.showExtraInfo=!1,this.overlappingScheduledWith=function(otherDrugOrder){var dateUtil=Bahmni.Common.Util.DateUtil;return!otherDrugOrder.effectiveStopDate&&!this.effectiveStopDate||(otherDrugOrder.effectiveStopDate?this.effectiveStopDate?dateUtil.diffInSeconds(this.effectiveStartDate,otherDrugOrder.effectiveStopDate)<=0&&dateUtil.diffInSeconds(this.effectiveStopDate,otherDrugOrder.effectiveStartDate)>-1:dateUtil.diffInSeconds(this.effectiveStartDate,otherDrugOrder.effectiveStartDate)>-1&&dateUtil.diffInSeconds(this.effectiveStartDate,otherDrugOrder.effectiveStopDate)<1:dateUtil.diffInSeconds(this.effectiveStopDate,otherDrugOrder.effectiveStartDate)>-1)};var morphToMixedFraction=function(number){var mantissa=parseFloat((number-Math.floor(number)).toFixed(2)),abscissa=Math.ceil(number-mantissa);if(!config.getDoseFractions||_.isEmpty(config.getDoseFractions())||0===mantissa)return number;var result=_.result(_.find(config.getDoseFractions(),function(item){return item.value===mantissa}),"label");return result?abscissa?""+abscissa+result:""+result:number},simpleDoseAndFrequency=function(){var doseAndUnits,uniformDosingType=self.uniformDosingType,mantissa=self.uniformDosingType.doseFraction?self.uniformDosingType.doseFraction.value:0,dose=uniformDosingType.dose?uniformDosingType.dose:0;return(uniformDosingType.dose||mantissa)&&(doseAndUnits=blankIfFalsy(morphToMixedFraction(parseFloat(dose)+mantissa))+" "+blankIfFalsy(self.doseUnits)),addDelimiter(blankIfFalsy(doseAndUnits),", ")+addDelimiter(blankIfFalsy(uniformDosingType.frequency),", ")},numberBasedDoseAndFrequency=function(){var variableDosingType=self.variableDosingType,variableDosingString=addDelimiter(morphToMixedFraction(variableDosingType.morningDose||0)+"-"+morphToMixedFraction(variableDosingType.afternoonDose||0)+"-"+morphToMixedFraction(variableDosingType.eveningDose||0)," ");if(!self.isVariableDoseEmpty(variableDosingType))return addDelimiter((variableDosingString+blankIfFalsy(self.doseUnits)).trim(),", ")};this.isVariableDoseEmpty=function(variableDosingType){return!variableDosingType.morningDose&&!variableDosingType.afternoonDose&&!variableDosingType.eveningDose};var asNeeded=function(asNeeded){return asNeeded&&config.translate?config.translate(null,"MEDICATION_AS_NEEDED"):asNeeded?"sos":""},blankIfFalsy=function(value){return value?value.toString().trim():""},getDoseAndFrequency=function
},flatten=function(transactions,item){return transactions.reduce(function(result,transaction){return setProviderToObservations(transaction[item],transaction.providers[0]),createMultiSelectObs(transaction.observations),result.concat(transaction[item])},[])},isObservationAgroup=function(observation){return observation.groupMembers&&observation.groupMembers.length>0},removeInvalidGroupMembers=function(observation){angular.forEach(observation.groupMembers,removeInvalidGroupMembers),observation.groupMembers&&(observation.groupMembers=observation.groupMembers.filter(validObservation))},removeInvalidEncounterTypes=function(encounterTransaction){return invalidEncounterTypes.indexOf(encounterTransaction.encounterTypeUuid)===-1};return encounterTransactions=encounterTransactions.filter(removeInvalidEncounterTypes),allObs=flatten(encounterTransactions,"observations").filter(validObservation),allObs.forEach(removeInvalidGroupMembers),allObs}},Bahmni.Clinical.PatientFileObservationsMapper=function(){var DateUtil=Bahmni.Common.Util.DateUtil;this.map=function(encounters){var conceptMapper=new Bahmni.Common.Domain.ConceptMapper,observationMapper=new Bahmni.Common.Domain.ObservationMapper,providerMapper=new Bahmni.Common.Domain.ProviderMapper,patientFileRecords=[];return encounters.forEach(function(encounter){var visitUuid=encounter.visit&&encounter.visit.uuid;encounter.obs.forEach(function(parentObservation){parentObservation.groupMembers.forEach(function(member){patientFileRecords.push({id:member.id,concept:conceptMapper.map(parentObservation.concept),imageObservation:observationMapper.map(member),visitUuid:visitUuid,provider:providerMapper.map(encounter.provider),visitStartDate:encounter.visit.startDatetime,visitStopDate:encounter.visit.stopDatetime,comment:member.comment})})})}),patientFileRecords.sort(function(record1,record2){return record1.imageObservation.observationDateTime!==record2.imageObservation.observationDateTime?DateUtil.parse(record1.imageObservation.observationDateTime)-DateUtil.parse(record2.imageObservation.observationDateTime):record1.id-record2.id}),patientFileRecords}},Bahmni.Clinical.OrdersMapper=function(nameToSort){this.nameToSort=nameToSort},Bahmni.Clinical.OrdersMapper.prototype.group=function(orders,groupingParameter){var getGroupingFunction=function(groupingParameter){return"date"===groupingParameter?function(order){return order.startDate?Bahmni.Common.Util.DateUtil.getDate(order.startDate):Bahmni.Common.Util.DateUtil.getDate(order.effectiveStartDate)}:function(order){return order[groupingParameter]}};groupingParameter=groupingParameter||"date";var groupingFunction=getGroupingFunction(groupingParameter),groupedOrders=(new Bahmni.Clinical.ResultGrouper).group(orders,groupingFunction,"orders",groupingParameter);return"date"===groupingParameter?groupedOrders.map(function(order){return{date:Bahmni.Common.Util.DateUtil.parse(order.date),orders:_.sortBy(order.orders,"orderNumber")}}).sort(function(first,second){return first.date<second.date?1:-1}):groupedOrders.map(function(order){var returnObj={};return returnObj[groupingParameter]=order[groupingParameter],returnObj.orders=order.orders,returnObj})},Bahmni.Clinical.OrdersMapper.prototype.create=function(encounterTransactions,ordersName,filterFunction,groupingParameter,allTestAndPanels){filterFunction=filterFunction||function(){return!0};var filteredOrders=this.map(encounterTransactions,ordersName,allTestAndPanels).filter(filterFunction);return this.group(filteredOrders,groupingParameter)},Bahmni.Clinical.OrdersMapper.prototype.map=function(encounterTransactions,ordersName,allTestAndPanels){var allTestsPanelsConcept=new Bahmni.Clinical.ConceptWeightBasedSorter(allTestAndPanels),orderObservationsMapper=new Bahmni.Clinical.OrderObservationsMapper,setOrderProvider=function(encounter){encounter[ordersName].forEach(function(order){order.provider=encounter.providers[0],order.accessionUuid=encounter.encounterUuid,order.encounterUuid=encounter.encounterUuid,order.visitUuid=encounter.visitUuid})};encounterTransactions.forEach(setOrderProvider);var flattenedOrders=_(encoun
});$scope.$on("$destroy",cleanUpListener)}]),angular.module("bahmni.clinical").controller("PatientDashboardLabOrdersController",["$scope","$stateParams",function($scope,$stateParams){$scope.dashboardConfig=$scope.dashboard.getSectionByType("labOrders").dashboardConfig||{},$scope.dashboardConfig.patientUuid=$stateParams.patientUuid,$scope.dialogData={patient:$scope.patient,expandedViewConfig:$scope.dashboard.getSectionByType("labOrders").expandedViewConfig||{}}}]),angular.module("bahmni.clinical").controller("PatientDashboardLabSummaryController",["$scope","$stateParams",function($scope,$stateParams){$scope.expandedViewConfig=$scope.ngDialogData.expandedViewConfig,$scope.expandedViewConfig.patientUuid=$stateParams.patientUuid,$scope.patient=$scope.ngDialogData.patient}]),angular.module("bahmni.clinical").controller("PatientDashboardRadiologyController",["$scope",function($scope){$scope.config=$scope.dashboard.getSectionByType("radiology")||{}}]),angular.module("bahmni.clinical").controller("PatientDashboardAllDiseaseTemplateController",["$scope","diseaseTemplateService","spinner","appService","$stateParams",function($scope,diseaseTemplateService,spinner,appService,$stateParams){var init=function(){$scope.diseaseName=$scope.ngDialogData.diseaseTemplateName,$scope.patient=$scope.ngDialogData.patient,$scope.section=$scope.ngDialogData.section,$scope.showDateTimeForIntake=!0,$scope.showTimeForProgress=!0;var programConfig=appService.getAppDescriptor().getConfigValue("program"),startDate=null,endDate=null;return programConfig&&programConfig.showDetailsWithinDateRange&&(startDate=$stateParams.dateEnrolled,endDate=$stateParams.dateCompleted),diseaseTemplateService.getAllDiseaseTemplateObs($scope.patient.uuid,$scope.diseaseName,startDate,endDate).then(function(diseaseTemplate){$scope.diseaseTemplate=diseaseTemplate})};spinner.forPromise(init())}]),angular.module("bahmni.clinical").controller("PatientDashboardController",["$scope","clinicalAppConfigService","clinicalDashboardConfig","printer","$state","spinner","visitSummary","appService","$stateParams","diseaseTemplateService","patientContext","$location","$filter",function($scope,clinicalAppConfigService,clinicalDashboardConfig,printer,$state,spinner,visitSummary,appService,$stateParams,diseaseTemplateService,patientContext,$location,$filter){$scope.patient=patientContext.patient,$scope.activeVisit=$scope.visitHistory.activeVisit,$scope.activeVisitData={},$scope.obsIgnoreList=clinicalAppConfigService.getObsIgnoreList(),$scope.clinicalDashboardConfig=clinicalDashboardConfig,$scope.visitSummary=visitSummary,$scope.enrollment=$stateParams.enrollment,$scope.isDashboardPrinting=!1;var programConfig=appService.getAppDescriptor().getConfigValue("program")||{};$scope.stateChange=function(){return"patient.dashboard.show"===$state.current.name};var cleanUpListenerSwitchDashboard=$scope.$on("event:switchDashboard",function(event,dashboard){$scope.init(dashboard)}),cleanUpListenerPrintDashboard=$scope.$on("event:printDashboard",function(event,tab){var printScope=$scope.$new();printScope.isDashboardPrinting=!0,printScope.tabBeingPrinted=tab||clinicalDashboardConfig.currentTab;var dashboardModel=Bahmni.Common.DisplayControl.Dashboard.create(printScope.tabBeingPrinted,$filter);spinner.forPromise(diseaseTemplateService.getLatestDiseaseTemplates($stateParams.patientUuid,clinicalDashboardConfig.getDiseaseTemplateSections(printScope.tabBeingPrinted),null,null).then(function(diseaseTemplate){printScope.diseaseTemplates=diseaseTemplate,printScope.sectionGroups=dashboardModel.getSections(printScope.diseaseTemplates),printer.printFromScope("dashboard/views/dashboardPrint.html",printScope)}))});$scope.$on("$destroy",function(){cleanUpListenerSwitchDashboard(),cleanUpListenerPrintDashboard()});var addTabNameToParams=function(board){$location.search("currentTab",board.translationKey)},getCurrentTab=function(){var currentTabKey=$location.search().currentTab,currentTab=$state.current.dashboard;return currentTabKey&&(currentTab=_.find(clinicalDashboardConfig.visibleTabs,function(tab){return tab.translation
var deferer=$q.defer(),labConceptsPromise=conceptSetService.getConcept({name:Bahmni.Clinical.Constants.labConceptSetName,v:"custom:(uuid,setMembers:(uuid,name,conceptClass,setMembers:(uuid,name,conceptClass,setMembers:(uuid,name,conceptClass))))"},!0),departmentConceptsPromise=conceptSetService.getConcept({name:Bahmni.Clinical.Constants.labDepartmentsConceptSetName,v:"custom:(uuid,setMembers:(uuid,name,setMembers:(uuid,name)))"},!0);return $q.all([labConceptsPromise,departmentConceptsPromise]).then(function(results){var labConceptsSet=results[0].data.results[0],labDepartmentsSet=results[1].data.results[0],tests=(new Bahmni.LabConceptsMapper).map(labConceptsSet,labDepartmentsSet);deferer.resolve(tests)},deferer.reject),deferer.promise}}]),angular.module("bahmni.clinical").service("otherTestsProvider",["$q","conceptSetService","clinicalAppConfigService",function($q,conceptSetService,clinicalAppConfigService){var orderTypesMapConfig=clinicalAppConfigService.getOtherInvestigationsMap(),orderTypesMap=orderTypesMapConfig?orderTypesMapConfig.value:{},mapper=new Bahmni.OtherInvestigationsConceptsMapper(orderTypesMap);this.getTests=function(){var deferer=$q.defer(),otherInvestigationsConceptPromise=conceptSetService.getConcept({name:Bahmni.Clinical.Constants.otherInvestigationsConceptSetName,v:"fullchildren"},!0),categoriesConceptPromise=conceptSetService.getConcept({name:Bahmni.Clinical.Constants.otherInvestigationCategoriesConceptSetName,v:"custom:(uuid,setMembers:(uuid,name,setMembers:(uuid,name)))"},!0);return $q.all([otherInvestigationsConceptPromise,categoriesConceptPromise]).then(function(results){var otherInvestigationConcept=results[0].data.results[0],labDepartmentsSet=results[1].data.results[0],tests=mapper.map(otherInvestigationConcept,labDepartmentsSet);deferer.resolve(tests)},deferer.reject),deferer.promise}}]),Bahmni.Clinical.Notifier=function(){var callBacks={};this.register=function(key,callback){callBacks[key]=callback},this.fire=function(){_.each(callBacks,function(callback){callback()})}},angular.module("bahmni.clinical").factory("treatmentConfig",["treatmentService","spinner","configurationService","appService","$q","$translate",function(treatmentService,spinner,configurationService,appService,$q,$translate){var getConfigFromServer=function(baseTreatmentConfig){return treatmentService.getConfig().then(function(result){var config=angular.extend(baseTreatmentConfig,result.data);return config.frequencies=_(config.frequencies).reverse().sortBy({name:"Immediately"}).sortBy({name:"SOS"}).reverse().value(),config})},setNonCodedDrugConcept=function(config){return treatmentService.getNonCodedDrugConcept().then(function(data){return config.nonCodedDrugconcept={uuid:data},config})},setStoppedOrderReasonConcepts=function(config){return configurationService.getConfigurations(["stoppedOrderReasonConfig"]).then(function(response){var stoppedOrderReasonConfig=response.stoppedOrderReasonConfig.results[0]||{};return config.stoppedOrderReasonConcepts=stoppedOrderReasonConfig.answers,config})};return function(tabConfigName){var drugOrderOptions,baseTreatmentConfig={allowNonCodedDrugs:function(){return drugOrderOptions.allowNonCodedDrugs},getDoseUnits:function(){return drugOrderOptions.doseUnits},getRoutes:function(){return drugOrderOptions.routes},getDurationUnits:function(){return drugOrderOptions.durationUnits},getDosingInstructions:function(){return drugOrderOptions.dosingInstructions},getDispensingUnits:function(){return drugOrderOptions.dispensingUnits},getFrequencies:function(){return drugOrderOptions.frequencies},getDosePlaceHolder:function(){return drugOrderOptions.dosePlaceHolder},getDoseFractions:function(){return drugOrderOptions.doseFractions},isHiddenField:function(fieldName){return _.includes(drugOrderOptions.hiddenFields,fieldName)},isDropDown:function(){return drugOrderOptions.isDropDown&&drugOrderOptions.drugConceptSet},isAutoComplete:function(){return!this.isDropDown()},getDrugConceptSet:function(){return drugOrderOptions.drugConceptSet},isDropDownForGivenConceptSet:function(){return this.isDropDown()&&this.get
$scope.toggleNote=function(){$scope.noteState=!$scope.noteState};var init=function(){$scope.noteState=!(!$scope.consultation.labOrderNote||!$scope.consultation.labOrderNote.value)};$scope.onNoteChanged=function(){$scope.consultation.labOrderNote&&($scope.consultation.labOrderNote.observationDateTime=null)},init()}]),angular.module("bahmni.clinical").controller("OrderController",["$scope","allOrderables","ngDialog","retrospectiveEntryService","appService","$translate",function($scope,allOrderables,ngDialog,retrospectiveEntryService,appService,$translate){$scope.consultation.orders=$scope.consultation.orders||[],$scope.consultation.childOrders=$scope.consultation.childOrders||[],$scope.allOrdersTemplates=allOrderables;var RadiologyOrderOptionsConfig=appService.getAppDescriptor().getConfig("enableRadiologyOrderOptions"),LabOrderOptionsConfig=appService.getAppDescriptor().getConfig("enableLabOrderOptions");$scope.enableRadiologyOrderOptions=RadiologyOrderOptionsConfig?RadiologyOrderOptionsConfig.value:null,$scope.enableLabOrderOptions=LabOrderOptionsConfig?LabOrderOptionsConfig.value:null;var testConceptToParentsMapping={},collapseExistingActiveSection=function(section){section&&(section.klass="")},showFirstLeftCategoryByDefault=function(){if(!$scope.activeTab.leftCategory){var allLeftCategories=$scope.getOrderTemplate($scope.activeTab.name).setMembers;allLeftCategories.length>0&&$scope.showLeftCategoryTests(allLeftCategories[0])}},findTest=function(testUuid){var test,allLeftCategories=$scope.getOrderTemplate($scope.activeTab.name).setMembers;return _.each(allLeftCategories,function(leftCategory){var foundTest=_.find(leftCategory.setMembers,function(test){return test.uuid===testUuid});if(foundTest)return void(test=foundTest)}),test},removeOrder=function(testUuid){var order=_.find($scope.consultation.orders,function(order){return order.concept.uuid===testUuid});order&&(order.uuid?order.isDiscontinued=!0:_.remove($scope.consultation.orders,order))},createOrder=function(test){var discontinuedOrder=_.find($scope.consultation.orders,function(order){return test.uuid===order.concept.uuid&&order.isDiscontinued});if(discontinuedOrder)discontinuedOrder.isDiscontinued=!1;else{var createdOrder=Bahmni.Clinical.Order.create(test);$scope.consultation.orders.push(createdOrder)}},initTestConceptToParentsMapping=function(){var allLeftCategories=$scope.getOrderTemplate($scope.activeTab.name).setMembers;_.each(allLeftCategories,function(leftCategory){_.each(leftCategory.setMembers,function(member){0!==member.setMembers.length&&_.each(member.setMembers,function(child){void 0===testConceptToParentsMapping[child.uuid]&&(testConceptToParentsMapping[child.uuid]=[]),testConceptToParentsMapping[child.uuid].push(member.uuid)})})})},init=function(){$scope.tabs=[],_.forEach($scope.allOrdersTemplates,function(item){var conceptName=$scope.getName(item);$scope.tabs.push({name:conceptName?conceptName:item.name.name,topLevelConcept:item.name.name})}),$scope.tabs&&($scope.activateTab($scope.tabs[0]),initTestConceptToParentsMapping())};$scope.isRetrospectiveMode=function(){return!_.isEmpty(retrospectiveEntryService.getRetrospectiveEntry())},$scope.activateTab=function(tab){"active"===tab.klass?(tab.klass="",$scope.activeTab=void 0):(collapseExistingActiveSection($scope.activeTab),$scope.activeTab=tab,$scope.activeTab.klass="active",$scope.updateSelectedOrdersForActiveTab(),initTestConceptToParentsMapping(),showFirstLeftCategoryByDefault())},$scope.updateSelectedOrdersForActiveTab=function(){if($scope.activeTab){var activeTabTestConcepts=_.map(_.flatten(_.map($scope.getOrderTemplate($scope.activeTab.name).setMembers,"setMembers")),"uuid");$scope.selectedOrders=_.filter($scope.consultation.orders,function(testOrder){return _.indexOf(activeTabTestConcepts,testOrder.concept.uuid)!==-1}),_.each($scope.selectedOrders,function(order){order.isUrgent="STAT"==order.urgency||order.isUrgent})}},$scope.getOrderTemplate=function(templateName){var key="'"+templateName+"'";return $scope.allOrdersTemplates[key]},$scope.showLeftCategoryTests=function(leftCategory){collapseExist
}}),$scope.popupActive=!0)}),$scope.consultation.preSaveHandler.register("drugOrderSaveHandlerKey",saveTreatment);var mergeActiveAndScheduledWithDiscontinuedOrders=function(){_.each($scope.consultation.discontinuedDrugs,function(discontinuedDrug){_.remove($scope.consultation.activeAndScheduledDrugOrders,{uuid:discontinuedDrug.uuid}),$scope.consultation.activeAndScheduledDrugOrders.push(discontinuedDrug)})},init=function(){$scope.consultation.removableDrugs=$scope.consultation.removableDrugs||[],$scope.consultation.discontinuedDrugs=$scope.consultation.discontinuedDrugs||[],$scope.consultation.drugOrdersWithUpdatedOrderAttributes=$scope.consultation.drugOrdersWithUpdatedOrderAttributes||{},$scope.consultation.activeAndScheduledDrugOrders=getActiveDrugOrders(activeDrugOrders),mergeActiveAndScheduledWithDiscontinuedOrders(),$scope.treatmentConfig=treatmentConfig};init()}]),angular.module("bahmni.clinical").controller("DispositionController",["$scope","$q","dispositionService","appService","retrospectiveEntryService","spinner","$rootScope","$translate",function($scope,$q,dispositionService,appService,retrospectiveEntryService,spinner,$rootScope,$translate){var consultation=$scope.consultation,allDispositions=[],getPreviousDispositionNote=function(){if(consultation.disposition&&!consultation.disposition.voided)return _.find(consultation.disposition.additionalObs,function(obs){return obs.concept.uuid===$scope.dispositionNoteConceptUuid})},getDispositionNotes=function(){var previousDispositionNotes=getPreviousDispositionNote();return getSelectedConceptName($scope.dispositionCode,$scope.dispositionActions)?_.cloneDeep(previousDispositionNotes)||{concept:{uuid:$scope.dispositionNoteConceptUuid}}:{concept:{uuid:$scope.dispositionNoteConceptUuid}}},getDispositionActionsPromise=function(){return dispositionService.getDispositionActions().then(function(response){allDispositions=(new Bahmni.Clinical.DispostionActionMapper).map(response.data.results[0].answers),$scope.dispositionActions=filterDispositionActions(allDispositions,$scope.$parent.visitSummary),$scope.dispositionCode=consultation.disposition&&!consultation.disposition.voided?consultation.disposition.code:null,$scope.dispositionNote=getDispositionNotes()})},getDispositionActions=function(finalDispositionActions,dispositions,action){var copyOfFinalDispositionActions=_.cloneDeep(finalDispositionActions),dispositionPresent=_.find(dispositions,action);return dispositionPresent&&copyOfFinalDispositionActions.push(dispositionPresent),copyOfFinalDispositionActions};$scope.getTranslatedDisposition=function(dispositionName){var translatedName=Bahmni.Common.Util.TranslationUtil.translateAttribute(dispositionName,Bahmni.Common.Constants.disposition,$translate);return translatedName};var filterDispositionActions=function(dispositions,visitSummary){var defaultDispositions=["Undo Discharge","Admit Patient","Transfer Patient","Discharge Patient"],finalDispositionActions=_.filter(dispositions,function(disposition){return defaultDispositions.indexOf(disposition.name)<0}),isVisitOpen=!!visitSummary&&_.isEmpty(visitSummary.stopDateTime);return visitSummary&&visitSummary.isDischarged()&&isVisitOpen?finalDispositionActions=getDispositionActions(finalDispositionActions,dispositions,{name:defaultDispositions[0]}):visitSummary&&visitSummary.isAdmitted()&&isVisitOpen?(finalDispositionActions=getDispositionActions(finalDispositionActions,dispositions,{name:defaultDispositions[2]}),finalDispositionActions=getDispositionActions(finalDispositionActions,dispositions,{name:defaultDispositions[3]})):finalDispositionActions=getDispositionActions(finalDispositionActions,dispositions,{name:defaultDispositions[1]}),finalDispositionActions};$scope.isRetrospectiveMode=function(){return!_.isEmpty(retrospectiveEntryService.getRetrospectiveEntry())},$scope.showWarningForEarlierDispositionNote=function(){return!$scope.dispositionCode&&consultation.disposition};var getDispositionNotePromise=function(){return dispositionService.getDispositionNoteConcept().then(function(response){$scope.dispositionNoteConceptUuid=respo
return drugOrder.orderGroupUuid?"orderSetOrders":"drugOrders"}),refillableDrugOrders=drugOrderHistoryHelper.getRefillableDrugOrders(orderSetOrdersAndDrugOrders.drugOrders,getPreviousVisitDrugOrders(),showOnlyActive);return _(orderSetOrdersAndDrugOrders.orderSetOrders).concat(refillableDrugOrders).uniqBy("uuid").value()},createRecentDrugOrderGroup=function(activeAndScheduledDrugOrders){var showOnlyActive=treatmentConfig.drugOrderHistoryConfig.showOnlyActive,refillableGroup={label:$translate.instant("MEDICATION_RECENT_TAB"),selected:!0,drugOrders:sortOrderSetDrugsFollowedByDrugOrders(activeAndScheduledDrugOrders,showOnlyActive)};$scope.consultation.drugOrderGroups.unshift(refillableGroup),void 0!==treatmentConfig.drugOrderHistoryConfig.numberOfVisits&&null!==treatmentConfig.drugOrderHistoryConfig.numberOfVisits&&0===treatmentConfig.drugOrderHistoryConfig.numberOfVisits&&($scope.consultation.drugOrderGroups=[$scope.consultation.drugOrderGroups[0]])},createPrescribedDrugOrderGroups=function(){if(0===prescribedDrugOrders.length)return[];var drugOrderGroupedByDate=_.groupBy(prescribedDrugOrders,function(drugOrder){return DateUtil.parse(drugOrder.visit.startDateTime)}),createDrugOrder=function(drugOrder){return DrugOrderViewModel.createFromContract(drugOrder,treatmentConfig)},drugOrderGroups=_.map(drugOrderGroupedByDate,function(drugOrders,visitStartDate){return{label:$filter("bahmniDate")(visitStartDate),visitStartDate:DateUtil.parse(visitStartDate),drugOrders:drugOrders.map(createDrugOrder),isCurrentVisit:currentVisit&&DateUtil.isSameDateTime(visitStartDate,currentVisit.startDatetime)}});$scope.consultation.drugOrderGroups=$scope.consultation.drugOrderGroups.concat(drugOrderGroups),$scope.consultation.drugOrderGroups=_.sortBy($scope.consultation.drugOrderGroups,"visitStartDate").reverse()};$scope.stoppedOrderReasons=treatmentConfig.stoppedOrderReasonConcepts;var init=function(){var numberOfVisits=treatmentConfig.drugOrderHistoryConfig.numberOfVisits?treatmentConfig.drugOrderHistoryConfig.numberOfVisits:3;spinner.forPromise(treatmentService.getPrescribedDrugOrders($stateParams.patientUuid,!0,numberOfVisits,$stateParams.dateEnrolled,$stateParams.dateCompleted).then(function(data){prescribedDrugOrders=data,createPrescriptionGroups($scope.consultation.activeAndScheduledDrugOrders)}))};$scope.getOrderReasonConcept=function(drugOrder){if(drugOrder.orderReasonConcept)return drugOrder.orderReasonConcept.display||drugOrder.orderReasonConcept.name},$scope.toggleShowAdditionalInstructions=function(line){line.showAdditionalInstructions=!line.showAdditionalInstructions},$scope.drugOrderGroupsEmpty=function(){return _.isEmpty($scope.consultation.drugOrderGroups)},$scope.isDrugOrderGroupEmpty=function(drugOrders){return _.isEmpty(drugOrders)},$scope.showEffectiveFromDate=function(visitStartDate,effectiveStartDate){return $filter("bahmniDate")(effectiveStartDate)!==$filter("bahmniDate")(visitStartDate)},$scope.refill=function(drugOrder){$rootScope.$broadcast("event:refillDrugOrder",drugOrder)},$scope.refillAll=function(drugOrders){$rootScope.$broadcast("event:refillDrugOrders",drugOrders)},$scope.revise=function(drugOrder,drugOrders){$scope.consultation.drugOrdersWithUpdatedOrderAttributes[drugOrder.uuid]&&(delete $scope.consultation.drugOrdersWithUpdatedOrderAttributes[drugOrder.uuid],$scope.toggleDrugOrderAttribute(drugOrder.orderAttributes[0])),drugOrder.isEditAllowed&&$rootScope.$broadcast("event:reviseDrugOrder",drugOrder,drugOrders)},$scope.updateFormConditions=function(drugOrder){var formCondition=Bahmni.ConceptSet.FormConditions.rules?Bahmni.ConceptSet.FormConditions.rules["Medication Stop Reason"]:void 0;formCondition?drugOrder.orderReasonConcept?formCondition(drugOrder,drugOrder.orderReasonConcept.name.name)||disableAndClearReasonText(drugOrder):disableAndClearReasonText(drugOrder):drugOrder.orderReasonNotesEnabled=!0};var disableAndClearReasonText=function(drugOrder){drugOrder.orderReasonText=null,drugOrder.orderReasonNotesEnabled=!1};$scope.discontinue=function(drugOrder){drugOrder.isDiscontinuedAllowed&&($rootScope.$broadcast("
scope:{params:"=",visitUuid:"=",patientUuid:"="},link:link}}]),function(){Bahmni=Bahmni||{},Bahmni.Clinical=Bahmni.Clinical||{},Bahmni.Clinical.ObservationGraph=function(model){angular.extend(this,model)};var fixCaseMismatchIssues=function(config,observations){var conceptNamesFromConfig=config.yAxisConcepts.slice(0);conceptNamesFromConfig.push(config.xAxisConcept),_.each(observations,function(obs){obs.concept.name=_.find(conceptNamesFromConfig,function(configConceptName){return configConceptName.toLowerCase()===obs.concept.name.toLowerCase()})})},createObservationPoint=function(config,obs,xAxisValues){var observation={};return observation[config.xAxisConcept]=xAxisValues,observation[obs.concept.name]=obs.value,observation},findMatchingLine=function(lines,obs){return _(lines).find(function(line){return line.name===obs.concept.name})};Bahmni.Clinical.ObservationGraph.create=function(allObservations,person,config,referenceLines){fixCaseMismatchIssues(config,allObservations);var yAxisObservations=_.filter(allObservations,function(obs){return obs.concept.name!==config.xAxisConcept}),xAxisObservations=_.filter(allObservations,function(obs){return obs.concept.name===config.xAxisConcept}),lines=_(yAxisObservations).uniqBy(function(item){return item.concept.name+item.concept.units}).map(function(item){return new Bahmni.Clinical.ObservationGraphLine({name:item.concept.name,units:item.concept.units,values:[]})}).value();if(_.forEach(yAxisObservations,function(yAxisObs){var xValue;if(config.displayForObservationDateTime())config.type="timeseries",xValue=Bahmni.Common.Util.DateUtil.parseDatetime(yAxisObs.observationDateTime).toDate();else if(config.displayForAge())xValue=Bahmni.Common.Util.AgeUtil.differenceInMonths(person.birthdate,yAxisObs.observationDateTime);else{config.type="indexed";var matchingObservation=_.find(xAxisObservations,function(xObs){return yAxisObs.observationDateTime===xObs.observationDateTime});xValue=matchingObservation?matchingObservation.value:void 0}if(void 0!==xValue){var line=findMatchingLine(lines,yAxisObs),observationPoint=createObservationPoint(config,yAxisObs,xValue);line.addPoint(observationPoint)}}),void 0!==referenceLines){lines=lines.concat(referenceLines);var referenceLinesYAxisConcepts=_.map(referenceLines,"name");config.yAxisConcepts=config.yAxisConcepts.concat(referenceLinesYAxisConcepts)}return new Bahmni.Clinical.ObservationGraph(lines)}}(),function(){Bahmni=Bahmni||{},Bahmni.Clinical=Bahmni.Clinical||{},Bahmni.Clinical.ObservationGraphLine=function(proto){angular.extend(this,proto)},Bahmni.Clinical.ObservationGraphLine.prototype.addPoint=function(point){point[this.name]&&this.values.push(point)}}(),function(){Bahmni=Bahmni||{},Bahmni.Clinical=Bahmni.Clinical||{},Bahmni.Clinical.ObservationGraphReference=function(csvString,config,gender,ageInMonths,yAxisUnit){var that=this,monthBuffer=1;this.config=config,this.csvString=csvString,this.yAxisUnit=yAxisUnit,this.referenceChartValues=asMatrix(this.csvString),this.header=this.referenceChartValues.shift(),this.ageColumnIndex=_.findIndex(this.header,function(columnName){return columnName.toLowerCase()===Bahmni.Clinical.Constants.concepts.age.toLowerCase()}),this.genderColumnIndex=_.findIndex(this.header,function(columnName){return columnName.toLowerCase()===Bahmni.Clinical.Constants.gender.toLowerCase()});var maxNoOfMonths=ageInMonths+monthBuffer;this.referenceChartValues=_.filter(this.referenceChartValues,function(value){return value[that.genderColumnIndex]===gender&&(void 0===maxNoOfMonths||value[that.ageColumnIndex]<=maxNoOfMonths)})};var asMatrix=function(csvString){return _.map(csvString.split("\n"),function(line){return line.split(",")})};Bahmni.Clinical.ObservationGraphReference.prototype.createValues=function(columnName){var that=this;return _.map(this.referenceChartValues,function(rowOfValues){var point={};return point[columnName]=rowOfValues[that.header.indexOf(columnName)],point[Bahmni.Clinical.Constants.concepts.age]=rowOfValues[that.ageColumnIndex],point})},Bahmni.Clinical.ObservationGraphReference.prototype.createObservationGraphRefere
var translatedName=Bahmni.Common.Util.TranslationUtil.translateAttribute(program,Bahmni.Common.Constants.program,$translate);return translatedName},$scope.translateProgramAttributes=function(program){var translatedName=Bahmni.Common.Util.TranslationUtil.translateAttribute(program.description,Bahmni.Common.Constants.program,$translate);return translatedName}},link=function($scope,element){spinner.forPromise($scope.initialization,element)};return{restrict:"E",link:link,controller:controller,templateUrl:"../common/displaycontrols/programs/views/programs.html",scope:{patient:"="}}}]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.DisplayControl=Bahmni.Common.DisplayControl||{},Bahmni.Common.DisplayControl.ObsToObsFlowSheet=Bahmni.Common.DisplayControl.ObsToObsFlowSheet||{},angular.module("bahmni.common.displaycontrol.obsVsObsFlowSheet",[]),angular.module("bahmni.common.displaycontrol.obsVsObsFlowSheet").directive("obsToObsFlowSheet",["$translate","spinner","observationsService","conceptSetService","$q","conceptSetUiConfigService",function($translate,spinner,observationsService,conceptSetService,$q,conceptSetUiConfigService){var link=function($scope,element){$scope.config=$scope.isOnDashboard?$scope.section.dashboardConfig:$scope.section.expandedViewConfig,$scope.isEditable=$scope.config.isEditable;var patient=$scope.patient,getTemplateDisplayName=function(){if($scope.config.templateName)return conceptSetService.getConcept({name:$scope.config.templateName,v:"custom:(uuid,names,displayString)"}).then(function(result){var templateConcept=result&&result.data&&result.data.results&&result.data.results[0],displayName=templateConcept&&templateConcept.displayString;templateConcept&&templateConcept.names&&1===templateConcept.names.length&&""!=templateConcept.names[0].name?displayName=templateConcept.names[0].name:templateConcept&&templateConcept.names&&2===templateConcept.names.length&&(displayName=_.find(templateConcept.names,{conceptNameType:"SHORT"}).name),$scope.conceptDisplayName=displayName})},removeEmptyRecords=function(records){return records.headers=_.filter(records.headers,function(header){return!_.every(records.rows,function(record){return _.isEmpty(record.columns[header.name])})}),records},getObsInFlowSheet=function(){return observationsService.getObsInFlowSheet(patient.uuid,$scope.config.templateName,$scope.config.groupByConcept,$scope.config.orderByConcept,$scope.config.conceptNames,$scope.config.numberOfVisits,$scope.config.initialCount,$scope.config.latestCount,$scope.config.type,$scope.section.startDate,$scope.section.endDate,$scope.enrollment,$scope.config.formNames).success(function(data){var obsInFlowSheet=data,groupByElement=_.find(obsInFlowSheet.headers,function(header){return header.name===$scope.config.groupByConcept});obsInFlowSheet.headers=_.without(obsInFlowSheet.headers,groupByElement),obsInFlowSheet.headers.unshift(groupByElement),$scope.config.hideEmptyRecords&&(obsInFlowSheet=removeEmptyRecords(obsInFlowSheet)),$scope.obsTable=obsInFlowSheet,_.isEmpty($scope.obsTable.rows)&&$scope.$emit("no-data-present-event")})},init=function(){return $q.all([getObsInFlowSheet(),getTemplateDisplayName()]).then(function(){})};$scope.isClickable=function(){return $scope.isOnDashboard&&$scope.section.expandedViewConfig},$scope.dialogData={patient:$scope.patient,section:$scope.section},$scope.getEditObsData=function(observation){var editData={observation:{encounterUuid:observation.encounterUuid}};if($scope.config.templateName)editData.observation.uuid=observation.obsGroupUuid,editData.conceptSetName=$scope.config.templateName,editData.conceptDisplayName=$scope.conceptDisplayName;else{var formNameAndVersion=Bahmni.Common.Util.FormFieldPathUtil.getFormNameAndVersion(observation.formFieldPath);editData.observation=Object.assign({},editData.observation,{formType:Bahmni.Common.Constants.formBuilderType,formName:formNameAndVersion.formName,formVersion:formNameAndVersion.formVersion})}return editData},$scope.getPivotOn=function(){return $scope.config.pivotOn},$scope.getHeaderName=function(header){var abbrevi
return findEncounter(providerData,currentProviderUuid,encounterDate).then(function(consultation){return consultation.encounterDateTime=encounterDateWithoutHours,consultation})},findEncounter=function(providerData,currentProviderUuid,encounterDate){return getEncounterType().then(function(encounterType){return encounterService.find({patientUuid:patientUuid,providerUuids:_.isEmpty(providerData)?[currentProviderUuid]:[providerData.uuid],includeAll:Bahmni.Common.Constants.includeAllObservations,encounterDateTimeFrom:encounterDate,encounterDateTimeTo:encounterDate,encounterTypeUuids:[encounterType.uuid],patientProgramUuid:enrollment,locationUuid:$bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName).uuid}).then(function(encounterTransactionResponse){return consultationMapper.map(encounterTransactionResponse.data)})})},getEncounter=function(){return encounterUuid?encounterService.findByEncounterUuid(encounterUuid).then(function(response){return consultationMapper.map(response.data)}):_.isEmpty($rootScope.retrospectiveEntry)?getActiveEncounter():getRetrospectiveEncounter()};return getEncounter().then(function(consultation){return diagnosisService.populateDiagnosisInformation(patientUuid,consultation).then(function(diagnosisConsultation){return diagnosisConsultation.preSaveHandler=new Bahmni.Clinical.Notifier,diagnosisConsultation.postSaveHandler=new Bahmni.Clinical.Notifier,diagnosisConsultation})}).then(function(consultation){return conditionsService.getConditions(patientUuid).then(function(conditions){return consultation.conditions=conditions,consultation})})}}]),angular.module("bahmni.clinical").factory("visitSummaryInitialization",["visitService",function(visitService){return function(visitUuid){return visitUuid?visitService.getVisitSummary(visitUuid).then(function(visitSummaryResponse){return new Bahmni.Common.VisitSummary(visitSummaryResponse.data)}):null}}]),Bahmni.Clinical.Constants=function(){var orderTypes={lab:"Lab Order",radiology:"Radiology Order"},dosingTypes={uniform:"uniform",variable:"variable"},orderActions={discontinue:"DISCONTINUE",new:"NEW",revise:"REVISE"},concepts={age:"Age",weight:"Weight"},errorMessages={discontinuingAndOrderingSameDrug:"DISCONTINUING_AND_ORDERING_SAME_DRUG_NOT_ALLOWED",incompleteForm:"INCOMPLETE_FORM_ERROR_MESSAGE",invalidItems:"Highlighted items in New Prescription section are incomplete. Please edit or remove them to continue",conceptNotNumeric:"CONCEPT_NOT_NUMERIC"},bacteriologyConstants={otherSampleType:"Other",specimenSampleSourceConceptName:"Specimen Sample Source"};return{patientsListUrl:"/patient/search",diagnosisObservationConceptName:"Visit Diagnoses",orderConceptName:"Diagnosis order",certaintyConceptName:"Diagnosis Certainty",nonCodedDiagnosisConceptName:"Non-coded Diagnosis",codedDiagnosisConceptName:"Coded Diagnosis",orderTypes:orderTypes,labOrderType:"Lab Order",drugOrderType:"Drug Order",labConceptSetName:"Lab Samples",testConceptName:"LabTest",labSetConceptName:"LabSet",labDepartmentsConceptSetName:"Lab Departments",otherInvestigationsConceptSetName:"Other Investigations",otherInvestigationCategoriesConceptSetName:"Other Investigations Categories",commentConceptName:"COMMENTS",messageForNoLabOrders:"NO_LAB_ORDERS_MESSAGE",messageForNoObservation:"NO_OBSERVATIONS_CAPTURED",messageForNoActiveVisit:"NO_ACTIVE_VISIT_MESSAGE",dischargeSummaryConceptName:"Discharge Summary",flexibleDosingInstructionsClass:"org.openmrs.module.bahmniemrapi.drugorder.dosinginstructions.FlexibleDosingInstructions",reviseAction:"REVISE",asDirectedInstruction:"As directed",dosingTypes:dosingTypes,orderActions:orderActions,errorMessages:errorMessages,caseIntakeConceptClass:"Case Intake",dialog:"DIALOG",dashboard:"DASHBOARD",default:"DEFAULT",gender:"Gender",concepts:concepts,otherActiveDrugOrders:"Other Active DrugOrders",dispensePrivilege:"bahmni:clinical:dispense",mandatoryVisitConfigUrl:"config/visitMandatoryTab.json",defaultExtensionName:"default",bacteriologyConstants:bacteriologyConstants,globalPropertyToFetchActivePatients:"emrapi.sqlSearch.activePatients",adtPrivilege:"app:adt",