HMPPTDEM ;ASMR/EJK,JD - File Patient Demographic Information passed via RPC ; 09/16/2014
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Oct 10, 2014;Build 63
;Per VA Directive 6402, this routine should not be modified.
;
; RPC = HMP WRITEBACK PT DEM
;
; *** NOTES ***
; Return variable must be an ARRAY
; A success MUST be sent as a 1
; A failure may take any form
; *************
;
Q ;Must come in at a tag.
;
FILE(RSP,HMPDEM) ;File Patient Demographic information.
;Inbound data layout:
; "^" delimited
; Piece 1: DFN
; Piece 2: Home Phone Number - ^DD(2,.131 - ^DPT(DFN,.13) piece 1
; Piece 3: Cell Phone Number - ^DD(2,.134 - ^DPT(DFN,.13) piece 4
; Piece 4: Work Phone Number - ^DD(2,.132 - ^DPT(DFN,.13) piece 2
; Piece 5: Emergency Phone Number - ^DD(2,.339 - ^DPT(DFN,.33) piece 9
; Piece 6: NOK Phone Number - ^DD(2,.219 - ^DPT(DFN,.21) piece 9
;
; If a piece contains -1, it means DELETE it
; If a piece is null, it means LEAVE it ALONE
; If a piece is not -1 and not null, it means UPDATE it
;
;D BEFORE ; testing ONLY
D PROC
;D AFTER ; testing ONLY
Q
;
PROC ;
N HMPDFN,HMPHPN,HMPCPN,HMPWPN,HMPEPN,HMPNPN,RSPCNT
N HMPER,HMPX
K HMPX
S RSPCNT=0,HMPER=""
S HMPDFN=$P(HMPDEM,"^",1)
S HMPHPN=$P(HMPDEM,"^",2)
S HMPCPN=$P(HMPDEM,"^",3)
S HMPWPN=$P(HMPDEM,"^",4)
S HMPEPN=$P(HMPDEM,"^",5)
S HMPNPN=$P(HMPDEM,"^",6)
S DA=HMPDFN
K RSP
S RSP(0)=1 ;"Writeback was successful" ; default to good news!
I HMPDFN']"" S RSP(0)="No DFN" Q
I '$D(^DPT(HMPDFN)) S RSP(0)="Patient does not exist. DFN: "_HMPDFN Q ;ICR 10035 DE2818 ASF 11/12/15
I $$GET1^DIQ(2,HMPDFN_",",.331)']"",HMPEPN]"" S RSP(0)="Setting EM CO PH w/o EM CO Name" Q
I $$GET1^DIQ(2,HMPDFN_",",.211)']"",HMPNPN]"" S RSP(0)="Setting NOK PH w/o NOK Name" Q
S HMPX(2,DA_",",.131)=$S(HMPHPN=-1:"",HMPHPN="":$$GET1^DIQ(2,HMPDFN_",",.131),1:HMPHPN)
S HMPX(2,DA_",",.132)=$S(HMPWPN=-1:"",HMPWPN="":$$GET1^DIQ(2,HMPDFN_",",.132),1:HMPWPN)
S HMPX(2,DA_",",.134)=$S(HMPCPN=-1:"",HMPCPN="":$$GET1^DIQ(2,HMPDFN_",",.134),1:HMPCPN)
S HMPX(2,DA_",",.219)=$S(HMPNPN=-1:"",HMPNPN="":$$GET1^DIQ(2,HMPDFN_",",.219),1:HMPNPN)
S HMPX(2,DA_",",.339)=$S(HMPEPN=-1:"",HMPEPN="":$$GET1^DIQ(2,HMPDFN_",",.339),1:HMPEPN)
D UPDATE^DIE(,"HMPX",,"HMPER")
I HMPER]"" S RSP(0)=HMPER
Q
BEFORE ;
S DFN=$P(HMPDEM,"^",1)
K HPN,CPN,WPN,EPN,NPN,PTNAME
S (HPN,CPN,WPN,EPN,NPN)=""
S PTNAME=$$GET1^DIQ(2,DFN_",",.01,"E")
S HPN=$$GET1^DIQ(2,DFN_",",.131,"E")
S CPN=$$GET1^DIQ(2,DFN_",",.134,"E")
S WPN=$$GET1^DIQ(2,DFN_",",.132,"E")
S EPN=$$GET1^DIQ(2,DFN_",",.339,"E")
S NPN=$$GET1^DIQ(2,DFN_",",.219,"E")
U 0 W "Patient: "_PTNAME,!
U 0 W "Before executing input string:",!
U 0 W ?5,"Home Phone: "_HPN,!
U 0 W ?5,"Cell Phone: "_CPN,!
U 0 W ?5,"Work Phone: "_WPN,!
U 0 W ?5,"Emergency Phone: "_EPN,!
U 0 W ?5,"NOK Phone: "_NPN,!!
Q
AFTER ;
S (HPN,CPN,WPN,EPN,NPN)=""
S PTNAME=$$GET1^DIQ(2,DFN_",",.01,"E")
S HPN=$$GET1^DIQ(2,DFN_",",.131,"E")
S CPN=$$GET1^DIQ(2,DFN_",",.134,"E")
S WPN=$$GET1^DIQ(2,DFN_",",.132,"E")
S EPN=$$GET1^DIQ(2,DFN_",",.339,"E")
S NPN=$$GET1^DIQ(2,DFN_",",.219,"E")
U 0 W "After executing input string:",!
U 0 W "Patient: "_PTNAME,!
U 0 W ?5,"Home Phone: "_HPN,!
U 0 W ?5,"Cell Phone: "_CPN,!
U 0 W ?5,"Work Phone: "_WPN,!
U 0 W ?5,"Emergency Phone: "_EPN,!
U 0 W ?5,"NOK Phone: "_NPN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPPTDEM 3417 printed Nov 22, 2024@17:04:40 Page 2
HMPPTDEM ;ASMR/EJK,JD - File Patient Demographic Information passed via RPC ; 09/16/2014
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Oct 10, 2014;Build 63
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; RPC = HMP WRITEBACK PT DEM
+5 ;
+6 ; *** NOTES ***
+7 ; Return variable must be an ARRAY
+8 ; A success MUST be sent as a 1
+9 ; A failure may take any form
+10 ; *************
+11 ;
+12 ;Must come in at a tag.
QUIT
+13 ;
FILE(RSP,HMPDEM) ;File Patient Demographic information.
+1 ;Inbound data layout:
+2 ; "^" delimited
+3 ; Piece 1: DFN
+4 ; Piece 2: Home Phone Number - ^DD(2,.131 - ^DPT(DFN,.13) piece 1
+5 ; Piece 3: Cell Phone Number - ^DD(2,.134 - ^DPT(DFN,.13) piece 4
+6 ; Piece 4: Work Phone Number - ^DD(2,.132 - ^DPT(DFN,.13) piece 2
+7 ; Piece 5: Emergency Phone Number - ^DD(2,.339 - ^DPT(DFN,.33) piece 9
+8 ; Piece 6: NOK Phone Number - ^DD(2,.219 - ^DPT(DFN,.21) piece 9
+9 ;
+10 ; If a piece contains -1, it means DELETE it
+11 ; If a piece is null, it means LEAVE it ALONE
+12 ; If a piece is not -1 and not null, it means UPDATE it
+13 ;
+14 ;D BEFORE ; testing ONLY
+15 DO PROC
+16 ;D AFTER ; testing ONLY
+17 QUIT
+18 ;
PROC ;
+1 NEW HMPDFN,HMPHPN,HMPCPN,HMPWPN,HMPEPN,HMPNPN,RSPCNT
+2 NEW HMPER,HMPX
+3 KILL HMPX
+4 SET RSPCNT=0
SET HMPER=""
+5 SET HMPDFN=$PIECE(HMPDEM,"^",1)
+6 SET HMPHPN=$PIECE(HMPDEM,"^",2)
+7 SET HMPCPN=$PIECE(HMPDEM,"^",3)
+8 SET HMPWPN=$PIECE(HMPDEM,"^",4)
+9 SET HMPEPN=$PIECE(HMPDEM,"^",5)
+10 SET HMPNPN=$PIECE(HMPDEM,"^",6)
+11 SET DA=HMPDFN
+12 KILL RSP
+13 ;"Writeback was successful" ; default to good news!
SET RSP(0)=1
+14 IF HMPDFN']""
SET RSP(0)="No DFN"
QUIT
+15 ;ICR 10035 DE2818 ASF 11/12/15
IF '$DATA(^DPT(HMPDFN))
SET RSP(0)="Patient does not exist. DFN: "_HMPDFN
QUIT
+16 IF $$GET1^DIQ(2,HMPDFN_",",.331)']""
IF HMPEPN]""
SET RSP(0)="Setting EM CO PH w/o EM CO Name"
QUIT
+17 IF $$GET1^DIQ(2,HMPDFN_",",.211)']""
IF HMPNPN]""
SET RSP(0)="Setting NOK PH w/o NOK Name"
QUIT
+18 SET HMPX(2,DA_",",.131)=$SELECT(HMPHPN=-1:"",HMPHPN="":$$GET1^DIQ(2,HMPDFN_",",.131),1:HMPHPN)
+19 SET HMPX(2,DA_",",.132)=$SELECT(HMPWPN=-1:"",HMPWPN="":$$GET1^DIQ(2,HMPDFN_",",.132),1:HMPWPN)
+20 SET HMPX(2,DA_",",.134)=$SELECT(HMPCPN=-1:"",HMPCPN="":$$GET1^DIQ(2,HMPDFN_",",.134),1:HMPCPN)
+21 SET HMPX(2,DA_",",.219)=$SELECT(HMPNPN=-1:"",HMPNPN="":$$GET1^DIQ(2,HMPDFN_",",.219),1:HMPNPN)
+22 SET HMPX(2,DA_",",.339)=$SELECT(HMPEPN=-1:"",HMPEPN="":$$GET1^DIQ(2,HMPDFN_",",.339),1:HMPEPN)
+23 DO UPDATE^DIE(,"HMPX",,"HMPER")
+24 IF HMPER]""
SET RSP(0)=HMPER
+25 QUIT
BEFORE ;
+1 SET DFN=$PIECE(HMPDEM,"^",1)
+2 KILL HPN,CPN,WPN,EPN,NPN,PTNAME
+3 SET (HPN,CPN,WPN,EPN,NPN)=""
+4 SET PTNAME=$$GET1^DIQ(2,DFN_",",.01,"E")
+5 SET HPN=$$GET1^DIQ(2,DFN_",",.131,"E")
+6 SET CPN=$$GET1^DIQ(2,DFN_",",.134,"E")
+7 SET WPN=$$GET1^DIQ(2,DFN_",",.132,"E")
+8 SET EPN=$$GET1^DIQ(2,DFN_",",.339,"E")
+9 SET NPN=$$GET1^DIQ(2,DFN_",",.219,"E")
+10 USE 0
WRITE "Patient: "_PTNAME,!
+11 USE 0
WRITE "Before executing input string:",!
+12 USE 0
WRITE ?5,"Home Phone: "_HPN,!
+13 USE 0
WRITE ?5,"Cell Phone: "_CPN,!
+14 USE 0
WRITE ?5,"Work Phone: "_WPN,!
+15 USE 0
WRITE ?5,"Emergency Phone: "_EPN,!
+16 USE 0
WRITE ?5,"NOK Phone: "_NPN,!!
+17 QUIT
AFTER ;
+1 SET (HPN,CPN,WPN,EPN,NPN)=""
+2 SET PTNAME=$$GET1^DIQ(2,DFN_",",.01,"E")
+3 SET HPN=$$GET1^DIQ(2,DFN_",",.131,"E")
+4 SET CPN=$$GET1^DIQ(2,DFN_",",.134,"E")
+5 SET WPN=$$GET1^DIQ(2,DFN_",",.132,"E")
+6 SET EPN=$$GET1^DIQ(2,DFN_",",.339,"E")
+7 SET NPN=$$GET1^DIQ(2,DFN_",",.219,"E")
+8 USE 0
WRITE "After executing input string:",!
+9 USE 0
WRITE "Patient: "_PTNAME,!
+10 USE 0
WRITE ?5,"Home Phone: "_HPN,!
+11 USE 0
WRITE ?5,"Cell Phone: "_CPN,!
+12 USE 0
WRITE ?5,"Work Phone: "_WPN,!
+13 USE 0
WRITE ?5,"Emergency Phone: "_EPN,!
+14 USE 0
WRITE ?5,"NOK Phone: "_NPN
+15 QUIT