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

TIU182DF.m

Go to the documentation of this file.
  1. TIU182DF ; SLC/MAM - Create new HP DDEFS ; 7/22/04
  1. ;;1.0;Text Integration Utilities;**182**;Jun 20, 1997
  1. ; Run this after installing patch 182.
  1. ;Use option: TIU182 DDEFS, MED CONVERSION
  1. ; External References
  1. ; DBIA 3409 ^USR(8930,"B"
  1. BEGIN ; Create DDEFS
  1. W !!,"This option creates Historical Procedure Document Definitions (DDEFS) for",!,"the Medicine Package conversion."
  1. W !,"It may take one or two minutes to run. It will tell you whether or not",!,"it is successful."
  1. W ! K IOP N %ZIS S %ZIS="Q" D ^%ZIS I POP K POP Q
  1. I $D(IO("Q")) K IO("Q") D Q
  1. .S ZTRTN="MAIN^TIUPS182"
  1. .S ZTDESC="Create DDEFS for Medicine Conversion - TIU*1*182"
  1. .D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Canceled!")
  1. .K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
  1. .D HOME^%ZIS
  1. U IO D MAIN,^%ZISC
  1. Q
  1. ;
  1. MAIN ; Create Historical Procedure DDEFS for Medicine Conversion
  1. N TIUDUPS,TMPCNT,TIUSTTS
  1. ; -- Set ^XTMP deletion date for about 2 years hence:
  1. ; Set it even if all are already created, in case it's in test
  1. ; for more than 2 years, so sites can reset it by running option.
  1. S ^XTMP("TIU182",0)=$$FMADD^XLFDT(DT,730)_U_DT_U_"Tracks DDEFS created by Option TIU182 DDEFS, MED CONVERSION"
  1. K ^TMP("TIU182MSG",$J),^TMP("TIU182ERR",$J),^TMP("TIU182",$J)
  1. ; -- Begin message array ^TMP("TIU182MSG",$J:
  1. S TMPCNT=0
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="*** Historical Procedure Document Definitions for the Medicine Conversion ***"
  1. ; -- Check if ALL done; check for Class Clinical Coord:
  1. I $G(^XTMP("TIU182","DONE"))="ALL" D G MAINX
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="All DDEFS exported for the conversion have already been created"
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="by option TIU182 DDEFS, MED CONVERSION."
  1. N CPCLASS S CPCLASS=$$CLASS^TIUCP I 'CPCLASS D
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="I can't find Class CLINICAL PROCEDURES, exported in patch TIU*1*109."
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Option cannot be run without it."
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=""
  1. I $O(^USR(8930,"B","CLINICAL COORDINATOR",""))="" D
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="I can't find User Class CLINICAL COORDINATOR. Option cannot be run without it."
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=""
  1. ; -- Set basic DDEF data into BASICS node of data array ^TMP("TIU182":
  1. D SETBASIC^TIUEN182
  1. ; -- Check for potential DDEF duplicates at site:
  1. D TIUDUPS^TIUEN182(.TIUDUPS,1)
  1. ; -- If potential duplicates exist, add them to message array:
  1. I TIUDUPS D LISTDUPS^TIUEN182(.TIUDUPS,.TMPCNT,1) G MAINX
  1. I $O(^USR(8930,"B","CLINICAL COORDINATOR",""))="" G MAINX
  1. I 'CPCLASS G MAINX
  1. ; -- If no potential dups, User Class exists, CLINICAL PROCEDURES
  1. ; Class exists, go on:
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Environment looks OK."
  1. ; -- Check if some DDEFS done:
  1. I $G(^XTMP("TIU182","DONE"))="SOME" D
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Some of the DDEFS exported for the conversion have already been"
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="created by this option. I will now create the others..."
  1. ; -- If none created yet:
  1. I '$D(^XTMP("TIU182","DONE")) D
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Creating the Document Definitions..."
  1. ; -- Set flds for FILE call & item data into nodes FILEDATA & DATA
  1. ; of array ^TMP("TIU182":
  1. D SETDATA^TIU182D
  1. ; -- Loop through DDEFS to create them:
  1. N NUM
  1. F NUM=1:1:13 D
  1. . N TIUIEN,YDDEF,TIUDA,PIEN,ITEMDA
  1. . ; -- If DDEF was previously created by this option,
  1. . ; quit and get next DDEF:
  1. . S TIUIEN=+$G(^XTMP("TIU182",NUM,"DONE")) Q:TIUIEN
  1. . ; -- If not, create new DDEF:
  1. . S YDDEF=$$CREATE^TIU182D1(NUM)
  1. . ; -- If DDEF couldn't be created or was found by lookup
  1. . ; instead of being created, quit and get next DDEF:
  1. . I $G(^TMP("TIU182ERR",$J,NUM))="CREATE" Q
  1. . S TIUDA=+YDDEF
  1. . ; -- Call FILE to stuff fields from ^TMP("TIU182",$J,"FILEDATA",NUM:
  1. . D FILE^TIU182D1(NUM,TIUDA)
  1. . I $G(^TMP("TIU182ERR",$J,NUM))="FILE" D DELETE^TIU182D1(TIUDA) Q
  1. . ; -- Add item to parent, stuff item data:
  1. . S PIEN=$$PARENT^TIU182D1(NUM)
  1. . I $G(^TMP("TIU182ERR",$J,NUM))="FINDPARENT" D DELETE^TIU182D1(TIUDA) Q
  1. . S ITEMDA=+$$ADDITEM^TIU182D1(NUM,TIUDA,PIEN)
  1. . I $G(^TMP("TIU182ERR",$J,NUM))="ADDITEM" D DELETE^TIU182D1(TIUDA) Q
  1. . D FILEITEM^TIU182D1(NUM,PIEN,ITEMDA)
  1. . I $G(^TMP("TIU182ERR",$J,NUM))="FILEITEM" D DELETE^TIU182D1(TIUDA,PIEN,ITEMDA) Q
  1. . ; -- DDEF NUM has been created and edited successfully:
  1. . S ^XTMP("TIU182",NUM,"DONE")=TIUDA
  1. . S ^XTMP("TIU182","DONE")="SOME"
  1. . Q
  1. ; -- Add results from CREATE loop to message array:
  1. N NUM S NUM=0
  1. I $O(^TMP("TIU182ERR",$J,NUM))="" D G MAINX
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="All Document Definitions have now been created successfully."
  1. . S ^XTMP("TIU182","DONE")="ALL"
  1. . ; -- Kill indiv DONE nodes:
  1. . N NUMBER F NUMBER=1:1:13 K ^XTMP("TIU182",NUMBER)
  1. . ; -- Edit Print Form Header,delete PF Number of Class CP:
  1. . N FDA,TIUFPRIV S FDA(8925.1,CPCLASS_",",6.1)="CLINICAL PROCEDURES"
  1. . S FDA(8925.1,CPCLASS_",",6.12)="@"
  1. . S TIUFPRIV=1
  1. . D FILE^DIE("TE","FDA")
  1. . Q:'$D(^TMP("DIERR",$J))
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Couldn't update CP Print Fields. See patch description or contact EVS."
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Problems were encountered creating the following Document Definitions:"
  1. F S NUM=$O(^TMP("TIU182ERR",$J,NUM)) Q:NUM="" D
  1. . N PROB S PROB=^TMP("TIU182ERR",$J,NUM)
  1. . D
  1. . . I PROB="CREATE" S PROB="Couldn't create DDEF." Q
  1. . . I PROB="FILE" S PROB="Couldn't file fields. DDEF deleted." Q
  1. . . I PROB="FINDPARENT" S PROB="Couldn't find parent. DDEF deleted." Q
  1. . . I PROB="ADDITEM" S PROB="Couldn't add DDEF to parent. DDEF deleted."
  1. . . I PROB="FILEITEM" S PROB="Couldn't file Menu Text. DDEF deleted."
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=$S(NUM=1:"Document Class ",1:"Title ")_^TMP("TIU182",$J,"BASICS",NUM,"NAME")_": "
  1. . S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=" "_PROB
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="Please contact Enterprise VistA Support. When problems have been resolved,"
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)="come back and rerun the option."
  1. MAINX ; Exit
  1. ; -- Leave latest error arrays ^TMP("DIERR",$J) & TIUIERR around until
  1. ; now in case modules are run separately for debugging:
  1. K TIUIERR,^TMP("DIERR",$J)
  1. ; -- Finish message array ^TMP("TIU182MSG",$J and print it:
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=""
  1. S TMPCNT=TMPCNT+1,^TMP("TIU182MSG",$J,TMPCNT)=" *************"
  1. D PRINT^TIU182D
  1. K ^TMP("TIU182MSG",$J),^TMP("TIU182ERR",$J),^TMP("TIU182",$J)
  1. Q