2 /*------begin------ This protection code was suggested by Luki R. luki@karet.org ---- */
3 if (eregi('inc_drg_entry_save.php',$PHP_SELF))
4 die('<meta http-equiv="refresh" content="0; url=../">');
7 require_once($root_path.'include/care_api_classes/class_drg.php');
10 if(is_object($DRG_obj)) unset($DRG_obj);
15 if(!isset($group_nr)) $group_nr=0;
16 if(!isset($opnr)) $opnr=0;
18 # Bug patch 2003-06-19
19 $DRG_obj=new DRG($pn); // Create a drg object
21 # Prepare the common data
22 $data['encounter_nr']=$pn;
23 $data['date']=date('Y-m-d H:i:s');
25 $data['group_nr']=$group_nr;
26 $data['category_nr']=99; // This is a dummy entry to force the new entries to appear below the current entries in the table
27 $data['history']="Create ".date('Y-m-d H:i:s')." ".$HTTP_SESSION_VARS['sess_user_name']."\n";
28 $data['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
29 $data['create_id']=$HTTP_SESSION_VARS['sess_user_name'];
30 $data['create_time']=date('YmdHis');
36 $data['code_version']=$DRG_obj->ICDVersion();
37 $data['diagnosing_clinician']=$HTTP_SESSION_VARS['sess_user_name'];
38 $data['diagnosing_dept_nr']=$dept_nr;
39 $DRG_obj->useDiagnosis();
40 $qlist_type='diagnosis';
45 $data['code_version']=$DRG_obj->OPSVersion();
46 $data['responsible_clinician']=$HTTP_SESSION_VARS['sess_user_name'];
47 $data['responsible_dept_nr']=$dept_nr;
48 $DRG_obj->useProcedure();
49 $qlist_type='procedure';
52 case 'ops_intern_code':
54 $DRG_obj->useInternalDRG();
55 $qlist_type='drg_intern';
56 if(isset($current)&&$current){
57 if(!$DRG_obj->EncounterDRGGroupExists($sel)){
58 $data['group_nr']=$sel;
59 # pass the variable as reference
60 $DRG_obj->setDataArray($data);
62 $DRG_obj->insertDataFromInternalArray();
63 # Set all non-grouped diagnoses and procedures to this group number
64 $DRG_obj->groupNonGroupedItems($sel);
75 for($i=0;$i<$lastindex;$i++
){
76 $selx="$itemselector$i";
77 $hidx="$hidselector$i";
78 if($
$selx=='') continue;
79 if($element=='ops_intern_code'){
80 if($DRG_obj->EncounterDRGGroupExists($
$selx)) continue;
81 else $data['group_nr']=$
$selx;
84 $data['code_parent']=$
$hidx;
86 # pass the variable as reference
87 $DRG_obj->setDataArray($data);
89 $DRG_obj->insertDataFromInternalArray();
90 //echo $DRG_obj->getLastQuery()."<p>";
92 $data['qlist_type']=$qlist_type;
93 $data['code_type']=$qlist_type;
94 $data['dept_nr']=$dept_nr;
96 # Update quick list table
97 $DRG_obj->addQuickCode($data);
98 //echo $DRG_obj->getLastQuery()."<br>";
99 # Update related code table
100 $DRG_obj->addDRGRelatedCode($data);
101 //echo $DRG_obj->getLastQuery()."<br>";
106 $buf="location:$thisfile?sid=$sid&lang=$lang&saveok=$saveok&pn=$pn&opnr=$opnr&group_nr=$group_nr&edit=$edit&ln=$ln&fn=$fn&bd=$bd&dept_nr=$dept_nr&oprm=$oprm&y=$y&m=$m&d=$d&display=$display&target=$target";