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

ORPRFHST.m

Go to the documentation of this file.
ORPRFHST ;SLC/SS/JMC/RM - Active Patient Record flag history ;Sep 23, 2021@13:10
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**542,574**;Dec 17, 1997;Build 1
 ;
 ;ICRs
 ;
 ;7107 - $$GETALL^DGPFAA and $$GETASGN^DGPFAA
 ;7108 - $$GETHIST^DGPFAAH
 ;7214 - $$GETALLDT^DGPFAAH
 ;2171 - $$STA^XUAF4
 ;
ACTPRFHS(ORDFN,RETARR) ;
 N ORRET,ORIEN13,ORIENS,ORARRH,ORFLGNM,ORARFLAG,ORCNT,ORDTTM,ORIEN14,ORZ
 I '$$GETALL^DGPFAA(ORDFN,.ORRET,"",1) Q
 S ORIEN13="" F  S ORIEN13=$O(ORRET(ORIEN13)) Q:ORIEN13=""  D
 . K ORARFLAG
 . I '$$GETASGN^DGPFAA(ORIEN13,.ORARFLAG) Q
 . S ORFLGNM=$P(ORARFLAG("FLAG"),U,2)
 . I '$L(ORFLGNM) Q
 . K ORIENS
 . I '$$GETALLDT^DGPFAAH(ORIEN13,.ORIENS) Q
 . S ORCNT=0
 . S ORDTTM="" F  S ORDTTM=$O(ORIENS(ORDTTM)) Q:+ORDTTM=0  S ORIEN14=$G(ORIENS(ORDTTM)) I ORIEN14 D
 . . K ORARRH
 . . I '$$GETHIST^DGPFAAH(ORIEN14,.ORARRH,1) Q
 . . S ORZ="^"_$P(ORARRH("ACTION"),U,2)_"^"
 . . ; ignore if the action is not in the list
 . . ; Added NEW ASSIGNMENT as an action to be included in the list.
 . . I "^INACTIVATE^REACTIVATE^CONTINUE^NEW ASSIGNMENT^"'[ORZ Q
 . . S ORCNT=ORCNT+1
 . . ;OR*3.0*574: Display station number instead of institution IEN
 . . N ORSTATN
 . . S ORSTATN=$$STA^XUAF4($P(ORARRH("ORIGFAC"),U,1))
 . . S RETARR(ORFLGNM,ORCNT)=$P(ORARRH("ORIGFAC"),U,2)_U_$P(ORARRH("ASSIGNDT"),U,2)_U_$P(ORARRH("ACTION"),U,2)_U
 . . S RETARR(ORFLGNM,ORCNT)=RETARR(ORFLGNM,ORCNT)_$S(ORSTATN]"":ORSTATN,1:"unknown")
 D REVERSE
 Q
 ;
REVERSE ; Reverse the order of entries so most recent displays on top
 N REVFLG,REVNUM,REVCNT,RETARR2
 S REVFLG=""
 F  S REVFLG=$O(RETARR(REVFLG)) Q:REVFLG=""  D
 . S REVNUM="",REVCNT=1
 . F  S REVNUM=$O(RETARR(REVFLG,REVNUM),-1) Q:REVNUM=""  D
 . . S RETARR2(REVFLG,REVCNT)=$G(RETARR(REVFLG,REVNUM))
 . . S REVCNT=REVCNT+1
 K RETARR
 M RETARR=RETARR2
 K RETARR2
 Q