 ; ACSPNT3.m --> PROCESS RECEIVED HL7 MESSAGE (ADT-A31) FROM ACS COMPUMD.
 ; ...continued from ACSPNT.m to process health record number
 ;
 ; DBS CALLS:
 ; D UPDATE^DIE ADDS NEW RECORDS
 ;
 ; GLOBAL/LOCAL VARIABLES:
 ; FAC          USER'S INSTITUTION(FACILITY)
 ; PFIEN        INTERNAL ENTRY NUMBER IN PATIENT FILE - FROM ACSPNT
 ; APN          ACS PATIENT NUMBER - FROM ACSPNT
 ; HRNROOT      ROOT FOR HRN FILE
 ; HRNSROOT     ROOT FOR HRN SUBFILE
 ; HRNIEN       INTERNAL ENTRY NUMBER FOR HRN FILE
 ; HRNSIEN      INTERNAL ENTRY NUMBER FOR HUN SUBFILE
 ; HRNERR       ERR FOR UPDATE HRN FILE
 ; HRNSERR      ERR FOR UPDATE HRN SUBFILE
 ; DATE         DATE IN INTERNAL FILEMAN FORMAT
 ; ^CHECK       TEMP STORAGE FOR ERR MESSAGES
 ;
 ; COMMENTS:
 ; ;)           TEMPORARY COMMENT/LINE OF CODE
 ;
 ; FILEMAN FILES:
 ; ^AUPNPAT     IHS PATIENT (#9000001)  9000001.41 - HRN SUBFILE
 ;
 ; last update 5.31.2007 0800
 ;
EN  ;entry point, init
 N FAC,HRNROOT,HRNSROOT,HRNIEN,HRNSIEN,HRNERR,HRNSERR
 N PFIEN,APN,DATE
 S PFIEN=FDAIEN(1)
 S APN=PIDSEG("NO")
 S FAC=DUZ(2)
 D DT^DILF(,"NOW",.DATE)
UPDATE ;
 S HRNROOT(9000001,"?+1,",.01)=PFIEN
 S HRNROOT(9000001,"?+1,",.02)=DATE
 S HRNROOT(9000001,"?+1,",.03)=DATE
 S HRNROOT(9000001,"?+1,",.11)=DUZ  ;"establishing user"
 S HRNROOT(9000001,"?+1,",.12)=DUZ  ;"USER LAST UPDATE"
 S HRNROOT(9000001,"?+1,",.16)=DATE
 D UPDATE^DIE("S","HRNROOT","HRNIEN","HRNERR")
 M ^CHECK("HRNERR")=HRNERR ;)
 S HRNSIEN(1)=FAC
 S HRNSIEN="?+1,"_HRNIEN(1)_","
 S HRNSROOT(9000001.41,HRNSIEN,.01)=FAC
 S HRNSROOT(9000001.41,HRNSIEN,.02)=APN
 D UPDATE^DIE(,"HRNSROOT","HRNSIEN","HRNSERR")
 M ^CHECK("HRNSERR")=HRNSERR ;)
REXIT   ;EXIT
 K FAC,HRNROOT,HRNSROOT,HRNIEN,HRNSIEN,HRNERR,HRNSERR
 K PFIEN,APN,DATE
 Q