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

ONC2PS17.m

Go to the documentation of this file.
ONC2PS17 ;HINES OIFO/RTK - Post-Install Routine for Patch ONC*2.2*17 ;02/14/23
 ;;2.2;ONCOLOGY;**17**;Jul 31, 2013;Build 6
 ;
 D CONV3884
 D REMV3884
 D SETTUSS
 D SGAJ385
 N RC
 ;DC production server Patch 17
 S RC=$$UPDCSURL^ONCSAPIU("http://127.0.0.1:83/cgi_bin/oncsrv.exe")
 ;DC PRODUCTION SERVER V21
 ;S RC=$$UPDCSURL^ONCSAPIU("http://127.0.0.1:86/cgi_bin/oncsrv.exe")
 ;test server uRL V21
 ;S RC=$$UPDCSURL^ONCSAPIU("http://127.0.0.1:81/cgi_bin/oncsrv.exe")
 Q
 ;
CONV3884 ;Convert value of field 3884 to 3 new fields 3957,3958,3959
 ;Originally planned for p15 moved to p17
 D MES^XPDUTL("Convert value of field #3884 in file #165.5...")
 N ONC38COD,ONC3800,ONC3884,ONC3957,ONC3958,ONC3959
 S ONCDXVP=3171231 F  S ONCDXVP=$O(^ONCO(165.5,"ADX",ONCDXVP)) Q:ONCDXVP'>0  D
 .S IEN=0 F  S IEN=$O(^ONCO(165.5,"ADX",ONCDXVP,IEN)) Q:IEN'>0  D
 ..S ONC3884=$P($G(^ONCO(165.5,IEN,"SSD3")),"^",14) I ONC3884="" Q
 ..S ONC3800=$P($G(^ONCO(165.5,IEN,"SSD1")),"^",1) I ONC3800="" Q
 ..S ONC38COD=ONC3884-1 I (ONC38COD'>0)&(ONC38COD'<10) Q
 ..I (ONC38COD=0)!(ONC38COD=8)!(ONC38COD=9) D  Q
 ...I (ONC3800="09520")!(ONC3800="00520") D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",10)=ONC38COD
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",11)=ONC38COD
 ...I ONC3800="00510" D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",10)=ONC38COD
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",11)=ONC38COD
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",12)=ONC38COD
 ...I ONC3800="00500" D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",10)=ONC38COD
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",12)=ONC38COD
 ..I (ONC3800="00500")!(ONC3800="00510") D  Q
 ...I (ONC38COD=1)!(ONC38COD=4)!(ONC38COD=5)!(ONC38COD=7) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",12)=1
 ...I (ONC38COD=2)!(ONC38COD=3)!(ONC38COD=6) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",12)=0
 ..I (ONC3800="00510")!(ONC3800="00520")!(ONC3800="09520") D  Q
 ...I (ONC38COD=2)!(ONC38COD=4)!(ONC38COD=6)!(ONC38COD=7) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",11)=1
 ...I (ONC38COD=1)!(ONC38COD=3)!(ONC38COD=5) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",11)=0
 ..I (ONC3800="00500")!(ONC3800="00510")!(ONC3800="00520")!(ONC3800="09520") D  Q
 ...I (ONC38COD=3)!(ONC38COD=5)!(ONC38COD=6)!(ONC38COD=7) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",10)=1
 ...I (ONC38COD=1)!(ONC38COD=2)!(ONC38COD=4) D  Q
 ....S $P(^ONCO(165.5,IEN,"SSD5"),"^",10)=0
 K ONC38COD,ONC3800,ONC3884,ONC3957,ONC3958,ONC3959
 Q
 ;
REMV3884 ;Remove data in fields 3884, 3871 and 3872
 N ONCDXVP
 S ONCDXVP=3171231 F  S ONCDXVP=$O(^ONCO(165.5,"ADX",ONCDXVP)) Q:ONCDXVP'>0  D
 .S IEN=0 F  S IEN=$O(^ONCO(165.5,"ADX",ONCDXVP,IEN)) Q:IEN'>0  D
 ..I $P($G(^ONCO(165.5,IEN,"SSD3")),"^",14)'="" S $P(^ONCO(165.5,IEN,"SSD3"),"^",14)=""
 ..I $P($G(^ONCO(165.5,IEN,"SSD3")),"^",1)'="" S $P(^ONCO(165.5,IEN,"SSD3"),"^",1)=""
 ..I $P($G(^ONCO(165.5,IEN,"SSD3")),"^",2)'="" S $P(^ONCO(165.5,IEN,"SSD3"),"^",2)=""
 K ONCDXVP
 Q
 ;
