3 * This is called as a pop-up to display patient education materials.
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2014 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/options.inc.php");
17 use OpenEMR\Core\Header
;
19 $educationdir = "$OE_SITE_DIR/documents/education";
21 $codetype = empty($_REQUEST['type' ]) ?
'' : $_REQUEST['type' ];
22 $codevalue = empty($_REQUEST['code' ]) ?
'' : $_REQUEST['code' ];
23 $language = empty($_REQUEST['language']) ?
'' : strtolower($_REQUEST['language']);
24 $source = empty($_REQUEST['source' ]) ?
'' : $_REQUEST['source' ];
28 if ($_POST['bn_submit']) {
29 if ($source == 'MLP') {
30 // MedlinePlus Connect Web Application. See:
31 // http://www.nlm.nih.gov/medlineplus/connect/application.html
32 $url = 'http://apps.nlm.nih.gov/medlineplus/services/mpconnect.cfm';
33 // Set code type in URL.
34 $url .= '?mainSearchCriteria.v.cs=';
35 if ('ICD9' == $codetype) {
36 $url .= '2.16.840.1.113883.6.103';
37 } else if ('ICD10' == $codetype) {
38 $url .= '2.16.840.1.113883.6.90' ;
39 } else if ('SNOMED' == $codetype) {
40 $url .= '2.16.840.1.113883.6.96' ;
41 } else if ('RXCUI' == $codetype) {
42 $url .= '2.16.840.1.113883.6.88' ;
43 } else if ('NDC' == $codetype) {
44 $url .= '2.16.840.1.113883.6.69' ;
45 } else if ('LOINC' == $codetype) {
46 $url .= '2.16.840.1.113883.6.1' ;
48 die(xlt('Code type not recognized') . ': ' . text($codetype));
51 // Set code value in URL.
52 $url .= '&mainSearchCriteria.v.c=' . urlencode($codevalue);
53 // Set language in URL if relevant. MedlinePlus supports only English or Spanish.
54 if ($language == 'es' ||
$language == 'spanish') {
55 $url .= '&informationRecipient.languageCode.c=es';
58 // There are 2 different ways to get the data: have the server do it, or
59 // have the browser do it.
61 $data = file_get_contents($url);
65 ."<script type=\"text/javascript\" src=\"". $webroot ."/interface/main/tabs/js/include_opener.js\"></script>"
66 . "<script language='JavaScript'>\n";
67 echo "document.location.href = '$url';\n";
68 echo "</script></body></html>\n";
74 if ($language == 'es' ||
$language == 'spanish') {
78 $filename = strtolower("{$codetype}_{$codevalue}_{$lang}.pdf");
79 $filepath = "$educationdir/$filename";
80 if (is_file($filepath)) {
81 header('Content-Description: File Transfer');
82 header('Content-Transfer-Encoding: binary');
84 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
85 header('Pragma: public');
86 // attachment, not inline
87 header("Content-Disposition: attachment; filename=\"$filename\"");
88 header("Content-Type: application/pdf");
89 header("Content-Length: " . filesize($filepath));
95 $errmsg = xl('There is no local content for this topic.');
103 <title
><?php
echo xlt('Education'); ?
></title
>
105 <?php Header
::setupHeader('opener'); ?
>
108 <body
class="body_top">
109 <div
class="container">
111 <div
class="col-xs-12">
112 <div
class="page-header">
115 echo xlt('Educational materials for');
116 echo ' ' . text($codetype) . ' ';
118 echo ' "' . text($codevalue) . '"';
120 echo ' ' . xlt('with preferred language') . ' ' .
121 text(getListItemTitle('language', $_REQUEST['language']));
127 echo "<p style='color:red'>" . text($errmsg) . "</p>\n";
134 <div
class='col-xs-12'>
135 <form method
='post' action
='education.php' onsubmit
='return top.restoreSession()'>
136 <input type
='hidden' name
='type' value
='<?php echo attr($codetype); ?>' />
137 <input type
='hidden' name
='code' value
='<?php echo attr($codevalue); ?>' />
138 <input type
='hidden' name
='language' value
='<?php echo attr($language); ?>' />
139 <div
class='form-group'>
140 <label
for="source"><?php
echo xlt('Select source'); ?
></label
>
141 <select name
='source' id
='source' class='form-control'>
142 <option value
='MLP' ><?php
echo xlt('MedlinePlus Connect'); ?
></option
>
143 <option value
='Local'><?php
echo xlt('Local Content'); ?
></option
>
146 <div
class='form-group'>
147 <div
class='btn-group' role
='group'>
148 <button type
='submit' class='btn btn-default btn-search' name
='bn_submit' value
='bn_submit'>
149 <?php
echo xlt('Submit'); ?
>
151 <button type
='button' class='btn btn-link btn-cancel' onclick
='window.close()'>
152 <?php
echo xlt('Cancel'); ?
>