This repository was archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulation.php
More file actions
166 lines (122 loc) · 5.02 KB
/
simulation.php
File metadata and controls
166 lines (122 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
include("AES.php");
include('exportExcelLibrary.php');
include("mysqlCredentials.php");
session_start();
if(!isset($_SESSION["isLoggedIn"]))exit("Not logged in");
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
<title>Medical ID</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/download.css" rel="stylesheet">
<style>
.select,
#locale {
width: 100%;
}
.like {
margin-right: 10px;
}
</style>
</head>
<body>
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Medical ID</a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="logout.php">Sign out</a>
</li>
</ul>
</nav>
<?php include("menu.php"); ?>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4 downloadCenter">
<div class="border-bottom pageTitle">
<h1 class="h2">Simulate Patient Data Entry</h1>
</div>
<div class="downloadCenter">
<textarea cols="5" rows="10" class="form-control" name="json" id="json">{
"MID_Name":"Matt",
"MID_Birthday":"03/16/2021",
"MID_Gender":"Male",
"MID_Address1":"123 random st",
"MID_Address2":"",
"MID_City":"auburn",
"MID_State":"Hawaii",
"MID_Zip":"12345",
"MID_HomePhone":"72276272727",
"MID_WorkPhone":"2828483838393",
"MID_MaritalStatus":"Married",
"MID_Weight":"125",
"MID_Height":"283",
"MID_BloodType":"B+",
"MID_Ethnicity":"White",
"MID_PrimaryInsurance":"Geico",
"MID_PrimaryInsuranceNumber":"3737373773",
"MID_PrimaryInsuranceGroupNumberOrMainPH":"282882828",
"MID_Conditions":"[\"back pain\"]",
"MID_Injuries":"[\"bit by alligator\"]"
}</textarea> <br><br>
<div id="msg"></div>
<p style="text-align: center;">Note: Do not add new attributes to the JSON, otherwise this will not work. Simply just edit the values.</p>
<br>
<button onclick="simulate()" type="button" class="btn btn-primary">Submit Simulation</button>
</div>
</main>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
</script>
<script>
window.jQuery || document.write('<script src="js/vendor/jquery-slim.min.js"><\/script>')
</script>
<script src="js/vendor/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<!-- Icons -->
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
<script>
feather.replace()
</script>
<script>
function simulate() {
var jsonData = JSON.parse(document.getElementById("json").value);
var buildPost = "";
for (var key in jsonData) {
// check if the property/key is defined in the object itself, not in parent
if (jsonData.hasOwnProperty(key)) {
console.log(key, jsonData[key]);
buildPost += key+"="+jsonData[key]+"&";
}
}
buildPost = buildPost.substring(0, buildPost.length - 1);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
//document.getElementById("demo").innerHTML = this.responseText;
//console.log(this.responseText);
//var obj = JSON.parse(this.responseText);
//document.getElementById("passInfo").innerHTML = "Password to excel file is: "+obj["password"];
document.getElementById("msg").innerHTML = '<div class="alert alert-success" role="alert">Simulation Done. Patient is in the database.</div>';
}
};
xhttp.open("POST", "receiveData.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(buildPost);
}
</script>
</body>
</html>