PageSourceSearch

https://webportal2.somamedical.com/app/scripts/controllers/adjuster-case-search-ctrl.js?v2.0.5

js somamedical.com collected 2026-10-06 08:24:34 UTC 18,641 bytes, 457 lines download raw bytes

1app.controller("adjusterCaseSearchCtrl", function ($rootScope, $scope, $location, $modal, $http) {
2    console.log("running adjuster case search control - client controllers");
3    //var APIUrl = $scope.app.baseAPIUrl + '/api/Dashboard/ReferralTracker?caseNbr=0&statusCode=&claimNbr=&examineeFirstName=&examineeLastName=';
4    //var APIUrl = $scope.app.baseAPIUrl + "/api/Dashboard/CaseSearch?userCode=" + UserCode + "&userType=" + UserType +
5    //    "&examineeFirstName=" + ExamineeFirstName + "&examineeLastName=" + ExamineeLastName + "&claimNbr=" + Claim + "&caseNbr=" + Case;// + "&statusCode=" + ReturnType + "&daysBack=" + ReturnDays;
6    //var filterAPIUrl = $scope.app.baseAPIUrl + '/api/Dashboard/ReferralTracker';
7    var filterAPIUrl = $scope.app.baseAPIUrl + '/api/Dashboard/CaseSearch';
8    var headConfig = {
9        headers: {
10            'Content-Type': 'application/json',
11            'Authorization': 'Basic ' + $rootScope.globals.currentUser.authdata
12        }
13    };
14    var count = 0;
15    $scope.initLoad = true;
16    $scope.tableOptions.language = { "emptyTable": "There are no results to show" };
17    $scope.selectedCaseType
18    $scope.isProgressiveAlbany = $rootScope.globals.currentUser.isProgressiveAlbany;
19    $scope.selectedClaimRep = {};
20    $scope.claimsReps = [];
21    $scope.examinees = [];
22    $scope.medylexQueueOptions = $rootScope.globals.currentUser.medylexQueueOptions;
23    var brand = JSON.parse(localStorage.getItem("brandData")).brandName;
24
25    if (brand == "Medylex")
26        filterAPIUrl = $scope.app.baseAPIUrl + "/api/medylex/ReferralTracker";
27
28    $scope.loadClaimsRepresentatives = function () {
29        var apiurl = "{0}/api/Progressive/ProgressiveClients".format($scope.app.baseAPIUrl);
30
31        $http.get(apiurl, headConfig).then(function (response) {
32            $scope.claimsReps = response.data;
33        });
34    }
35
36    $scope.loadExaminees = function () {
37        var apiurl = "{0}/api/Progressive/ProgressiveExaminees".format($scope.app.baseAPIUrl);
38
39        $http.get(apiurl, headConfig).then(function (response) {
40            $scope.examinees = response.data;
41        });
42    }
43
44    if ($scope.isProgressiveAlbany) {
45        $scope.loadClaimsRepresentatives();
46        $scope.loadExaminees();
47    }
48
49    $scope.$on("updateTeamMemberView", function (evt, data) {
50        $scope.firstName = "";
51        $scope.lastName = "";
52        $scope.caseNbr = "";
53        $scope.claimNbr = "";
54
55        $scope.rows = [];
56        $scope.DataReady = false;
57        //console.log("case table data");
58        //console.log($scope.rows);
59
60        //console.log("clearing table;");
61        //if ($scope.Claim != undefined || $scope.Examinee != undefined || $scope.Case != undefined) {
62        // trying different clear method.
63        //console.log("running fnClearTable()");
64        $('#ReferralCaseTable').dataTable().fnClearTable();
65        //console.log("running fnDestroy()");
66        $('#ReferralCaseTable').dataTable().fnDestroy();
67        //console.log("table destroyed;");
68        $scope.reload = {};
69    });
70
71    $scope.clearSearchCriteria = function () {
72        $scope.firstName = "";
73        $scope.lastName = "";
74        $scope.caseNbr = "";
75        $scope.claimNbr = "";
76        $scope.paExamineeName = "";
77        $scope.paSelectedClaimRep = "";
78        $scope.paCaseNumber = "";
79        $scope.paClaimNumber = "";
80        $scope.paFeatureNumber = "";
81    }
82
83    $scope.searchPaCases = function (paCaseNumber, paClaimNumber, paFeatureNumber, paExamineeName, paSelectedClaimRep) {
84        console.log("Adjuster Case Search Started");
85        count = 1 + count;
86        var CaseNumber = paCaseNumber;
87        var ClaimNumber = paClaimNumber;
88        var FeatureNumber = paFeatureNumber;
89        //var SelectedExaminee = paSelectedExaminee;
90        var ExamineeName = paExamineeName;
91        var SelectedClaimRep = paSelectedClaimRep;
92        var searchAPIUrl = "{0}/api/progressive/progressivereferralsearch?".format($scope.app.baseAPIUrl);
93        $scope.DataReady = false;
94        var searchParams = ""
95
96        if (CaseNumber == undefined || CaseNumber == "") {
97            searchParams += "&caseNbr=";
98        } else {
99            searchParams += "&caseNbr=" + CaseNumber;
100        }
101
102        searchParams += (ClaimNumber != undefined ? "&claimNbr=" + ClaimNumber : "&claimNbr=");
103        searchParams += (FeatureNumber != undefined ? "&featureNumber=" + FeatureNumber : "&featureNumber=");
104        //searchParams += (SelectedExaminee != undefined ? "&chartNbr=" + SelectedExaminee : "&chartNbr=");
105        searchParams += (ExamineeName != undefined ? "&examineeName=" + ExamineeName : "&examineeName=");
106        searchParams += (SelectedClaimRep != undefined ? "&clientCode=" + SelectedClaimRep : "&clientCode=");
107
108        console.log("URL: " + (searchAPIUrl + searchParams));
109
110        var searchRequest = $http.get(searchAPIUrl + searchParams, headConfig).then(function (response) {
111            $scope.searchdData = response;
112            $scope.DataReady = false;
113        });
114
115        searchRequest.then(function (searchdData) {
116            $scope.tableOptions.aoColumns = [
117                { mData: 'Web Ctl#' },
118                { mData: 'Claim Number' },
119                { mData: 'Status' },
120                { mData: 'Examinee' },
121                { mData: 'Case #' },
122                { mData: 'Physician' },
123                { mData: 'Service' },
124                { mData: 'Specialty' },
125                { mData: 'Appt Date' },
126                { mData: 'Appt Count' },
127                { mData: 'Action' }
128            ];
129
130            $scope.rows = $scope.searchdData.data;
131            $scope.DataReady = true;
132            console.log("case table data");
133            console.log($scope.rows);
134            console.log("Count: {0}".format(count));
135            if (count > 1) {
136                //console.log("clearing table;");
137                //if ($scope.Claim != undefined || $scope.Examinee != undefined || $scope.Case != undefined) {
138                // trying different clear method.
139                //console.log("running fnClearTable()");
140                $('#AdjusterCaseTablePA').dataTable().fnClearTable();
141                //console.log("running fnDestroy()");
142                $('#AdjusterCaseTablePA').dataTable().fnDestroy();
143                //console.log("table destroyed;");
144                $scope.reload = {};
145                // }
146            }
147        });
148
149    };
150
151    $scope.searchCases = function (firstName, lastName, caseNbr, claimNbr, caseType) {
152        console.log("Adjuster Case Search Started");
153        count = 1 + count;
154        var CaseNumber = caseNbr;
155        var ClaimNumber = claimNbr;
156        var FirstName = firstName;
157        var LastName = lastName;
158        $scope.medylexReloadParams = { firstName: FirstName, lastName: LastName, caseNbr: CaseNumber, 
158claimNbr: ClaimNumber }
159        $scope.DataReady = false;
160
161        var filterParams = "?userType=CL";//"?statusCode=";
162        console.log("***** filterParams: {0} *****".format(filterParams));
163        if (localStorage.getItem("SelectedTeamMemberId") == -2) {
164            filterParams += "&userCode={0}".format($rootScope.globals.currentUser.userCode);
165        } else {
166            filterParams += "&userCode={0}".format(localStorage.getItem("SelectedTeamMemberId"));
167        }
168
169        if (CaseNumber == undefined || CaseNumber == "") {
170            filterParams += "&caseNbr=0";
171        } else {
172            filterParams += "&caseNbr=" + CaseNumber;
173        }
174
175        //filterParams += (($scope.caseNum != undefined || $scope.caseNum != "") ? "&caseNbr=" + $scope.caseNum : "&caseNbr=0");
176        filterParams += (ClaimNumber != undefined ? "&claimNbr=" + ClaimNumber : "&claimNbr=");
177        filterParams += (LastName != undefined ? "&examineeLastName=" + LastName : "&examineeLastName=");
178        filterParams += (FirstName != undefined ? "&examineeFirstName=" + FirstName : "&examineeFirstName=");
179
180        //switch (userCode) {
181        //    case undefined:
182        //    case "reset":
183        //        filterParams += "&userCode={0}".format($rootScope.globals.currentUser.userCode);
184        //        break;
185        //    default:
186        //        filterParams += "&userCode={0}".format(userCode);
187        //        break;
188        //}
189
190        filterAPIUrl + filterParams;
191
192        //console.log("***** filter URL: {0}{1} *****".format(filterAPIUrl, filterParams));
193
194        console.log("URL: " + filterAPIUrl + filterParams);
195        var filteredRequest = $http.get(filterAPIUrl + filterParams, headConfig).then(function (response) {
196            $scope.filteredData = response;
197            $scope.DataReady = false;
198        });
199
200        filteredRequest.then(function (filteredData) {
201            $scope.tableOptions.aoColumns = [
202                { mData: 'Case Number' },
203                { mData: 'Claim Number' },
204                { mData: 'Expert' },
205                { mData: 'Date of Service' },
206                { mData: 'Examinee' },
207                { mData: 'Business Line' },
208                { mData: 'Specialty' },
209                { mData: 'Service' },
210                { mData: 'Status' },
211                { mData: 'Adjuster' },
212                { mData: 'Action' }
213            ];
214
215            $scope.rows = $scope.filteredData.data;
216            $scope.DataReady = true;
217            console.log("case table data");
218            console.log($scope.rows);
219            console.log("Count: {0}".format(count));
220            if (count > 1) {
221                //console.log("clearing table;");
222                //if ($scope.Claim != undefined || $scope.Examinee != undefined || $scope.Case != undefined) {
223                // trying different clear method.
224                //console.log("running fnClearTable()");
225                $('#AdjusterCaseTable').dataTable().fnClearTable();
226                //console.log("running fnDestroy()");
227                $('#AdjusterCaseTable').dataTable().fnDestroy();
228                //console.log("table destroyed;");
229                $scope.reload = {};
230                // }
231            }
232        });
233
234    };
235
236    $scope.applyFilter = function (userCode, params) {
237
238        $scope.DataReady = false;
239        count = 1 + count;
240
241        var filterParams = (params != null ? "?statusCode={0}".format(params) : "?statusCode=");
242        //console.log("***** filterParams: {0} *****".format(filterParams));
243
244        if ($scope.caseNum == undefined || $scope.caseNum == "") {
245            filterParams += "&caseNbr=0";
246        } else {
247            filterParams += "&caseNbr=" + $scope.caseNum;
248        }
249
250        //filterParams += (($scope.caseNum != undefined || $scope.caseNum != "") ? "&caseNbr=" + $scope.caseNum : "&caseNbr=0");
251        filterParams += ($scope.claimNum != undefined ? "&claimNbr=" + $scope.claimNum : "&claimNbr=");
252        filterParams += ($scope.lastName != undefined ? "&examineeLastName=" + $scope.lastName : "&examineeLastName=");
253        filterParams += ($scope.firstName != undefined ? "&examineeFirstName=" + $scope.firstName : "&examineeFirstName=");
254
255        switch (userCode) {
256            case undefined:
257            case "reset":
258                filterParams += "&userCode={0}".format($rootScope.globals.currentUser.userCode);
259                break;
260            default:
261                filterParams += "&userCode={0}".format(userCode);
262                break;
263        }
264
265        filterAPIUrl + filterParams;
266
267        //console.log("***** filter URL: {0}{1} *****".format(filterAPIUrl, filterParams));
268
269        var filteredRequest = $http.get(filterAPIUrl + filterParams, headConfig).then(function (response) {
270            $scope.filteredData = response;
271            $scope.DataReady = false;
272        });
273
274        filteredRequest.then(function (filteredData) {
275            $scope.tableOptions.aoColumns = [
276                { mData: 'Case Number' },
277                { mData: 'Claim Number' },
278                { mData: 'Expert' },
279                { mData: 'Date of Service' },
280                { mData: 'Examinee' },
281                { mData: 'Business Line' },
282                { mData: 'Specialty' },
283                { mData: 'Service' },
284                { mData: 'Status' },
285                { mData: 'Adjuster' },
286                { mData: 'Action' }
287            ];
288
289            $scope.rows = $scope.filteredData.data;
290            $scope.DataReady = true;
291            //console.log("case table data");
292            //console.log($scope.rows);
293
294            if (count > 1) {
295                //console.log("clearing table;");
296                //if ($scope.Claim != undefined || $scope.Examinee != undefined || $scope.Case != undefined) {
297                // trying different clear method.
298                //console.log("running fnClearTable()");
299                $('#ReferralCaseTable').dataTable().fnClearTable();
300                //console.log("running fnDestroy()");
301                $('#ReferralCaseTable').dataTable().fnDestroy();
302                //console.log("table destroyed;");
303                $scope.reload = {};
304                // }
305            }
306        });
307    };
308
309    $scope.resetResults = function () {
310        APIUrl = $scope.app.baseAPIUrl + '/api/Dashboard/ReferralTracker?caseNbr=0&statusCode=&claimNbr=&examinee=';
311        $scope.$apply(function () {
312            $scope.caseNum = "";
313            $scope.claimNum = "";
314            $scope.fistName = "";
315            $scope.lastName = "";
316        });
317
318        $scope.DataReady = false;
319        count = 1 + count;
320
321        var resetRequest = $http.get(APIUrl, headConfig).then(function (response) {
322            $scope.CaseTableData = response;
323            $scope.DataReady = false;
324        });
325
326        resetRequest.then(function (CaseTableData) {
327            $scope.tableOptions.aoColumns = [
328                { mData: 'Claim' },
329                { mData: 'Examinee' },
330                { mData: 'Status' },
331                { mData: 'Adjuster' },
332                { mData: 'Case' },
333                { mData: 'Physician' },
334                { mData: 'Service' },
335                { mData: 'Date of Service' },
336                { mData: 'Action' }
337            ];
338            $scope.rows = $scope.filteredData.data;
339            $scope.DataReady = true;
340            //console.log("case table data");
341            //console.log($scope.rows);
342
343            if (count > 1) {
344                //console.log("clearing table;");
345                //if ($scope.Claim != undefined || $scope.Examinee != undefined || $scope.Case != undefined) {
346                // trying different clear method.
347                //console.log("running fnClearTable()");
348                $('#ReferralCaseTable').dataTable().fnClearTable();
349                //console.log("running fnDestroy()");
350                $('#ReferralCaseTable').dataTable().fnDestroy();
351                //console.log("table destroyed;");
352                $scope.reload = {};
353                // }
354            }
355        });
356    }
357
358    $scope.initCaseTable = function () {
359
360        var request = $http.get(APIUrl, headConfig).then(function (response) {
361            $scope.CaseTableData = response;
362        });
363
364        request.then(function (CaseTableData) {
365            $scope.tableOptions.aoColumns = [
366                { mData: 'Claim' },
367                { mData: 'Examinee' },
368                { mData: 'Status' },
369                { mData: 'Adjuster' },
370                { mData: 'Case' },
371                { mData: 'Physician' },
372                { mData: 'Service' },
373                { mData: 'Date of Service' },
374                { mData: 'Action' }
375            ];
376            $scope.rows = $scope.CaseTableData.data;
377            $scope.DataReady = true;
378            //console.log("case table data");
379            //console.log($scope.rows);
380        });
381    };
382
383    if (brand == "Medylex") {
384        $scope.actions = [
385            'Add Note',
386            'Upload Files',
387            'View Cover Letter',
388            'View Medical Records',
389        ];
390    } else {
391        $scope.actions = [
392            'Add Note',
393            'Upload Medical Records',
394            'View Cover Letter',
395            'View Medical Records',
396        ];
397    }
398
399    $scope.PAactions = [
400        'Add Note',
401        'Upload Medical Records',
402        'View Medical Records',
403    ];
404
405    $scope.action_Click = function (action) {
406        var actionObj = $("#" + action.id);
407        var queueStatusCode = actionObj.data("statuscode");
408        var actionType = actionObj.data("type");
409        var actionCaseNo = actionObj.data("extcasenbr");
410
411        switch (actionType) {
412            case "queuePrev":
413                $scope.moveCaseQueue("Prev", actionCaseNo, queueStatusCode);
414                break;
415            case "queueNext":
416                $scope.moveCaseQueue("Next", actionCaseNo, queueStatusCode);
417                break;
418            case "View Cover Letter":
419            case "View Medical Records":
420                fileListViewerV2($scope, actionObj, $modal);
421                break;
422            case "Add Note":
423                addCaseHistoryNoteV2($scope, actionCaseNo, $modal)
424                break;
425            case "Upload Medical Records":
426            case "Upload Files":
427                fileuploadpopupV2($scope, actionObj, $modal);
428                break;
429        }
430    }
431
432    $scope.moveCaseQueue = function (direction, caseNo, statusCode) {
433        console.log("actions: {0} {1} {2}".format(direction, caseNo, statusCode));
434
435        var url = $scope.app.baseAPIUrl + "/api/medylex/changequeue?caseNbr={0}&queueStatusCode={1}&direction={2}";
436        url = url.format(caseNo, statusCode, direction);
437        $http({
438            dataType: "json",
439            method: "POST",
440            data: null,
441            url: url,
442            headers: headConfig
443        }).then(function (response) {
444            console.log(response);
445            $scope.searchCases(
446                $scope.medylexReloadParams.firstName,
447                $scope.medylexReloadParams.lastName,
448                $scope.medylexReloadParams.caseNbr,
449                $scope.medylexReloadParams.claimNbr
450            )                      
451        });
452    }
453
454    $scope.quickView = function (id) {
455        quickView($scope, $modal, id);
456    }
457});

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.