Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMVRPCM

GMVRPCM.m

Go to the documentation of this file.
  1. GMVRPCM ; HOIFO/DP - RPC for Vitals Manager ;07/25/05 9:10am
  1. ;;5.0;GEN. MED. REC. - VITALS;**1,8,13,3,22**;Oct 31, 2002;Build 22
  1. ; Integration Agreements:
  1. ; #10040 [Supported] File 44 references
  1. ; #10076 [Supported] XUSEC Calls
  1. ; #2263 [Supported] XPAR Calls
  1. ; #2541 [Supported] XUPARAM Calls
  1. ; #2692 [Controlled] ORQPTQ1
  1. ; #3227 [Private] NURAPI Calls
  1. ; #4084 [Private] File 44 AC x-ref
  1. ; #4360 [Private] GMV MANAGER RPC
  1. ADDQUAL ; [P] Add qualifier to vital/category
  1. S GMVVIT=+$P(DATA,";",1),GMVCAT=+$P(DATA,";",2),GMVQUAL=+$P(DATA,";",3)
  1. I $O(^GMRD(120.52,GMVQUAL,1,"B",GMVVIT,0)) D Q
  1. .S @RESULTS@(0)="1^Qualifier already assigned."
  1. S GMVFDA(120.521,"+1,"_GMVQUAL_",",.01)=GMVVIT
  1. S GMVFDA(120.521,"+1,"_GMVQUAL_",",.02)=GMVCAT
  1. D UPDATE^DIE("","GMVFDA","GMVIEN","GMVERR")
  1. I $G(GMVIEN(1)) S @RESULTS@(0)=+GMVIEN(1)_"^Qualifier Assigned"
  1. E S @RESULTS@(0)="-1^Unable to assign qualifier"
  1. Q
  1. DELQUAL ; [P] Delete qualifier from vital/category
  1. S GMVVIT=+$P(DATA,";",1),GMVCAT=+$P(DATA,";",2),GMVQUAL=+$P(DATA,";",3)
  1. S X=$O(^GMRD(120.52,GMVQUAL,1,"B",GMVVIT,0))
  1. S GMVFDA(120.521,X_","_GMVQUAL_",",.01)="@"
  1. D FILE^DIE("","GMVFDA","GMVERR")
  1. I $D(GMVERR) S @RESULTS@(0)="-1^Unable to remove qualifier."
  1. E S @RESULTS@(0)="1^Qualifier removed."
  1. Q
  1. DELTEMP ; [P] Delete Template
  1. S GMVENT=$P(DATA,U,1),GMVNAME=$P(DATA,U,2)
  1. I $$GET^XPAR(GMVENT,"GMV TEMPLATE DEFAULT")=GMVNAME D
  1. .D DEL^XPAR(GMVENT,"GMV TEMPLATE DEFAULT",1)
  1. D DEL^XPAR(GMVENT,"GMV TEMPLATE",GMVNAME,.GMVERR)
  1. I '$G(GMVERR) S @RESULTS@(0)="1^Template Removed."
  1. E S @RESULTS@(0)="-1^"_GMVERR
  1. Q
  1. GETCATS ; [P] Return Listing of categories
  1. N GMVQI
  1. F GMVCAT=0:0 S GMVCAT=$O(^GMRD(120.52,"AA",DATA,GMVCAT)) Q:'GMVCAT D
  1. .Q:$$ACTIVE^GMVUID(120.53,"",GMVCAT_",","")
  1. .S GMVQUAL="",X="" F S X=$O(^GMRD(120.52,"AA",DATA,GMVCAT,X)) Q:X="" D
  1. ..S GMVQI=$O(^GMRD(120.52,"AA",DATA,GMVCAT,X,0))
  1. ..Q:$$ACTIVE^GMVUID(120.52,"",GMVQI_",","")
  1. ..S GMVQUAL=GMVQUAL_$S(GMVQUAL]"":", ",1:"")_X
  1. .S Y=$O(@RESULTS@(""),-1)+1
  1. .S @RESULTS@(Y)=GMVCAT_U_$P(^GMRD(120.53,GMVCAT,0),U)_U_GMVQUAL
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)_U_$P(^GMRD(120.51,DATA,0),U)
  1. Q
  1. GETDATA ; [P] Generic fileman data call
  1. ; Variable DATA = File#^IENS^Field#
  1. S @RESULTS@(0)=$$GET1^DIQ($P(DATA,U,1),$P(DATA,U,2),$P(DATA,U,3))
  1. Q
  1. GETDEF ; [P] Get Default Template
  1. I $G(DATA)]"" D Q
  1. .S X=$$GET^XPAR($P(DATA,U),"GMV TEMPLATE DEFAULT")
  1. .I X="" S @RESULTS@(0)="-1^No Default Template"
  1. .E S @RESULTS@(0)=X
  1. D ENVAL^XPAR(.GMV,"GMV TEMPLATE DEFAULT")
  1. S X="" F S X=$O(GMV(X)) Q:X="" D
  1. .S Y=$O(@RESULTS@(""),-1)+1
  1. .S @RESULTS@(Y)=X_U_GMV(X,1)
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. Q
  1. GETHILO ; [P] Returns an abnormal value
  1. S @RESULTS@(0)=+$$GET1^DIQ(120.57,"1,",DATA)
  1. Q
  1. GETLIST ; [P] Return listing of file
  1. K GMVCNT,GMVLOOP,GMVRET,^TMP("DILIST",$J)
  1. S GMVSCRN=""
  1. I +DATA=44 S DATA2=$P(DATA,U,2),DATA=+DATA
  1. I DATA=120.51 D ; Set screen for vitals list
  1. .S GMVSCRN="I $$VITALIEN^GMVUTL8()[("",""_+Y_"","")"
  1. I DATA=42 D ; Screen for ward location
  1. .S GMVSCRN="I '$$INACT42^GMVUT2(+Y)"
  1. I DATA=44 D Q ; Clinics
  1. .N CNT S X=DATA2,CNT=0
  1. .F S X=$O(^SC("AC","C",X)) Q:'X!(CNT>100) D
  1. ..Q:+$G(^SC(X,"OOS"))
  1. ..S Y=$G(^SC(X,"I"))
  1. ..I Y Q:DT>+Y&($P(Y,U,2)=""!(DT<$P(Y,U,2)))
  1. ..S @RESULTS@($O(@RESULTS@(""),-1)+1)=DATA_";"_X_U_$P(^SC(X,0),U),CNT=CNT+1
  1. .S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. I DATA=100.21 D Q ; CPRS Teams
  1. .D TEAMS^ORQPTQ1(.GMVRET)
  1. .F X=0:0 S X=$O(GMVRET(X)) Q:'X S @RESULTS@(X)=DATA_";"_GMVRET(X)
  1. .S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. I DATA=211.4 D Q ; NURS Locations
  1. .D ACTLOCS^NURAPI(.GMVRET)
  1. .F X=0:0 S X=$O(GMVRET(X)) Q:'X S @RESULTS@(X)=DATA_";"_GMVRET(X)
  1. .S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. I DATA=120.52 D S @RESULTS@(0)=GMVCNT_U_$$GET1^DID(DATA,"","","NAME") Q ;qualifiers
  1. .S GMVCNT=0,GMVLOOP=""
  1. .F S GMVLOOP=$O(^GMRD(120.52,"B",GMVLOOP)) Q:GMVLOOP="" D
  1. ..S GMVIEN=0
  1. ..F S GMVIEN=$O(^GMRD(120.52,"B",GMVLOOP,GMVIEN)) Q:'GMVIEN D
  1. ...S GMVNAME=$P($G(^GMRD(120.52,GMVIEN,0)),U,1)
  1. ...Q:GMVNAME=""
  1. ...Q:$$ACTIVE^GMVUID(120.52,.01,GMVIEN_",","") ;inactive vuid
  1. ...S GMVCNT=GMVCNT+1
  1. ...S @RESULTS@(GMVCNT)="120.52;"_GMVIEN_U_GMVNAME
  1. D LIST^DIC(DATA,"","@;.01","P","","","","",GMVSCRN)
  1. F X=0:0 S X=$O(^TMP("DILIST",$J,X)) Q:'X D
  1. .S @RESULTS@(X)=DATA_";"_^TMP("DILIST",$J,X,0)
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)_U_$$GET1^DID(DATA,"","","NAME")
  1. K ^TMP("DILIST",$J)
  1. Q
  1. GETQUAL ; [P] Return qualifiers list
  1. ; DATA=VitalIEN;CatIEN
  1. ; Uses X-ref of ^GMRD(120.52,"AA",VitalIEN,CategoryIEN,QName,QIEN)
  1. S GMVIT=+$P(DATA,";",1),GMVCAT=+$P(DATA,";",2)
  1. I '$D(^GMRD(120.53,GMVCAT,0)) S @RESULTS@(0)="-1^No such category" Q
  1. I $$ACTIVE^GMVUID(120.53,"",GMVCAT_",","") S @RESULTS@(0)="-1^Inactive category" Q
  1. I '$D(^GMRD(120.51,GMVIT,0)) S @RESULTS@(0)="-1^No such vital" Q
  1. I $$ACTIVE^GMVUID(120.51,"",GMVIT_",","") S @RESULTS@(0)="-1^Inactive vital type" Q
  1. S GMVNAM=""
  1. F S GMVNAM=$O(^GMRD(120.52,"AA",GMVIT,GMVCAT,GMVNAM)) Q:GMVNAM="" D
  1. .S GMVIEN=$O(^GMRD(120.52,"AA",GMVIT,GMVCAT,GMVNAM,0)) ; Assume only one of this name
  1. .Q:$$ACTIVE^GMVUID(120.52,"",GMVIEN_",","")
  1. .S Y=$O(@RESULTS@(""),-1)+1
  1. .S @RESULTS@(Y)=GMVIEN_U_GMVNAM
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)_U_$P(^GMRD(120.53,GMVCAT,0),U)
  1. Q
  1. GETTEMP ; [P] Get Template List
  1. I $G(DATA)]"" D
  1. .S GMVENT=$$ENTITY($P(DATA,U,1)),GMVNAME=$P(DATA,U,2)
  1. .I GMVNAME="" D
  1. ..D GETLST^XPAR(.GMVTMP,GMVENT,"GMV TEMPLATE")
  1. ..F X=0:0 S X=$O(GMVTMP(X)) Q:'X D
  1. ...S GMV(GMVENT,$P(GMVTMP(X),U,1))=$P(GMVTMP(X),U,2,10)
  1. .I GMVNAME]"" S GMV(GMVENT,GMVNAME)=$$GET^XPAR(GMVENT,"GMV TEMPLATE",GMVNAME)
  1. I $G(DATA)="" D ENVAL^XPAR(.GMV,"GMV TEMPLATE")
  1. S GMVENT="",GMVNAME=""
  1. F S GMVENT=$O(GMV(GMVENT)) Q:GMVENT="" D
  1. .S GMVROOT=$P(GMVENT,";",2),GMVTYPE=$$TYPE(GMVROOT),GMVIEN=+GMVENT
  1. .Q:GMVTYPE=0 ;unknown template type
  1. .Q:GMVROOT="VA(200,"&('$$GET^XPAR("SYS","GMV ALLOW USER TEMPLATES"))
  1. .I GMVROOT="VA(200,"&(GMVIEN'=DUZ) Q:'$D(^XUSEC("GMV MANAGER",DUZ))
  1. .F S GMVNAME=$O(GMV(GMVENT,GMVNAME)) Q:GMVNAME="" D
  1. ..S GMVOWNER=$P($G(@(U_GMVROOT_(+GMVIEN)_",0)"),"Unk"),U)
  1. ..S Y=$O(@RESULTS@(""),-1)+1
  1. ..S @RESULTS@(Y)=GMVTYPE_U_GMVENT_U_GMVOWNER_U_GMVNAME_U_GMV(GMVENT,GMVNAME)
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. Q
  1. LOOKUP ; [P] Does a lookup on a file
  1. N GMVSCRN
  1. S GMVSCRN=$S(+DATA=44:"I "_"""^C^W^"""_"[$P(^(0),U,3)",1:"")
  1. I $P(DATA,"^",3)="" S GMVFLD="@;.01"
  1. E S GMVFLD="@;"_$P(DATA,"^",3)
  1. S GMVFLD=$P(GMVFLD,";",1,5) ; Limit lookup to 4 display fields
  1. D FIND^DIC(+DATA,"",GMVFLD,"P",$P(DATA,"^",2),61,,GMVSCRN)
  1. I ^TMP("DILIST",$J,0)<1 D Q
  1. .S @RESULTS@(0)="-1^No entries found matching '"_$P(DATA,U,2)_"'."
  1. I ^TMP("DILIST",$J,0)>60 D Q
  1. .S @RESULTS@(0)="-1^Too many matches found, please be more specific."
  1. F X=0:0 S X=$O(^TMP("DILIST",$J,X)) Q:'X D
  1. .S @RESULTS@(X)=+DATA_";"_^TMP("DILIST",$J,X,0)
  1. S @RESULTS@(0)=+$O(@RESULTS@(""),-1)
  1. Q
  1. NEWQUAL ; [P] Create New Qualifier
  1. S @RESULTS@(0)="-1^Use the New Term Rapid Turnaround (NTRT) process to add qualifiers"
  1. Q
  1. NEWTEMP ; [P] New Template
  1. S GMVENT=$P(DATA,"^",1),GMVNAME=$P(DATA,"^",2),GMVDESC=$P(DATA,"^",3)
  1. S GMVENT=$$ENTITY(GMVENT)
  1. S GMVTYPE=$$TYPE($P(GMVENT,";",2))
  1. S GMVOWN=$P($G(@(U_$P(GMVENT,";",2)_+GMVENT_",0)"),"Unk"),U)
  1. S:GMVDESC="" GMVDESC="No Description"
  1. D ADD^XPAR(GMVENT,"GMV TEMPLATE",GMVNAME,GMVDESC,.GMVERR)
  1. I 'GMVERR S @RESULTS@(0)=GMVTYPE_U_GMVENT_U_GMVOWN_U_GMVNAME
  1. E S @RESULTS@(0)="-1^"_GMVERR
  1. Q
  1. RENTEMP ; [P] Rename a Template
  1. S GMVENT=$P(DATA,U,1),GMVOLD=$P(DATA,U,2),GMVNEW=$P(DATA,U,3)
  1. D REP^XPAR(GMVENT,"GMV TEMPLATE",GMVOLD,GMVNEW,.GMVERR)
  1. I 'GMVERR S @RESULTS@(0)="1^Renamed"
  1. E S @RESULTS@(0)="-1^"_GMVERR Q
  1. ; Reset default template if this was a default template
  1. D:$$GET^XPAR(GMVENT,"GMV TEMPLATE DEFAULT")=GMVOLD
  1. .D EN^XPAR(GMVENT,"GMV TEMPLATE DEFAULT",1,GMVNEW)
  1. Q
  1. RPC(RESULTS,OPTION,DATA) ; [Procedure] Main RPC call tag
  1. ; RPC: [GMV MANAGER]
  1. ;
  1. ; Input parameters
  1. ; 1. RESULTS [Reference/Required] RPC Return array
  1. ; 2. OPTION [Literal/Required] RPC Option to execute
  1. ; 3. DATA [Literal/Required] Other data as required for call
  1. ;
  1. N GMV,GMVCAT,GMVDESC,GMVENT,GMVERR,GMVFDA,GMVFLD,GMVIEN,GMVIT,GMVNAM,GMVNAME,GMVNEW,GMVOLD,GMVOWN,GMVOWNER,GMVQUAL,GMVROOT,GMVTYPE,GMVVAL,GMVVIT,GMVSCRN
  1. S RESULTS=$NA(^TMP("GMVMGR",$J)) K @RESULTS
  1. D:$T(@OPTION)]"" @OPTION
  1. S:'$D(@RESULTS) @RESULTS@(0)="-1^No results returned"
  1. D CLEAN^DILF
  1. Q
  1. SETDATA ; [P] Save New Qualifier Name/Abbv
  1. S @RESULTS@(0)="-1^Use the New Term Rapid Turnaround (NTRT) process to add qualifiers"
  1. Q
  1. SETDEF ; [P] Set Default Template
  1. D EN^XPAR($P(DATA,U),"GMV TEMPLATE DEFAULT",1,$P(DATA,U,2),.GMVERR)
  1. I '$G(GMVERR) S @RESULTS@(0)="1^Set As Default."
  1. E S @RESULTS@(0)="-1^"_GMVERR
  1. Q
  1. SETHILO ; [P] Set abnormal value
  1. L +(^GMRD(120.57,0)):5
  1. E S @RESULTS@(0)="-1^Site File In Use." Q
  1. S GMVFLD=$P(DATA,"^",1),GMVVAL=$P(DATA,"^",2)
  1. S GMVFDA(120.57,"1,",GMVFLD)=GMVVAL
  1. D FILE^DIE("","GMVFDA","GMVERR")
  1. L -(^GMRD(120.57,0))
  1. S @RESULTS@(0)="1^Update Complete."
  1. Q
  1. SETTEMP ; [P] Set Template data
  1. D EN^XPAR($P(DATA,U),"GMV TEMPLATE",$P(DATA,U,2),$P(DATA,U,3),.GMVERR)
  1. I '$G(GMVERR) S @RESULTS@(0)="1^Template Saved."
  1. E S @RESULTS@(0)="-1^"_GMVERR
  1. Q
  1. VALID ; [P] Verify data validity against fileman
  1. D VAL^DIE($P(DATA,U,1),$P(DATA,U,2),$P(DATA,U,3),"H",$P(DATA,U,4),.GMVRET)
  1. I GMVRET'="^" S @RESULTS@(0)="1^Valid Data"
  1. E S @RESULTS@(0)="-1^"_^TMP("DIERR",$J,1,"TEXT",1)
  1. Q
  1. ENTITY(X) ; [Function] Convert USR, SYS, and DIV entities
  1. ; Input parameters
  1. ; 1. X [Literal/Required] XPAR generic entity to transform to variable pointer format
  1. ;
  1. Q:X="USR" DUZ_";VA(200,"
  1. Q:X="SYS" $$FIND1^DIC(4.2,"","QX",$$KSP^XUPARAM("WHERE"))_";DIC(4.2,"
  1. Q:X="DIV" DUZ(2)_";DIC(4,"
  1. Q X
  1. ;
  1. TYPE(X) ; [F] Returns the type of template
  1. ; Input parameters
  1. ; 1. X [Literal/Required] Variable pointer to evaluate
  1. ;
  1. Q:X="DIC(4.2," 1 ;Domain
  1. Q:X="DIC(4," 2 ; Institution
  1. Q:X="SC(" 3 ; Hospital Location
  1. Q:X="VA(200," 4 ; New Person
  1. Q 0 ; Unknown
  1. ;
  1. VT ;VitalTypeIENS
  1. N X,Y,Z
  1. S Y=0,@RESULTS@(0)="-1"
  1. F X="T","P","R","BP","HT","WT","PN","PO2","CVP","CG" D
  1. .S Z=$O(^GMRD(120.51,"C",X,0))
  1. .Q:'Z
  1. .S Y=Y+1,@RESULTS@(Y)=Z
  1. Q