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

SDESRECALLREQ.m

Go to the documentation of this file.
SDESRECALLREQ ;ALB/BWF/BLB,BLB/JAS - VISTA SCHEDULING RECALL/APPT REQUEST RPCS ; Mar 19, 2024@10:30am
 ;;5.3;Scheduling;**835,847,853,875,877**;Aug 13, 1993;Build 14
 ;;Per VHA Directive 6402, this routine should not be modified
 Q
REOPEN(RETURN,APPTIEN,SDAPTYP,NEWPID,SDECTYP,NOSHOWFLAG,USERID) ;for Recall Requests
 N OLDPTR,SD40350PRV,SD40350REC,SD40354PRV,SD4035IEN,SD409840REC,SD409842REC,CLINIC,RESOURCE,SDPROVNAM,IEN40985,SD409841COM,REQIEN
 N CANCHANGEPID,PIDH,RECOPENYN,APPTDAT,ERR,APPTIENS,CANREASONPTR,CLINIC,DFN40984,DFN40985,FDA,INSTIEN,REQUEST,I,LENGTH,COMMENT
 S APPTIENS=APPTIEN_","
 D GETS^DIQ(409.84,APPTIENS,".05;.06;.07;.122;.16;.2;.22;.23","I","APPTDAT","ERR")
 I $D(ERR) Q
 S SD409840REC=^SDEC(409.84,APPTIEN,0) ; APPT
 ; Only re-open Appt Request for approved Cancellation Reasons VSE-1112
 S CANREASONPTR=$G(APPTDAT(409.84,APPTIENS,.122,"I"))
 S RECOPENYN=$$GET1^DIQ(409.2,CANREASONPTR,5,"I")
 Q:RECOPENYN=0
 S OLDPTR=$P($G(APPTDAT(409.84,APPTIENS,.22,"I")),";")
 S SD409841COM=$G(^SDEC(409.84,APPTIEN,1,1,0))
 S LENGTH=$L(SD409841COM,$C(13,10))
 I LENGTH>1 D
 .F I=1:1:LENGTH S $P(COMMENT," | ",I)=$P(SD409841COM,$C(13,10),I) I I=LENGTH S:$L(COMMENT)>80 COMMENT=$E(COMMENT,1,77)_"..." S SD409841COM=COMMENT
 S RESOURCE=$G(APPTDAT(409.84,APPTIENS,.07,"I"))
 S CLINIC=$$GET1^DIQ(409.831,RESOURCE,.04,"I")
 S DFN40984=$G(APPTDAT(409.84,APPTIENS,.05,"I"))
 S REQUEST("DFN")=DFN40984
 S REQUEST("CREATE DATE")=$P($$NOW^XLFDT,".",1)
 S INSTIEN=$$GET1^DIQ(44,CLINIC,3,"I")
 S REQUEST("REQUEST SUB TYPE")="APPT"
 S REQUEST("APPOINTMENT TYPE IEN")=$G(APPTDAT(409.84,APPTIENS,.06,"I"))
 S REQUEST("APPOINTMENT TYPE")=$G(APPTDAT(409.84,APPTIENS,.06,"I"))
 S REQUEST("PATIENT STATUS")=$G(APPTDAT(409.84,APPTIENS,.23,"I"))
 S REQUEST("CLINIC IEN")=CLINIC
 S REQUEST("PRIORITY")="F"
 S REQUEST("REQUESTED BY")=1
 S REQUEST("PROVIDER IEN")=$G(APPTDAT(409.84,APPTIENS,.16,"I"))
 I $G(NEWPID)="" D
 .S REQUEST("PATIENT INDICATED DATE")=$G(APPTDAT(409.84,APPTIENS,.2,"I"))
 I $G(NEWPID)'="" D
 .S REQUEST("PATIENT INDICATED DATE")=NEWPID
 S REQUEST("REQUEST COMMENT")=SD409841COM
 S CANCHANGEPID=$S($G(SDECTYP)="PC":1,$G(SDECTYP)="C":0,$G(NOSHOWFLAG)=1:1,1:"")
 S REQUEST("PID CHANGE ALLOWED")=CANCHANGEPID
 S REQIEN=$$BUILDER^SDES2CRTAPREQ(.REQUEST,INSTIEN,$S($G(USERID):USERID,1:DUZ))
 S REQLINK=REQIEN_";SDEC(409.85,"
 D APPREQLINK(APPTIEN,REQIEN,REQLINK)
 S RETURN=$G(REQIEN)_U_$G(REQLINK)_U_$G(OLDPTR)
 Q
 ; update PID history
 N FDA
 S FDA(409.84,APPTIEN_",",.22)=REQLINK
 D FILE^DIE(,"FDA") K FDA
 Q
WPSTR(ARR)  ;convert WP field array to single string   ;alb/sat 658
 N RET,WPI
 S RET=""
 Q:'$D(ARR) RET
 S WPI=0 F  S WPI=$O(ARR(WPI)) Q:WPI=""  D
 .S RET=RET_ARR(WPI)
 Q RET