فهرست منبع

完成订病例管理功能

yang yi 7 ماه پیش
والد
کامیت
35bb75162c

+ 48 - 1
app.js

@@ -34,6 +34,12 @@ App({
     if (!storedDiagnosisHistory) {
       wx.setStorageSync('diagnosisHistory', [])
     }
+
+    // 初始化病历记录
+    const storedMedicalRecords = wx.getStorageSync('medicalRecords')
+    if (!storedMedicalRecords) {
+      wx.setStorageSync('medicalRecords', mockData.medicalRecords)
+    }
   },
 
   // 检查登录状态
@@ -121,9 +127,50 @@ App({
     this.globalData.diagnosisHistory = diagnosisHistory
   },
 
+  // 全局方法:获取所有病历记录
+  getMedicalRecords() {
+    const medicalRecords = wx.getStorageSync('medicalRecords') || []
+    this.globalData.medicalRecords = medicalRecords
+    return medicalRecords
+  },
+
+  // 全局方法:添加病历记录
+  addMedicalRecord(record) {
+    const medicalRecords = wx.getStorageSync('medicalRecords') || []
+    medicalRecords.unshift(record)
+    wx.setStorageSync('medicalRecords', medicalRecords)
+    
+    // 更新全局数据
+    this.globalData.medicalRecords = medicalRecords
+    console.log('病历记录已添加:', record)
+  },
+
+  // 全局方法:更新病历共享状态
+  updateMedicalRecordShare(recordId, shared) {
+    const medicalRecords = this.getMedicalRecords()
+    const recordIndex = medicalRecords.findIndex(record => record.id === recordId)
+    
+    if (recordIndex !== -1) {
+      medicalRecords[recordIndex].shared = shared
+      wx.setStorageSync('medicalRecords', medicalRecords)
+      this.globalData.medicalRecords = medicalRecords
+      console.log('病历共享状态已更新:', recordId, shared)
+    }
+  },
+
+  // 全局方法:删除病历记录
+  deleteMedicalRecord(recordId) {
+    let medicalRecords = this.getMedicalRecords()
+    medicalRecords = medicalRecords.filter(record => record.id !== recordId)
+    wx.setStorageSync('medicalRecords', medicalRecords)
+    this.globalData.medicalRecords = medicalRecords
+    console.log('病历记录已删除:', recordId)
+  },
+
   globalData: {
     userInfo: null,
     orders: [],
-    diagnosisHistory: []
+    diagnosisHistory: [],
+    medicalRecords: []
   }
 })

+ 3 - 1
app.json

@@ -6,7 +6,9 @@
     "pages/profile/profile",
     "pages/hospital/hospital",
     "pages/logs/logs",