SETTUSS ;Fill value of new Tobacco Usage Smoking Status (#165.5,#288) field
 D BMES^XPDUTL("Set value of field #288 in file #165.5...")
 N ONCDXVP,ONCPTIEN,IEN,MULT
 S ONCDXVP=3211231 F  S ONCDXVP=$O(^ONCO(165.5,"ADX",ONCDXVP)) Q:ONCDXVP'>0  D
 .S IEN=0 F  S IEN=$O(^ONCO(165.5,"ADX",ONCDXVP,IEN)) Q:IEN'>0  D
 ..S ONCPTIEN=$P($G(^ONCO(165.5,IEN,0)),"^",2)
 ..S ONCPTBHI=$P($G(^ONCO(160,ONCPTIEN,8)),"^",2)
 ..S ONCPTBUC=$P($G(^ONCO(160,ONCPTIEN,8)),"^",9)
 ..S ONCPTBOS=$P($G(^ONCO(160,ONCPTIEN,8)),"^",10)
 ..I $P($G(^ONCO(165.5,IEN,7)),"^",2)'=3 Q
 ..D CHKOTH I OLDDX=1 Q
 ..;
 ..I (ONCPTBHI=0)!(ONCPTBHI=3) S $P(^ONCO(165.5,IEN,25),"^",21)=0
 ..I (ONCPTBHI=1)!(ONCPTBHI=2)!(ONCPTBHI=4) S $P(^ONCO(165.5,IEN,25),"^",21)=1
 ..I ONCPTBHI=9 S $P(^ONCO(165.5,IEN,25),"^",21)=9
 ..I (ONCPTBHI=5)&((ONCPTBUC=2)!(ONCPTBOS=2)) S $P(^ONCO(165.5,IEN,25),"^",21)=3
 ..I (ONCPTBHI=5)&((ONCPTBUC=3)!(ONCPTBOS=3)) S $P(^ONCO(165.5,IEN,25),"^",21)=2
 ..I (ONCPTBHI=5)&((ONCPTBUC=4)!(ONCPTBOS=4)) S $P(^ONCO(165.5,IEN,25),"^",21)=2
 Q
 ;
CHKOTH ;Check if patient has other primaries, if any with Date DX < 2022 skip
 S OLDDX=0
 S MULT=0 F  S MULT=$O(^ONCO(165.5,"C",ONCPTIEN,MULT)) Q:MULT'>0  D
 .I $P($G(^ONCO(165.5,MULT,0)),"^",16)<3220000 S OLDDX=1 Q
 K MULT
 Q
 ;
SGAJ385 ;Execute trigger on STAGE GROUP (#38.5) for 2018+ cases
 D MES^XPDUTL("Checking STAGE GROUP (#38.5) field...")
 S ONCDXVP=3171231 F  S ONCDXVP=$O(^ONCO(165.5,"ADX",ONCDXVP)) Q:ONCDXVP'>0  D
 .S ONCIEN=0 F  S ONCIEN=$O(^ONCO(165.5,"ADX",ONCDXVP,ONCIEN)) Q:ONCIEN'>0  D
 ..;S STGRP=$P($G(^ONCO(165.5,ONCIEN,2)),"^",28) I STGRP'="" Q
 ..S CSTG=$P($G(^ONCO(165.5,ONCIEN,"AJCC8")),"^",5)
 ..S PSTG=$P($G(^ONCO(165.5,ONCIEN,"AJCC8")),"^",9)
 ..I CSTG="",PSTG="" Q
 ..I CSTG'="" S TMP=$G(DA) S DA=ONCIEN,X=CSTG D CSSG^ONCOCRC S DA=TMP Q
 ..I PSTG'="" S TMP=$G(DA) S DA=ONCIEN,X=PSTG D PSSG^ONCOCRC S DA=TMP Q
 ..Q
 .Q
 K ONCDXVP,ONCIEN,STGRP,CSTG,PSTG,TMP
 Q