<!---visitplan_print.cfm --->
<cfparam name="url.patient_id" default="0">
<cfparam name="url.assessment_id" default="0">
<cfparam name="url.redirect_from" default="">
<cfparam name="url.OASIS_D_PDGM_Visit" default="SN">
<cfparam name="url.download" default="no">
<cfparam name="url.visit" default="1">


<style>
    table.print-friendly tr td, table.print-friendly tr th {
        page-break-inside: avoid;
    }
</style>

<cfset TheFile="/var/www/datafiles/Agency_Logos/#session.AgencyID#.png">

<cfoutput> 
	    <cfset url.patient_id= decrypt(#url.patient_id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") />
		<cfset url.assessment_id= decrypt(#url.assessment_id#,"54kczhzgHTj4a8n+SRZPyg==","AES","Hex") />

		<cfquery name="UpdatepCareplan" datasource="#Application.DataSrc#">
			 UPDATE #Request.prefix_db_agency#.pCareplan SET Order_ID =  <cfqueryparam value = "99999" CFSQLType ="CF_SQL_INTEGER">
			 WHERE  Assmt_ID =  <cfqueryparam value="#url.assessment_id#"  cfsqltype="CF_SQL_INTEGER">
			 AND  Other = <cfqueryparam value = "1" CFSQLType ="CF_SQL_INTEGER">
			 AND status = <cfqueryparam value = "0" CFSQLType ="CF_SQL_INTEGER">
		 </cfquery>

		<cfquery name="GetPA" datasource="#Application.DataSrc#">
		    SELECT patient.Patient_ID, patient.Pt_Last AS Last_Name, patient.
		    Pt_First AS First_Name, patient.Pt_Middle AS Middle,
		    pAssessments.F26 as Assessment_Reason,pAssessments.F176 as Date_Completed,pAssessments.*
		    FROM  #Request.prefix_db_agency#.patient
		    JOIN #Request.prefix_db_agency#.pAssessments ON patient.Patient_ID = pAssessments.Patient_ID
		    WHERE patient.Patient_Id = <cfqueryparam value = "#url.patient_id#" CFSQLType ="CF_SQL_INTEGER">
		    AND pAssessments.Assmt_ID = <cfqueryparam value = "#url.assessment_id#" CFSQLType ="CF_SQL_INTEGER">
		    AND pAssessments.status = <cfqueryparam value = "0" CFSQLType ="CF_SQL_INTEGER">
		</cfquery>
		
		<cfscript>
		        careplandash = CreateObject("Component", "careplan");
		        pgnotes = CreateObject("Component", "progressnotes");
		        getpatientgoal = pgnotes.getprogressnotesprint(#url.assessment_id#,'patient_goal',#url.skilltype#,#url.visit#);
		        getgoal = careplandash.getscareplan(#url.assessment_id#,'goal',#url.skilltype#,0); 
		        getstandingorder = pgnotes.getprogressnotesprint(#url.assessment_id#,'standing_order',#url.skilltype#,#url.visit#);
		        getproblem = careplandash.getproblems(#url.assessment_id#,#url.skilltype#,0,0,'0');  
		        problemcount = getproblem.recordcount;
		        getsymptom = pgnotes.getprogressnotessymptoms(#url.assessment_id#,'symptom',#url.skilltype#,#url.visit#); 
		        getprocedure = pgnotes.getprogressnotesprint(#url.assessment_id#,'procedure',#url.skilltype#,#url.visit#); 
		        getallteaching = pgnotes.getprogressnotessymptoms(#url.assessment_id#,'teach',#url.skilltype#,#url.visit#); 
		        getallgoals = pgnotes.getprogressnotessymptoms(#url.assessment_id#,'goal',#url.skilltype#,#url.visit#);
			    pathwaydash = CreateObject("Component", "pathway");
                getpathway = pathwaydash.getspathway(0,'symptom',#url.assessment_id#); 
		</cfscript>
		<cfset url.AID = #url.assessment_id# />
		<cfset url.ID = #url.patient_id# />	
	</cfoutput>

	<cfquery name="getCW_Visit" datasource="#Application.DataSrc#">
		 SELECT * FROM #Request.prefix_db_lookup#.CW_Visit_Stagger_Detail 
		 WHERE problems =  <cfqueryparam value="#problemcount#"  cfsqltype="CF_SQL_INTEGER">
		 AND  total_visits = <cfqueryparam value = "#url.totalvisit#" CFSQLType ="CF_SQL_INTEGER">
		 AND  visit_no = <cfqueryparam value = "#url.visit#" CFSQLType ="CF_SQL_INTEGER">
	 </cfquery>

<style>
	hr {height:2px;border-width:0;color:gray;background-color:gray; }
</style>

<cfset thereason = GetPA.Assessment_Reason >
<cfif LEFT(thereason,1) eq '1'>
  <cfset thereason = 'Start of Care' />
  <cfelseif LEFT(thereason,1) eq '3'>
  <cfset thereason = 'Resumption of Care' />
  <cfelseif LEFT(thereason,1) eq '4'>
  <cfset thereason = 'Recertification' />
  <cfelseif LEFT(thereason,1) eq '5'>
  <cfset thereason = 'Other Follow Up' />
  <cfelseif LEFT(thereason,1) eq '6'>
  <cfset thereason = '6 - Transferred to Inpatient Facility' />
  <cfelseif LEFT(thereason,1) eq '7'>
  <cfset thereason = 'Transferred to Inpatient Facility' />
  <cfelseif LEFT(thereason,1) eq '8'>
  <cfset thereason = 'Death' />
  <cfelseif LEFT(thereason,1) eq '9'>
  <cfset thereason = 'Discharge' />
  <cfelseif thereason eq 'H - Hospice Comprehensive'>
  <cfset thereason = 'H - Hospice Comprehensive' />
  <cfelseif thereason eq 'SN Pediatric Evaluation'>
  <cfset thereason = 'SN Pediatric Evaluation' />
  <cfelseif thereason eq 'OT Pediatric Evaluation'>
  <cfset thereason = 'OT Pediatric Evaluation' />
  <cfelseif thereason eq 'PT Pediatric Evaluation'>
  <cfset thereason = 'PT Pediatric Evaluation' />
  <cfelseif thereason eq 'PT Adult Evaluation'>
  <cfset thereason = 'PT Adult Evaluation' />
  <cfelseif thereason eq 'OT Adult Evaluation'>
  <cfset thereason = 'OT Adult Evaluation' />
  <cfelseif thereason eq 'Chaplain Comprehensive Evaluation'>
  <cfset thereason = 'Chaplain Evaluation' />
  <cfelseif thereason eq 'Discharge Non-OASIS'>
  <cfset thereason = 'Discharge Non-OASIS' />
  <cfelseif thereason eq 'SN Hospice Evaluation'>
  <cfset thereason = 'SN Hospice Evaluation' />
  <cfelseif thereason eq 'SN Adult Evaluation'>
  <cfset thereason = 'SN Adult Evaluation' />
  <cfelseif thereason eq 'ST Adult Evaluation'>
  <cfset thereason = 'ST Adult Evaluation' />
  <cfelseif thereason eq 'MSW Adult Evaluation'>
  <cfset thereason = 'MSW Adult Evaluation' />
  <cfelseif thereason eq 'MSW Pediatric Evaluation'>
  <cfset thereason = 'MSW Pediatric Evaluation' />
  <cfelseif thereason eq 'Private Duty Assessment'>
  <cfset thereason = 'Private Duty Assessment' />
  <cfelseif thereason eq 'ST Pediatric Evaluation'>
  <cfset thereason = 'ST Pediatric Evaluation' />
  <cfelseif thereason.indexOf("OT Evaluation") neq "-1">
  <cfset thereason = 'OT Evaluation' />
  <cfelseif thereason.indexOf("SN Evaluation") neq "-1">
  <cfset thereason = 'SN Evaluation' />
  <cfelseif thereason.indexOf("PT Evaluation") neq "-1">
  <cfset thereason = 'PT Evaluation' />
  <cfelseif thereason.indexOf("Pediatric Evaluation") neq "-1">
  <cfset thereason = 'Ped - Pediatric Evaluation' />
  <cfelseif thereason.indexOf("ST Evaluation") neq "-1">
  <cfset thereason = 'ST Evaluation' />
</cfif>

<cfdocument format="pdf"  localURL = "yes"     orientation="portrait"  overwrite="yes">
	<cfdocumentsection>	
        <div class="row">
		    <table cellpadding="0" cellspacing="0" border="0" width="100%">
			  <tr>
				  <td align="left" width="70%">
						 <table cellpadding="0" cellspacing="0" border="0" width="100%">						
						    <tr>
								<td height="2px"></td>
							 </tr>
							 <tr>				
								<td style="padding-left:0px; font-family: Arial; font-size: 15px; font-weight: bold;"><cfoutput>#GetPA.First_Name#&nbsp;#GetPA.Last_Name#  #thereason#  #DATEFORMAT(GetPA.Date_Completed,"mm/dd/yyyy")# </cfoutput></td>
							 </tr>
						 </table>
					</td>
					<td align="right" width="30%">
						 <table cellpadding="0" cellspacing="0" border="0" width="100%">						
						    <tr>
								<td height="2px"></td>
							 </tr>
							 <tr>				
								<td style="padding-right:0px; font-family: Arial; font-size: 14px; font-weight: bold;"><cfoutput> Visit #url.visit# Date __________</cfoutput></td>
							 </tr>
						 </table>
					</td>				
				</tr>
			</table>		
		</div>
		
		<br >
		<div class="row">
			<div>
				<label style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">DIAGNOSES</label>
			</div>
		</div><br>
		<cfoutput>
		   <cfif getproblem.RecordCount GT 0>	
				<cfset j = 0 />
				 <table cellpadding="0" cellspacing="0" border="0" width="100%">
				    <tr>
					   <td align="left" width="45%">
						   <cfloop index="i" from="1" to="3" step = 1> 
						     <cfset j = i + 3 />
						    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
						     <tr>
						        <cfif getproblem["Description"][i] neq ''>
						          <td align="left" valign="top" width="45%">
									    #getproblem["proborder_id"][i]# - #getproblem["Description"][i]#	
								  </td>
								</cfif>
								<cfif getproblem["Description"][j] neq ''>
									<td align="left" valign="top" width="45%">
									    #getproblem["proborder_id"][j]# - #getproblem["Description"][j]#	
									</td>
								</cfif>
							 </tr>
							</table>
							  
						   </cfloop>
						</td>
					</tr>
					
				</table>		
			<cfelse>
				<table>
						<tr>
							<td align="center" valign="middle" colspan="2" height="50px">
								No Diagnosis Found
							</td>
						</tr>
				</table>
			</cfif>	
		</cfoutput>
		<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">
 <cfsavecontent  variable ="horizontalimage">
		 	<span style="font-weight: bold;"><img src="file:///var/www/pathway/horizontal.jpg"  width="50px"  hight="5px"> </span>
		 </cfsavecontent>
	   <cfif getstandingorder.RecordCount GT 0>	
			  <cfset standdsecription=ValueArray(getstandingorder,"Description") />
	   		  <cfset standingtotalcount = getstandingorder.recordcount />
			  <cfset endrow1 	 =   fix(standingtotalcount / 2 ) />
			  <cfset startrow2 =   endrow1 + 1 />
			  <cfset endrow2   =   standingtotalcount />
			  <table cellpadding="0" cellspacing="0" border="0" width="100%">
			    <tr>
				   <td align="left" valign="top"  width="49%">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
					     <tr> <td align="left" valign="top" width="50%"> <span style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">STANDING ORDERS:</span></tr>
						<cfloop from="1" to="#endrow1#" index="i">
							<cfoutput>
								<cfset deslength = len(#standdsecription[i]#) />
							    	  <cfset dashlength = 50 - deslength /> 
							    <tr><td style="width:#deslength#%;font-size:11px;font-family: Arial;text-align: left;" nowrap="nowrap">  #standdsecription[i]#
									  <td style="width:#dashlength#%; height: 20px; border-bottom: 1px solid black; text-align: left" nowrap="nowrap" >
									   </td>
							     </td>
								</tr>
						     </cfoutput>
						 </cfloop>
						<!--- <tr>
						  <td style="width: 50%;font-size: 12px;  padding: 0 5px;" > Your Text Herebcbcbxcbxcbfdfdhdfhdfhdfhfhfdhfh
						  <td style="width: 50%; height: 20px; border-bottom: 1px solid black; text-align: right">
						   </td>
						</td> </tr> 
						<tr>
						 <td style="width: 20%;font-size: 12px;  padding: 0 5px;" > Your Text
						  <td style="width:70%; height: 20px; border-bottom: 1px solid black; text-align: right" >
						   </td>
						</td>
						 </tr> --->
						</table>
					</td>
					<td align="left" width="1.5%" valign="top">&nbsp;</td>
					<td align="left" width="49%" valign="top">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
							<cfloop from="#startrow2#" to="#endrow2#" index="j">
								<cfoutput>
								  <!--- <tr>
								        <td align="left" valign="top" width="50%" height="20px" >#standdsecription[j]# _____________________</td>
									 </tr> --->
									  <cfset deslength = len(#standdsecription[i]#) />
									  <!--- <cfset deslength = (deslength/2) + 2 /> --->
							    	  <cfset dashlength = 100 - deslength /> 
									  <tr><td style="width:#deslength#%;font-size:11px;font-family: Arial;text-align: left;" nowrap="nowrap">  #standdsecription[j]#
									  <td valign="top" style="width:#dashlength#%; height: 20px; border-bottom: 1px solid black; margin: left" >
									   </td>
							     </td>
								</tr>
								</cfoutput>
							 </cfloop>
						</table>
					</td>
				</tr>
			</table>	
		<cfelse>

			<table>
					<tr>
						<td align="center" valign="middle" colspan="2" height="50px">
							No Standing Orders Found
						</td>
					</tr>
			</table>
		</cfif>	
		<!--- <br>
		 	<div style="background-color:##000000; height:1px; width:100%;"></div>
		<br>
		<style>
        .vertical {
            border-left: 2px solid black;
         }
         .box {
		  height: 50px;
		  width: 50px;
		  margin-bottom: 50px;
		  border: 5px solid green;
		}

    	</style>
		 --->
		 <cfsavecontent  variable ="metcheckboximage">
		 	<span style="font-weight: bold;">MET</span> <img src="file:///var/www/pathway/checkboximage.png"  width="12px"  hight="12px"> 
			<span style="font-weight: bold;">NOT MET</span>  <img src="file:///var/www/pathway/checkboximage.png"   width="12px"  hight="12px" > 
		 </cfsavecontent>
		
		 <cfsavecontent  variable ="yescheckboximage">
		 	<span style="font-weight: bold;">Y</span> <img src="file:///var/www/pathway/checkboximage.png"  width="12px"  hight="12px"> 
			<span style="font-weight: bold;">N</span>  <img src="file:///var/www/pathway/checkboximage.png"   width="12px"  hight="12px" > 
		 </cfsavecontent>
		<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">
		<cfif getgoal.RecordCount GT 0>	
			<cfset j = 0 />
			 <table cellpadding="0" cellspacing="0" border="0" width="100%">
			    <tr>
				   <td align="left" width="100%">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%"  style="padding-left:0px; font-family: Arial;font-size: 11px ">
					     <tr>
					        <td align="left" >
					        <span style="font-size: 11.0px;font-weight: bold;">PATIENT GOAL:</span>
							<cfoutput query="getpatientgoal"> #Description#: #metcheckboximage#</cfoutput>&nbsp;
							<span style="font-size: 11.0px;font-weight: bold;"> AGENCY GOALS FOR VISIT</span> <cfoutput>#url.visit#</cfoutput>:</b>
							<cfloop query="getCW_Visit"> 
							 	<cfset diagnosis = QueryGetRow(getproblem, #getCW_Visit.goals#) >
								<cfquery name="getitems" datasource="#Application.DataSrc#">
							         SELECT * FROM #Request.prefix_db_lookup#.pPathway 
							         WHERE Pathway_ID = <cfqueryparam value = "#diagnosis.Path_ID#" CFSQLType ="CF_SQL_INTEGER">
							         AND Type= <cfqueryparam value="goal" cfsqltype="CF_SQL_VARCHAR">
							         ORDER BY Type_Order,Order_ID ASC
							    </cfquery>
							    <cfset Item_IDs = ValueList(getitems.Item_ID,",")>
							    <cfif len(Item_IDs) gt 0 >
								<cfquery  name="getpggoals" dbtype="query">
									    SELECT * FROM getallgoals 
									   WHERE  Item_ID  IN   (<cfqueryparam CFSQLType="CF_SQL_INTEGER" value="#Item_IDs#"  list="yes" >) 
								</cfquery>
							   <cfset goal_decription = "" />
							   <cfif getCW_Visit.CurrentRow EQ 1>
								   	<cfset static_goals =   ' symptoms are controlled by '& 
								   	    #DateFormat(getpggoals.Date_Target,"yyyy-mm-dd")# & #metcheckboximage# /> 
								   	<cfset static_goals =   static_goals &  ' patient/caregiver recalls related medication(s) purpose and schedule by '  & #DateFormat(getpggoals.Date_Target,"yyyy-mm-dd")# & #metcheckboximage# />  
								   <cfoutput>	#static_goals# <br></cfoutput>
							   	</cfif> 
							   	<cfoutput>###diagnosis.proborder_id#: </cfoutput>
							   	<cfoutput query="getpggoals" group="Description"> 
							   	   <cfif Description DOES NOT CONTAIN 'symptoms are controlled' AND Description DOES NOT CONTAIN 'patient/caregiver recalls related medication(s) purpose and schedule'>
								   	    <cfset goaldescrip =   ' ' & getpggoals.Description & ' by '  & 
								   	    #DateFormat(getpggoals.Date_Target,"yyyy-mm-dd")# & #metcheckboximage# />     
								   	 	<cfset goal_decription = goal_decription & #goaldescrip# />
							   	 	</cfif>
							   	 </cfoutput>
							   	 <cfif getpggoals.recordcount gt 0> 
							   	 	<cfoutput>#goal_decription#</cfoutput>
							   	 <cfelse>
							   	 	None of goals Found for this diagnosis 
							   	 </cfif>

							   	<br></cfif>
							</cfloop>
							</td>
						 </tr>
						</table>
					</td>
					
				</tr>
				
			</table>		
		<cfelse>
			<table>
					<tr>
						<td align="center" valign="middle" colspan="2" height="50px">
							No Goals Found
						</td>
					</tr>
			</table>
		</cfif>	
		<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">

		<cfif getsymptom.RecordCount GT 0>	
		      <cfset Param_Lo = ValueArray(getsymptom,"Param_Lo") />
		      <cfset Param_Hi = ValueArray(getsymptom,"Param_Hi") />
		      <cfset Item_ID = ValueArray(getsymptom,"Item_ID") />
		      <cfset symptomdsecription=ValueArray(getsymptom,"Description") />
		      <cfset symptomHeader=ValueArray(getsymptom,"Header") />
		      <cfset total_count = getsymptom.recordcount />
			  <cfset endrow1 	 =   fix(total_count / 2 ) />
			  <cfset startrow2 =   endrow1 + 1 />
			  <cfset endrow2   =   total_count />
			 
		    

			 <table cellpadding="0" cellspacing="0" border="0" width="100%">
			    <tr style="page-break-inside: avoid;">
				   <td align="left" width="49%" valign="top">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
					    <cfset previoustitle = "" />
						<cfloop from="1" to="#endrow1#" index="i">
						  <cfoutput>
						        <cfquery  name="getdiag" dbtype="query">
							          SELECT * FROM getpathway 
							          WHERE  Item_ID IN (<cfqueryparam value="#Item_ID[i]#"  cfsqltype="cf_sql_varchar" list="yes">)
							          AND  Item_ID != 0 
							     </cfquery>
							     <cfset orderid = ReReplace(getdiag.order_ids, "0", "", "all") >

							    <cfif previoustitle NEQ #Ucase(symptomHeader[i])# >
								     <tr style="height="30px"">
								        <td align="left" valign="center" width="50%"  style="font-size: 11.0px;font-weight: bold;" height="30px">#Ucase(symptomHeader[i])#</td>
									 </tr>
								 </cfif>
							     <tr style="page-break-inside: avoid;">
								   <!--- <td align="left" valign="top" width="80%" height="20px" nowrap="nowrap">
							        #symptomdsecription[i]# [#ListSort(orderid,"Numeric","asc",",")#] <cfif Param_Lo[i] neq ''> <br>(call if &gt; #Param_Hi[i]# &lt; #Param_Lo[i]# )__________<cfelse>__________</cfif> </td> --->
									<cfset deslength = len(#symptomdsecription[i]#) + len(orderid) />
							    	  <cfset dashlength = 75 - deslength /> 
									  <tr><td width="20%" style="width:15%;font-size:11px;font-family: Arial;text-align: left;">#symptomdsecription[i]# [#ListSort(orderid,"Numeric","asc",",")#]<cfif Param_Lo[i] neq ''> <br>(call if &gt; #Param_Hi[i]# &lt; #Param_Lo[i]# )<cfelse></cfif> 
									  <td valign="top" style="width:15%; height: 20px; border-bottom: 1px solid black; margin: left" >
									   </td></td>
									  <td  align="left" valign="top" width="15%" height="20px" nowrap="nowrap"> #yescheckboximage# </td> 
								 </tr>
							</cfoutput>
							  <cfset previoustitle = #Ucase(symptomHeader[i])# />
						 </cfloop>
						</table>
						  
					</td>
					<td align="left" width="1.5%" valign="top"></td>
					 <td align="left" width="49%" valign="top">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
							<cfloop from="#startrow2#" to="#endrow2#" index="j">
								<cfoutput>
								   	<cfquery  name="getdiag" dbtype="query">
								          SELECT * FROM getpathway 
								          WHERE  Item_ID IN (<cfqueryparam value="#Item_ID[j]#"  cfsqltype="cf_sql_varchar" list="yes">)
								          AND  Item_ID != 0 
							     	</cfquery>
							     	<cfset orderid = ReReplace(getdiag.order_ids, "0", "", "all") >

								    <cfif previoustitle NEQ #Ucase(symptomHeader[j])# >
									   <tr style="height="30px">
								        	<td align="left" valign="center" width="50%"  style="font-size: 11.0px;font-weight: bold;" height="30px">#Ucase(symptomHeader[j])#</td>
									   </tr>
									 </cfif>
								   <tr width="50%" nowrap="nowrap">
							      <!--- <td align="left" valign="top" width="80%" height="20px" nowrap="nowrap">
							        #symptomdsecription[j]# [#ListSort(orderid,"Numeric","asc",",")#] <cfif Param_Lo[j] neq ''> <br>(call if &gt; #Param_Hi[j]# &lt; #Param_Lo[j]# )__________<cfelse>__________</cfif> </td>
							        <td  align="center" valign="top" width="20%" height="20px" nowrap="nowrap"> #yescheckboximage# </td> --->

							        <tr><td width="20%" style="width:15%;font-size:11px;font-family: Arial;text-align: left;">#symptomdsecription[j]# [#ListSort(orderid,"Numeric","asc",",")#]<cfif Param_Lo[j] neq ''> <br>(call if &gt; #Param_Hi[j]# &lt; #Param_Lo[j]# )<cfelse></cfif> 
									  <td valign="top" style="width:15%; height: 20px; border-bottom: 1px solid black; margin: left" >
									   </td></td>
									  <td  align="left" valign="top" width="15%" height="20px" nowrap="nowrap"> #yescheckboximage# </td> 


								 </tr>

								</cfoutput>
								  <cfset previoustitle = #Ucase(symptomHeader[j])# />
							 </cfloop>
						</table>
					</td>
				</tr>
				
			</table>		
		<cfelse>
			<table>
					<tr>
						<td align="center" valign="middle" colspan="2" height="50px">
							No symptoms  Found
						</td>
					</tr>
			</table>
		</cfif>	
	<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">

		<cfif getprocedure.RecordCount GT 0>	
			 <!--- <table cellpadding="0" cellspacing="0" border="0" width="100%" valign="top">
			    <tr>
			      <td align="left" width="100%">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">



					     <tr>
					        <td align="left" valign="top" width="100%"> <span style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">PROCEDURES:</span>
								   		<cfoutput query="getprocedure">#Description#,</cfoutput>
								   		_____________________
							</td>
						 </tr>
						</table>
						  
					</td>
				</tr>
			 </table> --->
			  
			  <cfset procdescription=ValueArray(getprocedure,"Description") />
	   		  <cfset proctotalcount = getprocedure.recordcount />
			  <cfset endrow1 	 =   fix(proctotalcount / 2 ) />
			  <cfset startrow2 =   endrow1 + 1 />
			  <cfset endrow2   =   proctotalcount />
			  <table cellpadding="0" cellspacing="0" border="0" width="100%">
			    <tr>
				   <td align="left" valign="top"  width="49%">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
					     <tr> <td align="left" valign="top" width="50%"> <span style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">PROCEDURES:</span></tr>
						<cfloop from="1" to="#endrow1#" index="i">
							<cfoutput>
								<cfset deslength = len(#procdescription[i]#) />
							    <cfset dashlength = 50 - deslength /> 
							    <tr><td style="width:#deslength#%;font-size:11px;font-family: Arial;text-align: left;" nowrap="nowrap">  #procdescription[i]#
									  <td style="width:#dashlength#%; height: 20px; border-bottom: 1px solid black; text-align: left" nowrap="nowrap" >
									   </td>
							     </td>
								</tr>
						     </cfoutput>
						 </cfloop>
						
						</table>
					</td>
					<td align="left" width="1.5%" valign="top">&nbsp;</td>
					<td align="left" width="49%" valign="top">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
							<cfloop from="#startrow2#" to="#endrow2#" index="j">
								<cfoutput>
								  <!--- <tr>
								        <td align="left" valign="top" width="50%" height="20px" >#procdescription[j]# _____________________</td>
									 </tr> --->
									  <cfset deslength = len(#procdescription[i]#) />
									  <!--- <cfset deslength = (deslength/2) + 2 /> --->
							    	  <cfset dashlength = 100 - deslength /> 
									  <tr><td style="width:#deslength#%;font-size:11px;font-family: Arial;text-align: left;" nowrap="nowrap">  #procdescription[j]#
									  <td valign="top" style="width:#dashlength#%; height: 20px; border-bottom: 1px solid black; margin: left" >
									   </td>
							     </td>
								</tr>
								</cfoutput>
							</cfloop>
						</table>
					</td>
				</tr>
			</table>	

		   <cfelse>
			<table>
					<tr>
						<td align="center" valign="middle" colspan="2" height="50px">
							None of Procedures Found
						</td>
					</tr>
			</table>
		</cfif>	
	
	<!--- 
  	<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">
  	<cfif getproblem.RecordCount GT 0>	
	    <table cellpadding="0" cellspacing="0" border="0" width="100%" valign="top" style ="display:none">
		    <tr>
		      <td align="left" width="100%">
				    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
				     <tr>
				        <td align="left" valign="top" width="100%">
				         <span style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">PATIENT TEACHING FOR VISIT <cfoutput>#url.visit#</cfoutput>: </span> 
				         <cfoutput query="getCW_Visit"> 
							 	<cfset diagnosis = QueryGetRow(getproblem, #getCW_Visit.goals#) >
									<cfquery name="getitems" datasource="#Application.DataSrc#">
								         SELECT * FROM #Request.prefix_db_lookup#.pPathway 
								         WHERE Pathway_ID = <cfqueryparam value = "#diagnosis.Path_ID#" CFSQLType ="CF_SQL_INTEGER">
								         AND Type= <cfqueryparam value="teach" cfsqltype="CF_SQL_VARCHAR">
								         ORDER BY Type_Order,Order_ID ASC
								    </cfquery>
								    <cfset Item_IDs = ValueList(getitems.Item_ID,",")>
								    <cfif len(Item_IDs) gt 0 >
									<cfquery  name="getteach" dbtype="query">
									    SELECT * FROM getallteaching 
									   WHERE  Item_ID  IN   (<cfqueryparam CFSQLType="CF_SQL_INTEGER" value="#Item_IDs#"  list="yes" >) 
									</cfquery>
								   	#Ucase(diagnosis.Description)#:  
								   	<cfset teach_decription = "" />
								   	<cfloop query="getteach">        
								   	 <cfset teach_decription = ListAppend(teach_decription,#getteach.Description#,",") /></cfloop>
								   	 <cfif getteach.recordcount gt 0>
									   	 TEACH caregiver  #teach_decription#
									   	<cfelse>
									   	None of teachingplans Found for this diagnosis
									 </cfif><br>
									 </cfif>
							</cfoutput>
						</td>
					 </tr>
					</table>
					  
				</td>
			</tr>
			
		</table>		
		<cfelse>
		<table>
				<tr>
					<td align="center" valign="middle" colspan="2" height="50px">
						None of teaching plans Found
					</td>
				</tr>
		</table>
	</cfif>	 --->


	<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">	


	<cfif getproblem.RecordCount GT 0>	
		    <table cellpadding="0" cellspacing="0" border="0" width="100%" valign="top">
			    <tr>
			      <td align="left" width="100%">
					    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-left:0px; font-family: Arial;font-size: 11px ">
					     <tr>
					        <td align="left" valign="top" width="100%">
					         <span style="padding-left:0px; font-family: Arial; font-size: 11.0px;font-weight:bold;">PATIENT RECALL FOR VISIT <cfoutput>#url.visit#</cfoutput>: </span> 
								<cfoutput query="getCW_Visit"> 
							 	<cfset diagnosis = QueryGetRow(getproblem, #getCW_Visit.goals#) >
									<cfquery name="getitems" datasource="#Application.DataSrc#">
								         SELECT * FROM #Request.prefix_db_lookup#.pPathway 
								         WHERE Pathway_ID = <cfqueryparam value = "#diagnosis.Path_ID#" CFSQLType ="CF_SQL_INTEGER">
								         AND Type= <cfqueryparam value="teach" cfsqltype="CF_SQL_VARCHAR">
								         ORDER BY Type_Order,Order_ID ASC
								    </cfquery>
								    <cfset Item_IDs = ValueList(getitems.Item_ID,",")>
								    <cfif len(Item_IDs) gt 0 >
									<cfquery  name="getteach" dbtype="query">
									    SELECT * FROM getallteaching 
									   WHERE  Item_ID  IN   (<cfqueryparam CFSQLType="CF_SQL_INTEGER" value="#Item_IDs#"  list="yes" >) 
									</cfquery>
								   	 ###diagnosis.proborder_id#:
								   	<cfset teach_decription = "" />
								   	<cfloop query="getteach">        
								   	 <cfset teach_decription = ListAppend(teach_decription,#getteach.Description#,",") /></cfloop>
								   	 <cfif getteach.recordcount gt 0>
									   	 TEACH caregiver  #teach_decription#
									   	<cfelse>
									   	None of teachingplans Found for this diagnosis
									 </cfif><br>
									 </cfif>
							</cfoutput>
							</td>
						 </tr>
						</table>
						  
					</td>
				</tr>
				
			</table>		
		<cfelse>
			<table>
					<tr>
						<td align="center" valign="middle" colspan="2" height="50px">
							None of goals Found
						</td>
					</tr>
			</table>
		</cfif>	
	<hr style="height:1px;border-width:0;color:gray;background-color:##000000;">
	 
	</cfdocumentsection>
</cfdocument>
