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