
<cfparam name="url.patient_id" default="0">
<cfparam name="url.assessment_id" default="0">

<cfparam name="url.type" default="diagnosis">


<cfif url.type neq ''>
	<cfif url.type eq 'diagnosis'>
		<cfset dig_type = 'diagnosis'>	
	<cfelseif url.type eq 'procedure'>
		<cfset dig_type = 'procedure'>		
	<cfelseif url.type eq 'diet'>
		<cfset dig_type = 'diet'>	
	<cfelseif url.type eq 'safe_mes'>
		<cfset dig_type = 'safety measure'>	
	<cfelseif url.type eq 'act_permit'>
		<cfset dig_type = 'activity permitted'>	
	<cfelseif url.type eq 'func_limt'>
		<cfset dig_type = 'functional limitation'>	
	<cfelseif url.type eq 'dme_sup'>
		<cfset dig_type = 'DME/supplies'>	
	<cfelse>
		<cfset dig_type = 'diagnosis'>		
	</cfif>		
</cfif>


<cfif url.patient_id  neq 0 and url.assessment_id  neq 0>
  <cfset Encrypted_patientID= #url.patient_id # />  
  <cfset url.patient_id= decrypt(#url.patient_id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") />
  <cfset Encrypted_assessmentID= #url.assessment_id # />  
  <cfset url.assessment_id= decrypt(#url.assessment_id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") />
  <cfset Encrypted_assessmentTracker_id= #url.assessmentTracker_id # />  
  <cfset url.assessmentTracker_id= decrypt(#url.assessmentTracker_id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") />  
  
<cfelse>
	<cfset Encrypted_patientID="0" />
	<cfset Encrypted_assessmentID="0" />
</cfif>




	<cfif isdefined('url.patient_id')>
		<cfoutput>			
			<cfscript>
                    diag = CreateObject("Component", "components.diagnosis");	
					TeachingDiagnoses_list = diag.Search_diagnosis(text="#url.text#");
                     
			</cfscript>	
		</cfoutput>
        <cfif CGI.REMOTE_ADDR EQ '157.51.236.232'><cfdump var ="#TeachingDiagnoses_list#"></cfif> 
     <h4 class="center hide"><b>Teaching Diagnoses:</b></h4>
        <div style="margin-bottom:10px;float:right;">
                        <img title="Close" 
			name="imgbtnSkinCloseVital" style="border:none;cursor:pointer;" id="imgbtnSkinCloseVital" onclick="$('#searchFormM0230').modal('hide');" src="../../images/icon_back.gif" width="33" height="35"/>
          </div>
        <br>
        <div class="portlet-body form">
	       <div >
				<div class="col-md-4">
                        <div class="form-group">
                            <div class="label-stable">
                                <label>Primary?</label>
                            </div>
                        </div>
					</div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <div class="radio-list">
                                <label style="display:unset;"><input type="radio" id="Primary_yes" name="Primary_chk"  value="1"> Yes</label>
                                <label style="display:unset;"><input type="radio" id="Primary_no" name="Primary_chk" checked value="0"> No</label>
                            </div>
                        </div>
                    </div>
                    
         </div>		
	    <table class="table table-bordered table-striped table-condensed flip-content">
	        <thead>
	            <tr>
	                <th style="text-align: center;">Diagnosis</th>
                    <th style="text-align: center;">ICD</th>
                    <th style="text-align: center;">PDGM</th>
                    <th style="text-align: center;">Comorbid</th>
	                <th class="text-center" style="width:10%;">Action</th>
	            </tr>
	        </thead>
	        <tbody>
		        <cfif isdefined('TeachingDiagnoses_list.recordcount') and  TeachingDiagnoses_list.RecordCount GT 0>
		            <cfoutput query="TeachingDiagnoses_list">
		                <tr>
		                    <td style="font-size: 13px;">#TeachingDiagnoses_list.Diagnosis#</td>
                            <td style="font-size: 13px;">#TeachingDiagnoses_list.ICD#</td>
                             <td style="font-size: 13px;">#TeachingDiagnoses_list.PDGM#</td>
                             <td style="font-size: 13px;">#TeachingDiagnoses_list.Comorbid#</td>
		                    <td class="text-center">
									<cfset Encrypted_Dx_list_ICD10_ID=encrypt(#TeachingDiagnoses_list.id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") /> 
		                            <input class="btn blue btn-sm" name="Select" type="button" value="select"  onClick="return Diagnosis_update('#Encrypted_patientID#','#Encrypted_assessmentID#','#Encrypted_Dx_list_ICD10_ID#','#Encrypted_assessmentTracker_id#','#TeachingDiagnoses_list.ICD#','#PDGM#','#Comorbid#');" />
		                    </td>
		                </tr>
		            </cfoutput>
		        <cfelse>
						<tr>
							<td align="center" valign="middle" colspan="5" height="50px">
								No Result Found
							</td>
						</tr>
		        </cfif>
	        </tbody>
	    </table>
        </div>
	</cfif>

        <script type="application/javascript" src="https://code.jquery.com/jquery-1.3.2.min.js"></script>
          <script type="text/javascript">
        $(document).ready(function() {
            $('#Primary_yes').change(function() {
                $('td:nth-child(4)').hide();
                $('th:nth-child(4)').hide();
                $('td:nth-child(3)').show();
                $('th:nth-child(3)').show();
               
                // if your table has header(th), use this
                //$('td:nth-child(2),th:nth-child(2)').hide();
            });
              $('#Primary_no').change(function() {
               
                   $('td:nth-child(3)').hide();
                $('th:nth-child(3)').hide();
                $('td:nth-child(4)').show();
                $('th:nth-child(4)').show();
                // if your table has header(th), use this
                //$('td:nth-child(2),th:nth-child(2)').hide();
            });
        });
    </script>
	

<cfinclude template="teaching_plan_script.cfm" />

	

	

	