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

GMVUID.m

Go to the documentation of this file.
  1. GMVUID ;HIOFO/FT-VUID-RELATED UTILITIES ;5/3/05 11:48
  1. ;;5.0;GEN. MED. REC. - VITALS;**8**;Oct 31, 2002
  1. ;
  1. ; This routine uses the following IAs:
  1. ; #2263 - XPAR calls (supported)
  1. ; #4631 - XTID calls (supported)
  1. ; #10070 - ^XMD (supported)
  1. ; #4640 - ^HDISVF01 (supported)
  1. ;
  1. EN(ERROR) ; Clean up existing file connections and gui templates
  1. ;
  1. I ERROR D QMAIL Q
  1. N FILE,OK
  1. S OK=1
  1. F FILE=120.51,120.52,120.53 I '$$SCREEN^HDISVF01(FILE) S OK=0
  1. Q:'OK
  1. D QUAL,CAT,TEMPS
  1. Q
  1. QMAIL ; Queue mail message
  1. N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
  1. S ZTRTN="MAIL^GMVUID",ZTDESC="GMRV VITALS VUID ERROR"
  1. S ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD
  1. Q
  1. MAIL ; Send mail message to installer that an error occurred
  1. N GMVMSG,XMDUZ,XMSUB,XMTEXT,XMY
  1. S XMY(DUZ)=""
  1. S XMDUZ=.5 ;message sender
  1. S XMSUB="ERROR IN VITALS VUID UPDATE"
  1. S GMVMSG(1)="An error occurred while updating the VUID data for the"
  1. S GMVMSG(2)="GEN. MED. REC. - VITALS package files. "
  1. S GMVMSG(3)=" "
  1. S GMVMSG(4)="Please log a Remedy ticket immediately. "
  1. S XMTEXT="GMVMSG("
  1. D ^XMD
  1. Q
  1. QUAL ; Loop through the Qualifier entries in FILE 120.52:
  1. ; 1) If the QUALIFIER is not active, get rid of all VITAL TYPE (#1)
  1. ; associations,
  1. ; 2) If the QUALIFIER is active and a VITAL TYPE is not active, get rid
  1. ; of that VITAL TYPE association,
  1. ; 3) If the QUALIFIER and VITAL TYPE are active, but the CATEGORY
  1. ; (#.02 in subfile 120.521) is not, get rid of that subfile entry.
  1. ;
  1. N GMVNODE,GMVQUAL,GMVT
  1. S GMVQUAL=0
  1. F S GMVQUAL=$O(^GMRD(120.52,GMVQUAL)) Q:'GMVQUAL D
  1. .I $$ACTIVE(120.52,"",GMVQUAL_",","") D Q ;see #1 above
  1. ..S GMVT=0
  1. ..F S GMVT=$O(^GMRD(120.52,GMVQUAL,1,GMVT)) Q:'GMVT D
  1. ...D QUAL1(GMVQUAL,GMVT)
  1. ...Q
  1. ..Q
  1. .S GMVT=0
  1. .F S GMVT=$O(^GMRD(120.52,GMVQUAL,1,GMVT)) Q:'GMVT D
  1. ..S GMVNODE=$G(^GMRD(120.52,GMVQUAL,1,GMVT,0))
  1. ..S GMVTY=$$ACTIVE(120.51,"",+$P(GMVNODE,U)_",","")
  1. ..I GMVTY D
  1. ...D QUAL1(GMVQUAL,GMVT)
  1. ...Q
  1. ..I 'GMVTY D
  1. ...S GMVNODE=$G(^GMRD(120.52,GMVQUAL,1,GMVT,0))
  1. ...Q:GMVNODE=""
  1. ...I $$ACTIVE(120.53,"",$P(GMVNODE,U,2)_",","") D
  1. ....D QUAL1(GMVQUAL,GMVT)
  1. ....Q
  1. ...Q
  1. ..Q
  1. .Q
  1. Q
  1. QUAL1(GMVX,GMVY) ; Delete a multiple entry (#1) in FILE 120.52
  1. N DA,DIK
  1. S DA(1)=GMVX,DA=GMVY,DIK="^GMRD(120.52,"_DA(1)_",1,"
  1. D ^DIK
  1. Q
  1. CAT ; Loop through the Category entries in FILE 120.53:
  1. ; 1) If the CATEGORY is not active, get rid of all VITAL TYPE (#1)
  1. ; associations,
  1. ; 2) If the CATEGORY is active and a VITAL TYPE is not active, get rid
  1. ; of that VITAL TYPE association,
  1. ; 3) If the CATEGORY and VITAL TYPE are active, but the DEFAULT
  1. ; QUALIFIER (#.07) is not, null out the DEFAULT QUALIFIER field.
  1. ;
  1. N GMVCAT,GMVNODE,GMVT,GMVTI,GMVTY
  1. S GMVCAT=0
  1. F S GMVCAT=$O(^GMRD(120.53,GMVCAT)) Q:'GMVCAT D
  1. .I $$ACTIVE(120.53,"",GMVCAT_",","") D Q ;see #1 sbove
  1. ..S GMVT=0
  1. ..F S GMVT=$O(^GMRD(120.53,GMVCAT,1,GMVT)) Q:'GMVT D
  1. ..D CAT1(GMVCAT,GMVT)
  1. ..Q
  1. .;The CATEGORY is active, but check if the VITAL TYPE is active.
  1. .S GMVT=0
  1. .F S GMVT=$O(^GMRD(120.53,GMVCAT,1,GMVT)) Q:'GMVT D
  1. ..S GMVTI=+$P($G(^GMRD(120.53,GMVCAT,1,GMVT,0)),U,1)
  1. ..S GMVTY=$$ACTIVE(120.51,"",GMVTI_",","")
  1. ..I GMVTY D ;see #2 above
  1. ...D CAT1(GMVCAT,GMVT)
  1. ...Q
  1. ..I 'GMVTY D
  1. ...S GMVNODE=$G(^GMRD(120.53,GMVCAT,1,GMVT,0))
  1. ...Q:GMVNODE=""
  1. ...Q:$P(GMVNODE,U,7)=""
  1. ...I $$ACTIVE(120.52,"",$P(GMVNODE,U,7)_",","") D ;see #3 above
  1. ....D CAT2(GMVCAT,GMVT)
  1. ....Q
  1. ...Q
  1. ..Q
  1. .Q
  1. Q
  1. CAT1(GMVX,GMVY) ; Delete a multiple entry (#1) in FILE 120.53
  1. N DA,DIK
  1. S DA(1)=GMVX,DA=GMVY,DIK="^GMRD(120.53,"_DA(1)_",1,"
  1. D ^DIK
  1. Q
  1. CAT2(GMVX,GMVY) ; Delete a default qualifier
  1. Q:'GMVX
  1. Q:'GMVY
  1. S $P(^GMRD(120.53,GMVX,1,GMVY,0),U,7)=""
  1. Q
  1. ACTIVE(GMVFILE,GMVFLD,GMVIEN,GMVDATE) ; Calls the $$SCREEN^XTID API to get VUID status
  1. ; Input: GMVFILE - File number
  1. ; GMVFLD - Field number
  1. ; GMVIEN - IEN
  1. ; GMVDATE - Date
  1. ; Output: 0 - Active
  1. ; 1 - Inactive
  1. Q $$SCREEN^XTID(GMVFILE,GMVFLD,GMVIEN,GMVDATE)
  1. ;
  1. GET(GMVFILE,GMVIEN,GMVREF) ; Calls the $$GETVUID^XTID API to get the VUID number
  1. ; GMVFILE - File number
  1. ; GMVIEN - field #
  1. ; GMVREF - value
  1. N GMVUID
  1. S GMVUID=$$GETVUID^XTID(GMVFILE,GMVIEN,GMVREF)
  1. Q $P(GMVUID,U,1)
  1. ;
  1. TEMPS ; Clean up GUI templates definitions.
  1. ; If a qualifier is inactive, remove it and its category.
  1. N GMV,GMV1,GMV2,GMVDESC,GMVERR,GMVI,GMVJ,GMVLIST,GMVNEW,GMVNODE,GMVOLD,GMVORIG,GMVQUAL,GMVX,GMVY
  1. K ^TMP($J)
  1. S GMVLIST=$NA(^TMP($J))
  1. D ENVAL^XPAR(.GMVLIST,"GMV TEMPLATE","","",1)
  1. Q:'$D(^TMP($J))
  1. S GMV1="" ; ien;file
  1. F S GMV1=$O(^TMP($J,GMV1)) Q:GMV1="" D
  1. .S GMV2="" ;template name
  1. .F S GMV2=$O(^TMP($J,GMV1,GMV2)) Q:GMV2="" D
  1. ..S (GMVNODE,GMVORIG)=$G(^TMP($J,GMV1,GMV2))
  1. ..Q:GMVNODE=""
  1. ..S GMVDESC=$P(GMVNODE,"|",1) ;template description
  1. ..S GMVNODE=$P(GMVNODE,"|",2)
  1. ..K GMV ;array of vital types
  1. ..F GMVI=1:1 Q:$P(GMVNODE,";",GMVI)="" S GMV(GMVI)=$P(GMVNODE,";",GMVI)
  1. ..S GMVI=0
  1. ..F S GMVI=$O(GMV(GMVI)) Q:'GMVI D
  1. ...S GMVX=GMV(GMVI)
  1. ...Q:GMVX=""
  1. ...S GMVY=$P(GMVX,":",1,2) ;vital ien:metric indicator
  1. ...S GMVX=$P(GMVX,":",3) ;~categories,qualifiers~
  1. ...Q:GMVX=""
  1. ...S GMVNEW=""
  1. ...F GMVJ=1:1 Q:$P(GMVX,"~",GMVJ)="" D
  1. ....S GMVOLD=$P(GMVX,"~",GMVJ) ;each category & qualifier combo
  1. ....S GMVQUAL=$P(GMVOLD,",",2) ;qualifier
  1. ....I '$$ACTIVE(120.52,"",GMVQUAL_",",""),$$COMBO($P(GMVY,":",1),GMVQUAL,$P(GMVOLD,",",1)) S GMVNEW=GMVNEW_GMVOLD_"~" ;active qualifier & right combination of type, qualifier and category
  1. ...I $E(GMVNEW,$L(GMVNEW))="~" S GMVNEW=$E(GMVNEW,1,($L(GMVNEW)-1))
  1. ...S:GMVNEW]"" GMVNEW=GMVY_":"_GMVNEW
  1. ...S:GMVNEW="" GMVNEW=GMVY
  1. ...S GMV(GMVI)=GMVNEW
  1. ..S GMVI=0,GMVNODE=GMVDESC_"|"
  1. ..F S GMVI=$O(GMV(GMVI)) Q:'GMVI D
  1. ...S GMVNODE=GMVNODE_GMV(GMVI)_";"
  1. ...Q
  1. ..I $E(GMVNODE,$L(GMVNODE))=";" S GMVNODE=$E(GMVNODE,1,($L(GMVNODE)-1))
  1. ..I $E(GMVNODE,$L(GMVNODE))="|" S GMVNODE=$E(GMVNODE,1,($L(GMVNODE)-1))
  1. ..I GMVNODE=GMVORIG Q ;no change in template
  1. ..D EN^XPAR(GMV1,"GMV TEMPLATE",GMV2,GMVNODE,.GMVERR)
  1. ..Q
  1. .Q
  1. K ^TMP($J)
  1. Q
  1. COMBO(GMVTI,GMVQUALI,GMVCATI) ; Check if this combination is in the AA cross-
  1. ; reference of File 120.52
  1. ; Input:
  1. ; GMVTI - File 120.51 ien
  1. ; GMVQUALI - File 120.52 ien
  1. ; GMVCATI - File 120.53 ien
  1. N GMVFLAG,GMVQUALE
  1. S GMVFLAG=0
  1. S GMVTI=+$G(GMVTI),GMVQUALI=+$G(GMVQUALI),GMVCATI=+$G(GMVCATI)
  1. I 'GMVTI!(GMVQUALI'>0)!(GMVCATI'>0) Q GMVFLAG
  1. S GMVQUALE=$P($G(^GMRD(120.52,GMVQUALI,0)),U,1)
  1. I GMVQUALE="" Q GMVFLAG
  1. I $D(^GMRD(120.52,"AA",GMVTI,GMVCATI,GMVQUALE,GMVQUALI)) S GMVFLAG=1
  1. Q GMVFLAG
  1. ;