- GMVPAR ; HOIFO/DP - XPARameter RPC ; 31-MAY-2002 10:06:18
- ;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
- ; Integration Agreements:
- ; IA# 2263 [Supported] XPAR parameter call.
- ; IA# 2541 [Supported] Call to XUPARAM.
- ; IA# 10060 [Supported] FILE 200 fields
- ; IA# 10090 [Supported] FILE 4 references
- ;
- ; This routine supports the following IAs:
- ; #4367 - GMV PARAMETER RPC is called at RPC (private)
- ;
- ;DELLST; [Procedure] Delete list of parameters
- ;D NDEL^XPAR(ENT,PAR,.ERR)
- ;S:'$G(ERR) @RESULTS@(0)="1^All instances removed"
- ;Q
- ;
- DELPAR ; [Procedure] Delete single parameter value
- D DEL^XPAR(ENT,PAR,INST,.ERR)
- S:'$G(ERR) @RESULTS@(0)="1^Instance deleted"
- Q
- ;
- ENTVAL ; [Procedure] Return value of the entity
- I ENT="SYS" S ENT=$$KSP^XUPARAM("WHERE")
- E I ENT="DIV" S ENT=$$GET1^DIQ(4,DUZ(2)_",",.01)
- E I ENT="USR" S ENT=$$GET1^DIQ(200,DUZ_",",.01)
- E S ENT=$$GET1^DIQ(+$P(ENT,"(",2),+ENT_",",.01)
- S @RESULTS@(0)=ENT
- Q
- ;
- ;GETHDR; [Procedure] Returns common header format
- ;S X=$$FIND1^DIC(8989.51,,"QX",PAR)
- ;I X S @RESULTS@(0)=X_";8989.51^"_PAR
- ;E S @RESULTS@(0)="-1^No such parameter ["_PAR_"]"
- ;Q
- ;
- GETLST ; [Procedure] Return all instances of a parameter
- D GETLST^XPAR(.RET,ENT,PAR,"E",.ERR)
- Q:$G(ERR,0)
- S TMP="RET"
- F S TMP=$Q(@TMP) Q:TMP="" D
- .S @RESULTS@($O(@RESULTS@(""),-1)+1)=@TMP
- S @RESULTS@(0)=$O(@RESULTS@(""),-1)
- Q
- ;
- GETPAR ; [Procedure] Returns external value of a parameter
- S @RESULTS@(0)=$$GET^XPAR(ENT,PAR,INST,"E")
- Q
- ;
- ;GETWP; [Procedure] Returns WP text for a parameter
- ;D GETWP^XPAR(.RET,ENT,PAR,INST,.ERR)
- ;Q:$G(ERR,0)
- ;S TMP="RET"
- ;F S TMP=$Q(@TMP) Q:TMP="" D
- ;.S @RESULTS@($O(@RESULTS@(""),-1)+1)=@TMP
- ;S @RESULTS@(0)=$O(@RESULTS@(""),-1)_U_INST
- ;Q
- ;
- RPC(RESULTS,OPTION,ENT,PAR,INST,VAL) ; [Procedure] Main RPC Hit Point
- ; RPC: [GMV PARAMETER]
- ;
- ; Requires that the parameter name in PAR
- ; be in the GMV namespace.
- ;
- ; Input parameters
- ; 1. RESULTS [Literal/Required] No description
- ; 2. OPTION [Literal/Required] No description
- ; 3. ENT [Literal/Required] No description
- ; 4. PAR [Literal/Required] No description
- ; 5. INST [Literal/Required] No description
- ; 6. VAL [Literal/Required] No description
- ;
- N ERR,TMP,RET,TXT,IEN,IENS,ROOT
- S INST=$G(INST,1)
- S PAR=$G(PAR,"GMV")
- S RESULTS=$NA(^TMP($J)) K @RESULTS
- I PAR'?1"GMV".E S ^TMP($J,0)="-1^Non Vitals Measurements Parameter" Q
- D:$T(@OPTION)]"" @OPTION
- I +$G(ERR) K @RESULTS S @RESULTS@(0)="-1^Error: "_(+ERR)_" "_$P(ERR,U,2)
- I '$D(^TMP($J)) S @RESULTS@(0)="-1^No date returned"
- D CLEAN^DILF
- Q
- ;
- ;SETLST; [Procedure] Build list of parameters
- ;N GMVINS ; Instance Counter
- ;D DELLST(ENT,PAR)
- ;S GMVINS=""
- ;F S GMVINS=$O(VAL(GMVINS)) Q:GMVINS="" D
- ;.D EN^XPAR(ENT,PAR,GMVINS,VAL(GMVINS),.ERR)
- ;S:'$G(ERR) @RESULTS@(0)="1^List "_PAR_" rebuilt"
- ;Q
- ;
- SETPAR ; [Procedure] Set single value into a parameter
- D EN^XPAR(ENT,PAR,INST,VAL,.ERR)
- S:'$G(ERR) @RESULTS@(0)="1^Parameter updated"
- Q
- ;
- ;SETWP; [Procedure] Set WP text into a parameter
- ;S TXT=INST,TMP=""
- ;F S TMP=$O(VAL(TMP)) Q:TMP="" D
- ;.S TXT($O(TXT(""),-1)+1,0)=VAL(TMP)
- ;D EN^XPAR(ENT,PAR,INST,.TXT,.ERR)
- ;S:'$G(ERR) @RESULTS@(0)="1^WP Text Saved"
- ;Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMVPAR 3296 printed Feb 18, 2025@23:26:06 Page 2
- GMVPAR ; HOIFO/DP - XPARameter RPC ; 31-MAY-2002 10:06:18
- +1 ;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
- +2 ; Integration Agreements:
- +3 ; IA# 2263 [Supported] XPAR parameter call.
- +4 ; IA# 2541 [Supported] Call to XUPARAM.
- +5 ; IA# 10060 [Supported] FILE 200 fields
- +6 ; IA# 10090 [Supported] FILE 4 references
- +7 ;
- +8 ; This routine supports the following IAs:
- +9 ; #4367 - GMV PARAMETER RPC is called at RPC (private)
- +10 ;
- +11 ;DELLST; [Procedure] Delete list of parameters
- +12 ;D NDEL^XPAR(ENT,PAR,.ERR)
- +13 ;S:'$G(ERR) @RESULTS@(0)="1^All instances removed"
- +14 ;Q
- +15 ;
- DELPAR ; [Procedure] Delete single parameter value
- +1 DO DEL^XPAR(ENT,PAR,INST,.ERR)
- +2 if '$GET(ERR)
- SET @RESULTS@(0)="1^Instance deleted"
- +3 QUIT
- +4 ;
- ENTVAL ; [Procedure] Return value of the entity
- +1 IF ENT="SYS"
- SET ENT=$$KSP^XUPARAM("WHERE")
- +2 IF '$TEST
- IF ENT="DIV"
- SET ENT=$$GET1^DIQ(4,DUZ(2)_",",.01)
- +3 IF '$TEST
- IF ENT="USR"
- SET ENT=$$GET1^DIQ(200,DUZ_",",.01)
- +4 IF '$TEST
- SET ENT=$$GET1^DIQ(+$PIECE(ENT,"(",2),+ENT_",",.01)
- +5 SET @RESULTS@(0)=ENT
- +6 QUIT
- +7 ;
- +8 ;GETHDR; [Procedure] Returns common header format
- +9 ;S X=$$FIND1^DIC(8989.51,,"QX",PAR)
- +10 ;I X S @RESULTS@(0)=X_";8989.51^"_PAR
- +11 ;E S @RESULTS@(0)="-1^No such parameter ["_PAR_"]"
- +12 ;Q
- +13 ;
- GETLST ; [Procedure] Return all instances of a parameter
- +1 DO GETLST^XPAR(.RET,ENT,PAR,"E",.ERR)
- +2 if $GET(ERR,0)
- QUIT
- +3 SET TMP="RET"
- +4 FOR
- SET TMP=$QUERY(@TMP)
- if TMP=""
- QUIT
- Begin DoDot:1
- +5 SET @RESULTS@($ORDER(@RESULTS@(""),-1)+1)=@TMP
- End DoDot:1
- +6 SET @RESULTS@(0)=$ORDER(@RESULTS@(""),-1)
- +7 QUIT
- +8 ;
- GETPAR ; [Procedure] Returns external value of a parameter
- +1 SET @RESULTS@(0)=$$GET^XPAR(ENT,PAR,INST,"E")
- +2 QUIT
- +3 ;
- +4 ;GETWP; [Procedure] Returns WP text for a parameter
- +5 ;D GETWP^XPAR(.RET,ENT,PAR,INST,.ERR)
- +6 ;Q:$G(ERR,0)
- +7 ;S TMP="RET"
- +8 ;F S TMP=$Q(@TMP) Q:TMP="" D
- +9 ;.S @RESULTS@($O(@RESULTS@(""),-1)+1)=@TMP
- +10 ;S @RESULTS@(0)=$O(@RESULTS@(""),-1)_U_INST
- +11 ;Q
- +12 ;
- RPC(RESULTS,OPTION,ENT,PAR,INST,VAL) ; [Procedure] Main RPC Hit Point
- +1 ; RPC: [GMV PARAMETER]
- +2 ;
- +3 ; Requires that the parameter name in PAR
- +4 ; be in the GMV namespace.
- +5 ;
- +6 ; Input parameters
- +7 ; 1. RESULTS [Literal/Required] No description
- +8 ; 2. OPTION [Literal/Required] No description
- +9 ; 3. ENT [Literal/Required] No description
- +10 ; 4. PAR [Literal/Required] No description
- +11 ; 5. INST [Literal/Required] No description
- +12 ; 6. VAL [Literal/Required] No description
- +13 ;
- +14 NEW ERR,TMP,RET,TXT,IEN,IENS,ROOT
- +15 SET INST=$GET(INST,1)
- +16 SET PAR=$GET(PAR,"GMV")
- +17 SET RESULTS=$NAME(^TMP($JOB))
- KILL @RESULTS
- +18 IF PAR'?1"GMV".E
- SET ^TMP($JOB,0)="-1^Non Vitals Measurements Parameter"
- QUIT
- +19 if $TEXT(@OPTION)]""
- DO @OPTION
- +20 IF +$GET(ERR)
- KILL @RESULTS
- SET @RESULTS@(0)="-1^Error: "_(+ERR)_" "_$PIECE(ERR,U,2)
- +21 IF '$DATA(^TMP($JOB))
- SET @RESULTS@(0)="-1^No date returned"
- +22 DO CLEAN^DILF
- +23 QUIT
- +24 ;
- +25 ;SETLST; [Procedure] Build list of parameters
- +26 ;N GMVINS ; Instance Counter
- +27 ;D DELLST(ENT,PAR)
- +28 ;S GMVINS=""
- +29 ;F S GMVINS=$O(VAL(GMVINS)) Q:GMVINS="" D
- +30 ;.D EN^XPAR(ENT,PAR,GMVINS,VAL(GMVINS),.ERR)
- +31 ;S:'$G(ERR) @RESULTS@(0)="1^List "_PAR_" rebuilt"
- +32 ;Q
- +33 ;
- SETPAR ; [Procedure] Set single value into a parameter
- +1 DO EN^XPAR(ENT,PAR,INST,VAL,.ERR)
- +2 if '$GET(ERR)
- SET @RESULTS@(0)="1^Parameter updated"
- +3 QUIT
- +4 ;
- +5 ;SETWP; [Procedure] Set WP text into a parameter
- +6 ;S TXT=INST,TMP=""
- +7 ;F S TMP=$O(VAL(TMP)) Q:TMP="" D
- +8 ;.S TXT($O(TXT(""),-1)+1,0)=VAL(TMP)
- +9 ;D EN^XPAR(ENT,PAR,INST,.TXT,.ERR)
- +10 ;S:'$G(ERR) @RESULTS@(0)="1^WP Text Saved"
- +11 ;Q
- +12 ;