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

GMTSOBI.m

Go to the documentation of this file.
  1. GMTSOBI ; SLC/KER - HS Object - Import/Install ; 01/06/2003
  1. ;;2.7;Health Summary;**58,89**;Oct 20, 1995;Build 61
  1. ;
  1. ; External References
  1. ; DBIA 10096 ^%ZOSF("DEL"
  1. ; DBIA 10013 IX1^DIK
  1. ; DBIA 10112 $$SITE^VASITE
  1. ; DBIA 2055 $$FLDNUM^DILFD (file 142.5)
  1. ; DBIA 10103 $$NOW^XLFDT
  1. ; DBIA 10013 ^DIK
  1. ;
  1. EN ; Install Object from Routine GMTSOBX
  1. N DA,DIK,GMTS3,GMTS4,GMTSC,GMTSEDAT,GMTSETYP,GMTSETTL,GMTSDAO
  1. N GMTSDAT,GMTSDR,GMTSEX,GMTSFAC,GMTSFRM,GMTSI,GMTSIEN,GMTSIT
  1. N GMTSL,GMTSLN,GMTSNDD,GMTSOBJ,GMTSOBX,GMTSON,GMTSQIT,GMTSR
  1. N GMTSROK,GMTSRT,GMTSRTN,GMTST,GMTSTE,GMTSTN,GMTSTMP,GMTSTR
  1. N GMTSTTL,GMTSTXT,GMTSTYP,GMTSUSR,X
  1. I +($$FLDNUM^DILFD(142.5,"NAME"))'>0!('$D(^GMT(142.5))) D Q
  1. . W !," Unable to find HEALTH SUMMARY OBJECTS file #142.5"
  1. S GMTSEDAT=0,GMTSRTN="GMTSOBX",GMTSQIT=0,GMTSUSR=+($G(DUZ)) I +GMTSUSR=0 W !!," User not defined" Q
  1. I +($$ROK^GMTSOBU(GMTSRTN))'>0 W !," Error:",!," Object not Found (routine GMTSOBX)" Q
  1. F GMTSI=1:1:7 D
  1. . S GMTST=$$TX^GMTSOBU(GMTSRTN,GMTSRTN,(GMTSI-1)) S:GMTST["Object: " GMTSOBJ=$P(GMTST,"Object: ",2)
  1. . S:GMTST["From: " GMTSFRM=$P(GMTST,"From: ",2) S:GMTST["Sender: " GMTSDR=$P(GMTST,"Sender: ",2)
  1. S (GMTSON,GMTSOBJ)=$P($$TX^GMTSOBU(GMTSRTN,"OBJ",1),";",2)
  1. S (GMTSTN,GMTSTYP)=$P($$TX^GMTSOBU(GMTSRTN,"TYPE",1),";",2)
  1. I GMTSOBJ=""!(GMTSFRM="")!(GMTSDR="") W !," Error:",!," Can not install object from ",GMTSRTN Q
  1. W !," Installing Health Summary Object: ",GMTSOBJ
  1. I $L(GMTSTYP) D
  1. . W !," Using Health Summary Type: ",GMTSTYP
  1. W !," From: ",GMTSFRM
  1. W !," Sender: ",GMTSDR
  1. S GMTSTTL=$P($$TX^GMTSOBU(GMTSRTN,"TYPE",2),";",2)
  1. ; Check Facility
  1. S GMTSFAC=+($P($$SITE^VASITE,"^",3)) I +GMTSFAC=0 W !," Error:",!," Facility not defined" Q
  1. ; Check Object
  1. W !!," Checking Health Summary Object file #142.5"
  1. I $L(GMTSOBJ) D Q:GMTSQIT
  1. . N GMTSTMP S GMTSTMP=$$BOX^GMTSOBU(GMTSOBJ) I +($G(GMTSTMP))>0 W ! D ER1^GMTSOBU S GMTSQIT=1
  1. ; Check Type
  1. W !," Check Health Summary Type file #142"
  1. I $L(GMTSTYP) D Q:GMTSQIT
  1. . S GMTSQIT=1 N GMTSTMP S GMTSTMP=$$NWX^GMTSOBU(GMTSTYP)
  1. . S:+($G(GMTSTMP))'>0 GMTSQIT=0 I +($G(GMTSTMP))>0 D
  1. . . S GMTSEDAT=$$EHST^GMTSOBU I GMTSEDAT>0 D Q
  1. . . . S GMTSDAT=GMTSEDAT,GMTSQIT=0 I $L($G(GMTSETYP)),$L($G(GMTSETTL)) D
  1. . . . . S GMTSTYP=GMTSETYP,GMTSTTL=GMTSETTL
  1. ; Check Title
  1. W !," Checking for Duplicate Title"
  1. I $L(GMTSTTL) D Q:GMTSQIT
  1. . N GMTSTMP S GMTSTMP=$$TWX^GMTSOBU(GMTSTTL) I +GMTSTMP>0 W ! D ER3^GMTSOBU S GMTSQIT=1
  1. S GMTSDAT=$$TIEN^GMTSOBU S:+($G(GMTSEDAT))>0 GMTSDAT=+($G(GMTSEDAT))
  1. S:GMTSDAT'>0 GMTSQIT=1
  1. I GMTSQIT W !," Unable to add Health Summary Type" Q
  1. S GMTSDAO=$$OIEN^GMTSOBU(GMTSFAC) S:GMTSDAO'>0 GMTSQIT=1
  1. I GMTSQIT W !," Unable to add Health Summary Object" Q
  1. L +^GMT(142,+GMTSDAT):0 S:'$T GMTSQIT=1
  1. L +^GMT(142.5,+GMTSDAO):0 S:'$T GMTSQIT=1
  1. I +($G(GMTSQIT))>0 L -^GMT(142,+GMTSDAT) L -^GMT(142,+GMTSDAO) D Q
  1. . W !," Unable to add Health Summary Type and Object"
  1. I GMTSDAT>0,GMTSDAO>0,GMTSQIT'>0 D HST,HSO
  1. D DELERR L -^GMT(142,+GMTSDAT) L -^GMT(142,+GMTSDAO)
  1. D DONE W !
  1. Q
  1. HST ; Install Health Summary Type
  1. ; Needs GMTSRTN, GMTSDAT, GMTSUSR, GMTSTYP, GMTSTTL
  1. Q:+($G(GMTSTE))>0 N GMTSROK,GMTSI,GMTSTXT,GMTSTR,GMTSNDD,GMTSR,GMTSC,GMTSRT,GMTS3,GMTS4,DA,DIK
  1. Q:+($G(GMTSQIT))>0 S GMTSQIT=0,GMTSROK=$$ROK^GMTSOBU(GMTSRTN) Q:GMTSROK'>0
  1. ; Save Type
  1. I '$L(GMTSTYP)!('$L(GMTSTTL)) S GMTSQIT=1 Q
  1. F GMTSI=3:1 Q:GMTSQIT D Q:GMTSQIT
  1. . S GMTSTXT=$$TX^GMTSOBU(GMTSRTN,"TYPE",GMTSI),GMTSTXT=$P(GMTSTXT," ;",2,299)
  1. . I '$L(GMTSTXT) S GMTSQIT=1 Q
  1. . S GMTSTR=$P(GMTSTXT,";",1),GMTSNDD=$P(GMTSTXT,";",2)
  1. . S GMTSR=$P(GMTSTR,",",2),GMTSC=$P(GMTSNDD,"^",2)
  1. . Q:GMTSR>0&(GMTSC>0)&('$D(^GMT(142.1,+GMTSC))) Q:(GMTSR>0)&(GMTSC>0)&(GMTSC>999)
  1. . S:GMTSTR="0" $P(GMTSNDD,"^",3)=GMTSUSR
  1. . S:GMTSTR="0"&($L(GMTSTYP)) $P(GMTSNDD,"^",1)=GMTSTYP
  1. . S:GMTSTR="""T"""&($L(GMTSTTL)) $P(GMTSNDD,"^",1)=GMTSTTL
  1. . S GMTSNDD=$TR(GMTSNDD,"""","") S:'$L(GMTSNDD) GMTSNDD=""""""
  1. . S GMTSRT="^GMT(142,DA,"_GMTSTR_")"
  1. . S DA=GMTSDAT S @GMTSRT=GMTSNDD
  1. ; Check Indexes
  1. S GMTSQIT=0 F GMTSI="B","C" S GMTSR=0 F S GMTSR=$O(^GMT(142,GMTSDAT,1,GMTSI,GMTSR)) Q:+GMTSR=0 D
  1. . S GMTSC=0 F S GMTSC=$O(^GMT(142,GMTSDAT,1,GMTSI,GMTSR,GMTSC)) Q:+GMTSC=0 D
  1. . . I '$D(^GMT(142,GMTSDAT,1,GMTSC)) K ^GMT(142,GMTSDAT,1,GMTSI,GMTSR,GMTSC)
  1. ; Re-Index
  1. S DA=GMTSDAT,DIK="^GMT(142," D IX1^DIK
  1. ; Check Structure (sub-file 142.01)
  1. S (GMTSI,GMTS3,GMTS4)=0 F S GMTSI=$O(^GMT(142,GMTSDAT,1,GMTSI)) Q:+GMTSI=0 D
  1. . S GMTS3=GMTSI,GMTS4=GMTS4+1
  1. S:GMTS3>0&(GMTS4>0)&($D(^GMT(142,GMTSDAT,1,0))) ^GMT(142,+GMTSDAT,1,0)="^142.01IA^"_GMTS3_"^"_GMTS4
  1. Q
  1. HSO ; Install Health Summary Object
  1. ; Needs GMTSRTN, GMTSDAO,GMTSUSR
  1. Q:+($G(GMTSQIT))>0 N GMTSQIT,GMTSROK,GMTSTXT,GMTSOBJ,GMTSNDD,GMTSTR,GMTSRT,DA,DIK
  1. S GMTSQIT=0,GMTSROK=$$ROK^GMTSOBU(GMTSRTN) Q:GMTSROK'>0
  1. S GMTSTXT=$$TX^GMTSOBU(GMTSRTN,"OBJ",1),GMTSOBJ=$P(GMTSTXT,";",2,299)
  1. S GMTSTXT=$$TX^GMTSOBU(GMTSRTN,"OBJ",2),$P(GMTSTXT,"^",17)=GMTSUSR,GMTSNDD=GMTSTXT
  1. S GMTSTR=$P(GMTSNDD,";",2),GMTSNDD=$P(GMTSNDD,";",3,299)
  1. S GMTSRT="^GMT(142.5,DA,"_GMTSTR_")",DA=GMTSDAO,DIK="^GMT(142.5,"
  1. S $P(GMTSNDD,"^",3)=+($G(GMTSDAT)),$P(GMTSNDD,"^",17)=+($G(GMTSUSR))
  1. S $P(GMTSNDD,"^",18)=$$NOW^XLFDT H 1 S $P(GMTSNDD,"^",19)=$$NOW^XLFDT
  1. S $P(GMTSNDD,"^",20)=0,@GMTSRT=GMTSNDD
  1. ;AGP CHANGE FOR NEW SUBSCRIPT
  1. S GMTSTXT=$$TX^GMTSOBU(GMTSRTN,"OBJ",3),GMTSNDD=GMTSTXT
  1. S GMTSTR=$P(GMTSNDD,";",2),GMTSNDD=$P(GMTSNDD,";",3,299)
  1. S GMTSRT="^GMT(142.5,DA,"_GMTSTR_")"
  1. S @GMTSRT=GMTSNDD
  1. D IX1^DIK
  1. Q
  1. DELERR ; Delete on Error
  1. I +($G(GMTSDAT))>0,+($G(GMTSDAO))'>0 D
  1. . D DI(+($G(GMTSDAT)),"^GMT(142,")
  1. . W !," An error has occurred while installing Health Summary Object"
  1. . W !," Deleting the associated Health Summary Type"
  1. I +($G(GMTSDAT))'>0,+($G(GMTSDAO))>0 D
  1. . D DI(+($G(GMTSDAO)),"^GMT(142.5,")
  1. . W !," An error has occurred while installing Health Summary Type"
  1. . W !," Deleting the associated Health Summary Object"
  1. I +($G(GMTSDAT))>0&('$D(^GMT(142,+GMTSDAT))) D
  1. . D DI(+($G(GMTSDAT)),"^GMT(142,"),DEL(+($G(GMTSDAO)),"^GMT(142.5,")
  1. . W !," An error has occurred while installing Health Summary Type"
  1. . W !," Deleting the associated Health Summary Object"
  1. I +($G(GMTSDAO))>0&('$D(^GMT(142.5,+GMTSDAO))) D
  1. . D DI(+($G(GMTSDAT)),"^GMT(142,"),DEL(+($G(GMTSDAO)),"^GMT(142.5,")
  1. . W !," An error has occurred while installing Health Summary Object"
  1. . W !," Deleting the associated Health Summary Type"
  1. Q
  1. DI(X,Y) ; Delete Item
  1. N DA,DIK S DA=+($G(X)),DIK=$G(Y) D:$L(DIK) ^DIK
  1. Q
  1. DONE ; Completed
  1. I +($G(GMTSDAT))>0,+($G(GMTSDAO))>0 D
  1. . I $D(^GMT(142,+GMTSDAT,0)),$D(^GMT(142.5,+GMTSDAO,0)) D
  1. . . H 1 I $L(GMTSTN),$L(GMTSON) D Q
  1. . . . W !!," Object '",GMTSON,"' installed using Health Summary Type '",GMTSTN,"'"
  1. . . W !," Object Installed"
  1. ;AGP ADDED TO CLEAN-UP ROUTINE GMTSOBX
  1. D DEL(GMTSRTN)
  1. Q
  1. DEL(X) ; Delete Routine X
  1. S X=$G(X) Q:'$L(X) Q:$L(X)>8 Q:$$ROK^GMTSOBU(X)=0 X ^%ZOSF("DEL") Q