ORQPTQ5 ; SLC/PKS - Functions for Patient Selection Lists. [4/23/04 4:49pm]
;;3.0;ORDER ENTRY/RESULTS REPORTING;**82,85,187,190**;Dec 17, 1997
;
Q
;
COMBDISP(ORQDUZ,ORQPTR) ; Display user's "Combination" pt selection sources.
;
; Variables used:
;
; ORQCNT = Counter for number of entries displayed.
; ORQDUZ = DUZ of user involved.
; ORQPTR = IEN for user's OE/RR PT SEL COMBO file entries.
; ORQSRC = $O command values from combo entries, file ^OR(100.24,.
; ORQTXT = Text name string for combo entry pointers.
;
N ORQCNT,ORQSRC,ORQTXT
;
; Check passed variables, punt on errors:
S ORQCNT=0
I '($D(ORQDUZ)) W !,"No user DUZ passed.",! Q ORQCNT
I '($D(ORQPTR)) W !,"No combination pointer passed.",! Q ORQCNT
I ORQDUZ="" W !,"No user DUZ passed.",! Q ORQCNT
I ORQPTR="" W !,"No combination pointer passed.",! Q ORQCNT
;
; Order through the user's combination source entries:
K ^TMP("OR",$J,"ORQCPL")
S ORQSRC=0
F S ORQSRC=$O(^OR(100.24,ORQPTR,.01,ORQSRC)) Q:'ORQSRC D
.;
.; Get the actual source name based on the pointer entry value:
.S ORQTXT=""
.S ORQTXT=$G(^OR(100.24,ORQPTR,.01,ORQSRC,0))
.I '(ORQTXT="") D
..S ORQCNT=ORQCNT+1 ; Increment counter.
..S ORQTXT=$$COMBNM(ORQTXT) ; Call tag to create complete string.
..;
..; Write to ^TMP file for sorting:
..I ORQTXT'="" S ^TMP("OR",$J,"ORQCPL",$P(ORQTXT,U))=$P(ORQTXT,U,2)
;
; Write data to the screen:
I ORQCNT D ; Data to write?
.S ORQTXT="" ; Reset, re-use.
.F S ORQTXT=$O(^TMP("OR",$J,"ORQCPL",ORQTXT)) Q:ORQTXT="" D
..W !,$G(^TMP("OR",$J,"ORQCPL",ORQTXT))
;
K ^TMP("OR",$J,"ORQCPL") ; Clean house.
;
Q ORQCNT ; Return counter.
;
COMBNM(ORQVAL) ; Returns name of "Combination" source entry, ^OR(100.24 file.
;
; Returned string is "X_Name^String" where X is letter of type,
; Name is name of entity, and String resembles examples below:
;
; W_1W^Ward: 1W SURGERY WEST
; P_JONES,WILMA MD^Provider: JONES,WILMA MD
; T_SURGERYLIST2^Team List: SURGERYLIST2
; (Etc.)
;
; Variables used:
;
; ORQFILE = File for retrieval of name.
; ORQPTR = Name string to return.
; ORQRTN = Value returned by this function.
; ORQVAL = Combo source entry pointer.
;
N ORQPTR,ORQFILE,ORQRTN
I '($D(ORQVAL)) Q ORQRTN ; Error - punt.
;
S ORQRTN="No source found...." ; Default init.
S ORQPTR=$P(ORQVAL,";") ; Get pointer.
S ORQFILE="^"_$P(ORQVAL,";",2) ; Get file.
;
I ORQFILE="^DIC(42," D Q ORQRTN ; Wards.
.S ORQRTN=$G(^DIC(42,ORQPTR,0))
.I $D(ORQRTN) S ORQRTN="W"_"_"_$P(ORQRTN,U)_U_"Ward: "_$P(ORQRTN,U)_" "_$P(ORQRTN,U,2)
;
I ORQFILE="^VA(200," D Q ORQRTN ; Providers.
.S ORQRTN=$G(^VA(200,ORQPTR,0))
.I $D(ORQRTN) S ORQRTN="P"_"_"_$P(ORQRTN,U)_U_"Provider: "_$P(ORQRTN,U)
;
I ORQFILE="^DIC(45.7," D Q ORQRTN ; Specialties.
.S ORQRTN=$G(^DIC(45.7,ORQPTR,0))
.I $D(ORQRTN) S ORQRTN="S"_"_"_$P(ORQRTN,U)_U_"Specialty: "_$P(ORQRTN,U)
;
I ORQFILE="^OR(100.21," D Q ORQRTN ; Team Lists.
.S ORQRTN=$G(^OR(100.21,ORQPTR,0))
.I $D(ORQRTN) S ORQRTN="T"_"_"_$P(ORQRTN,U)_U_"Team List: "_$P(ORQRTN,U)
;
I ORQFILE="^SC(" D Q ORQRTN ; Clinics.
.S ORQRTN=$G(^SC(ORQPTR,0))
.I $D(ORQRTN) S ORQRTN="C"_"_"_$P(ORQRTN,U)_U_"Clinic: "_$P(ORQRTN,U)
;
; Return value (null will be returned if nothing matched):
Q ORQRTN
;
PTSCOMBO(ORQTYP,ORQPTR) ; Write ^TMP("OR",$J,"PATIENTS","B") patient entries.
;
; Called from COMBPTS^ORQPTQ6.
; (ORQCNT,ORQPDAT,ORQPIEN,ORQPNM,ORQPSTAT,SORT new'd in calling tag.)
; (Array ORY new'd in calling routine ORQPTQ2.)
;
; Variables used:
;
; ORQDOB = Patient DOB.
; ORQDONE = Flag for end of patient records.
; ORQIDT = Clinic app't date stored in internal format.
; ORQMORE = Room/bed or appointment information.
; ORQPTR = PASSED: Pointer from subfile entry, combination file.
; ORQSNM = Name of source from subfile entry pointer.
; ORQSNM4 = First four letters of name of source.
; ORQSSN = Patient SSN suffix.
; ORQTYP = PASSED: Holds source type:
;
; W = Ward
; P = Provider
; S = Specialty
; T = Team List
; C = Clinic
;
N ORQDOB,ORQDONE,ORQIDT,ORQMORE,ORQSNM,ORQSNM4,ORQSSN
;
; Initialize variables:
S ORQDONE=0
S ORQCNT=1
;
; Get name data for source:
S ORQSNM4="" ; Default setting.
I ORQTYP="W" S ORQSNM4=$G(^DIC(42,ORQPTR,0)) ; Wards.
I ORQTYP="P" S ORQSNM4=$G(^VA(200,ORQPTR,0)) ; Providers.
I ORQTYP="S" S ORQSNM4=$G(^DIC(45.7,ORQPTR,0)) ; Specialties.
I ORQTYP="T" S ORQSNM4=$G(^OR(100.21,ORQPTR,0)) ; Team Lists.
I ORQTYP="C" S ORQSNM4=$G(^SC(ORQPTR,0)) ; Clinics.
;
; Assure use of first 4 letters of name:
S ORQSNM4=$P(ORQSNM4,U)_" " ; Add 4 for safety.
S ORQSNM4=$E(ORQSNM4,1,4) ; Get first 4 only.
;
; Add label prefix to source name:
S ORQSNM="" ; Default setting.
S ORQSNM=$S(ORQTYP="W":"Wd ",ORQTYP="P":"Pr ",ORQTYP="S":"Sp ",ORQTYP="T":"Tm ",ORQTYP="C":"Cl ",1:" ") ; Get correct name.
S ORQSNM=ORQSNM_ORQSNM4 ; Prepend label.
;
; Order thru ORY array created by calls in calling routine:
S ORQPDAT="" ; Initialize.
F S ORQPDAT=$G(ORY(ORQCNT)) Q:((ORQPDAT="")!(ORQDONE)) D
.;
.; Clear variables each time:
.S (ORQPIEN,ORQPNM,ORQSSN,ORQDOB,ORQIDT,ORQMORE,ORQPSTAT)=""
.;
.S ORQPIEN=$P(ORQPDAT,U) ; Get patient IEN.
.I ORQPIEN="" S ORQDONE=1 Q ; Punt if no IEN.
.S ORQPNM=$P(ORQPDAT,U,2) ; Get patient name.
.;
.; Get patient SSN suffix:
.S ORQSSN=$$ID($G(ORQPIEN))
.;
.; Get patient DOB:
.S ORQDOB=$$FMTE^XLFDT($P($G(^DPT(ORQPIEN,0)),U,3))
.;
.; Get patient room/bed information where data exists:
.S ORQMORE=$P($G(^DPT(ORQPIEN,.101)),U)
.;
.; Assure at least 4 letters for any existing room/bed data:
.I ORQMORE'="" D ; Any data now?
..I $L(ORQMORE)<4 D ; Less than 4 now?
...S ORQMORE=ORQMORE_" " ; Add 3 for safety.
...S ORQMORE=$E(ORQMORE,1,4) ; Get first 4 only.
.;
.; Get clinic appointment information, if applicable:
.I ORQTYP="C" D
..S ORQMORE="" ; Reset, re-use.
..S ORQMORE=$P(ORQPDAT,U,4) ; App't data.
..S ORQIDT=ORQMORE ; Internal format.
..S $P(ORQMORE,".",2)=$E($P(ORQMORE,".",2)_"000",1,4)
..S ORQMORE=$$FMTE^XLFDT($P(ORQMORE,U)) ; Format app't.
..S ORQPSTAT=$P(ORQPDAT,U,9) ; Ipt/Opt status.
.;
.; Write a sorted entry in ^TMP("OR",$J,"PATIENTS","B"):
.; (Node's data:)
.; (DFN^PtName^SSN^DOB^SourceName^App't/Room/Bed^SourceIEN^IOStat)
.I ORQPIEN'="" D
..;
..; Write using source name first if sorted by "S" (source) -or-
..; if "P" (app't) sort and not a clinic:
..I ((SORT="S")!((SORT="P")&(ORQTYP'="C"))) D Q
...S ^TMP("OR",$J,"PATIENTS","B",ORQSNM_" "_ORQPNM_" "_ORQPIEN_" "_ORQIDT)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
..;
..; Use source source+app't first if "P" (app't) sort, and a clinic:
..I ((ORQTYP="C")&(SORT="P")) D Q
...S ^TMP("OR",$J,"PATIENTS","B",ORQSNM_" "_ORQIDT_" "_ORQPNM_" "_ORQPIEN)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
..;
..; If not by source or source/app't, default to alpha ("A") sort:
..S ^TMP("OR",$J,"PATIENTS","B",ORQPNM_" "_ORQPIEN_" "_ORQSNM_" "_ORQIDT)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
.;
.S ORQCNT=ORQCNT+1 ; Increment counter.
;
Q
;
ID(ORQPIEN) ; Return short ID for patient ID.
; (Copied from ORQPT routine and modified.)
;
N ID
;
S ID=$P($G(^DPT(ORQPIEN,.36)),U,4) ; Gets short ID.
I '$L(ID) D ; - or -
.S ID=$E($P($G(^DPT(ORQPIEN,0)),U,9),6,9) ; Last 4 of SSN
;
Q "("_$E(ORQPNM)_ID_")"
;
ORQPTQ5 ; SLC/PKS - Functions for Patient Selection Lists. [4/23/04 4:49pm]
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**82,85,187,190**;Dec 17, 1997
+2 ;
+3 QUIT
+4 ;
COMBDISP(ORQDUZ,ORQPTR) ; Display user's "Combination" pt selection sources.
+1 ;
+2 ; Variables used:
+3 ;
+4 ; ORQCNT = Counter for number of entries displayed.
+5 ; ORQDUZ = DUZ of user involved.
+6 ; ORQPTR = IEN for user's OE/RR PT SEL COMBO file entries.
+7 ; ORQSRC = $O command values from combo entries, file ^OR(100.24,.
+8 ; ORQTXT = Text name string for combo entry pointers.
+9 ;
+10 NEW ORQCNT,ORQSRC,ORQTXT
+11 ;
+12 ; Check passed variables, punt on errors:
+13 SET ORQCNT=0
+14 IF '($DATA(ORQDUZ))
WRITE !,"No user DUZ passed.",!
QUIT ORQCNT
+15 IF '($DATA(ORQPTR))
WRITE !,"No combination pointer passed.",!
QUIT ORQCNT
+16 IF ORQDUZ=""
WRITE !,"No user DUZ passed.",!
QUIT ORQCNT
+17 IF ORQPTR=""
WRITE !,"No combination pointer passed.",!
QUIT ORQCNT
+18 ;
+19 ; Order through the user's combination source entries:
+20 KILL ^TMP("OR",$JOB,"ORQCPL")
+21 SET ORQSRC=0
+22 FOR
SET ORQSRC=$ORDER(^OR(100.24,ORQPTR,.01,ORQSRC))
IF 'ORQSRC
QUIT
Begin DoDot:1
+23 ;
+24 ; Get the actual source name based on the pointer entry value:
+25 SET ORQTXT=""
+26 SET ORQTXT=$GET(^OR(100.24,ORQPTR,.01,ORQSRC,0))
+27 IF '(ORQTXT="")
Begin DoDot:2
+28 ; Increment counter.
SET ORQCNT=ORQCNT+1
+29 ; Call tag to create complete string.
SET ORQTXT=$$COMBNM(ORQTXT)
+30 ;
+31 ; Write to ^TMP file for sorting:
+32 IF ORQTXT'=""
SET ^TMP("OR",$JOB,"ORQCPL",$PIECE(ORQTXT,U))=$PIECE(ORQTXT,U,2)
End DoDot:2
End DoDot:1
+33 ;
+34 ; Write data to the screen:
+35 ; Data to write?
IF ORQCNT
Begin DoDot:1
+36 ; Reset, re-use.
SET ORQTXT=""
+37 FOR
SET ORQTXT=$ORDER(^TMP("OR",$JOB,"ORQCPL",ORQTXT))
IF ORQTXT=""
QUIT
Begin DoDot:2
+38 WRITE !,$GET(^TMP("OR",$JOB,"ORQCPL",ORQTXT))
End DoDot:2
End DoDot:1
+39 ;
+40 ; Clean house.
KILL ^TMP("OR",$JOB,"ORQCPL")
+41 ;
+42 ; Return counter.
QUIT ORQCNT
+43 ;
COMBNM(ORQVAL) ; Returns name of "Combination" source entry, ^OR(100.24 file.
+1 ;
+2 ; Returned string is "X_Name^String" where X is letter of type,
+3 ; Name is name of entity, and String resembles examples below:
+4 ;
+5 ; W_1W^Ward: 1W SURGERY WEST
+6 ; P_JONES,WILMA MD^Provider: JONES,WILMA MD
+7 ; T_SURGERYLIST2^Team List: SURGERYLIST2
+8 ; (Etc.)
+9 ;
+10 ; Variables used:
+11 ;
+12 ; ORQFILE = File for retrieval of name.
+13 ; ORQPTR = Name string to return.
+14 ; ORQRTN = Value returned by this function.
+15 ; ORQVAL = Combo source entry pointer.
+16 ;
+17 NEW ORQPTR,ORQFILE,ORQRTN
+18 ; Error - punt.
IF '($DATA(ORQVAL))
QUIT ORQRTN
+19 ;
+20 ; Default init.
SET ORQRTN="No source found...."
+21 ; Get pointer.
SET ORQPTR=$PIECE(ORQVAL,";")
+22 ; Get file.
SET ORQFILE="^"_$PIECE(ORQVAL,";",2)
+23 ;
+24 ; Wards.
IF ORQFILE="^DIC(42,"
Begin DoDot:1
+25 SET ORQRTN=$GET(^DIC(42,ORQPTR,0))
+26 IF $DATA(ORQRTN)
SET ORQRTN="W"_"_"_$PIECE(ORQRTN,U)_U_"Ward: "_$PIECE(ORQRTN,U)_" "_$PIECE(ORQRTN,U,2)
End DoDot:1
QUIT ORQRTN
+27 ;
+28 ; Providers.
IF ORQFILE="^VA(200,"
Begin DoDot:1
+29 SET ORQRTN=$GET(^VA(200,ORQPTR,0))
+30 IF $DATA(ORQRTN)
SET ORQRTN="P"_"_"_$PIECE(ORQRTN,U)_U_"Provider: "_$PIECE(ORQRTN,U)
End DoDot:1
QUIT ORQRTN
+31 ;
+32 ; Specialties.
IF ORQFILE="^DIC(45.7,"
Begin DoDot:1
+33 SET ORQRTN=$GET(^DIC(45.7,ORQPTR,0))
+34 IF $DATA(ORQRTN)
SET ORQRTN="S"_"_"_$PIECE(ORQRTN,U)_U_"Specialty: "_$PIECE(ORQRTN,U)
End DoDot:1
QUIT ORQRTN
+35 ;
+36 ; Team Lists.
IF ORQFILE="^OR(100.21,"
Begin DoDot:1
+37 SET ORQRTN=$GET(^OR(100.21,ORQPTR,0))
+38 IF $DATA(ORQRTN)
SET ORQRTN="T"_"_"_$PIECE(ORQRTN,U)_U_"Team List: "_$PIECE(ORQRTN,U)
End DoDot:1
QUIT ORQRTN
+39 ;
+40 ; Clinics.
IF ORQFILE="^SC("
Begin DoDot:1
+41 SET ORQRTN=$GET(^SC(ORQPTR,0))
+42 IF $DATA(ORQRTN)
SET ORQRTN="C"_"_"_$PIECE(ORQRTN,U)_U_"Clinic: "_$PIECE(ORQRTN,U)
End DoDot:1
QUIT ORQRTN
+43 ;
+44 ; Return value (null will be returned if nothing matched):
+45 QUIT ORQRTN
+46 ;
PTSCOMBO(ORQTYP,ORQPTR) ; Write ^TMP("OR",$J,"PATIENTS","B") patient entries.
+1 ;
+2 ; Called from COMBPTS^ORQPTQ6.
+3 ; (ORQCNT,ORQPDAT,ORQPIEN,ORQPNM,ORQPSTAT,SORT new'd in calling tag.)
+4 ; (Array ORY new'd in calling routine ORQPTQ2.)
+5 ;
+6 ; Variables used:
+7 ;
+8 ; ORQDOB = Patient DOB.
+9 ; ORQDONE = Flag for end of patient records.
+10 ; ORQIDT = Clinic app't date stored in internal format.
+11 ; ORQMORE = Room/bed or appointment information.
+12 ; ORQPTR = PASSED: Pointer from subfile entry, combination file.
+13 ; ORQSNM = Name of source from subfile entry pointer.
+14 ; ORQSNM4 = First four letters of name of source.
+15 ; ORQSSN = Patient SSN suffix.
+16 ; ORQTYP = PASSED: Holds source type:
+17 ;
+18 ; W = Ward
+19 ; P = Provider
+20 ; S = Specialty
+21 ; T = Team List
+22 ; C = Clinic
+23 ;
+24 NEW ORQDOB,ORQDONE,ORQIDT,ORQMORE,ORQSNM,ORQSNM4,ORQSSN
+25 ;
+26 ; Initialize variables:
+27 SET ORQDONE=0
+28 SET ORQCNT=1
+29 ;
+30 ; Get name data for source:
+31 ; Default setting.
SET ORQSNM4=""
+32 ; Wards.
IF ORQTYP="W"
SET ORQSNM4=$GET(^DIC(42,ORQPTR,0))
+33 ; Providers.
IF ORQTYP="P"
SET ORQSNM4=$GET(^VA(200,ORQPTR,0))
+34 ; Specialties.
IF ORQTYP="S"
SET ORQSNM4=$GET(^DIC(45.7,ORQPTR,0))
+35 ; Team Lists.
IF ORQTYP="T"
SET ORQSNM4=$GET(^OR(100.21,ORQPTR,0))
+36 ; Clinics.
IF ORQTYP="C"
SET ORQSNM4=$GET(^SC(ORQPTR,0))
+37 ;
+38 ; Assure use of first 4 letters of name:
+39 ; Add 4 for safety.
SET ORQSNM4=$PIECE(ORQSNM4,U)_" "
+40 ; Get first 4 only.
SET ORQSNM4=$EXTRACT(ORQSNM4,1,4)
+41 ;
+42 ; Add label prefix to source name:
+43 ; Default setting.
SET ORQSNM=""
+44 ; Get correct name.
SET ORQSNM=$SELECT(ORQTYP="W":"Wd ",ORQTYP="P":"Pr ",ORQTYP="S":"Sp ",ORQTYP="T":"Tm ",ORQTYP="C":"Cl ",1:" ")
+45 ; Prepend label.
SET ORQSNM=ORQSNM_ORQSNM4
+46 ;
+47 ; Order thru ORY array created by calls in calling routine:
+48 ; Initialize.
SET ORQPDAT=""
+49 FOR
SET ORQPDAT=$GET(ORY(ORQCNT))
IF ((ORQPDAT="")!(ORQDONE))
QUIT
Begin DoDot:1
+50 ;
+51 ; Clear variables each time:
+52 SET (ORQPIEN,ORQPNM,ORQSSN,ORQDOB,ORQIDT,ORQMORE,ORQPSTAT)=""
+53 ;
+54 ; Get patient IEN.
SET ORQPIEN=$PIECE(ORQPDAT,U)
+55 ; Punt if no IEN.
IF ORQPIEN=""
SET ORQDONE=1
QUIT
+56 ; Get patient name.
SET ORQPNM=$PIECE(ORQPDAT,U,2)
+57 ;
+58 ; Get patient SSN suffix:
+59 SET ORQSSN=$$ID($GET(ORQPIEN))
+60 ;
+61 ; Get patient DOB:
+62 SET ORQDOB=$$FMTE^XLFDT($PIECE($GET(^DPT(ORQPIEN,0)),U,3))
+63 ;
+64 ; Get patient room/bed information where data exists:
+65 SET ORQMORE=$PIECE($GET(^DPT(ORQPIEN,.101)),U)
+66 ;
+67 ; Assure at least 4 letters for any existing room/bed data:
+68 ; Any data now?
IF ORQMORE'=""
Begin DoDot:2
+69 ; Less than 4 now?
IF $LENGTH(ORQMORE)<4
Begin DoDot:3
+70 ; Add 3 for safety.
SET ORQMORE=ORQMORE_" "
+71 ; Get first 4 only.
SET ORQMORE=$EXTRACT(ORQMORE,1,4)
End DoDot:3
End DoDot:2
+72 ;
+73 ; Get clinic appointment information, if applicable:
+74 IF ORQTYP="C"
Begin DoDot:2
+75 ; Reset, re-use.
SET ORQMORE=""
+76 ; App't data.
SET ORQMORE=$PIECE(ORQPDAT,U,4)
+77 ; Internal format.
SET ORQIDT=ORQMORE
+78 SET $PIECE(ORQMORE,".",2)=$EXTRACT($PIECE(ORQMORE,".",2)_"000",1,4)
+79 ; Format app't.
SET ORQMORE=$$FMTE^XLFDT($PIECE(ORQMORE,U))
+80 ; Ipt/Opt status.
SET ORQPSTAT=$PIECE(ORQPDAT,U,9)
End DoDot:2
+81 ;
+82 ; Write a sorted entry in ^TMP("OR",$J,"PATIENTS","B"):
+83 ; (Node's data:)
+84 ; (DFN^PtName^SSN^DOB^SourceName^App't/Room/Bed^SourceIEN^IOStat)
+85 IF ORQPIEN'=""
Begin DoDot:2
+86 ;
+87 ; Write using source name first if sorted by "S" (source) -or-
+88 ; if "P" (app't) sort and not a clinic:
+89 IF ((SORT="S")!((SORT="P")&(ORQTYP'="C")))
Begin DoDot:3
+90 SET ^TMP("OR",$JOB,"PATIENTS","B",ORQSNM_" "_ORQPNM_" "_ORQPIEN_" "_ORQIDT)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
End DoDot:3
QUIT
+91 ;
+92 ; Use source source+app't first if "P" (app't) sort, and a clinic:
+93 IF ((ORQTYP="C")&(SORT="P"))
Begin DoDot:3
+94 SET ^TMP("OR",$JOB,"PATIENTS","B",ORQSNM_" "_ORQIDT_" "_ORQPNM_" "_ORQPIEN)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
End DoDot:3
QUIT
+95 ;
+96 ; If not by source or source/app't, default to alpha ("A") sort:
+97 SET ^TMP("OR",$JOB,"PATIENTS","B",ORQPNM_" "_ORQPIEN_" "_ORQSNM_" "_ORQIDT)=ORQPIEN_U_ORQPNM_U_ORQSSN_U_ORQDOB_U_ORQSNM_U_ORQMORE_U_ORQPTR_U_ORQIDT_U_ORQPSTAT
End DoDot:2
+98 ;
+99 ; Increment counter.
SET ORQCNT=ORQCNT+1
End DoDot:1
+100 ;
+101 QUIT
+102 ;
ID(ORQPIEN) ; Return short ID for patient ID.
+1 ; (Copied from ORQPT routine and modified.)
+2 ;
+3 NEW ID
+4 ;
+5 ; Gets short ID.
SET ID=$PIECE($GET(^DPT(ORQPIEN,.36)),U,4)
+6 ; - or -
IF '$LENGTH(ID)
Begin DoDot:1
+7 ; Last 4 of SSN
SET ID=$EXTRACT($PIECE($GET(^DPT(ORQPIEN,0)),U,9),6,9)
End DoDot:1
+8 ;
+9 QUIT "("_$EXTRACT(ORQPNM)_ID_")"
+10 ;