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

DGPFAPI2.m

Go to the documentation of this file.
  1. DGPFAPI2 ;ALB/RBS - PRF EXTERNAL API'S ; 6/7/05 4:44pm
  1. ;;5.3;Registration;**554,650,1015**;Aug 13, 1993;Build 21
  1. ;
  1. Q ;no direct entry
  1. ;
  1. STOTIU(DGDFN,DGAIEN,DGHIEN,DGTIUIEN) ;store TIU Progress Note link
  1. ;This function is used to update the TIU PN LINK (#.06) field of
  1. ;the PRF ASSIGNMENT HISTORY (#26.14) file with the IEN of the
  1. ;TIU Progress Note in the TIU DOCUMENT (#8925) file.
  1. ;
  1. ; Associated DBIA: #4384 - DGPF FILE/DELETE TIU PN LINK
  1. ; Supported DBIA: #4380 - $$CHKDOC^TIUPRF - TIU API's for PRF
  1. ;
  1. ; Input:
  1. ; DGDFN - [Required] IEN of PATIENT (#2) file
  1. ; DGAIEN - [Required] IEN of PRF ASSIGNMENT (#26.13) file
  1. ; DGHIEN - [Required] IEN of PRF ASSIGNMENT HISTORY (#26.14) file
  1. ; DGTIUIEN - [Required] IEN of TIU DOCUMENT (#8925) file
  1. ;
  1. ; Output:
  1. ; Function result - returns 1 on success
  1. ; - returns two piece string on failure
  1. ; Format: 0^error text generated from EZBLD^DIALOG
  1. ;
  1. N DGDIALOG ;failure reason generated from EZBLD^DIALOG
  1. N DGPFA ;flag assignment array
  1. N DGPFAH ;flag assignment history array
  1. N DGRSLT ;function result
  1. ;
  1. S DGDFN=+$G(DGDFN)
  1. S DGAIEN=+$G(DGAIEN)
  1. S DGHIEN=+$G(DGHIEN)
  1. S DGTIUIEN=+$G(DGTIUIEN)
  1. ;
  1. S DGRSLT=0
  1. ;
  1. D ;drops out on error condition
  1. . ;
  1. . I '$$CHKDOC^TIUPRF(DGTIUIEN) S DGDIALOG=$$EZBLD^DIALOG(261104) Q
  1. . ;
  1. . ;check if progress note already setup (x-ref "ATIUPN")
  1. . I $D(^DGPF(26.14,"ATIUPN",DGTIUIEN)) S DGDIALOG=$$EZBLD^DIALOG(261109) Q
  1. . ;
  1. . ;get history record that is being updated
  1. . I '$$GETHIST^DGPFAAH(DGHIEN,.DGPFAH) S DGDIALOG=$$EZBLD^DIALOG(261101) Q
  1. . ;
  1. . ;check if correct history record of the patient assignment
  1. . I $P($G(DGPFAH("ASSIGN")),U)'=DGAIEN S DGDIALOG=$$EZBLD^DIALOG(261101) Q
  1. . ;
  1. . ;check for existing entry
  1. . I +$P($G(DGPFAH("TIULINK")),U) S DGDIALOG=$$EZBLD^DIALOG(261109) Q
  1. . ;
  1. . ;get assignment record
  1. . I '$$GETASGN^DGPFAA(DGAIEN,.DGPFA) S DGDIALOG=$$EZBLD^DIALOG(261102) Q
  1. . ;
  1. . ;check if current site is Owner Site
  1. . I '$$ISDIV^DGPFUT($P(DGPFA("OWNER"),U)) S DGDIALOG=$$EZBLD^DIALOG(261103) Q
  1. . ;
  1. . ;file the TIU PN LINK
  1. . S DGRSLT=$$STOHIST(DGHIEN,DGTIUIEN)
  1. . I 'DGRSLT S DGDIALOG=$P($G(DGRSLT),"^",2) Q
  1. . ;
  1. . S DGRSLT=1
  1. ;
  1. Q $S(DGRSLT:1,1:DGRSLT_"^"_$G(DGDIALOG))
  1. ;
  1. STOHIST(DGHIEN,DGTIUIEN) ;update TIU Progress Note link
  1. ;This function is used to update the TIU PN LINK (#.06) field of
  1. ;the PRF ASSIGNMENT HISTORY (#26.14) file.
  1. ;
  1. ; Input:
  1. ; DGHIEN - [Required] IEN of PRF ASSIGNMENT HISTORY (#26.14) file
  1. ; DGTIUIEN - [Required] IEN of TIU DOCUMENT (#8925) file
  1. ;
  1. ; Output:
  1. ; Function result - returns 1 on success
  1. ; - returns two piece string on failure
  1. ; Format: 0^error text generated from EZBLD^DIALOG
  1. ;
  1. N DGDIALOG ;failure reason generated from EZBLD^DIALOG
  1. N DGERR ;FILE^DIE error array (undefined on filing success)
  1. N DGFDA ;FILE^DIE formatted array containing field ien and data
  1. N DGFIL ;file number to file data
  1. N DGRSLT ;function result
  1. ;
  1. S DGHIEN=+$G(DGHIEN)
  1. S DGTIUIEN=+$G(DGTIUIEN)
  1. ;
  1. S DGRSLT=0
  1. S DGFIL=26.14
  1. ;
  1. D ;drops out on error condition
  1. . S DGFDA(DGFIL,DGHIEN_",",.06)=DGTIUIEN
  1. . D FILE^DIE("","DGFDA","DGERR")
  1. . I $D(DGERR) S DGDIALOG=$$EZBLD^DIALOG(261105) Q
  1. . ;
  1. . S DGRSLT=1
  1. ;
  1. Q $S(DGRSLT:1,1:DGRSLT_"^"_$G(DGDIALOG))
  1. ;
  1. DELTIU(DGTIUIEN) ;delete TIU Progress Note link
  1. ;This function is used to delete the TIU PN LINK (#.06) field of
  1. ;the PRF ASSIGNMENT HISTORY (#26.14) file.
  1. ;
  1. ; Associated DBIA: #4384 - DGPF FILE/DELETE TIU PN LINK
  1. ; Supported DBIA: #4380 - $$CHKDOC^TIUPRF - TIU API's for PRF
  1. ;
  1. ; Input:
  1. ; DGTIUIEN - [Required] IEN of record in TIU DOCUMENT (#8925) file
  1. ;
  1. ; Output:
  1. ; Function result - returns 1 on success
  1. ; - returns two piece string on failure
  1. ; Format: 0^error text generated from EZBLD^DIALOG
  1. ;
  1. N DGDIALOG ;failure reason generated from EZBLD^DIALOG
  1. N DGERR ;FILE^DIE error array (undefined on filing success)
  1. N DGFDA ;FILE^DIE formatted array containing field ien and data
  1. N DGFIL ;file number to file data
  1. N DGHIEN ;IEN of history record
  1. N DGRSLT ;function result
  1. ;
  1. S DGTIUIEN=+$G(DGTIUIEN)
  1. S (DGRSLT,DGHIEN)=0
  1. S DGFIL=26.14
  1. ;
  1. D ;drops out on error condition
  1. . ;
  1. . S DGHIEN=+$O(^DGPF(DGFIL,"ATIUPN",DGTIUIEN,DGHIEN))
  1. . I '$D(^DGPF(DGFIL,DGHIEN,0)) S DGDIALOG=$$EZBLD^DIALOG(261101) Q
  1. . S DGFDA(DGFIL,DGHIEN_",",.06)="@"
  1. . D FILE^DIE("","DGFDA","DGERR")
  1. . I $D(DGERR) S DGDIALOG=$$EZBLD^DIALOG(261106) Q
  1. . ;
  1. . S DGRSLT=1
  1. ;
  1. Q $S(DGRSLT:1,1:DGRSLT_"^"_$G(DGDIALOG))