Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03745e19c3 | ||
|
|
be9f10e968 | ||
|
|
6e1b793b40 | ||
|
|
e90e8c30ff |
90
app.py
90
app.py
@@ -77,6 +77,30 @@ def compute_stats():
|
||||
total_evening = 0
|
||||
total_study = 0
|
||||
calendar = {}
|
||||
all_morning_items = []
|
||||
all_evening_items = []
|
||||
all_study_items = []
|
||||
|
||||
# 关键词 → 板块 自动归类规则
|
||||
PILLAR_KEYWORDS = {
|
||||
'医药营销': ['科普','科研','学术会议','学术','会议','患者管理','临床推广','临床','药企','处方','KOL','代表','拜访','荣昌','恒瑞','信达','鲁银','OPC','项目','标杆','客户'],
|
||||
'医疗服务': ['诊疗','治疗','医生','医院','科室','手术','门诊','患者','病','护理','诊断','影像','检验'],
|
||||
'医疗支付': ['医保','商保','理赔','支付','保险','费用','报销','商业保险','保单'],
|
||||
'AI 智能': ['AI','数字人','智能','算法','自动化','平台','系统','网站','开发','代码','程序','模型'],
|
||||
'公司治理': ['团队','组织','管理','招聘','HR','制度','流程','财务','考核','KPI','规划','人才','架构','预算'],
|
||||
'个人修养': ['早起','睡觉','俯卧撑','运动','冥想','阅读','复盘','写作','习惯','修身','立志','责善','改过','勤学'],
|
||||
}
|
||||
|
||||
def classify_auto(text):
|
||||
"""根据文本内容自动归类"""
|
||||
if not text or not text.strip():
|
||||
return ''
|
||||
text_lower = text.strip()
|
||||
for pillar, keywords in PILLAR_KEYWORDS.items():
|
||||
for kw in keywords:
|
||||
if kw in text_lower:
|
||||
return pillar
|
||||
return '' # 未匹配
|
||||
|
||||
for row in rows:
|
||||
d = row['date']
|
||||
@@ -85,7 +109,41 @@ def compute_stats():
|
||||
evening = data.get('evening', [])
|
||||
study = data.get('study', [])
|
||||
|
||||
morning_count = sum(1 for x in morning if isinstance(x, str) and x.strip())
|
||||
# 收集并自动归类
|
||||
for mi in morning:
|
||||
text = mi if isinstance(mi, str) else mi.get('text', '')
|
||||
if isinstance(text, str) and text.strip():
|
||||
auto_pillar = mi.get('pillar', '') if isinstance(mi, dict) else ''
|
||||
if not auto_pillar:
|
||||
auto_pillar = classify_auto(text)
|
||||
all_morning_items.append({'text': text.strip(), 'pillar': auto_pillar})
|
||||
|
||||
for ei in evening:
|
||||
if isinstance(ei, dict):
|
||||
m = (ei.get('mistake') or '').strip()
|
||||
imp = (ei.get('improvement') or '').strip()
|
||||
if m or imp:
|
||||
pillar = ei.get('pillar', '') or classify_auto(m + ' ' + imp)
|
||||
all_evening_items.append({'mistake': m, 'improvement': imp, 'pillar': pillar})
|
||||
elif isinstance(ei, str) and ei.strip():
|
||||
all_evening_items.append({'mistake': ei.strip(), 'improvement': '', 'pillar': classify_auto(ei)})
|
||||
|
||||
for si in study:
|
||||
name = si.get('name', '') if isinstance(si, dict) else str(si)
|
||||
if name.strip():
|
||||
pillar = si.get('pillar', '') if isinstance(si, dict) else ''
|
||||
if not pillar:
|
||||
pillar = classify_auto(name)
|
||||
all_study_items.append({
|
||||
'name': name.strip(),
|
||||
'done': si.get('done', False) if isinstance(si, dict) else False,
|
||||
'pillar': pillar
|
||||
})
|
||||
|
||||
morning_count = sum(1 for x in morning if (
|
||||
isinstance(x, str) and x.strip() or
|
||||
isinstance(x, dict) and (x.get('text', '') or '').strip()
|
||||
))
|
||||
evening_count = sum(1 for x in evening if (
|
||||
isinstance(x, str) and x.strip() or
|
||||
isinstance(x, dict) and (x.get('mistake', '') or '').strip()
|
||||
@@ -103,10 +161,38 @@ def compute_stats():
|
||||
# day_score = 60 + extra * 5 (不在此处使用,仅用于日历状态)
|
||||
calendar[d] = 'pass' if all_three else 'fail'
|
||||
|
||||
# 构建板块统计
|
||||
pillars = ['医疗服务','医药营销','医疗支付','AI 智能','公司治理','个人修养']
|
||||
pillar_breakdown = {}
|
||||
for p in pillars:
|
||||
pillar_breakdown[p] = {
|
||||
'morning': 0, 'evening': 0, 'study': 0,
|
||||
'morning_items': [], 'evening_items': [], 'study_items': []
|
||||
}
|
||||
for mi in all_morning_items:
|
||||
p = mi['pillar']
|
||||
if p in pillar_breakdown:
|
||||
pillar_breakdown[p]['morning'] += 1
|
||||
pillar_breakdown[p]['morning_items'].append(mi)
|
||||
for ei in all_evening_items:
|
||||
p = ei['pillar']
|
||||
if p in pillar_breakdown:
|
||||
pillar_breakdown[p]['evening'] += 1
|
||||
pillar_breakdown[p]['evening_items'].append(ei)
|
||||
for si in all_study_items:
|
||||
p = si['pillar']
|
||||
if p in pillar_breakdown:
|
||||
pillar_breakdown[p]['study'] += 1
|
||||
pillar_breakdown[p]['study_items'].append(si)
|
||||
|
||||
return dict(
|
||||
total_days=total_days, total_morning=total_morning,
|
||||
total_evening=total_evening, total_study=total_study,
|
||||
calendar=calendar
|
||||
calendar=calendar,
|
||||
morning_items=all_morning_items,
|
||||
evening_items=all_evening_items,
|
||||
study_items=all_study_items,
|
||||
pillar_breakdown=pillar_breakdown
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,16 @@
|
||||
'知识库能力提升'
|
||||
];
|
||||
|
||||
/* 蓝图六板块 */
|
||||
var PILLARS = [
|
||||
{key:'medical_service', name:'医疗服务', emoji:'🥼'},
|
||||
{key:'pharma_mkt', name:'医药营销', emoji:'💊'},
|
||||
{key:'payment', name:'医疗支付', emoji:'🛡️'},
|
||||
{key:'ai', name:'AI 智能', emoji:'🤖'},
|
||||
{key:'governance', name:'公司治理', emoji:'🏛️'},
|
||||
{key:'self_cultivation', name:'个人修养', emoji:'🎯'}
|
||||
];
|
||||
|
||||
/* ================================================================
|
||||
Toast
|
||||
================================================================ */
|
||||
@@ -106,6 +116,7 @@
|
||||
if (name === 'weekly') loadWeekly();
|
||||
if (name === 'history') loadHistory();
|
||||
if (name === 'wishes') loadWishes();
|
||||
if (name === 'blueprint') loadBlueprint();
|
||||
};
|
||||
|
||||
/* ================================================================
|
||||
@@ -269,7 +280,10 @@
|
||||
// 早间立志
|
||||
document.getElementById('morning-list').innerHTML = '';
|
||||
if (morning.length === 0) morning = [''];
|
||||
for (var m=0; m<morning.length; m++) addMorningRow(morning[m]);
|
||||
for (var m=0; m<morning.length; m++) {
|
||||
var txt = typeof morning[m] === 'string' ? morning[m] : (morning[m].text || '');
|
||||
addMorningRow(txt);
|
||||
}
|
||||
|
||||
// 责善改过
|
||||
document.getElementById('evening-list').innerHTML = '';
|
||||
@@ -299,11 +313,12 @@
|
||||
function addMorningRow(val) {
|
||||
var container = document.getElementById('morning-list');
|
||||
var idx = container.children.length;
|
||||
val = val || '';
|
||||
var text = typeof val === 'string' ? val : (val && val.text ? val.text : '');
|
||||
text = text || '';
|
||||
var div = document.createElement('div');
|
||||
div.className = 'item-row';
|
||||
div.innerHTML = '<span class="idx">' + (idx+1) + '.</span>' +
|
||||
'<input type="text" value="' + esc(val) + '" placeholder="今天最重要的一件事…">' +
|
||||
'<input type="text" value="' + esc(text) + '" placeholder="今天最重要的一件事…">' +
|
||||
'<button class="btn-del" onclick="this.parentElement.remove();renumberMorning()"><svg class="icon-sm"><use href="#icon-x"/></svg></button>';
|
||||
container.appendChild(div);
|
||||
renumberMorning();
|
||||
@@ -520,13 +535,20 @@
|
||||
var panel = document.getElementById('panel-daily');
|
||||
if (!panel) return;
|
||||
|
||||
// 输入框 & 文本域:失去焦点时保存
|
||||
// 输入框 & 文本域 & 下拉选择器:失去焦点时保存
|
||||
panel.addEventListener('blur', function(e) {
|
||||
if (e.target.matches('input[type="text"], textarea, input[type="date"]')) {
|
||||
if (e.target.matches('input[type="text"], textarea, input[type="date"], select')) {
|
||||
triggerAutoSave();
|
||||
}
|
||||
}, true);
|
||||
|
||||
// 选择器:change 事件也保存(及时响应)
|
||||
panel.addEventListener('change', function(e) {
|
||||
if (e.target.matches('select.morning-pillar')) {
|
||||
triggerAutoSave();
|
||||
}
|
||||
});
|
||||
|
||||
// 复选框:change 事件
|
||||
panel.addEventListener('change', function(e) {
|
||||
if (e.target.matches('input[type="checkbox"]')) {
|
||||
@@ -983,6 +1005,38 @@
|
||||
|
||||
window.renderWishes = renderWishes;
|
||||
|
||||
/* ================================================================
|
||||
Blueprint — 蓝图六板块
|
||||
================================================================ */
|
||||
|
||||
function loadBlueprint() {
|
||||
apiGetStats(function(err, data) {
|
||||
if (err || !data || !data.pillar_breakdown) return;
|
||||
var pb = data.pillar_breakdown;
|
||||
PILLARS.forEach(function(p){
|
||||
var el = document.getElementById('bp-count-' + p.name);
|
||||
var info = pb[p.name] || {};
|
||||
var m = info.morning || 0, e = info.evening || 0, s = info.study || 0;
|
||||
if (el) el.textContent = '立志' + m + ' · 责善' + e + ' · 勤学' + s;
|
||||
// 显示详情列表
|
||||
var detailEl = document.getElementById('bp-detail-' + p.name);
|
||||
if (detailEl) {
|
||||
var html = '';
|
||||
(info.morning_items || []).forEach(function(mi){
|
||||
html += '<div class="bp-item" data-type="morning">🥼 ' + esc(mi.text) + '</div>';
|
||||
});
|
||||
(info.evening_items || []).forEach(function(ei){
|
||||
html += '<div class="bp-item" data-type="evening">🔍 ' + esc(ei.mistake || ei.improvement) + '</div>';
|
||||
});
|
||||
(info.study_items || []).forEach(function(si){
|
||||
html += '<div class="bp-item" data-type="study">📚 ' + esc(si.name) + '</div>';
|
||||
});
|
||||
detailEl.innerHTML = html || '<div class="bp-empty">暂无记录</div>';
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
Init
|
||||
================================================================ */
|
||||
|
||||
@@ -546,18 +546,17 @@ body {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 6px 12px;
|
||||
padding: 8px 14px;
|
||||
border: 1.5px solid var(--border);
|
||||
background: var(--card);
|
||||
color: var(--text-dim);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
font-family: inherit;
|
||||
margin-left: 6px;
|
||||
}
|
||||
.btn-cal-sync:hover {
|
||||
border-color: var(--primary);
|
||||
@@ -1424,3 +1423,64 @@ body {
|
||||
}
|
||||
.main-content { height: auto; overflow: visible; padding: 16px; }
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Blueprint Panel
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
.blueprint-mission {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--primary);
|
||||
margin-bottom: 24px;
|
||||
padding: 12px 16px;
|
||||
background: var(--primary-light);
|
||||
border-radius: var(--radius);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.blueprint-pillars {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.blueprint-pillar {
|
||||
background: var(--card);
|
||||
border: 1.5px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 20px 16px;
|
||||
text-align: center;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
.blueprint-pillar:hover {
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 4px 16px rgba(74,108,247,0.08);
|
||||
}
|
||||
|
||||
.bp-icon { font-size: 32px; margin-bottom: 8px; }
|
||||
.bp-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
|
||||
.bp-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
|
||||
.bp-count { font-size: 13px; font-weight: 600; color: var(--primary); }
|
||||
|
||||
.bp-detail {
|
||||
margin-top: 10px;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
max-height: 120px;
|
||||
overflow-y: auto;
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 8px;
|
||||
}
|
||||
.bp-item {
|
||||
padding: 2px 0;
|
||||
color: var(--text-dim);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.bp-empty { color: var(--text-muted); text-align: center; padding: 6px 0; }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.blueprint-pillars { grid-template-columns: repeat(2, 1fr); }
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@
|
||||
<svg class="icon-sm"><use href="#icon-list-bullet"/></svg>
|
||||
历史记录
|
||||
</a>
|
||||
<a class="nav-item" data-panel="blueprint" onclick="switchPanel('blueprint')">
|
||||
<svg class="icon-sm"><use href="#icon-star"/></svg>
|
||||
蓝图
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<!-- 底部新建按钮 -->
|
||||
@@ -269,6 +273,60 @@
|
||||
<div class="wishes-empty" id="wishes-empty" style="display:none">暂无心愿,点击上方按钮添加</div>
|
||||
</section>
|
||||
|
||||
<!-- ── 蓝图面板 ── -->
|
||||
<section class="panel" id="panel-blueprint">
|
||||
<div class="panel-header">
|
||||
<h2>蓝图 · 数字医疗集团</h2>
|
||||
</div>
|
||||
<div class="blueprint-mission">
|
||||
一辈子,干成一件事 — 用 AI 重构医疗全链路
|
||||
</div>
|
||||
<div class="blueprint-pillars" id="blueprint-pillars">
|
||||
<div class="blueprint-pillar" data-pillar="医疗服务">
|
||||
<div class="bp-icon">🥼</div>
|
||||
<div class="bp-name">医疗服务</div>
|
||||
<div class="bp-desc">诊疗能力 · 临床路径 · 医疗质量</div>
|
||||
<div class="bp-count" id="bp-count-医疗服务">—</div>
|
||||
<div class="bp-detail" id="bp-detail-医疗服务"></div>
|
||||
</div>
|
||||
<div class="blueprint-pillar" data-pillar="医药营销">
|
||||
<div class="bp-icon">💊</div>
|
||||
<div class="bp-name">医药营销</div>
|
||||
<div class="bp-desc">科普 · 科研 · 学术会议 · 患者管理</div>
|
||||
<div class="bp-count" id="bp-count-医药营销">—</div>
|
||||
<div class="bp-detail" id="bp-detail-医药营销"></div>
|
||||
</div>
|
||||
<div class="blueprint-pillar" data-pillar="医疗支付">
|
||||
<div class="bp-icon">🛡️</div>
|
||||
<div class="bp-name">医疗支付</div>
|
||||
<div class="bp-desc">医保 · 商保 · 支付闭环</div>
|
||||
<div class="bp-count" id="bp-count-医疗支付">—</div>
|
||||
<div class="bp-detail" id="bp-detail-医疗支付"></div>
|
||||
</div>
|
||||
<div class="blueprint-pillar" data-pillar="AI 智能">
|
||||
<div class="bp-icon">🤖</div>
|
||||
<div class="bp-name">AI 智能</div>
|
||||
<div class="bp-desc">数字人 · 智能平台 · AI 赋能</div>
|
||||
<div class="bp-count" id="bp-count-AI 智能">—</div>
|
||||
<div class="bp-detail" id="bp-detail-AI 智能"></div>
|
||||
</div>
|
||||
<div class="blueprint-pillar" data-pillar="公司治理">
|
||||
<div class="bp-icon">🏛️</div>
|
||||
<div class="bp-name">公司治理</div>
|
||||
<div class="bp-desc">组织 · 人才 · 制度 · 文化</div>
|
||||
<div class="bp-count" id="bp-count-公司治理">—</div>
|
||||
<div class="bp-detail" id="bp-detail-公司治理"></div>
|
||||
</div>
|
||||
<div class="blueprint-pillar" data-pillar="个人修养">
|
||||
<div class="bp-icon">🎯</div>
|
||||
<div class="bp-name">个人修养</div>
|
||||
<div class="bp-desc">立志 · 责善 · 改过 · 勤学</div>
|
||||
<div class="bp-count" id="bp-count-个人修养">—</div>
|
||||
<div class="bp-detail" id="bp-detail-个人修养"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user