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

ONCGENED.m

Go to the documentation of this file.
ONCGENED ;Hines OIFO/GWB - EDITS API ;10/19/11
 ;;2.2;ONCOLOGY;**1,4,6,10**;Jul 31, 2013;Build 20
 ;P10 V18 NAACCR
NAACCR D CLEAR^ONCSAPIE(1)
 K ^TMP("ONC",$J)
 K ^TMP("ONC1",$J)
 N BLANK,DEVICE,DXH,EXT,IINPNT,MSGLST,NINE,OIEN,ONCEDLST,OSP
 N PAGE,PAGEX,STAT1,ZERO,ZNINE
 S ABSTAT=$$GET1^DIQ(165.5,D0,91,"I")
 S:(ABSTAT=3)&($$GET1^DIQ(165.5,D0,282,"I")="N") $P(^ONCO(165.5,D0,"EDITS"),U,3)="U"
 S:($$GET1^DIQ(165.5,D0,282,"I")="") $P(^ONCO(165.5,D0,"EDITS"),U,3)="N"
 S BLANK=" "
 S ZERO=0
 S NINE=9
 S ZNINE="09"
 S EXTRACT=$O(^ONCO(160.16,"B","VACCR EXTRACT V18.0",0))
 S EXT="VACCR"
 S EXTVER=$G(^ONCO(160.16,EXTRACT,"FIELD",5,4))
 S DEVICE=0,OIEN=0,PAGE=1,OUT=0
 S OSP=$O(^ONCO(160.1,"C",DUZ(2),0))
 I OSP="" S OSP=$O(^ONCO(160.1,0))
 S IINPNT=$P($G(^ONCO(160.1,OSP,1)),U,4)
 S DXH=$$GET1^DIQ(160.19,IINPNT,.01,"I")
 S STAT1=DXH
 S PAGE=1
 S IEN=D0
 S ONCDST=$NA(^TMP("ONC",$J))
 S MSGLST=$NA(^TMP("ONC1",$J))
 ;
 S RC=$$RBQPREP^ONCSED01(.ONCSAPI,.ONCDST)
 ;S RC=$$RBQPREP^ONCSED01(.ONCSAPI,.ONCDST,"DEBUG")
 ;S ERRFLG=RC
 I RC<0 D PRTERRS^ONCSAPIE() Q
 ;
 N D0
 D OUTPUT(IEN,EXTRACT,.OUT)
 I $G(EDITS)="NO" D END^ONCSNACR(.ONCDST) Q
 ;
EDITS S RC=$$RBQEXEC^ONCSED01(.ONCSAPI,.ONCDST,MSGLST)
 S ERRFLG=RC
 I RC<0 D PRTERRS^ONCSAPIE()
 I RC>0 D  Q:RC<0
 . N %ZIS,IOP,POP
 . S %ZIS("B")="HOME"
 . D ^%ZIS  Q:$G(POP)  U IO
 . S RC=$$REPORT^ONCSED01(.ONCSAPI,MSGLST,"MT")
 . D ^%ZISC
 Q
 ;
OUTPUT(IEN,EXTRACT,OUT) ;
 N POS
 S ACD160=$P(^ONCO(165.5,IEN,0),U,2)
 S POS=0
 F  S POS=$O(^ONCO(160.16,EXTRACT,"FIELD","B",POS)) Q:POS<1  D  Q:OUT
 .N NODE
 .S NODE=0
 .F  S NODE=$O(^ONCO(160.16,EXTRACT,"FIELD","B",POS,NODE)) Q:NODE<1  D  Q:OUT
 ..N STRING,DEFAULT,FILL,LEN
 ..Q:$G(^ONCO(160.16,EXTRACT,"FIELD",NODE,0))=""
 ..S STRING=$TR(^ONCO(160.16,EXTRACT,"FIELD",NODE,1),"~","^")
 ..S DEFAULT=^ONCO(160.16,EXTRACT,"FIELD",NODE,2)
 ..S FILL=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,3),U,1)
 ..S LEN=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,0),U,2)
 ..D DATA(IEN,ACD160,STRING,DEFAULT,FILL,LEN,NODE,POS)
 Q
 ;
