123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- //@ sourceURL=request-config.js
- $(function () {
- $(".selectpicker").selectpicker({
- dropuAuto: false
- });
- initDeptSelect();
- //告警阈值
- $.ajax({
- type: "GET",
- url: '/thmz/getConfigByKey?key=alarm_num',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- $("#alarmNum").val(res.data.configValue);
- }
- });
- $('#send').click(function () {
- //修改告警设置
- $.ajax({
- type: "POST",
- contentType: "application/json;charset=UTF-8",
- url: '/thmz/setConfig',
- dataType: "json",
- data: JSON.stringify({"configKey": "alarm_num","configValue": $("#alarmNum").val()}),
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- //修改告警人员
- var doctor=$("#doctor").val();
- var doctorStr=null;
- if(doctor!=null && doctor.length>0){
- for (var i=0;i<doctor.length;i++){
- if(doctorStr==null){
- doctorStr=doctor[i];
- }else {
- doctorStr+=","+doctor[i];
- }
- }
- }
- $.ajax({
- type: "POST",
- contentType: "application/json;charset=UTF-8",
- url: '/thmz/setConfig',
- dataType: "json",
- data: JSON.stringify({"configKey": "alarm_user","configValue": doctorStr}),
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- successMesage(res);
- } else {
- errorMesage(res);
- }
- }
- });
- } else {
- errorMesage(res);
- }
- }
- });
- });
- });
- /**
- * 挂号列表中的科室列表
- */
- function initDeptSelect() {
- //科室列表
- $.ajax({
- type: "GET",
- url: '/thmz/allMzUnitCode',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (data) {
- if (data == '401' || data == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var html = '<option value=""></option>';
- $.each(data.data, function (commentIndex, comment) {
- html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
- });
- $('#deptNo').empty();
- $('#deptNo').html(html);
- $('#deptNo').selectpicker('refresh');
- $("#deptNo").selectpicker('val', '1400002');
- $("#deptNo").selectpicker('refresh');
- initDoctorSelect();
- }
- });
- }
- /**
- * 挂号列表中的医生列表初始化
- */
- function initDoctorSelect() {
- //医生列表
- $.ajax({
- type: "GET",
- url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNo').val(),
- //url: '/thmz/listEmployeeByDepts?depts=null',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var html = '<option value=""></option>';
- $.each(res.data, function (commentIndex, comment) {
- html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + ' (' + comment.deptName + ') </option>';
- });
- $('#doctor').empty();
- $('#doctor').html(html);
- $('#doctor').selectpicker('destroy').selectpicker('refresh');
- //告警人员设置
- $.ajax({
- type: "GET",
- url: '/thmz/getConfigByKey?key=alarm_user',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- var doctorStr=res.data.configValue;
- if(doctorStr!=null && doctorStr!=''){
- var arr =doctorStr.split(",");
- $("#doctor").selectpicker('val', arr);
- $("#doctor").selectpicker('refresh');
- }
- }
- });
- }
- });
- }
|