-    "pages/order-detail/order-detail"
+    "pages/order-detail/order-detail",
+    "pages/medical-records/medical-records",
+    "pages/medical-record-detail/medical-record-detail"
   ],
   "window": {
     "navigationBarTextStyle": "black",

+ 26 - 1
pages/diagnosis/diagnosis.js

@@ -145,8 +145,33 @@ Page({
   // 保存诊断记录
   saveDiagnosis() {
     if (this.data.diagnosisResult) {
+      const result = this.data.diagnosisResult
+      
+      // 创建病历记录
+      const medicalRecord = {
+        id: Date.now(),
+        date: new Date().toISOString().split('T')[0],
+        hospital: '智能诊断系统',
+        doctor: 'AI医生',
+        department: '全科',
+        diagnosis: result.diagnosis,
+        symptoms: result.symptoms,
+        medicines: result.recommendedMedicines.map((name, index) => ({
+          id: index + 1,
+          name: name,
+          price: 0,
+          quantity: 1
+        })),
+        notes: result.suggestion,
+        shared: false
+      }
+
+      // 保存到全局变量
+      const app = getApp()
+      app.addMedicalRecord(medicalRecord)
+
       wx.showToast({
-        title: '已保存到诊断历史',
+        title: '已保存到病历记录',
         icon: 'success'
       })
     }

+ 124 - 0
pages/medical-record-detail/medical-record-detail.js

@@ -0,0 +1,124 @@
+// medical-record-detail.js
+Page({
+  data: {
+    record: null
+  },
+
+  onLoad(options) {
+    const recordId = parseInt(options.id)
+    const app = getApp()
+    const records = app.getMedicalRecords()
+    const record = records.find(r => r.id === recordId)
+    
+    if (record) {
+      this.setData({
+        record: record
+      })
+    } else {
+      wx.showToast({
+        title: '病历不存在',
+        icon: 'none'
+      })
+      setTimeout(() => {
+        wx.navigateBack()
+      }, 1500)
+    }
+  },
+
+  // 返回上一页
+  goBack() {
+    wx.navigateBack({
+      delta: 1
+    })
+  },
+
+  // 切换共享状态
+  toggleShare() {
+    const record = this.data.record
+    const newShared = !record.shared
+    
+    wx.showModal({
+      title: '确认操作',
+      content: newShared ? '确定要共享此病历吗?' : '确定要取消共享此病历吗?',
+      success: (res) => {
+        if (res.confirm) {
+          const app = getApp()
+          app.updateMedicalRecordShare(record.id, newShared)
+          
+          this.setData({
+            'record.shared': newShared
+          })
+          
+          wx.showToast({
+            title: newShared ? '已共享' : '已取消共享',
+            icon: 'success'
+          })
+        }
+      }
+    })
+  },
+
+  // 再次购买药品
+  reorder() {
+    const record = this.data.record
+    wx.showModal({
+      title: '再次购买',
+      content: `确认购买${record.hospital}的药品吗?`,
+      success: (res) => {
+        if (res.confirm) {
+          // 跳转到下单页面
+          wx.switchTab({
+            url: '/pages/order/order'
+          })
+          
+          // 延迟设置搜索关键词
+          setTimeout(() => {
+            const pages = getCurrentPages()
+            const orderPage = pages.find(page => page.route === 'pages/order/order')
+            if (orderPage) {
+              orderPage.setData({
+                currentTab: 0,
+                hospitalKeyword: record.hospital
+              })
+            }
+          }, 500)
+        }
+      }
+    })
+  },
+
+  // 联系医生
+  contactDoctor() {
+    const record = this.data.record
+    wx.showModal({
+      title: '联系医生',
+      content: `医生:${record.doctor}\n医院:${record.hospital}\n科室:${record.department}\n\n请通过医院官方渠道联系医生`,
+      showCancel: false
+    })
+  },
+
+  // 删除病历
+  deleteRecord() {
+    const record = this.data.record
+    wx.showModal({
+      title: '确认删除',
+      content: '确定要删除这条病历记录吗?删除后无法恢复。',
+      success: (res) => {
+        if (res.confirm) {
+          const app = getApp()
+          app.deleteMedicalRecord(record.id)
+          
+          wx.showToast({
+            title: '病历已删除',
+            icon: 'success',
+            success: () => {
+              setTimeout(() => {
+                wx.navigateBack()
+              }, 1500)
+            }
+          })
+        }
+      }
+    })
+  }
+})

+ 5 - 0
pages/medical-record-detail/medical-record-detail.json

@@ -0,0 +1,5 @@
+{
+  "navigationBarTitleText": "病历详情",
+  "navigationStyle": "custom",
+  "enablePullDownRefresh": false
+}

+ 122 - 0
pages/medical-record-detail/medical-record-detail.wxml

@@ -0,0 +1,122 @@
+<!--medical-record-detail.wxml-->
+<view class="container">
+  <!-- 自定义导航栏 -->
+  <view class="custom-navbar">
+    <view class="navbar-content">
+      <view class="back-btn" bindtap="goBack">
+        <text class="back-icon">‹</text>
+      </view>
+      <view class="navbar-title">
+        <text>病历详情</text>
+      </view>
+      <view class="navbar-right"></view>
+    </view>
+  </view>
+
+  <!-- 基本信息 -->
+  <view class="basic-info-section">
+    <view class="section-title">
+      <text>基本信息</text>
+    </view>
+    <view class="info-card">
+      <view class="info-row">
+        <text class="info-label">就诊日期:</text>
+        <text class="info-value">{{record.date}}</text>
+      </view>
+      <view class="info-row">
+        <text class="info-label">医院:</text>
+        <text class="info-value">{{record.hospital}}</text>
+      </view>
+      <view class="info-row">
+        <text class="info-label">科室:</text>
+        <text class="info-value">{{record.department}}</text>
+      </view>
+      <view class="info-row">
+        <text class="info-label">医生:</text>
+        <text class="info-value">{{record.doctor}}</text>
+      </view>
+    </view>
+  </view>
+
+  <!-- 诊断信息 -->
+  <view class="diagnosis-section">
+    <view class="section-title">
+      <text>诊断信息</text>
+    </view>
+    <view class="diagnosis-card">
+      <view class="diagnosis-item">
+        <text class="diagnosis-label">诊断结果:</text>
+        <text class="diagnosis-value">{{record.diagnosis}}</text>
+      </view>
+      <view class="symptoms-list">
+        <text class="symptoms-title">症状描述:</text>
+        <view class="symptoms-tags">
+          <view class="symptom-tag" wx:for="{{record.symptoms}}" wx:key="*this">
+            <text>{{item}}</text>
+          </view>
+        </view>
+      </view>
+      <view class="notes-item">
+        <text class="notes-label">医生建议:</text>
+        <text class="notes-value">{{record.notes}}</text>
+      </view>
+    </view>
+  </view>
+
+  <!-- 药品信息 -->
+  <view class="medicines-section">
+    <view class="section-title">
+      <text>处方药品</text>
+    </view>
+    <view class="medicine-list">
+      <view class="medicine-item" wx:for="{{record.medicines}}" wx:key="id">
+        <view class="medicine-icon">
+          <text>💊</text>
+        </view>
+        <view class="medicine-info">
+          <text class="medicine-name">{{item.name}}</text>
+          <text class="medicine-spec">数量:{{item.quantity}}</text>
+        </view>
+        <view class="medicine-price">
+          <text class="price-text">¥{{item.price}}</text>
+        </view>
+      </view>
+    </view>
+  </view>
+
+  <!-- 共享状态 -->
+  <view class="share-section">
+    <view class="section-title">
+      <text>共享设置</text>
+    </view>
+    <view class="share-card">
+      <view class="share-info">
+        <text class="share-label">病历共享:</text>
+        <text class="share-status {{record.shared ? 'shared' : 'unshared'}}">
+          {{record.shared ? '已共享' : '未共享'}}
+        </text>
+      </view>
+      <view class="share-desc">
+        <text>共享后医院可以查看您的病历信息,便于后续诊疗</text>
+      </view>
+      <view class="share-action">
+        <button class="share-btn {{record.shared ? 'unshare' : 'share'}}" bindtap="toggleShare">
+          <text>{{record.shared ? '取消共享' : '立即共享'}}</text>
+        </button>
+      </view>
+    </view>
+  </view>
+
+  <!-- 操作按钮 -->
+  <view class="action-section">
+    <button class="action-btn primary" bindtap="reorder">
+      <text>再次购买药品</text>
+    </button>
+    <button class="action-btn secondary" bindtap="contactDoctor">
+      <text>联系医生</text>
+    </button>
+    <button class="action-btn danger" bindtap="deleteRecord">
+      <text>删除病历</text>
+    </button>
+  </view>
+</view>

+ 351 - 0
pages/medical-record-detail/medical-record-detail.wxss

@@ -0,0 +1,351 @@
+.container {
+  width: 100%;
+  align-items: stretch;
+  padding: 0;
+  box-sizing: border-box;
+  background-color: #f5f5f5;
+}
+
+.custom-navbar {
+  background: white;
+  padding: 20rpx 30rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+  position: sticky;
+  top: 0;
+  z-index: 100;
+}
+
+.navbar-content {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  height: 88rpx;
+}
+
+.back-btn {
+  width: 60rpx;
+  height: 60rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.back-icon {
+  font-size: 48rpx;
+  color: #333;
+  font-weight: bold;
+}
+
+.navbar-title {
+  flex: 1;
+  text-align: center;
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.navbar-right {
+  width: 60rpx;
+}
+
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  margin-bottom: 20rpx;
+  color: #333;
+  padding-left: 10rpx;
+  border-left: 6rpx solid #007AFF;
+}
+
+.basic-info-section {
+  background: white;
+  padding: 30rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.info-card {
+  background: #f8f8f8;
+  border-radius: 15rpx;
+  padding: 25rpx;
+}
+
+.info-row {
+  display: flex;
+  margin-bottom: 20rpx;
+  align-items: center;
+}
+
+.info-row:last-child {
+  margin-bottom: 0;
+}
+
+.info-label {
+  font-size: 26rpx;
+  color: #666;
+  width: 150rpx;
+  flex-shrink: 0;
+}
+
+.info-value {
+  font-size: 26rpx;
+  color: #333;
+  flex: 1;
+}
+
+.diagnosis-section {
+  background: white;
+  padding: 30rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.diagnosis-card {
+  background: #f8f8f8;
+  border-radius: 15rpx;
+  padding: 25rpx;
+}
+
+.diagnosis-item {
+  display: flex;
+  margin-bottom: 20rpx;
+  align-items: flex-start;
+}
+
+.diagnosis-label {
+  font-size: 26rpx;
+  color: #666;
+  width: 150rpx;
+  flex-shrink: 0;
+}
+
+.diagnosis-value {
+  font-size: 28rpx;
+  color: #FF6B35;
+  font-weight: bold;
+  flex: 1;
+}
+
+.symptoms-list {
+  display: flex;
+  flex-direction: column;
+  margin-bottom: 20rpx;
+}
+
+.symptoms-title {
+  font-size: 26rpx;
+  color: #666;
+  margin-bottom: 15rpx;
+}
+
+.symptoms-tags {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 15rpx;
+}
+
+.symptom-tag {
+  background: #e6f7ff;
+  color: #007AFF;
+  padding: 10rpx 20rpx;
+  border-radius: 20rpx;
+  font-size: 24rpx;
+}
+
+.notes-item {
+  display: flex;
+  align-items: flex-start;
+}
+
+.notes-label {
+  font-size: 26rpx;
+  color: #666;
+  width: 150rpx;
+  flex-shrink: 0;
+}
+
+.notes-value {
+  font-size: 26rpx;
+  color: #333;
+  flex: 1;
+  line-height: 1.6;
+}
+
+.medicines-section {
+  background: white;
+  padding: 30rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.medicine-list {
+  background: #f8f8f8;
+  border-radius: 15rpx;
+  padding: 20rpx;
+}
+
+.medicine-item {
+  display: flex;
+  align-items: center;
+  padding: 20rpx;
+  background: white;
+  border-radius: 10rpx;
+  margin-bottom: 15rpx;
+}
+
+.medicine-item:last-child {
+  margin-bottom: 0;
+}
+
+.medicine-icon {
+  width: 60rpx;
+  height: 60rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 20rpx;
+  font-size: 36rpx;
+}
+
+.medicine-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+
+.medicine-name {
+  font-size: 28rpx;
+  color: #333;
+  font-weight: bold;
+  margin-bottom: 8rpx;
+}
+
+.medicine-spec {
+  font-size: 24rpx;
+  color: #999;
+}
+
+.medicine-price {
+  flex-shrink: 0;
+}
+
+.price-text {
+  font-size: 28rpx;
+  color: #FF6B35;
+  font-weight: bold;
+}
+
+.share-section {
+  background: white;
+  padding: 30rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.share-card {
+  background: #f8f8f8;
+  border-radius: 15rpx;
+  padding: 25rpx;
+}
+
+.share-info {
+  display: flex;
+  align-items: center;
+  margin-bottom: 15rpx;
+}
+
+.share-label {
+  font-size: 26rpx;
+  color: #666;
+  width: 150rpx;
+  flex-shrink: 0;
+}
+
+.share-status {
+  font-size: 26rpx;
+  font-weight: bold;
+  flex: 1;
+}
+
+.share-status.shared {
+  color: #52c41a;
+}
+
+.share-status.unshared {
+  color: #fa8c16;
+}
+
+.share-desc {
+  margin-bottom: 20rpx;
+  padding: 15rpx;
+  background: #fff7e6;
+  border-radius: 10rpx;
+  font-size: 24rpx;
+  color: #666;
+  line-height: 1.5;
+}
+
+.share-action {
+  display: flex;
+  justify-content: center;
+}
+
+.share-btn {
+  width: 100%;
+  padding: 25rpx 0;
+  border-radius: 10rpx;
+  font-size: 28rpx;
+  text-align: center;
+  border: none;
+}
+
+.share-btn.share {
+  background: #007AFF;
+  color: white;
+}
+
+.share-btn.unshare {
+  background: #ff4d4f;
+  color: white;
+}
+
+.action-section {
+  background: white;
+  padding: 30rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.action-btn {
+  width: 100%;
+  padding: 25rpx 0;
+  border-radius: 10rpx;
+  font-size: 28rpx;
+  text-align: center;
+  border: none;
+  margin-bottom: 20rpx;
+}
+
+.action-btn:last-child {
+  margin-bottom: 0;
+}
+
+.action-btn.primary {
+  background: #007AFF;
+  color: white;
+}
+
+.action-btn.secondary {
+  background: #52c41a;
+  color: white;
+}
+
+.action-btn.danger {
+  background: #ff4d4f;
+  color: white;
+}

+ 76 - 0
pages/medical-records/medical-records.js

@@ -0,0 +1,76 @@
+// medical-records.js
+Page({
+  data: {
+    medicalRecords: [],
+    filteredRecords: [],
+    stats: {
+      total: 0,
+      shared: 0,
+      recent: 0
+    },
+    currentFilter: '全部'
+  },
+
+  onLoad() {
+    console.log('病历记录页面加载完成')
+    this.loadMedicalRecords()
+  },
+
+  onShow() {
+    this.loadMedicalRecords()
+  },
+
+  // 加载病历记录
+  loadMedicalRecords() {
+    const app = getApp()
+    const records = app.getMedicalRecords()
+    
+    // 计算统计信息
+    const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
+    const recentRecords = records.filter(record => new Date(record.date) > thirtyDaysAgo)
+    
+    const stats = {
+      total: records.length,
+      shared: records.filter(record => record.shared).length,
+      recent: recentRecords.length
+    }
+
+    this.setData({
+      medicalRecords: records,
+      filteredRecords: records,
+      stats: stats
+    })
+  },
+
+  // 筛选病历记录
+  filterRecords(e) {
+    const filter = e.currentTarget.dataset.filter
+    let filteredRecords = this.data.medicalRecords
+
+    if (filter === '已共享') {
+      filteredRecords = filteredRecords.filter(record => record.shared)
+    } else if (filter === '未共享') {
+      filteredRecords = filteredRecords.filter(record => !record.shared)
+    }
+
+    this.setData({
+      currentFilter: filter,
+      filteredRecords: filteredRecords
+    })
+  },
+
+  // 查看病历详情
+  viewRecordDetail(e) {
+    const record = e.currentTarget.dataset.record
+    wx.navigateTo({
+      url: `/pages/medical-record-detail/medical-record-detail?id=${record.id}`
+    })
+  },
+
+  // 返回上一页
+  goBack() {
+    wx.navigateBack({
+      delta: 1
+    })
+  }
+})

+ 5 - 0
pages/medical-records/medical-records.json

@@ -0,0 +1,5 @@
+{
+  "navigationBarTitleText": "病历记录",
+  "navigationStyle": "custom",
+  "enablePullDownRefresh": false
+}

+ 93 - 0
pages/medical-records/medical-records.wxml

@@ -0,0 +1,93 @@
+<!--medical-records.wxml-->
+<view class="container">
+  <!-- 自定义导航栏 -->
+  <view class="custom-navbar">
+    <view class="navbar-content">
+      <view class="back-btn" bindtap="goBack">
+        <text class="back-icon">‹</text>
+      </view>
+      <view class="navbar-title">
+        <text>病历记录</text>
+      </view>
+      <view class="navbar-right"></view>
+    </view>
+  </view>
+
+  <!-- 统计信息 -->
+  <view class="stats-section">
+    <view class="stat-card">
+      <text class="stat-number">{{stats.total}}</text>
+      <text class="stat-label">总病历数</text>
+    </view>
+    <view class="stat-card">
+      <text class="stat-number">{{stats.shared}}</text>
+      <text class="stat-label">已共享</text>
+    </view>
+    <view class="stat-card">
+      <text class="stat-number">{{stats.recent}}</text>
+      <text class="stat-label">最近30天</text>
+    </view>
+  </view>
+
+  <!-- 筛选标签 -->
+  <view class="filter-section">
+    <view class="filter-item {{currentFilter === '全部' ? 'active' : ''}}" bindtap="filterRecords" data-filter="全部">
+      <text>全部</text>
+    </view>
+    <view class="filter-item {{currentFilter === '已共享' ? 'active' : ''}}" bindtap="filterRecords" data-filter="已共享">
+      <text>已共享</text>
+    </view>
+    <view class="filter-item {{currentFilter === '未共享' ? 'active' : ''}}" bindtap="filterRecords" data-filter="未共享">
+      <text>未共享</text>
+    </view>
+  </view>
+
+  <!-- 病历列表 -->
+  <view class="records-list">
+    <view class="record-item" wx:for="{{filteredRecords}}" wx:key="id" bindtap="viewRecordDetail" data-record="{{item}}">
+      <view class="record-header">
+        <view class="record-date">
+          <text class="date-text">{{item.date}}</text>
+        </view>
+        <view class="record-share">
+          <text class="share-badge {{item.shared ? 'shared' : 'unshared'}}">
+            {{item.shared ? '已共享' : '未共享'}}
+          </text>
+        </view>
+      </view>
+      
+      <view class="record-info">
+        <view class="info-row">
+          <text class="info-label">医院:</text>
+          <text class="info-value">{{item.hospital}}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">科室:</text>
+          <text class="info-value">{{item.department}}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">医生:</text>
+          <text class="info-value">{{item.doctor}}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">诊断:</text>
+          <text class="info-value diagnosis">{{item.diagnosis}}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">症状:</text>
+          <text class="info-value symptoms">{{item.symptoms.join('、')}}</text>
+        </view>
+      </view>
+
+      <view class="record-footer">
+        <text class="arrow">></text>
+      </view>
+    </view>
+
+    <!-- 空状态 -->
+    <view class="empty-state" wx:if="{{filteredRecords.length === 0}}">
+      <text class="empty-icon">📋</text>
+      <text class="empty-text">暂无病历记录</text>
+    </view>
+  </view>
+</view>

+ 232 - 0
pages/medical-records/medical-records.wxss

@@ -0,0 +1,232 @@
+.container {
+  width: 100%;
+  align-items: stretch;
+  padding: 0;
+  box-sizing: border-box;
+  background-color: #f5f5f5;
+}
+
+.custom-navbar {
+  background: white;
+  padding: 20rpx 30rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+  position: sticky;
+  top: 0;
+  z-index: 100;
+}
+
+.navbar-content {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  height: 88rpx;
+}
+
+.back-btn {
+  width: 60rpx;
+  height: 60rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.back-icon {
+  font-size: 48rpx;
+  color: #333;
+  font-weight: bold;
+}
+
+.navbar-title {
+  flex: 1;
+  text-align: center;
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.navbar-right {
+  width: 60rpx;
+}
+
+.stats-section {
+  display: flex;
+  justify-content: space-around;
+  background: white;
+  padding: 30rpx 20rpx;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.stat-card {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  flex: 1;
+}
+
+.stat-number {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: #007AFF;
+  margin-bottom: 10rpx;
+}
+
+.stat-label {
+  font-size: 22rpx;
+  color: #666;
+}
+
+.filter-section {
+  display: flex;
+  background: white;
+  margin: 20rpx;
+  border-radius: 20rpx;
+  padding: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+}
+
+.filter-item {
+  flex: 1;
+  text-align: center;
+  padding: 20rpx 0;
+  font-size: 26rpx;
+  color: #666;
+  border-radius: 10rpx;
+  transition: all 0.3s;
+}
+
+.filter-item.active {
+  color: #007AFF;
+  font-weight: bold;
+  background: #f0f8ff;
+}
+
+.records-list {
+  padding: 20rpx;
+  display: flex;
+  flex-direction: column;
+}
+
+.record-item {
+  display: flex;
+  flex-direction: column;
+  background: white;
+  border-radius: 20rpx;
+  padding: 25rpx;
+  margin-bottom: 20rpx;
+  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+  transition: all 0.3s;
+}
+
+.record-item:active {
+  transform: scale(0.98);
+  box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.1);
+}
+
+.record-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20rpx;
+  padding-bottom: 15rpx;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+
+.record-date {
+  flex: 1;
+}
+
+.date-text {
+  font-size: 24rpx;
+  color: #999;
+}
+
+.record-share {
+  flex-shrink: 0;
+}
+
+.share-badge {
+  font-size: 22rpx;
+  padding: 5rpx 15rpx;
+  border-radius: 20rpx;
+}
+
+.share-badge.shared {
+  background: #f6ffed;
+  color: #52c41a;
+}
+
+.share-badge.unshared {
+  background: #fff7e6;
+  color: #fa8c16;
+}
+
+.record-info {
+  display: flex;
+  flex-direction: column;
+}
+
+.info-row {
+  display: flex;
+  align-items: center;
+  margin-bottom: 15rpx;
+}
+
+.info-row:last-child {
+  margin-bottom: 0;
+}
+
+.info-label {
+  font-size: 26rpx;
+  color: #666;
+  width: 120rpx;
+  flex-shrink: 0;
+}
+
+.info-value {
+  font-size: 26rpx;
+  color: #333;
+  flex: 1;
+}
+
+.info-value.diagnosis {
+  color: #FF6B35;
+  font-weight: bold;
+}
+
+.info-value.symptoms {
+  color: #666;
+  line-height: 1.5;
+}
+
+.record-footer {
+  display: flex;
+  justify-content: flex-end;
+  margin-top: 20rpx;
+  padding-top: 15rpx;
+  border-top: 1rpx solid #f0f0f0;
+}
+
+.arrow {
+  font-size: 32rpx;
+  color: #ccc;
+}
+
+.empty-state {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  padding: 100rpx 0;
+}
+
+.empty-icon {
+  font-size: 120rpx;
+  margin-bottom: 30rpx;
+}
+
+.empty-text {
+  font-size: 28rpx;
+  color: #999;
+}

+ 18 - 29
pages/profile/profile.js

@@ -10,11 +10,11 @@ Page({
       completed: 0
     },
     recentOrders: [],
-    diagnosisStats: {
+    medicalStats: {
       total: 0,
       recent: 0
     },
-    recentDiagnosis: [],
+    recentMedicalRecords: [],
     showFingerprintModal: false,
     showFaceModal: false
   },
@@ -43,23 +43,23 @@ Page({
     
     const recentOrders = orders.slice(0, 3) // 显示最近3个订单
 
-    // 加载诊断记录
-    const diagnosisHistory = wx.getStorageSync('diagnosisHistory') || []
-    const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
-    const recentDiagnosis = diagnosisHistory.filter(item => 
-      new Date(item.date) > oneWeekAgo
+    // 加载病历记录
+    const medicalRecords = app.getMedicalRecords()
+    const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
+    const recentMedicalRecords = medicalRecords.filter(item => 
+      new Date(item.date) > thirtyDaysAgo
     ).slice(0, 3)
 
-    const diagnosisStats = {
-      total: diagnosisHistory.length,
-      recent: recentDiagnosis.length
+    const medicalStats = {
+      total: medicalRecords.length,
+      recent: recentMedicalRecords.length
     }
 
     this.setData({
       orderStats: orderStats,
       recentOrders: recentOrders,
-      diagnosisStats: diagnosisStats,
-      recentDiagnosis: recentDiagnosis
+      medicalStats: medicalStats,
+      recentMedicalRecords: recentMedicalRecords
     })
   },
 
@@ -196,10 +196,8 @@ Page({
 
   // 查看病历记录
   viewMedicalRecords() {
-    wx.showModal({
-      title: '病历记录',
-      content: '这里将显示您的完整病历记录信息',
-      showCancel: false
+    wx.navigateTo({
+      url: '/pages/medical-records/medical-records'
     })
   },
 
@@ -242,20 +240,11 @@ Page({
     })
   },
 
-  // 查看诊断历史
-  viewDiagnosisHistory() {
+  // 查看病历详情
+  viewMedicalRecordDetail(e) {
+    const record = e.currentTarget.dataset.record
     wx.navigateTo({
-      url: '/pages/diagnosis/diagnosis'
-    })
-  },
-
-  // 查看诊断详情
-  viewDiagnosisDetail(e) {
-    const diagnosis = e.currentTarget.dataset.diagnosis
-    wx.showModal({
-      title: '诊断详情',
-      content: `症状:${diagnosis.symptoms}\n诊断:${diagnosis.diagnosis}\n建议:${diagnosis.suggestion}`,
-      showCancel: false
+      url: `/pages/medical-record-detail/medical-record-detail?id=${record.id}`
     })
   },
 

+ 10 - 10
pages/profile/profile.wxml

@@ -126,26 +126,26 @@ module.exports = {
     </view>
   </view>
 
-  <!-- 诊断记录 -->
+  <!-- 病历记录 -->
   <view class="diagnosis-section">
     <view class="section-title">
-      <text>诊断记录</text>
+      <text>病历记录</text>
     </view>
     <view class="diagnosis-stats">
-      <view class="stat-item" bindtap="viewDiagnosisHistory">
-        <text class="stat-number">{{diagnosisStats.total}}</text>
-        <text class="stat-label">诊断记录</text>
+      <view class="stat-item" bindtap="viewMedicalRecords">
+        <text class="stat-number">{{medicalStats.total}}</text>
+        <text class="stat-label">病历记录</text>
       </view>
-      <view class="stat-item" bindtap="viewDiagnosisHistory">
-        <text class="stat-number">{{diagnosisStats.recent}}</text>
-        <text class="stat-label">最近7天</text>
+      <view class="stat-item" bindtap="viewMedicalRecords">
+        <text class="stat-number">{{medicalStats.recent}}</text>
+        <text class="stat-label">最近30天</text>
       </view>
     </view>
     <view class="recent-diagnosis">
-      <view class="diagnosis-item" wx:for="{{recentDiagnosis}}" wx:key="id" bindtap="viewDiagnosisDetail" data-diagnosis="{{item}}">
+      <view class="diagnosis-item" wx:for="{{recentMedicalRecords}}" wx:key="id" bindtap="viewMedicalRecordDetail" data-record="{{item}}">
         <view class="diagnosis-info">
           <text class="diagnosis-date">{{item.date}}</text>
-          <text class="diagnosis-symptoms">{{item.symptoms}}</text>
+          <text class="diagnosis-symptoms">{{item.symptoms.join('、')}}</text>
           <text class="diagnosis-result">{{item.diagnosis}}</text>
         </view>
         <view class="diagnosis-arrow">

+ 64 - 0
utils/mockData.js

@@ -128,6 +128,70 @@ const mockData = {
     medicalRecordsShared: false
   },
 
+  // 病历记录数据
+  medicalRecords: [
+    {
+      id: 1,
+      date: "2024-01-15",
+      hospital: "北京协和医院",
+      doctor: "张医生",
+      department: "内科",
+      diagnosis: "上呼吸道感染",
+      symptoms: ["流鼻涕", "咳嗽", "发烧", "头痛"],
+      medicines: [
+        { id: 1, name: "阿莫西林胶囊", price: 25.5, quantity: 2 },
+        { id: 2, name: "布洛芬缓释胶囊", price: 18.0, quantity: 1 }
+      ],
+      notes: "建议多休息,多喝水,注意保暖",
+      shared: false
+    },
+    {
+      id: 2,
+      date: "2024-02-20",
+      hospital: "北京协和医院",
+      doctor: "李医生",
+      department: "皮肤科",
+      diagnosis: "过敏性皮炎",
+      symptoms: ["皮肤瘙痒", "红疹", "皮肤干燥"],
+      medicines: [
+        { id: 3, name: "氯雷他定片", price: 32.0, quantity: 1 },
+        { id: 4, name: "氢化可的松乳膏", price: 28.5, quantity: 1 }
+      ],
+      notes: "建议避免接触过敏原,保持皮肤清洁",
+      shared: true
+    },
+    {
+      id: 3,
+      date: "2024-01-10",
+      hospital: "上海瑞金医院",
+      doctor: "王医生",
+      department: "消化科",
+      diagnosis: "急性胃炎",
+      symptoms: ["胃部不适", "恶心", "食欲不振"],
+      medicines: [
+        { id: 5, name: "奥美拉唑肠溶胶囊", price: 45.0, quantity: 1 },
+        { id: 6, name: "铝碳酸镁咀嚼片", price: 22.5, quantity: 2 }
+      ],
+      notes: "建议清淡饮食,避免辛辣刺激食物",
+      shared: false
+    },
+    {
+      id: 4,
+      date: "2024-03-01",
+      hospital: "广州中山医院",
+      doctor: "陈医生",
+      department: "骨科",
+      diagnosis: "软组织损伤",
+      symptoms: ["关节疼痛", "活动受限", "肿胀"],
+      medicines: [
+        { id: 7, name: "云南白药气雾剂", price: 38.0, quantity: 1 },
+        { id: 8, name: "双氯芬酸钠凝胶", price: 26.5, quantity: 1 }
+      ],
+      notes: "建议休息,避免剧烈运动",
+      shared: false
+    }
+  ],
+
   // 订单数据
   orders: [
     {