DATA(IEN,ACD160,STRING,DEFAULT,FILL,LEN,NODE,POS) ;Data print
 N ACDANS
 S:'$D(ONCPHI) ONCPHI=0   ;P2.2*4
 X STRING
 I ACDANS="" D  Q
 .N X,I
 .S X=""
 .I DEFAULT=8 D  Q
 ..F I=1:1:LEN D WRITE^ONCSNACR(.ONCDST,DEFAULT)
 .I @DEFAULT="09" D WRITE^ONCSNACR(.ONCDST,@DEFAULT) Q
 .F I=1:1:LEN D WRITE^ONCSNACR(.ONCDST,@DEFAULT)
 I $L(ACDANS)=LEN D WRITE^ONCSNACR(.ONCDST,ACDANS) Q
 I $L(ACDANS)>LEN D WRITE^ONCSNACR(.ONCDST,$E(ACDANS,1,LEN)) Q
 E  D  Q
 .N JUST,STUFF,I,REM,CAL
 .S JUST=$P(FILL,","),STUFF=$P(FILL,",",2)
 .S REM=LEN-$L(ACDANS)
 .I JUST="R" D WRITE^ONCSNACR(.ONCDST,ACDANS)
 .F I=1:1:REM D WRITE^ONCSNACR(.ONCDST,@STUFF)
 .I JUST="L" D WRITE^ONCSNACR(.ONCDST,ACDANS)
 Q
 ;
CHKSUM ;Compute checksum
 N CHECKSUM
 Q:'$D(ONCDST)
 Q:$P($G(^ONCO(165.5,D0,7)),U,2)'=3
 W !," Computing checksum value for this abstract..."
 S CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
 S $P(^ONCO(165.5,D0,"EDITS"),U,1)=CHECKSUM
 S $P(^ONCO(165.5,D0,"EDITS"),U,2)=EXTVER
 Q
 ;
CHANGE ;Check for change to ONCOLOGY PRIMARY (165.5) record
 ;first check if there are missing required fields.
 ;if there are and DTDX>3031231, set abstract status to incomplete - P54
 N ONCFILE,DTDX,PRM
 S ONCFILE=165.5,PRM=ONCOD0P
 S DTDX=$P(^ONCO(165.5,PRM,0),U,16)
 D F1655^ONCOEDC1
 I $D(LIST),(DTDX>3031231),ABSTAT=3 D  Q
 .S ONCTYP="A" D PRINT^ONCOEDC
 .S DIE="^ONCO(165.5,"
 .S DA=ONCOD0P
 .S DR="91///^S X=0" D ^DIE
 .W !!,"ABSTRACT STATUS changed to 0 (Incomplete).",!
 .K DIR S DIR(0)="E" D ^DIR
 ;
 N ERRFLG
 S EDITS="NO" D NAACCR K EDITS
 S:'$D(CHECKSUM) CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
 Q:$P($G(^ONCO(165.5,ONCOD0P,"EDITS")),U,1)=""
 I (ABSTAT=3),(CHECKSUM'=$P($G(^ONCO(165.5,ONCOD0P,"EDITS")),U,1)) D
 .W !
 .W !," You have made a change to a 'Complete' abstract."
 .W !," This abstract needs to be re-run through the EDITS API."
 .W !!," Calling EDITS API..."
 .S $P(^ONCO(165.5,ONCOD0P,"EDITS"),U,3)="U"
 .S DIE="^ONCO(165.5,"
 .S DA=ONCOD0P
 .S DR="198///^S X=DT"
 .D ^DIE
 .D ^ONCGENED
 .I ERRFLG'=0 D  Q
 ..W !!," EDITS errors were encountered."
 ..W !!," The ABSTRACT STATUS has been changed to 0 (Incomplete)."
 ..S DIE="^ONCO(165.5,"
 ..S DA=ONCOD0P
 ..S DR="91///0;197///@;199////^S X=DUZ"
 ..D ^DIE
 ..W !
 ..Q:$G(EAFLAG)="YES"
 ..K DIR S DIR(0)="YA"
 ..S DIR("A")=" Do you wish to return to the Primary Menu Options? "
 ..S DIR("B")="Yes" D ^DIR K DIR
 ..I Y=1 S Y="@0"
 .W !!," No EDITS errors or warnings.  ABSTRACT STATUS = 3 (Complete)."
 .S CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
 .S DIE="^ONCO(165.5,"
 .S DA=ONCOD0P
 .S DR="197///^S X=CHECKSUM;197.1///^S X=EXTVER;199////^S X=DUZ"
 .D ^DIE
 .;S EDITS="NO" D NAACCR K EDITS
 .;S CHECKSUM=$$CRC32^ONCSNACR(.ONCDST)
 .;S $P(^ONCO(165.5,D0,"EDITS"),U,1)=CHECKSUM
 .;S $P(^ONCO(165.5,D0,"EDITS"),U,2)=EXTVER
 .W !
 .K DIR S DIR(0)="E" D ^DIR
 K DA,DIE,DR,RC
 Q
 ;
CLEANUP ;Cleanup
 K EAFLAG,EXTVER,ONCDST,ONCOD0P,ONCSAPI,Y