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

DGPFLMA4.m

Go to the documentation of this file.
  1. DGPFLMA4 ;ALB/KCL - PRF ASSIGNMENT LM PROTOCOL ACTIONS CONT. ; 10/18/06 9:41am
  1. ;;5.3;Registration;**425,554,650,1015**;Aug 13, 1993;Build 21
  1. ;
  1. ;no direct entry
  1. QUIT
  1. ;
  1. ;
  1. CO ;Entry point for DGPF CHANGE ASSIGNMENT OWNERSHIP action protocol.
  1. ;
  1. ; Input: None
  1. ;
  1. ; Output:
  1. ; VALMBCK - 'R' = refresh screen
  1. ;
  1. N DIC,DGWPROOT,DIWETXT,DIWESUB,DWLW,DDWC,DWPK ;input vars for EN^DIWE
  1. N DGCROOT ;assignment history comment word processing root
  1. N DGABORT ;abort flag for entering assignment narrative
  1. N DGOK ;ok flag for entering assignment narrative
  1. N DGIEN ;assignment ien
  1. N DGINST ;institution ien
  1. N DGPFA ;assignment array
  1. N DGPFAH ;assignment history array
  1. N DGRESULT ;result of STOALL api call
  1. N DGERR ;error if unable to edit assignment
  1. N DGETEXT ;error text
  1. N DGPFERR ;if error returned from STOALL api call
  1. N DGOWN ;valid owner list array
  1. N SEL ;user selection (list item)
  1. N VALMY ;output of EN^VALM2 call, array of user selected entries
  1. ;
  1. ;set screen to full scroll region
  1. D FULL^VALM1
  1. ;
  1. ;quit if selected action is not appropriate
  1. I '$D(@VALMAR@("IDX")) D Q
  1. . I '$G(DGDFN) S DGETEXT(1)="Patient has not been selected."
  1. . E S DGETEXT(1)="Patient has no record flag assignments."
  1. . D BLD^DIALOG(261129,.DGETEXT,"","DGERR","F")
  1. . D MSG^DIALOG("WE","","","","DGERR") W *7
  1. . D PAUSE^VALM1
  1. . S VALMBCK="R"
  1. ;
  1. ;allow user to select a SINGLE flag assignment for ownership change
  1. S (DGIEN,VALMBCK)=""
  1. D EN^VALM2($G(XQORNOD(0)),"S")
  1. ;
  1. ;process user selection
  1. S SEL=$O(VALMY(""))
  1. I SEL,$D(@VALMAR@("IDX",SEL,SEL)) D
  1. . S DGIEN=$P($G(@VALMAR@("IDX",SEL,SEL)),U)
  1. . S DGDFN=$P($G(@VALMAR@("IDX",SEL,SEL)),U,2)
  1. . ;
  1. . ;attempt to obtain lock on assignment record
  1. . I '$$LOCK^DGPFAA3(DGIEN) D Q
  1. . . W !!,"Record flag assignment currently in use, can not be edited!",*7
  1. . . D PAUSE^VALM1
  1. . ;
  1. . ;get assignment into DGPFA array
  1. . I '$$GETASGN^DGPFAA(DGIEN,.DGPFA) D Q
  1. . . W !!,"Unable to retrieve the record flag assignment selected.",*7
  1. . . D PAUSE^VALM1
  1. . ;
  1. . ;can site change ownership of the assignment?
  1. . I '$$CHGOWN^DGPFAA2(.DGPFA,$G(DUZ(2)),"DGERR") D Q
  1. . . W !!,"Changing the ownership of this record flag assignment not allowed...",*7
  1. . . D MSG^DIALOG("WE","","",5,"DGERR")
  1. . . D PAUSE^VALM1
  1. . ;
  1. . ;prompt for new OWNER SITE of the assignment
  1. . ;
  1. . ;-create selection list of enabled division owners
  1. . S DGINST=0
  1. . F S DGINST=$O(^DG(40.8,"APRF",DGINST)) Q:'DGINST D
  1. . . I $$TF^XUAF4(DGINST) S DGOWN(DGINST)=""
  1. . ;
  1. . ;-add treating facilities to selection list for Cat I assignments
  1. . I $G(DGPFA("FLAG"))["26.15",$$BLDTFL^DGPFUT2(DGDFN,.DGOWN)
  1. . ;
  1. . ;-remove existing owner from selection list
  1. . K DGOWN(+$G(DGPFA("OWNER")))
  1. . ;
  1. . S DGPFA("OWNER")=$$ANSWER^DGPFUT("Select new owner site for this record flag assignment","","P^4:EMZ","","I $D(DGOWN(+Y))")
  1. . Q:(DGPFA("OWNER")'>0)
  1. . ;
  1. . ;prompt for APPROVED BY person
  1. . S DGPFAH("APPRVBY")=$$ANSWER^DGPFUT("Approved By","","P^200:EMZ")
  1. . Q:(DGPFAH("APPRVBY")'>0)
  1. . ;
  1. . ;allow user to enter HISTORY COMMENTS (edit reason)
  1. . S DGCROOT=$NA(^TMP($J,"DGPFCMNT")) ;init WP array for hist comments
  1. . K @DGCROOT
  1. . S (DGABORT,DGOK)=0
  1. . F D Q:(DGOK!DGABORT)
  1. . . W !!,"Enter the reason for editing this assignment:" ;needed for line editor
  1. . . S @DGCROOT@(1,0)="Change of flag assignment ownership. "
  1. . . S DIC=$$OREF^DILF(DGCROOT)
  1. . . S DIWETXT="Enter the reason for record flag assignment ownership change:"
  1. . . S DIWESUB="Change of Ownership Reason"
  1. . . S DWLW=75 ;max # of chars allowed to be stored on WP global node
  1. . . S DWPK=1 ;if line editor, don't join lines
  1. . . S DDWC="E" ;initially place cursor at end of line 1
  1. . . D EN^DIWE
  1. . . I $$CKWP^DGPFUT(DGCROOT) S DGOK=1 Q
  1. . . W !,"The reason for editing this record flag assignment is required!",*7
  1. . . I '$$CONTINUE^DGPFUT() S DGABORT=1
  1. . ;
  1. . ;quit if required HISTORY COMMENTS not entered
  1. . Q:$G(DGABORT)
  1. . ;
  1. . ;place HISTORY COMMENTS into history array
  1. . M DGPFAH("COMMENT")=@DGCROOT K @DGCROOT
  1. . ;
  1. . ;setup remaining assignment history array nodes for filing
  1. . S DGPFAH("ACTION")=2 ;continue
  1. . S DGPFAH("ASSIGNDT")=$$NOW^XLFDT() ;current date/time
  1. . S DGPFAH("ENTERBY")=DUZ ;current user
  1. . ;
  1. . ;relinquishing ownership should remove existing review date when
  1. . ;new owner is not a local division
  1. . I '$D(^DG(40.8,"APRF",DGPFA("OWNER"))) S DGPFA("REVIEWDT")=""
  1. . ;
  1. . ;display flag assignment review screen to user
  1. . D REVIEW^DGPFUT3(.DGPFA,.DGPFAH,DGIEN,XQY0,XQORNOD(0))
  1. . ;
  1. . ;ask user if ok to file ownership change
  1. . Q:$$ANSWER^DGPFUT("Would you like to file the assignment ownership change","YES","Y")'>0
  1. . ;
  1. . ;file the assignment and history using STOALL api
  1. . W !!,"Updating the ownership of this patient's record flag assignment..."
  1. . S DGRESULT=$$STOALL^DGPFAA(.DGPFA,.DGPFAH,.DGPFERR)
  1. . W !?5,"Update was "_$S(+$G(DGRESULT):"successful",1:"not successful")_"."
  1. . ;
  1. . ;send HL7 ORU msg if editing assignment to a Cat I flag
  1. . I +$G(DGRESULT),$G(DGPFA("FLAG"))["26.15",$$SNDORU^DGPFHLS(+DGRESULT) D
  1. . . W !?5,"Message sent...updating patient's sites of record."
  1. . ;
  1. . D PAUSE^VALM1
  1. . ;
  1. . ;rebuild list of flag assignments for patient
  1. . D BLDLIST^DGPFLMU(DGDFN)
  1. . ;
  1. . ;release lock after CO edit
  1. . D UNLOCK^DGPFAA3(DGIEN)
  1. ;
  1. ;return to LM (refresh screen)
  1. S VALMBCK="R"
  1. ;
  1. Q