PageSourceSearch

https://patient.webdoctors.com/Scripts/Page/Encounter.js?v=3.2

js webdoctors.com collected 2026-10-04 03:07:46 UTC 33,362 bytes, 1,039 lines download raw bytes

1
2var imgArray = [];
3
4//Load Patient List by Patient Id
5function LoadData(patientId, sectionName) {
6    ShowAjaxloader(sectionName);
7    var url = '/Encounter/List';
8    $.get(url, { PatientId: patientId }, function (data) {
9        $('#' + sectionName).html(data);
10    });
11}
12
13
14function LoadReasonSymptons(id, sectionName) {
15    ShowAjaxloader(sectionName);
16    var url = '/Encounter/GetReasonSymptons';
17    $.get(url, { id: id }, function (data) {
18        $('#' + sectionName).html(data);
19    });
20}
21
22//Load details based on EncounterId and PatientId
23function LoadDetails(id, sectionName) {
24    ShowAjaxloader(sectionName);
25    var url = '/Encounter/GetbyId';
26    $.get(url, { Id: id }, function (data) {
27        $('#' + sectionName).html(data);
28    });
29}
30
31
32//Load Total Refund and Chargeback Amount based on Encounter Id
33function LoadTransactionDetails(id, sectionName) {
34    ShowAjaxloader(sectionName);
35    $.get("/Encounter/GetTransactionDetails", { Id: id }, function (data) {
36        $('#' + sectionName).html(data);
37    });
38}
39
40//Load Transaction Activities by Encounter Id
41function LoadTransactionActivities(encounterId) {
42    var url = '/Activity/GetbyEncounterId';
43    $.get(url, {
44        encounterId: encounterId
45    }, function (data) {
46        $('#DivTransactionActivities').html(data);
47    });
48}
49
50//Get Encounter notes by Id
51function GetEncounterNotes(encounterId, sectionName) {
52    ShowAjaxloader(sectionName);
53    $.get("/Encounter/GetEncounterNotes", { Id: encounterId }, function (data) {
54        $('#' + sectionName).html(data);
55    });
56}
57
58function GetPicture(Id, sectionName, description = "") {
59    ShowAjaxloader(sectionName);
60    $.get("/Encounter/GetReasonImages", { id: Id }, function (data) {
61        $('#' + sectionName).html(data);
62        if (description != "") {
63            $('#divReasonPictureDescription').show();
64            $('#divReasonPictureDescription').html("<b>Photo description: </b> " + description);
65        }
66    });
67}
68
69//Add Patient Notes
70function AddPatientNote(note, statusId) {
71    
72    if (statusId != 2) {
73        var get_code = $('#divPatientNote').summernote('code');
74        if (get_code.trim() != "") {
75            get_code = get_code + "<br/><br/>" + note;
76        } else {
77            get_code = note;
78        }
79
80        $('#divPatientNote').summernote('code', get_code);
81    }
82}
83
84//Bind Reminder section by Check/UnCheck
85function BindReminder() {
86    if ($("#chkFollowupReminder").is(':checked')) {
87        $('#followReminderRow').show();
88    }
89    else {
90        $('#followReminderRow').hide();
91    }
92}
93
94//Medical Note
95function ShowMedicalNote() {
96    $('#divMedicalNote').show();
97    $('#divMedicalMessage').hide();
98    var gender = $("#spanPatientGender").html() == "Male" ? "Mr." : $("#spanPatientGender").html() == "Female" ? "Ms." : "";
99    var name = $("#spanPatientName").html(); 
100    var appdate = $("#spanApptDate").html();
101    var physician = $("#spanPhysician").html();
102    var note = gender + name + ' was treated by' + physician + ' on the date ' + appdate + ' for a medical condition.';  
103    $('#divMedicalNotes').summernote('code', note);
104  
105}
106
107function UpdateImageDescription() {
108
109    //Create reasonPicture model and store the data of each pic (id and Description)
110    var reasonPictures = [];
111    $('#divImg .imgli').each(function () {
112        var model = {
113            Id: $(this).attr("id").split('_')[1],
114            Description: $(this).find("textarea").val()
115        };
116        reasonPictures.push(model);
117    });
118    
119    $.post('/Encounter/UpdateImageDescriptions', { reasonPictures: reasonPictures }, function (data) {
120        if (data.success) {
121            toastr["success"]("Description updated.");
122        } else {
123            toastr["error"](data.message);
124        }
125    });
126}
127
128function handleFileSelect(e) {
129    $('#divpictureerror').hide();
130    var fileslen = $("#divImg .imgli").length;
131    var uploadedfilelen = e.target.files.length;
132    var totallen = fileslen + uploadedfilelen;
133
134    if (totallen > 4) {
135        $('#divpictureerror').html("You cannot add more than 4 pictures.");
136        $('#divpictureerror').show();
137        if ($(window).width() > 768) {
138            $(window).scrollTop(0);
139        }
140        else {
141            $(window).scrollTop(500, 500);
142        }
143    } else {
144        $('#divpictureerror').hide();
145        $('#updPicturedescription').show();
146        $('#spnpicturemsg').hide();
147
148        for (var i = 0; i <= (e.target.files.length - 1); i++) {
149
150            var fileimg = e.target.files[i];
151            loadImage(
152                fileimg,
153                function (img) {
154                    SaveImage(img.toDataURL());
155                },
156                { maxWidth: 600, orientation: true, canvas: true, pixelRatio: window.devicePixelRatio } // Options
157            );
158        }
159
160        $('#fileinputcntrl').attr("value", "");
161    }
162}
163
164//Save Image
165var imageencounter = 0;
166var imageencounterincrement = 0;
167var content = "";
168function SaveImage(stream) {
169    imageencounter = imageencounter + 1;
170
171    gencounterId = gencounterId === "" ? 0 : gencounterId;
172
173    var model = {
174        EncounterId: gencounterId,
175        Stream: stream.split("base64,")[1]
176    };
177    $('#divImg').append(ShowLoaderImageDiv(stream.split("base64,")[1]));
178
179    Disable('continueAppointment');
180
181    if (imageencounter === 1) {
182        content = $('#continueAppointment').html();
183    }
184    $('#continueAppointment').html("Please wait...");
185
186
187    $.post('/Encounter/SaveImage', { reasonPicture: model }, function (data) {
188        imageencounterincrement = imageencounterincrement + 1;
189        $('#divImg').append(GetImagediv(stream, data.message));
190
191        //Look for EncounterId if it is 0 then save in localstorage
192        if (gencounterId === 0) {
193            if (localStorage.getItem("encounterimages") === null) {
194                localStorage.setItem("encounterimages", data.message);
195            } else {
196                var encounterimages = localStorage.getItem("encounterimages");
197                encounterimages = encounterimages + "," + data.message;
198                localStorage.setItem("encounterimages", encounterimages);
199            }
200       
201        }
202        if (imageencounter === imageencounterincrement) {
203            Enable('continueAppointment');
204            $('#continueAppointment').html(content);
205        }
206    });
207
208}
209
210//Show Loader Div Image
211function ShowLoaderImageDiv(base64) {
212    var imgtag = "<div class='col-md-4 pt-5 imgli' id='div_" + base64.substring(1, 30) + "'> <div class='col-md-12' style='text-align:center'>";
213    imgtag = imgtag + "<img src='/assets/images/ajax-loader.gif' /> Loading...";
214    imgtag = imgtag + "<textarea cols='2' style='width:100%;' class='form-control' placeholder='Enter image description...' disabled></textarea></div></div>";
215    return imgtag;
216}
217
218//Get Image Div
219function GetImagediv(base64, id) {
220    $('#div_' + base64.split("base64,")[1].substring(1, 30)).remove();
221    var imgtag = "<div class='col-md-4 pt-5 imgli' id='div_" + id + "'> <div class='col-md-12' style='text-align:center'>";
222    imgtag = imgtag + "<a href=" + base64 + " class='a1'>  <img name='Doc-" + id + "' id='" + id + "' src='" + base64 + "' style='max-width: 120px;max-height: 120px;' class='img-thumbnail' /></a><br /><a href='javascript:void(0)' onclick='DeleteEncounterImage(" + id + ")'><i class='icon-material-outline-delete font-size-24 color-danger istatic'></i></a>";
223    imgtag = imgtag + "<textarea cols='2' style='width:100%;' class='form-control' placeholder='Enter image description...'></textarea></div></div>";
224    return imgtag;
225}
226
227//Delete Encounter Image
228//First delete using API, if success then remove DIV
229function DeleteEncounterImage(id) {
230    var name = $('#' + id).attr("name");
231    $.post('/Encounter/DeleteImage', { imgId: id, encounterId: gencounterId }, function (data) {
232        if (data.success) {
233            $('#div_' + id).remove();
234            toastr["success"]("Image deleted successfully.");
235            if ($("#divImg .imgli").length == 0) {
236                $('#updPicturedescription').hide();
237            }
238        } else {
239            toastr["error"](data.message);
240        }
241    });
242  
243}
244
245
246//Save Data - Notes Section
247function SaveEncounter(id) {
248    //Error Messages
249    var errbody = "";
250
251    //Summer Note
252    var patientNote = $('#divPatientNote').summernote('code');
253    var physicianNote = $('#divPhysicianNote').summernote('code');
254    var medicalNote = $('#divMedicalNotes').summernote('code');
255
256    //Create Reminder Object
257    var reminder = null;
258
259    //To Checked whether Reminder is Turned On or Off
260    var isReminder = false;
261    if ($("#chkFollowupReminder").is(':checked')) {
262
263        //Validate Reminder data
264        errbody = errbody + CheckEmptyValidation($("#ddlReminder"), "Reminder Duration");
265        errbody = errbody + CheckEmptyValidation($("#txtReminderDate"), "Reminder Date");
266        errbody = errbody + CheckEmptyValidation($("#txtReminderNote"), "Reminder Note");
267        if (errbody != "") {
268            $('#divReminderError').html(errbody).slideDown("slow");
269            return;
270        }
271
272        isReminder = true;
273        reminder = {
274            ReminderOn: new Date($('#txtReminderDate').val()).toLocaleString(),
275            Note: $('#txtReminderNote').val()
276        };
277    }
278
279    $('#divReminderError').hide();
280    var encounter = {
281        ID: id,
282        PatientNote: patientNote,
283        PhysicianNote: physicianNote,
284        MedicalNote: { Note: medicalNote },
285        Reminder: reminder,
286        IsReminder: isReminder
287    };
288
289    //Show Message
290    ShowAjaxSave('divEncounterActionBtn');
291
292    //Post Method
293    $.post("/Encounter/SaveNotes", { encounter: encounter }, function (data) {
294        HideAjaxSearch('divEncounterActionBtn');
295        if (data.success) {
296
297            toastr["success"]("Data saved successfully.");
298
299            //If Physician Note mentioned then refershing the encounter Note section
300            if (physicianNote.trim() != "") {
301                //Get Encounter Notes
302                GetEncounterNotes(id, "divEncounterNote");
303            }
304        }
305        else {
306            toastr["error"](data.message);
307        }
308    });
309
310}
311
312function ShowMedicalPrintPreview(encounterId) {
313    var url = '/Encounter/GetMedicalPrintPreview?id=' + encounterId;
314    $.get(url, function (data) {
315        ShowLargeModal(data);
316    });
317}
318
319//Print Document
320//function Print() {
321
322//    var divToPrint = $("#Print").html();
323//    var newWin = window.open("", "_blank");
324//    var style = newWin.document.createElement('link');
325//    style.type = "text/css";
326//    style.rel = "stylesheet";
327//    style.href = window.location.origin + "/global/css/bootstrap.min.css";
328//    style.media = "all";
329//    //var style1 = newWin.document.createElement('link');
330//    //style1.type = "text/css";
331//    //style1.rel = "stylesheet";
332//    //style1.href = window.location.origin + "/global/css/bootstrap-extend.min.css";
333//    //style1.media = "all";
334//    //var style2 = newWin.document.createElement('link');
335//    //style2.type = "text/css";
336//    //style2.rel = "stylesheet";
337//    //style2.href = window.location.origin + "/assets/css/site.min.css";
338//    //style2.media = "all";
339//    newWin.document.title = 'Medical Note';
340//    newWin.document.write(divToPrint);
341//    newWin.document.getElementsByTagName("head")[0].appendChild(style);
342//    //newWin.document.getElementsByTagName("head")[0].appendChild(style1);
343//    //newWin.document.getElementsByTagName("head")[0].appendChild(style2);
344//    setTimeout(function () {
345//        newWin.print();
346//        newWin.close();
347//    }, 250);
348//}
349
350function MedicalNotePrint() {
351
352    var divToPrint = $("#dMedicalNotePrint").html();
353    var newWin = window.open("", "_blank");
354    var style = newWin.document.createElement('link');
355    style.type = "text/css";
356    style.rel = "stylesheet";
357    style.href = window.location.origin + "/global/css/bootstrap.min.css";
358    style.media = "all";
359    newWin.document.title = 'Medical Note';
360    newWin.document.write(divToPrint);
361    newWin.document.getElementsByTagName("head")[0].appendChild(style);
362
363    setTimeout(function () {
364        newWin.print();
365        newWin.close();
366    }, 250);
367}
368
369//Cancel Encounter - Parameter - EncounterId
370function CancelEncounter(id) {
371
372    swal({
373        title: 'Select Outage Tier',
374        input: 'select',
375        inputOptions: {
376            '1': 'Tier 1',
377            '2': 'Tier 2',
378            '3': 'Tier 3'
379        },
380        inputPlaceholder: 'required',
381        showCancelButton: true,
382        inputValidator: function (value) {
383            return new Promise(function (resolve, reject) {
384                if (value !== '') {
385                    resolve();
386                } else {
387                    reject('You need to select a Tier');
388                }
389            });
390        }
391    }).then(function (result) {
392        if (result.value) {
393            swal({
394                type: 'success',
395                html: 'You selected: ' + result.value
396            });
397        }
398    });
399    //swal({
400    //    title: 'Are you sure?',
401    //    text: "To cancel the Appointment?",
402    //    type: 'warning',
403    //    showCancelButton: true,
404    //    confirmButtonColor: '#3085d6',
405    //    cancelButtonColor: '#d33',
406    //    confirmButtonText: "Yes, Cancel it!"
407    //}, function (isConfirm) {
408    //    if (isConfirm) {
409    //        //Show Message
410    //        ShowAjaxSave('divEncounterActionBtn');
411
412    //        $.post("/Encounter/CancelEncounter", { id: id }, function (data) {
413    //            if (data.success) {
414    //                swal({
415    //                    title: 'Appointment Cancelled!',
416    //                    text: '',
417    //                    type: 'success'
418    //                }, function () {
419    //                    window.location.href = "/Home";
420    //                }
421    //                );
422    //            } else {
423    //                toastr["error"](data.message);
424    //                HideAjaxSearch('divEncounterActionBtn');
425    //            }
426    //        });
427    //    }
428    //});
429}
430
431//SignOff and SignOff for Free
432//type:- 1:- SignOff and 2: SignOff for free
433function SignOff(id, type) {
434
435
436    var msg = "to SignOff?";
437
438    if (type === 2) {
439        msg = "to SignOff for free?";
440    }
441
442    if ($('#tblEncounterPrescription tr > td:contains("Pending")').length > 0 || $('#tblEncounterPrescription tr > td:contains("PENDING")').length > 0) {
443        msg = "You have pending medication waiting approval.Do you still want to sign off ?";
444    }
445
446
447
448    var model = {
449        "Id": id,
450        "TypeId": type,
451        "TrustPilotMail": $("#chkTrustPilotMail").prop("checked")
452    };
453
454    swal({
455        title: 'Are you sure?',
456        text: msg,
457        type: 'warning',
458        showCancelButton: true,
459        confirmButtonColor: '#3085d6',
460        cancelButtonColor: '#d33',
461        confirmButtonText: "Yes, Proceed!"
462    }, function (isConfirm) {
463        if (isConfirm) {
464            blockUI("Please wait..");
465            $.post("/Encounter/SignOff", { model: model }, function (data) {
466                if (data.success) {
467                    swal({
468                        title: 'SignOff Completed!',
469                        text: '',
470                        type: 'success'
471                    }, function () {
472
473                        window.location.href = "/Home";
474                    }
475                    );
476                } else {
477                    HideConnection();
478                    toastr["error"](data.message);
479                    HideAjaxSearch('divEncounterActionBtn');
480                }
481            });
482
483        }
484    }
485    );
486
487}
488
489//Calculate Reminder date
490function CalculateReminderDate() {
491    var today = new Date();
492    var dt = "";
493    switch ($("#ddlReminder").val().toString().toLowerCase()) {
494        case '1week':
495            dt = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 7);
496            break;
497        case '1month':
498            dt = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
499
500            break;
501        case '3months':
502            dt = new Date(today.getFullYear(), today.getMonth() + 3, today.getDate());
503            $(name).removeAttr("class");
504            $(name).attr("class", "btn btn-small btn-success");
505            break;
506        default:
507            dt = new Date(today.getFullYear(), today.getMonth(), today.getDate());
508    }
509    $("#txtReminderDate").val(moment(dt).format('MM-DD-YYYY'));
510    $('#txtReminderDate').datepicker('update', $("#txtReminderDate").val());
511}
512
513
514//Load Diagnosis Modal
515function ShowDiagnosisModal(id) {
516    $.get("/Encounter/LoadDiagnosis", {
517        id: id
518    }, function (data) {
519        $('#DivPaymentModel').html(data);
520        $('#DivpaymentViewModel').modal('show');
521    });
522}
523
524
525//Load Diagnosis List based on Encounter Id
526function LoadDiagnosisList(id, sectionName) {
527    encounterId = id;
528    $.get("/Encounter/GetDiagnosis", { Id: id }, function (data) {
529        $('#' + sectionName).html(data);
530    });
531}
532
533//Save Diagnosis
534function SaveDianosis() {
535    //Validate
536    var errbody = "";
537    errbody = errbody + CheckEmptyValidation($("#ddldiagnosis"), "Diagnosis");
538    errbody = errbody + CheckEmptyValidation($("#ddldiagnosisLevel"), "Diagnosis Level");
539
540    if (errbody != "") {
541        $('#Errordiv').html(errbody).slideDown("slow");
542        return;
543    }
544
545    $('#Errordiv').hide();
546    var model = {
547        EncounterId: encounterId,
548        DiagnosisCodeId: $('#ddldiagnosis').val(),
549        Level: $('#ddldiagnosisLevel').val()
550    };
551
552    $.post("/Encounter/SaveDiagnosis", { diagnosis: model }, function (data) {
553        if (data.success) {
554            LoadDiagnosisList(encounterId, "divDiagnosisList");
555            $('#DivpaymentViewModel').modal('hide');
556        } else {
557            $('#Errordiv').html(data.message).slideDown("slow");
558        }
559    });
560}
561
562//Delete Encounter Diagnosis
563function DeleteEncounterDiagnosis(id) {
564    swal({
565        title: 'Are you sure?',
566        text: 'to remove diagnosis',
567        type: 'warning',
568        showCancelButton: true,
569        confirmButtonColor: '#3085d6',
570        cancelButtonColor: '#d33',
571        confirmButtonText: "Yes, Proceed!"
572    }, function (isConfirm) {
573        if (isConfirm) {
574
575            $.post('/Encounter/DeleteDiagnosis', { id: id }, function (data) {
576                if (data.success) {
577
578                    toastr["success"]("Diagnosis deleted");
579                    $('#' + id).remove();
580                } else {
581                    toastr["error"]("Some error occured.");
582                }
583            });
584        }
585    });
586}
587
588//Load Medication Modal
589function ShowMedicationModal(prescriptionId) {
590    $.get("/Encounter/LoadMedicationModal", {
591        prescriptionId: prescriptionId
592    }, function (data) {
593        ShowLargeModal(data);
594        //$('#DivPrintViewModel').html(data);
595        //$('#DivPrintView').modal('show');
596    });
597}
598
599function AddPreferredMedication(id, drug, sig, qty, days) {
600    $.get("/Encounter/LoadPreferredModal", {
601        id: id, drug: drug, sig: sig, qty: qty, days: days
602    }, function (data) {
603        $('#DivPrintViewModel').html(data);
604        $('#DivPrintView').modal('show');
605    });
606}
607
608//Load Medication List
609function LoadMedicationList(id, sectionName) {
610    var url = '/Encounter/GetPrescriptions';
611    $.get(url, { id: id }, function (data) {
612        $('#' + sectionName).html(data);
613
614   
615
616    });
617}
618
619//Load Preferred Medication
620function LoadPreferredMedication(id, sectionName) {
621    var url = '/Encounter/GetPrefferedMedication';
622    $.get(url, { id: id }, function (data) {
623        $('#' + sectionName).html(data);
624    });
625}
626
627//Here typeId by default represent Summary and 1 represent LegalSummary
628//function PrintPatientLegalSummary(typeId = 0) {
629//    $.get("/Encounter/LoadPatientSummary", { id: $('#hdnEncounterId').val(), patientId: $('#hdnPatientId').val(), typeId: typeId }, function (data) {
630       
631//        //var dv = $('<div/>').html(data);
632//        //var message = dv.find("#dMsg").html();
633//        //if (dv == "") {
634
635       
636//        w = window.open("", "_blank", "top=50,left=50,width=2000,height=2000,toolbar=no,menubar=no,location=no,titlebar=no,status=no,fullscreen=yes");        
637//        w.document.write(data);       
638//        setTimeout(function () {                
639//                w.print();
640//                w.close();
641//            }, 200);
642//        //}
643//        //else {
644//        //    alert(message);
645//        //}
646        
647
648      
649//    });
650//}
651//Here typeId by default represent Summary and 1 represent LegalSummary
652function PrintPatientLegalSummary(typeId = 0) {
653    $.get("/Encounter/LoadPatientSummary", { id: $('#hdnEncounterId').val(), patientId: $('#hdnPatientId').val(), typeId: typeId }, function (data) {
654        ShowLargeModal(data);
655    });
656}
657
658function ShowLargeModal(model) {
659    $('#DivPrintdialog').addClass("modal-lg").removeClass("modal-sm");
660    $('#DivPrintViewModel').html(model);
661    $('#DivPrintView').modal('show');
662}
663
664function CallPatient() {
665    CallConnection();
666    $.post('/Encounter/MakeCall', { encounterId: $('#hdnEncounterId').val() },function(data){
667        HideConnection();
668    });
669}
670
671function LoadPreferredPhone() {
672    
673    var phoneno = $('#spanEncounterPhone').html().replace(/-/g, '');
674    $.get("/Encounter/LoadPreferredPhone", { phone: phoneno }, function (data) {
675        ShowSmallModal(data);
676    });
677}
678
679function UpdatePreferredPhone(btn) {
680    Disablethis(btn);
681    $.post('/Encounter/UpdatePreferredPhone', { encounterId: $('#hdnEncounterId').val(), phone: $('#txtPhone').val() }, function (data) {
682        if (data.success) {
683
684            toastr["success"]("Phone updated");
685            $('#spanEncounterPhone').html(data.message);
686            HideModal();
687        } else {
688            Enablethis(btn);
689            toastr["error"]("Some error occured.");
690        }
691    });
692}
693
694
695
696
697//Change Pharmacy
698function ChangePharmacy(code) {
699    $('#divProgress').show();
700    $.post('/Encounter/ChangePharmacy', { pharmacyId: code, encounterId: $('#hdnEncounterId').val(), patientId: $('#hdnPatientId').val()  }, function (data) {
701        
702        if (data.success) {
703            toastr["success"]("Pharmacy changed.");
704            GetPharmacy($('#hdnPatientId').val(), "divPharmacy");
705            HideModal('');
706        } else {
707            $('#divProgress').hide();
708            toastr["error"](data.message);
709        }
710    });
711}
712
713//Cancelled Prescription
714function GetCancelledPrescription(id, sectionName) {
715    ShowAjaxloader(sectionName);
716    var url = '/Encounter/GetCancelledPrescription';
717
718    $.get(url, { id: id }, function (data) {
719        $('#' + sectionName).html(data);
720    });
721}
722
723
724//Handle SignOff and SignOff button Color on Medication Pending and Approve
725function UpdateEncounterButtons() {
726    if ($("#tblEncounterPrescription tr > td:contains(Pending)").length > 0) {
727        $('#btnSignOff').addClass("btn-danger").removeClass("btn-primary").removeClass("btn-success");
728        $('#btnFreeSignOff').addClass("btn-danger").removeClass("btn-primary").removeClass("btn-success");
729    }
730    else if ($('#tblEncounterPrescription >tbody >tr').length == 0) {
731        $('#btnSignOff').addClass("btn-primary").removeClass("btn-danger").removeClass("btn-success");
732        $('#btnFreeSignOff').addClass("btn-primary").removeClass("btn-danger").removeClass("btn-success");
733    } else {
734        $('#btnSignOff').addClass("btn-success").removeClass("btn-primary").removeClass("btn-danger");
735        $('#btnFreeSignOff').addClass("btn-success").removeClass("btn-primary").removeClass("btn-danger");
736    }
737}
738
739//Load Send Medical Module
740function LoadSendMedicalMail(id) {
741    $.get('/Encounter/LoadSendMedicalMail', {id: id}, function (data) {
742        ShowSmallModal(data);
743        $('#txtTo').val($('#spanUserEmail').html().trim());
744    });
745}
746
747//Send Medical Mail
748function SendMedicalNote(id,btn) {
749
750    //Validate
751    var errbody = "";
752    errbody = errbody + CheckEmptyValidation($("#txtTo"), "To");
753
754    if (errbody !== "") {
755        $('#divMailError').html(errbody).slideDown("slow");
756        return;
757    }
758
759    Disablethis(btn);
760    ShowAjaxSave('divSendMailfooter','Sending, Please wait...');
761
762    $.post('/Encounter/SendMedicalNote', { id: id, to: $('#txtTo').val() }, function (data) {
763        SuccessMessage("Message Sent");
764        HideModal();
765    });
766}
767
768function LoadAssignEncounter(id) {
769    $.get('/Encounter/LoadAssignEncounter', { id: id }, function (data) {
770        ShowSmallModal(data);
771    });
772}
773
774function AssignEncounter(id,btn) {
775    
776    //Check for null/blank value
777    if ($(btn).val() == "") { return; }
778
779    swal({
780        title: 'Are you sure?',
781        text: 'to assign the encounter to Dr. ' + $("option:selected", btn).text(),
782        type: 'warning',
783        showCancelButton: true,
784        confirmButtonColor: '#3085d6',
785        cancelButtonColor: '#d33',
786        confirmButtonText: "Yes, Proceed!"
787    }, function (isConfirm) {
788        if (isConfirm) {
789            Disablethis(btn);
790            ShowAjaxSave('divPhysicianEncounter_' + id);
791            $.post('/Encounter/AssignEncounter', { id: id, physicianId: $(btn).val() }, function (data) {
792                if (data.success) {
793                    SuccessMessage("Encounter Assigned");
794                    $('#divPhysicianEncounter_' + id).removeClass('text-info');
795                    $('#divPhysicianEncounter_' + id).html("<div class='col-md-12 pl-0'><i class='icon fa-stethoscope text-success font-weight-500'></i> <span class='font-weight-bold'>Dr.</span> " + $("option:selected", btn).text() + "</div>");
796                }
797                else {
798                    Enablethis(btn);
799                    ErrorMessage("Some error occured. Please contact Administrator");
800                }
801            });
802        }
803    });
804
805
806
807  
808}
809
810function checkCurrentUserSelfAssign(id) {
811   
812    if (id === undefined) {
813        $.get('/Encounter/CheckSelfAssignrole', function (data) {
814           
815            if (data.success) {
816                $('#btnSelfAssign').show();
817            }
818        });
819    }
820}
821
822function SelfAssign(id) {
823    blockUI("Please wait..");
824    $.post('/Encounter/SelfAssign', { id: id }, function (data) {
825        if (data.success) {
826            SuccessMessage("Encounter Assigned");
827            window.location.reload();
828        }
829        else {
830            HideConnection();
831            ErrorMessage(data.message);
832        }
833    });
834}
835
836function UpdateMedicationTitles() {
837    var title = $('#Medicationtitle').html();
838    title = "<span style='color:red'>*</span>" + title + "<span style='color:red'>*</span>";
839    $('#Medicationtitle').html(title);
840}
841
842function ShowPatientVitals() {
843    var vital = "";
844    if (height !== "") {
845        vital = "Height: " + height + "";
846    }
847
848    if (weight !== "") {
849        if (vital != "") {
850            vital = vital + ", ";
851        }
852        vital = vital + "Weight: " + weight;
853    }
854
855    if (bmi !== "") {
856        if (vital != "") {
857            vital = vital + ", ";
858        }
859        vital = vital + "BMI: " + bmi;
860    }
861
862    if (vital != "") {
863        vital = vital + "<br/>";
864    }
865    $('#spanPatientVitals').html(vital);
866}
867
868//Load Video Call UI
869function Videocall() {
870    var url = '/Encounter/Videocall?encounterId=' + $('#hdnEncounterId').val();
871    window.open(url, 'MDPROACTIVE - Video Call', 'width=1350,height=660,toolbar=0,resizable=0'); return false;
872}
873
874
875//Show video call button based on Code:- Video Consultant
876function CheckServiceType(code) {   
877    if (code === "VID") {
878        $('#btnPatientVideoCall').show();
879    } else {
880        $('#btnPatientVideoCall').hide();
881    }
882}
883
884//Verify Encounter Physician and based on that hide all buttons from the summary section
885function VerifyEncounterPhysician(physicianId) {
886    $.get('/Base/CurrentUserId', function (data) {
887        if (data != physicianId) {
888            $('.encbtn').hide();
889            $('head').append("<style>.encbtn{display:none !important;}</style>");
890           
891        }
892    });
893}
894
895//Show Call history button based on StatusId (Not Scheduled)
896function ShowCallHistoryBtn(statusId) {
897    
898    if (statusId !== 3) {
899        $('#btnCallHistory').show();
900    }
901}
902
903//show history
904function ShowCallHistory() {
905    $.get('/Encounter/GetCallhistory', { encounterId: $('#hdnEncounterId').val() }, function (data) {
906        ShowLargeModal(data);
907    });
908}
909
910function downloadDoc(document) {
911
912    $.post('/Encounter/GetRecording', { documentURL: document }, function (data) {
913        window.open(data, '_blank');
914    });
915}
916
917// Show Change Preferred Phone Number Popup
918async function ChangePreferredPhone(encounterId) {
919
920    var phoneNo = $('#spanEncounterPhone').html().replace(/-/g, '');
921
922    const { value: phoneNumber } = await Swal.fire({
923        title: 'Enter Phone Number',
924        input: 'text',
925        inputValue: phoneNo,
926        inputAttributes: {
927            maxlength: 10
928        },
929        showCancelButton: true,
930        inputValidator: (value) => {
931            if (!value) {
932                return 'Invalid Phone Number!'
933            }
934            var reg = /^([+]?\d{1,2}[.-\s]?)?\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
935            if (!reg.test(value)) {
936                return 'Invalid Phone Number!'
937            }
938        }
939    })
940
941    if (phoneNumber) {
942        UpdatePreferredPhone(encounterId, phoneNumber)
943    }
944}
945
946//Update Phone Number for particular encounter
947function UpdatePreferredPhone(encounterId, phoneNo) {
948    $.post('/Encounter/UpdatePreferredPhone', { encounterId: encounterId , phone: phoneNo }, function (data) {
949        if (data.success) {
950            toastr["success"]("Phone updated");
951            $('#spanEncounterPhone').html(data.message);
952        } else {
953            toastr["error"]("Some error occured.");
954        }
955    });
956}
957
958//function IsVideoEncounter(encounterId) {
959//    $.post('/Video/IsVideoEncounter', { encounterId: encounterId }, function (data) {
960//        if (data.success) {
961//            window.location.href = "/Video/VideoCall?encounterId=" + encounterId;
962//        }
963//        else {
964//            swal({
965//                title: 'Video Consultation',
966//                text: "This is not a video visit",
967//                type: 'warning'
968//            });
969//        }
970//    });
971//}
972
973function IsVideoEncounter(encounterId) {
974    $("#aGoOnline").hide();
975    $.post('/Video/IsVideoEncounter', { encounterId: encounterId }, function (data) {
976        if (data.success) {
977            $("#aGoOnline").show();
978        }
979        else {
980            $("#aGoOnline").hide();
981        }
982    });
983}
984
985//Check "Alcohol Use Disorder" appointment already exist
986function CheckAUDFollowup(patientId) {
987    $.get('/Encounter/CheckAUDFollowup', { patientID: patientId }, function (data) {
988        if (data.success) {
989            //Change the title of the Reason - AUD Followup
990            $("#17S").attr("title", "Alcohol Use Disorder Followup");
991            $('label[for="17S"]').html($('label[for="17S"]').html().replace("Alcohol Use Disorder", "Alcohol Use Disorder Followup"));
992
993        }
994    })
995}
996
997function Joincall(url) {
998    if (url != null) {
999        window.open(url, '_blank');
1000    }
1001}
1002
1003// Get Questionnaire Summary
1004function GetQuestionnairesummary(Id, sectionName) {
1005    ShowAjaxloader(sectionName);
1006    $.get("/Questionnaire/GetQuestionnaireSummaryDetails", { id: Id }, function (data) {
1007        $('#' + sectionName).html(data);
1008    });
1009}
1010
1011//Delete Encounter Document
1012//First delete using API, if success then remove DIV
1013function DeleteEncounterDocument(id) {
1014    $.post('/Encounter/DeleteImage', { imgId: id, encounterId: gencounterId }, function (data) {
1015        if (data.success) {
1016            $('#div_' + id).remove();
1017            toastr["success"]("File deleted successfully.");
1018        } else {
1019            toastr["error"](data.message);
1020        }
1021    });
1022
1023}
1024
1025if (typeof (Encounter) == "undefined") { Encounter = {}; }
1026
1027Encounter.Form = {
1028    BindBackButton: function () {
1029        if (localStorage.getItem("reasonId") === GlobalVariable.Form.ReviewLabReasonId) {
1030            $('#btnBacktoPharmacy').hide();
1031            $('#btnBacktoHealthHistory').show();
1032        } else {
1033            $('#btnBacktoPharmacy').show();
1034            $('#btnBacktoHealthHistory').hide();
1035        }
1036
1037    }
1038
1039}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.