Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ac6f1af6b | ||
|
|
8c81fae334 | ||
|
|
67505414d9 | ||
|
|
03745e19c3 | ||
|
|
be9f10e968 | ||
|
|
6e1b793b40 | ||
|
|
e90e8c30ff | ||
|
|
046f144896 | ||
|
|
ba592c07b7 | ||
|
|
105d62f8db |
91
app.py
91
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,42 @@ 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,
|
||||
'note': si.get('note', '') if isinstance(si, dict) else '',
|
||||
'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 +162,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
|
||||
)
|
||||
|
||||
|
||||
|
||||
107
static/app.js
107
static/app.js
@@ -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
|
||||
================================================================ */
|
||||
@@ -76,7 +86,7 @@
|
||||
function apiGetStats(cb) {
|
||||
fetch('/api/stats')
|
||||
.then(function(r){ return r.json(); })
|
||||
.then(function(res){ if (res.ok) cb(null, res.data); else cb(res.error); })
|
||||
.then(function(res){ if (res.ok) cb(null, res); else cb(res.error); })
|
||||
.catch(function(e){ cb(e.message); });
|
||||
}
|
||||
|
||||
@@ -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,79 @@
|
||||
|
||||
window.renderWishes = renderWishes;
|
||||
|
||||
/* ================================================================
|
||||
Blueprint — 蓝图六板块
|
||||
================================================================ */
|
||||
|
||||
var blueprintData = null;
|
||||
var blueprintFilter = 'all';
|
||||
|
||||
function loadBlueprint() {
|
||||
apiGetStats(function(err, data) {
|
||||
if (err || !data || !data.pillar_breakdown) return;
|
||||
blueprintData = data.pillar_breakdown;
|
||||
renderBlueprintPillars(blueprintData);
|
||||
renderBlueprintList();
|
||||
});
|
||||
}
|
||||
|
||||
function renderBlueprintPillars(pb) {
|
||||
var container = document.getElementById('blueprint-pillars');
|
||||
if (!container) return;
|
||||
var html = '';
|
||||
PILLARS.forEach(function(p){
|
||||
html += '<div class="blueprint-pillar" data-pillar="' + p.name + '">' +
|
||||
'<div class="bp-icon">' + p.emoji + '</div>' +
|
||||
'<div class="bp-name">' + p.name + '</div>' +
|
||||
'</div>';
|
||||
});
|
||||
container.innerHTML = html;
|
||||
}
|
||||
|
||||
function renderBlueprintList() {
|
||||
var list = document.getElementById('bp-list');
|
||||
var empty = document.getElementById('bp-list-empty');
|
||||
if (!list || !blueprintData) return;
|
||||
var items = [];
|
||||
PILLARS.forEach(function(p){
|
||||
var info = blueprintData[p.name] || {};
|
||||
if (blueprintFilter === 'all' || blueprintFilter === 'morning') {
|
||||
(info.morning_items || []).forEach(function(mi){ items.push({pillar: p, text: mi.text, type: 'morning'}); });
|
||||
}
|
||||
if (blueprintFilter === 'all' || blueprintFilter === 'evening') {
|
||||
(info.evening_items || []).forEach(function(ei){ items.push({pillar: p, text: ei.mistake || ei.improvement, type: 'evening'}); });
|
||||
}
|
||||
if (blueprintFilter === 'all' || blueprintFilter === 'study') {
|
||||
(info.study_items || []).forEach(function(si){ items.push({pillar: p, text: si.name, type: 'study', done: si.done, note: si.note}); });
|
||||
}
|
||||
});
|
||||
if (items.length === 0) {
|
||||
list.innerHTML = '';
|
||||
if (empty) empty.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
if (empty) empty.style.display = 'none';
|
||||
var typeLabels = {morning: '立志', evening: '责善', study: '勤学'};
|
||||
var html = '';
|
||||
items.forEach(function(item){
|
||||
var noteHtml = item.type === 'study' && item.note ? '<span class="bp-item-note">' + esc(item.note) + '</span>' : '';
|
||||
html += '<div class="bp-list-item">' +
|
||||
'<span class="bp-item-pillar">' + item.pillar.emoji + ' ' + item.pillar.name + '</span>' +
|
||||
'<span class="bp-item-type ' + item.type + '">' + (typeLabels[item.type] || item.type) + '</span>' +
|
||||
'<span class="bp-item-text">' + esc(item.text) + '</span>' +
|
||||
noteHtml +
|
||||
'</div>';
|
||||
});
|
||||
list.innerHTML = html;
|
||||
}
|
||||
|
||||
window.filterBlueprint = function(btn) {
|
||||
blueprintFilter = btn.dataset.filter;
|
||||
document.querySelectorAll('.bp-tab').forEach(function(t){ t.classList.remove('active'); });
|
||||
btn.classList.add('active');
|
||||
renderBlueprintList();
|
||||
};
|
||||
|
||||
/* ================================================================
|
||||
Init
|
||||
================================================================ */
|
||||
|
||||
158
static/style.css
158
static/style.css
@@ -428,6 +428,12 @@ body {
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.panel-header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.check-date-input {
|
||||
padding: 8px 14px;
|
||||
border: 1.5px solid var(--border);
|
||||
@@ -537,22 +543,25 @@ body {
|
||||
|
||||
/* 日历同步按钮 */
|
||||
.btn-cal-sync {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
border-radius: 6px;
|
||||
gap: 5px;
|
||||
padding: 8px 14px;
|
||||
border: 1.5px solid var(--border);
|
||||
background: var(--card);
|
||||
color: var(--text-dim);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
font-family: inherit;
|
||||
}
|
||||
.btn-cal-sync:hover {
|
||||
background: var(--success-light);
|
||||
color: var(--success);
|
||||
border-color: var(--primary);
|
||||
color: var(--primary);
|
||||
background: var(--primary-light);
|
||||
}
|
||||
|
||||
/* 编辑模式下才显示的元素 */
|
||||
@@ -1414,3 +1423,132 @@ 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: 12px; font-weight: 600; color: var(--primary); display: flex; gap: 10px; justify-content: center; }
|
||||
.bp-type { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
|
||||
.bp-type.morning { color: var(--warning); }
|
||||
.bp-type.evening { color: var(--danger); }
|
||||
.bp-type.study { color: var(--success); }
|
||||
|
||||
/* Tab 筛选 */
|
||||
.bp-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-bottom: 16px;
|
||||
border-bottom: 1.5px solid var(--border);
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.bp-tab {
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-dim);
|
||||
cursor: pointer;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1.5px;
|
||||
transition: all 0.15s;
|
||||
font-family: inherit;
|
||||
}
|
||||
.bp-tab:hover { color: var(--text); }
|
||||
.bp-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
|
||||
|
||||
/* 明细列表 */
|
||||
.bp-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
.bp-list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 14px;
|
||||
background: var(--card);
|
||||
border-bottom: 0.5px solid var(--border);
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.bp-list-item:hover { background: var(--bg); }
|
||||
.bp-item-pillar {
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
white-space: nowrap;
|
||||
min-width: 80px;
|
||||
}
|
||||
.bp-item-type {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 2px 8px;
|
||||
border-radius: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bp-item-type.morning { background: var(--warning-light); color: #D97706; }
|
||||
.bp-item-type.evening { background: var(--danger-light); color: var(--danger); }
|
||||
.bp-item-type.study { background: var(--success-light); color: var(--success); }
|
||||
.bp-item-text {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
color: var(--text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bp-item-note {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-left: 8px;
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bp-list-empty {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
text-align: center;
|
||||
padding: 32px 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>
|
||||
|
||||
<!-- 底部新建按钮 -->
|
||||
@@ -125,7 +129,12 @@
|
||||
<section class="panel active" id="panel-daily">
|
||||
<div class="panel-header">
|
||||
<h2>每日打卡</h2>
|
||||
<input type="date" id="check-date" class="check-date-input" onchange="loadCheckin()">
|
||||
<div class="panel-header-right">
|
||||
<input type="date" id="check-date" class="check-date-input" onchange="loadCheckin()">
|
||||
<button class="btn-cal-sync" onclick="syncCalendar()" title="同步钉钉日历">
|
||||
<svg class="icon-sm"><use href="#icon-calendar"/></svg> 日历同步
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="daily-grid">
|
||||
<div class="card card-morning">
|
||||
@@ -134,9 +143,6 @@
|
||||
<svg class="icon-h2"><use href="#icon-sun"/></svg>
|
||||
<h3>早间立志</h3>
|
||||
</div>
|
||||
<button class="btn-cal-sync" onclick="syncCalendar()" title="同步钉钉日历">
|
||||
<svg class="icon-sm"><use href="#icon-calendar"/></svg>
|
||||
</button>
|
||||
<button class="btn-edit-toggle" onclick="toggleEditMode(this)" title="编辑">
|
||||
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
|
||||
</button>
|
||||
@@ -267,6 +273,28 @@
|
||||
<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>
|
||||
<!-- Tab 筛选 -->
|
||||
<div class="bp-tabs">
|
||||
<button class="bp-tab active" data-filter="all" onclick="filterBlueprint(this)">全部</button>
|
||||
<button class="bp-tab" data-filter="morning" onclick="filterBlueprint(this)">🥼 立志</button>
|
||||
<button class="bp-tab" data-filter="evening" onclick="filterBlueprint(this)">🔍 责善</button>
|
||||
<button class="bp-tab" data-filter="study" onclick="filterBlueprint(this)">📚 勤学</button>
|
||||
</div>
|
||||
<!-- 明细列表 -->
|
||||
<div class="bp-list" id="bp-list"></div>
|
||||
<div class="bp-list-empty" id="bp-list-empty" style="display:none">暂无记录</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user