@@ -324,12 +381,17 @@ var points=[
{id:7,name:'姬塬作业区医疗点',addr:'采油三厂筹备组姬塬先导试验区板房区',unit:'采油一厂',leader:'杨慧敏',found:'2024-02-27',hospital:null},
{id:8,name:'乌审旗采气区医疗点',addr:'采气一厂苏里格南作业区营地',unit:'采气一厂',leader:'徐立成',found:'2020-12-11',hospital:'庆阳市人民医院'}
];
-var hospitals=[
- {id:1,name:'CQ油田总医院',level:'三级甲等',addr:'西峰区长庆北路1号',admins:[['hgt_admin','石维国'],['hgt_nurse01','李桂芳']]},
- {id:2,name:'第四采油厂总医院',level:'二级甲等',addr:'西峰区石油西路22号',admins:[['sgyy_admin','高建军']]},
- {id:3,name:'环县油田医院',level:'二级甲等',addr:'环县环城镇新区大街8号',admins:[['hx_admin','赵万福']]},
- {id:4,name:'吴起油田医院',level:'一级',addr:'吴起县红旗街西段',admins:[]},
- {id:5,name:'庆阳市人民医院',level:'三级甲等',addr:'西峰区兰州路456号',admins:[['qyrm_admin','徐立成']]}
+/* 系统管理模块配置的医院主数据池;partner=true 表示已标记为医疗点合作医院 */
+var sysHospitals=[
+ {id:1,name:'CQ油田总医院',level:'三级甲等',addr:'西峰区长庆北路1号',intro:'长庆油田职工医院,承担油田一线医疗保障与职业病防治任务。',admins:[['hgt_admin','石维国'],['hgt_nurse01','李桂芳']],partner:true},
+ {id:2,name:'第四采油厂总医院',level:'二级甲等',addr:'西峰区石油西路22号',intro:'面向第四采油厂职工及家属的二级综合医院。',admins:[['sgyy_admin','高建军']],partner:true},
+ {id:3,name:'环县油田医院',level:'二级甲等',addr:'环县环城镇新区大街8号',intro:'服务环县油区职工的二级综合医院。',admins:[['hx_admin','赵万福']],partner:true},
+ {id:4,name:'吴起油田医院',level:'一级',addr:'吴起县红旗街西段',intro:'吴起县油区基层医疗机构。',admins:[],partner:true},
+ {id:5,name:'庆阳市人民医院',level:'三级甲等',addr:'西峰区兰州路456号',intro:'庆阳市三级甲等综合医院,区域医疗中心。',admins:[['qyrm_admin','徐立成']],partner:true},
+ {id:6,name:'长庆石油总医院',level:'三级甲等',addr:'西安市未央区凤城四路58号',intro:'长庆油田总部综合性医院。',admins:[],partner:false},
+ {id:7,name:'延安大学附属医院',level:'三级甲等',addr:'延安市宝塔区北大街43号',intro:'延安地区三级甲等综合医院。',admins:[],partner:false},
+ {id:8,name:'定边县人民医院',level:'二级甲等',addr:'定边县定边镇鼓楼南大街',intro:'定边县二级甲等综合医院。',admins:[],partner:false},
+ {id:9,name:'榆林市第一医院',level:'三级甲等',addr:'榆林市榆阳区西沙柳营东路',intro:'榆林市区域医疗中心。',admins:[],partner:false}
];
var curHosp=null,pendingRemove=null;
@@ -338,7 +400,7 @@ function jurCount(h){return points.filter(function(p){return p.hospital===h;}).l
function renderTable(){
var name=document.getElementById('filterName').value.trim();
var level=document.getElementById('filterLevel').value;
- var list=hospitals.filter(function(h){return (!name||h.name.indexOf(name)!==-1)&&(!level||h.level===level);});
+ var list=sysHospitals.filter(function(h){return h.partner&&(!name||h.name.indexOf(name)!==-1)&&(!level||h.level===level);});
var tbody=document.getElementById('tableBody');
if(!list.length){tbody.innerHTML='
| 暂无匹配数据 |
';return;}
var html='';
@@ -356,6 +418,7 @@ function renderTable(){
+''
+''
+''
+ +''
+' | ';
});
tbody.innerHTML=html;
@@ -364,7 +427,7 @@ function applyFilter(){renderTable();}
function resetFilter(){document.getElementById('filterName').value='';document.getElementById('filterLevel').value='';renderTable();}
/* ===== 管辖范围抽屉 ===== */
-function hospById(id){return hospitals.find(function(h){return h.id===id;});}
+function hospById(id){return sysHospitals.find(function(h){return h.id===id;});}
function openJur(id){
curHosp=hospById(id);
document.getElementById('jurTitle').textContent='管辖范围 · '+curHosp.name;
@@ -405,50 +468,159 @@ function confirmPick(){
}
function askRemove(kind,val){
pendingRemove={kind:kind,val:val};
- document.getElementById('delText').textContent=kind==='point'
- ?('确认将该医疗点从「'+curHosp.name+'」管辖范围移除?移除后该医疗点需重新指定归属医院。')
- :('确认移除管理员账号「'+pendingRemove.val+'」?其历史操作记录保留。');
+ var text;
+ if(kind==='point'){
+ text='确认将该医疗点从「'+curHosp.name+'」管辖范围移除?移除后该医疗点需重新指定归属医院。';
+ }else if(kind==='admin'){
+ text='确认移除管理员账号「'+val+'」?其历史操作记录保留。';
+ }else if(kind==='hospital'){
+ var h=hospById(val);
+ text='确认取消「'+h.name+'」的合作医院标记?取消后该医院将从列表移除,其管辖的医疗点需重新指定归属。';
+ }else if(kind==='adminBatch'){
+ text='确认批量移除 '+val.length+' 个管理员账号?其历史操作记录保留。';
+ }
+ document.getElementById('delText').textContent=text;
document.getElementById('delMask').classList.add('open');
}
function confirmRemove(){
if(pendingRemove.kind==='point'){
points.find(function(p){return p.id===+pendingRemove.val;}).hospital=null;
renderJur();renderTable();showToast('医疗点已移除管辖');
- }else{
+ }else if(pendingRemove.kind==='admin'){
curHosp.admins=curHosp.admins.filter(function(a){return a[0]!==pendingRemove.val;});
renderAdmin();renderTable();showToast('管理员已移除');
+ }else if(pendingRemove.kind==='adminBatch'){
+ var accounts=pendingRemove.val;
+ curHosp.admins=curHosp.admins.filter(function(a){return accounts.indexOf(a[0])===-1;});
+ renderAdmin();renderTable();showToast('已移除 '+accounts.length+' 个管理员');
+ }else if(pendingRemove.kind==='hospital'){
+ var h=hospById(pendingRemove.val);
+ points.forEach(function(p){if(p.hospital===h.name)p.hospital=null;});
+ h.partner=false;
+ closeDrawer('hp');
+ renderTable();showToast('已取消合作医院标记');
}
closeModal('delMask');
}
+/* ===== 新增/编辑合作医院抽屉 ===== */
+var hpSelected=null;
+function openHospital(){
+ document.getElementById('hpTitle').textContent='新增合作医院';
+ var sel=document.getElementById('hpSelect');
+ var opts=sysHospitals.filter(function(x){return !x.partner;});
+ sel.innerHTML=''+opts.map(function(x){return '';}).join('');
+ sel.disabled=false;
+ hpSelected=null;
+ clearHpEcho();
+ document.getElementById('hpMask').classList.add('open');
+ document.getElementById('hpDrawer').classList.add('open');
+}
+function onHpSelect(){
+ var id=+document.getElementById('hpSelect').value;
+ hpSelected=id?hospById(id):null;
+ if(hpSelected){echoHp(hpSelected);}else{clearHpEcho();}
+}
+function echoHp(h){
+ document.getElementById('hpLevel').value=h.level;
+ document.getElementById('hpAddr').value=h.addr;
+ document.getElementById('hpIntro').value=h.intro||'';
+}
+function clearHpEcho(){
+ document.getElementById('hpLevel').value='';
+ document.getElementById('hpAddr').value='';
+ document.getElementById('hpIntro').value='';
+}
+function saveHospital(){
+ if(!hpSelected){showToast('请先选择医院');return;}
+ hpSelected.partner=true;
+ closeDrawer('hp');
+ renderTable();
+ showToast('已将「'+hpSelected.name+'」标记为合作医院');
+}
/* ===== 医院管理员抽屉 ===== */
function openAdmin(id){
curHosp=hospById(id);
- document.getElementById('adminTitle').textContent='医院管理员 · '+curHosp.name;
- toggleAdminForm(false);
+ document.getElementById('adminHospName').textContent='医院名称:'+curHosp.name;
+ document.getElementById('adminHospLevel').textContent='医院等级:'+curHosp.level;
+ hideAdminForm();
renderAdmin();
document.getElementById('adminMask').classList.add('open');
document.getElementById('adminDrawer').classList.add('open');
}
function renderAdmin(){
- document.getElementById('adminBody').innerHTML=curHosp.admins.length?curHosp.admins.map(function(a){
- return '| '+a[0]+' | '+a[1]+' | 2026-0'+((a[1].length%8)+1)+'-1'+(a[0].length%9)+' | '
- +' |
';
- }).join(''):'| 暂未设置管理员 |
';
+ var rows=curHosp.admins;
+ document.getElementById('adminBody').innerHTML=rows.length?rows.map(function(a){
+ var t='2026-0'+((a[1].length%8)+1)+'-1'+(a[0].length%9);
+ return ''
+ +' | '
+ +''+a[0]+' | '+a[1]+' | '+t+' | '
+ +''
+ +''
+ +''
+ +''
+ +' |
';
+ }).join(''):'| 暂未设置管理员 |
';
}
-function toggleAdminForm(show){
- document.getElementById('adminForm').style.display=show?'':'none';
- if(show){['aUser','aName','aPwd','aPwd2'].forEach(function(id){document.getElementById(id).value='';});}
+var adminEditUser=null;
+function showAdminForm(account){
+ adminEditUser=account;
+ document.getElementById('adminForm').style.display='';
+ var u=document.getElementById('aUser');
+ if(account){
+ var a=curHosp.admins.find(function(x){return x[0]===account;});
+ u.value=a[0];u.disabled=true;
+ document.getElementById('aName').value=a[1];
+ document.getElementById('aPwdGroup').style.display='none';
+ }else{
+ u.value='';u.disabled=false;
+ document.getElementById('aName').value='';
+ document.getElementById('aPwd').value='';
+ document.getElementById('aPwd2').value='';
+ document.getElementById('aPwdGroup').style.display='';
+ }
+}
+function hideAdminForm(){
+ document.getElementById('adminForm').style.display='none';
+ document.getElementById('aUser').disabled=false;
}
function saveAdmin(){
var u=document.getElementById('aUser').value.trim(),n=document.getElementById('aName').value.trim();
- var p1=document.getElementById('aPwd').value,p2=document.getElementById('aPwd2').value;
if(!u||!n){showToast('请填写账号与姓名');return;}
- if(p1.length<8){showToast('初始密码不少于8位');return;}
+ if(adminEditUser){
+ var a=curHosp.admins.find(function(x){return x[0]===adminEditUser;});
+ a[1]=n;
+ hideAdminForm();renderAdmin();renderTable();
+ showToast('管理员「'+n+'」已更新');
+ }else{
+ var p1=document.getElementById('aPwd').value,p2=document.getElementById('aPwd2').value;
+ if(p1.length<8){showToast('初始密码不少于8位');return;}
+ if(p1!==p2){showToast('两次输入的密码不一致');return;}
+ curHosp.admins.push([u,n]);
+ hideAdminForm();renderAdmin();renderTable();
+ showToast('管理员「'+n+'」已创建');
+ }
+}
+function adminPickAll(el){
+ document.querySelectorAll('.admin-check').forEach(function(c){c.checked=el.checked;});
+}
+function batchRemoveAdmin(){
+ var accounts=[].slice.call(document.querySelectorAll('.admin-check:checked')).map(function(c){return c.value;});
+ if(!accounts.length){showToast('请先勾选管理员');return;}
+ askRemove('adminBatch',accounts);
+}
+function openResetPwd(account){
+ document.getElementById('resetPwdUser').textContent=account;
+ document.getElementById('rpPwd').value='';
+ document.getElementById('rpPwd2').value='';
+ document.getElementById('resetPwdMask').classList.add('open');
+}
+function confirmResetPwd(){
+ var p1=document.getElementById('rpPwd').value,p2=document.getElementById('rpPwd2').value;
+ if(p1.length<8){showToast('新密码不少于8位');return;}
if(p1!==p2){showToast('两次输入的密码不一致');return;}
- curHosp.admins.push([u,n]);
- toggleAdminForm(false);renderAdmin();renderTable();
- showToast('管理员「'+n+'」已创建');
+ closeModal('resetPwdMask');
+ showToast('密码已重置');
}
/* ===== 通用 ===== */