Switch to unified view

a b/web-app/client/src/components/hospitaladmind.vue
1
<template>
2
  <div>
3
   
4
5
    <!-- <div v-for = "patientdata in patientdatas" :key="patientdata.Key" >
6
        <h1>{{this.patientdatas.age}}</h1>
7
    </div> -->
8
    <h1 id="hero2">HOSPITAL ADMIN</h1>
9
    <div class="flex-container">
10
      <div>
11
          <h1>Doctor Details</h1>
12
        <table style="width:100%">
13
          <tr>
14
            <th>Doctor Name</th>
15
            <th>Doctor Id</th>
16
            <th>Doctor Phno</th>
17
            <th>Doctor Age</th>
18
          </tr>
19
          <tr  v-for = "doctordata in doctordatas" :key="doctordata.Key">
20
           <td>{{doctordata.Record.name}}</td>
21
            <td>{{doctordata.Record.doctorId}}</td>
22
            <td>{{doctordata.Record.phNo}}</td>
23
            <td>{{doctordata.Record.age}}</td>
24
          </tr>
25
        </table>
26
      </div>
27
28
      <div>
29
          <h1>Patient Details</h1>
30
        <table style="width:100%">
31
          <tr>
32
            <th>Patient Name</th>
33
            <th>Patient Id</th>
34
            <th>Patient Phno</th>
35
            <th>Patient Age</th>
36
          </tr>
37
          <tr  v-for = "patientdata in patientdatas" :key="patientdata.Key">
38
            <td>{{patientdata.Record.name}}</td>
39
            <td>{{patientdata.Record.patientId}}</td>
40
            <td>{{patientdata.Record.phNo}}</td>
41
            <td>{{patientdata.Record.age}}</td>
42
          </tr>
43
          
44
        </table>
45
      </div>
46
    </div>
47
48
     <div class="ro ">
49
50
                <h3 id="up">UPLOAD PRESCRIPTION</h3>
51
                <form @submit="fs" enctype=multipart/form-data >
52
                    <ul>
53
                        <li>
54
                            
55
                                <label for="fname" >Patient ID:</label>
56
                                <input type="text" v-model="patid" id="fname" name="patid" >
57
                            
58
                        </li>
59
                        <li>
60
                            <label for="fname" >Upload prescription:</label>
61
                            <input type="file"  ref="file" id="myFile" name="patreport" >
62
                        </li>
63
                        
64
                            
65
                            <li>
66
                                <input type="submit" value="Submit" name="patsubmit" class="cfs" id="reg">
67
                            </li>
68
                        
69
                    </ul>
70
               </form>
71
            </div>
72
    
73
74
75
76
  </div>
77
</template>
78
79
<script>
80
// import blob from 'blob';
81
// import docxtemplater from "docxtemplater";
82
// import PizZip from "docxtemplater"
83
import axios from "axios";
84
export default {
85
  name: "hospitaladmind",
86
  // props: ["patientdatas"],
87
 async mounted() {
88
    // console.log("created");
89
    // this.x = 99;
90
91
    let res = await axios.get('http://localhost:8080/getPatients');
92
93
    let data = res.data;
94
    this.patientdatas = data;
95
    console.log("this is patient data")
96
   console.log(data)
97
 
98
99
    
100
    let res1 = await axios.get('http://localhost:8080/getDoctors');
101
102
    let data1 = res1.data;
103
    this.doctordatas = data1;
104
    console.log("this is doctor data")
105
   console.log(data1)
106
 
107
  },
108
109
  data() {
110
    return {
111
      x: 1,
112
      patientdatas : [],
113
       doctordatas : [],
114
      patid:"",
115
      file:{}
116
    };
117
  },
118
    methods: {
119
        fs(e)
120
        { 
121
             
122
            e.preventDefault();
123
            console.log("submit pressed")
124
            console.log(this.patid)
125
            this.file= this.$refs.file.files[0];
126
             var doc=this.file;
127
             console.log("this is file")
128
              console.log(doc)
129
              const formData = new FormData();
130
              formData.append('file' , this.file)
131
              console.log("this is after object")
132
              console.log(formData)
133
              axios.post('http://localhost:8080/getReport' , this.file)
134
             .then(res => console.log(res.data))
135
        
136
            .catch(e => {
137
            this.errors.push(e)
138
            })
139
            //   var text=doc.getFullText();
140
            // console.log("this is doc");
141
            // // var x = JSON.stringify(doc)
142
            // //var stream = blob.stream(doc);
143
            //  console.log(text);
144
            //  console.log(doc);
145
            // // console.log(this.file)
146
        },
147
        // generate()
148
        // {
149
        //   if (docs.files.length === 0) {
150
        // alert("No files selected")
151
        // }
152
        // reader.readAsBinaryString(docs.files.item(0));
153
154
        //  reader.onerror = function (evt) {
155
        // console.log("error reading file", evt);
156
        // alert("error reading file" + evt)
157
        // }
158
        //  reader.onload = function (evt) {
159
        // const content = evt.target.result;
160
        // var zip = new PizZip(content);
161
        // // Same code as in the main HTML example.
162
        // }
163
        // }
164
     
165
166
    //  created(){
167
168
    //      axios.get('https://jsonplaceholder.typicode.com/todos')
169
    //      .then(res => console.log(res))
170
    //      .catch(err => console.log(err))
171
172
    //  }
173
    }
174
};
175
console.log("outside");
176
</script>
177
178
<style scoped>
179
ul{
180
  list-style-type: none;
181
}
182
table,
183
th,
184
td {
185
    /* border: 1px solid black;  */
186
     border-bottom: 1px solid rgb(8, 2, 2)34, 17, 17); 
187
  border-collapse: collapse;
188
}
189
190
th{
191
  text-align: center;
192
}
193
th, td {
194
  padding: 15px;
195
}
196
tr:hover {background-color: #f5f5f5;}
197
.flex-container {
198
  display: flex;
199
  /* background-color: rgb(255, 255, 255); */
200
   background-color: white;
201
  /* color: white; */
202
  justify-content: space-around;
203
   /* border-radius: 25px; */
204
     -webkit-box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
205
          box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
206
}
207
208
#hero2{
209
    text-align: center;
210
    font-size: 2em;
211
}
212
213
.ro {
214
  height: 230px;
215
  width: 250px;
216
  background-color: white;
217
  /* color: white; */
218
  border-radius: 25px;
219
  padding: 0.5em;
220
    margin: 2em auto;
221
  
222
  -webkit-box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
223
          box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
224
}
225
226
#up{
227
    text-align: center;
228
}
229
</style>