Browse Source

Merge branch 'master' of http://172.20.2.8:9091/data_center_platform/ABC_MiniApp_H5

* 'master' of http://172.20.2.8:9091/data_center_platform/ABC_MiniApp_H5:
  优化我的病历与处方的展示
chenjianhua 1 month ago
parent
commit
d0564687f6

+ 483 - 180
src/pages/mine/myPrescription/prescriptionDetail/prescriptionDetail.vue

@@ -1,98 +1,109 @@
 <template>
-    <!--pages/mine//myPrescription/prescriptionDetail/prescriptionDetail.wxml-->
-    <nav-bar :navbar-data="navbarData" />
-    <view class="prescriptionDetail" :style="{ marginTop: 'calc('+ height +'px + 20rpx)', marginBottom: '20rpx' }">
-        <view class="top">
-            <view class="buttom">{{ PrescDataMainInfo.prescType }}</view>
-            <view class="tit">{{ PrescDataMainInfo.hospDesc }}</view>
-            <view class="tit-small">互联网医院处方筏</view>
-            <view class="NO">
-                <text>处方编号: <text class="k">{{ PrescDataMainInfo.ordPrescNo }}</text></text>
+    <view class="medical-record-detail">
+        <nav-bar :navbar-data="navbarData" />
+        <view class="page-content" :style="{ paddingTop: height + 'px' }">
+            <view class="visit-summary">
+                <view class="summary-name">{{ doctorName || '-' }}{{ locDesc ? ' · ' + locDesc : '' }}</view>
+                <view class="summary-time">{{ visitTime || '-' }}</view>
             </view>
-            <view class="userInfo">
-                <view class="left">
-                    <view>
-                        <text class="room">科室:</text> {{ PrescDataMainInfo.ordLocDesc }}
-                    </view>
-                    <view>
-                        <text class="room">患者:</text> {{ PrescDataMainInfo.patName }}
-                    </view>
-                    <view>
-                        <text class="room">年龄:</text> {{ PrescDataMainInfo.patAge }}
-                    </view>
-
-                </view>
-                <view class="right">
-                    <view> <text class="room">费别:</text> {{ PrescDataMainInfo.admReasonDesc }}</view>
-                    <view> <text class="room">性别:</text> {{ PrescDataMainInfo.patSexDesc }}</view>
-                    <view> <text class="room">日期:</text>{{ PrescDataMainInfo.ordDate }}</view>
-                </view>
-                <view>
-                    <text class="room">诊断:</text> {{ PrescDataMainInfo.admDiag }}
-                </view>
+            <view class="tabs">
+                <view :class="['tab', activeTab === 'record' ? 'active' : '']" @tap="changeTab('record')">病历</view>
+                <view :class="['tab', activeTab === 'prescription' ? 'active' : '']" @tap="changeTab('prescription')">处方</view>
             </view>
-            <view class="RP" style="height: calc(100vh - 840rpx)">
-                <view class="T">Rp:</view>
-                <block v-if="PrescDataMainInfo.cmPrescFlag == 0">
-                    <view class="content" v-for="(item, index) in PrescDataDetail" :key="index">
-                        <view class="content-tit">
-                            <text class="Y">{{ index + 1 }}.{{ item.medDesc }}</text>
-                            <text class="A">{{ item.medSpec }}</text>
-                            <text class="N">X{{ item.ordQty }}{{ item.ordUnitDesc }}</text>
+
+            <scroll-view scroll-y class="detail-scroll">
+                <view v-if="activeTab === 'record'" class="tab-content">
+                    <view v-if="recordLoading" class="loading-text">加载中...</view>
+                    <view v-else-if="medicalRecordFields.length > 0" class="record-card">
+                        <view class="record-card-head">
+                            <text>病历内容</text>
+                            <text>{{ medicalRecordFields.length }}项</text>
                         </view>
-                        <view class="content-bottom">
-                            <text>用法: {{ item.ordFreqDesc }} {{ item.ordDurationDesc }}</text>
+                        <view class="record-row" v-for="field in medicalRecordFields" :key="field.key">
+                            <view class="record-label">{{ field.label }}</view>
+                            <view :class="['record-value', field.empty ? 'is-empty' : '']">{{ field.value }}</view>
+                        </view>
+                        <view v-if="doctorSignatureUrl" class="signature-row">
+                            <text>医生电子签名</text>
+                            <image :src="doctorSignatureUrl" mode="aspectFit" />
                         </view>
                     </view>
-                </block>
-
-                <block v-if="PrescDataMainInfo.cmPrescFlag == 1">
-                    <view class="content" v-for="(item, index) in PrescDataDetail" :key="index">
-                        <view class="content-tit">{{ index + 1 }}.{{ item.medDesc }} {{ item.ordDoseUnitDesc }} </view>
-                    </view>
-                </block>
-
-                <view class="content-bottom">
-                    <view v-if="PrescDataMainInfo.cmPrescFlag == 1">用法: {{ PrescDataMainInfo.cmFreqDesc }} ,
-                        {{ PrescDataMainInfo.cmExplainDesc }} , {{ PrescDataMainInfo.cmUsageDesc }} 共:
-                        {{ PrescDataMainInfo.cmFac }}剂 {{ PrescDataMainInfo.cmCookTypeDesc }}</view>
-                    <view class="blank"> (以下空白)</view>
+                    <view v-else class="empty-text">暂无病历数据</view>
                 </view>
-            </view>
-            <view class="userInfo doctor">
-                <view class="left">
-                    <view> <text class="room">医师:</text>
-                        <image v-if="PrescDataMainInfo.docStamp.length > 10" style="width:180rpx;height:66rpx"
-                            :src="PrescDataMainInfo.docStamp" />
-                        <text v-if="PrescDataMainInfo.docStamp.length < 10" class="room">{{ PrescDataMainInfo.ordDocDesc
-                        }}</text>
+
+                <view v-else class="tab-content">
+                    <view v-if="prescNos.length > 1" class="prescription-switcher">
+                        <view
+                            v-for="prescNo in prescNos"
+                            :key="prescNo"
+                            :class="['prescription-pill', activePrescNo === prescNo ? 'active' : '']"
+                            @tap="selectPrescription(prescNo)"
+                        >
+                            {{ prescNo }}
+                        </view>
                     </view>
-                    <!-- <view> <text class="room">复核:</text> {{PrescDataMainInfo.ordDocDesc}}</view> -->
-                    <view> <text class="room">金额: </text> {{ PrescDataMainInfo.prescAmt }}</view>
-                </view>
-                <view class="right">
-                    <view> <text class="room">审核:</text>
-                        <image v-if="PrescDataMainInfo.dispUserStamp.length > 10" style="width:180rpx;height:66rpx"
-                            :src="PrescDataMainInfo.dispUserStamp" />
-                        <text v-if="PrescDataMainInfo.dispUserStamp.length < 10" class="room">{{
-                            PrescDataMainInfo.auditUserName }}</text>
+                    <view v-if="prescriptionLoading" class="loading-text">加载中...</view>
+                    <view v-else-if="activePrescNo && prescMainInfo" class="prescription-card">
+                        <view class="prescription-head">
+                            <view class="hospital-name">{{ prescMainInfo.hospDesc || '-' }}</view>
+                            <view class="prescription-type">{{ prescMainInfo.prescType || '' }}</view>
+                            <view class="prescription-title">互联网医院处方笺</view>
+                            <view class="prescription-no">处方编号:{{ prescMainInfo.ordPrescNo || activePrescNo }}</view>
+                        </view>
+                        <view class="patient-info">
+                            <view><text>科室:</text>{{ prescMainInfo.ordLocDesc || locDesc || '-' }}</view>
+                            <view><text>患者:</text>{{ prescMainInfo.patName || '-' }}</view>
+                            <view><text>性别:</text>{{ prescMainInfo.patSexDesc || '-' }}</view>
+                            <view><text>年龄:</text>{{ prescMainInfo.patAge || '-' }}</view>
+                            <view><text>日期:</text>{{ prescMainInfo.ordDate || '-' }}</view>
+                            <view class="full-line"><text>诊断:</text>{{ prescMainInfo.admDiag || '-' }}</view>
+                        </view>
+                        <view class="rp-title">Rp:</view>
+                        <view class="medicine-list" v-if="prescDataDetail.length > 0">
+                            <view class="medicine-item" v-for="(item, index) in prescDataDetail" :key="index">
+                                <view class="medicine-main">
+                                    {{ index + 1 }}. {{ item.medDesc || '-' }}
+                                    <text>{{ item.medSpec || '' }}</text>
+                                    <text class="medicine-qty">×{{ item.ordQty || '' }}{{ item.ordUnitDesc || '' }}</text>
+                                </view>
+                                <view class="medicine-usage" v-if="item.ordFreqDesc || item.ordDurationDesc">用法:{{ item.ordFreqDesc || '' }} {{ item.ordDurationDesc || '' }}</view>
+                            </view>
+                            <view v-if="prescMainInfo.cmPrescFlag == 1" class="medicine-usage">
+                                用法:{{ prescMainInfo.cmFreqDesc || '' }} {{ prescMainInfo.cmExplainDesc || '' }} {{ prescMainInfo.cmUsageDesc || '' }}
+                            </view>
+                        </view>
+                        <view v-else class="empty-text">暂无处方明细</view>
+                        <view class="prescription-footer">
+                            <view class="prescription-signature">
+                                <text>医师:</text>
+                                <image v-if="prescriptionDoctorSignUrl" :src="prescriptionDoctorSignUrl" mode="aspectFit" />
+                                <text v-else>{{ prescMainInfo.ordDocDesc || '-' }}</text>
+                            </view>
+                            <view>金额:{{ prescMainInfo.prescAmt || '-' }}</view>
+                            <view class="prescription-signature">
+                                <text>审核:</text>
+                                <image v-if="prescriptionAuditSignUrl" :src="prescriptionAuditSignUrl" mode="aspectFit" />
+                                <text v-else>{{ prescMainInfo.auditUserName || '-' }}</text>
+                            </view>
+                        </view>
                     </view>
-                    <!-- <view> <text class="room">发药:</text> {{PrescDataMainInfo.dispUserName}}</view> -->
+                    <view v-else class="empty-text">本次就诊暂无处方</view>
                 </view>
-            </view>
-            <view class="last">医师处方仅开具3日内有效(医师注明除外)</view>
+            </scroll-view>
         </view>
     </view>
 </template>
 
 <script>
-import $http from "@/utils/https";
-import Util from '@/utils/utils';
-import navBar from '@/components/navBar/index'
-const app = getApp()
+import $http from '@/utils/https';
+import httpConfig from '@/utils/httpConfig';
+import NavBar from '@/components/navBar/index.vue';
+
+const app = getApp();
+
 export default {
     components: {
-        'nav-bar': navBar
+        'nav-bar': NavBar
     },
     data() {
         return {
@@ -100,170 +111,462 @@ export default {
             navbarData: {
                 isGoHome: true,
                 isGoBack: true,
-                title: "我的处方详情"
+                title: '病历详情'
             },
-            prescNo: '',
             userData: {},
-            PrescDataDetail: [],       ///药品列表
-            PrescDataMainInfo: {}      ///处方信息
-        }
+            admID: '',
+            doctorName: '',
+            locDesc: '',
+            visitTime: '',
+            activeTab: 'record',
+            medicalRecordTemplateID: '137',
+            medicalRecordFields: [],
+            doctorSignatureUrl: '',
+            recordLoading: true,
+            prescNos: [],
+            activePrescNo: '',
+            prescriptionLoading: false,
+            prescDataDetail: [],
+            prescMainInfo: null,
+            prescriptionDoctorSignUrl: '',
+            prescriptionAuditSignUrl: ''
+        };
     },
     onLoad(options) {
-        const userData = this.$cache.get('userData')
-        if (userData) this.userData = userData
-        if (options && options.hasOwnProperty('id') && options.id) {
-            this.setData({ prescNo: options.id })
-        }
-    },
-    onReady: function () {
-        this.getPrescDataDetail()
+        const prescNos = String(options.prescNos || options.prescNo || '')
+            .split(',')
+            .filter(Boolean);
+        this.setData({
+            userData: this.$cache.get('userData') || {},
+            admID: options.admID || '',
+            doctorName: options.doctorName || '',
+            locDesc: options.locDesc || '',
+            visitTime: options.visitTime || '',
+            prescNos,
+            activePrescNo: prescNos[0] || ''
+        });
+        this.queryMedicalRecord();
     },
     methods: {
-        // 请求电子处方详情列表数据
-        getPrescDataDetail: function () {
-            let data = {
-                params: [{
-                    prescNo: this.prescNo,
-                    hospCode: this.userData.hisHospID
-                }]
+        changeTab(tab) {
+            this.setData({ activeTab: tab });
+            if (tab === 'prescription' && this.activePrescNo && !this.prescMainInfo && !this.prescriptionLoading) {
+                this.queryPrescription();
             }
-            $http.post("urlS", this, {
-                code: "03100092",
-                data: data,
+        },
+        selectPrescription(prescNo) {
+            if (prescNo === this.activePrescNo) return;
+            this.setData(
+                {
+                    activePrescNo: prescNo,
+                    prescDataDetail: [],
+                    prescMainInfo: null,
+                    prescriptionDoctorSignUrl: '',
+                    prescriptionAuditSignUrl: ''
+                },
+                () => {
+                    this.queryPrescription();
+                }
+            );
+        },
+        queryMedicalRecord() {
+            if (!this.admID) {
+                this.setData({ recordLoading: false });
+                return;
+            }
+            $http.post('urlS', this, {
+                code: '10020002',
+                data: {
+                    params: [{
+                        IEMRTemplateID: this.medicalRecordTemplateID,
+                        admID: this.admID
+                    }]
+                },
                 namespace: 'Y',
                 success: function (res) {
-                    if (+res.errorCode === 0) {
-                        this.setData({ PrescDataDetail: res.result[0].detailInfo[0].rows, PrescDataMainInfo: res.result[0].mainInfo[0] });
-                    } else {
-                        this.setData({ PrescDataDetail: [], PrescDataMainInfo: {} });
-                    }
+                    const rows = +res.errorCode === 0 && res.result instanceof Array ? res.result : [];
+                    this.setData({
+                        medicalRecordFields: rows
+                            .filter((item) => item && item.IEMRTempElementDesc)
+                            .map((item, index) => ({
+                                key: item.IEMRTempElementID || item.IEMRTempElementDesc + '-' + index,
+                                label: item.IEMRTempElementDesc,
+                                value: this.getMedicalRecordValue(item),
+                                empty: !this.hasMedicalRecordValue(item)
+                            })),
+                        doctorSignatureUrl: this.resolveSignatureImage(res.signImage),
+                        recordLoading: false
+                    });
+                },
+                error: function () {
+                    this.setData({ medicalRecordFields: [], doctorSignatureUrl: '', recordLoading: false });
+                }
+            });
+        },
+        resolveSignatureImage(signImage) {
+            const source = String(signImage || '').trim();
+            if (!source) return '';
+            if (/^(https?:)?\/\//.test(source) || source.indexOf('data:image/') === 0) return source;
+            if (source.indexOf('/') === 0) return (httpConfig.imgHost || '').replace(/\/$/, '') + source;
+            return (httpConfig.imgHost || '').replace(/\/$/, '') + '/images/photo/' + source;
+        },
+        hasMedicalRecordValue(item) {
+            return [item.IEMRTempElementData, item.IEMRTempElementPrintData, item.printValue].some((value) => {
+                return value !== undefined && value !== null && String(value).trim() !== '';
+            });
+        },
+        getMedicalRecordValue(item) {
+            const value = [item.IEMRTempElementData, item.IEMRTempElementPrintData, item.printValue].find((itemValue) => {
+                return itemValue !== undefined && itemValue !== null && String(itemValue).trim() !== '';
+            });
+            return value === undefined ? '未填写' : String(value);
+        },
+        queryPrescription() {
+            if (!this.activePrescNo) return;
+            this.setData({ prescriptionLoading: true });
+            $http.post('urlS', this, {
+                code: '03100092',
+                data: {
+                    params: [{
+                        prescNo: this.activePrescNo,
+                        hospCode: this.userData.hisHospID || ''
+                    }]
+                },
+                namespace: 'Y',
+                success: function (res) {
+                    const detail = +res.errorCode === 0 && res.result instanceof Array ? res.result[0] || {} : {};
+                    const mainInfo = detail.mainInfo instanceof Array ? detail.mainInfo[0] || null : null;
+                    const detailInfo = detail.detailInfo instanceof Array ? detail.detailInfo[0] || {} : {};
+                    this.setData({
+                        prescMainInfo: mainInfo,
+                        prescDataDetail: detailInfo.rows instanceof Array ? detailInfo.rows : [],
+                        prescriptionDoctorSignUrl: this.resolveSignatureImage(mainInfo && mainInfo.ordDocSignImage),
+                        prescriptionAuditSignUrl: this.resolveSignatureImage(mainInfo && mainInfo.auditUserSignImage),
+                        prescriptionLoading: false
+                    });
+                },
+                error: function () {
+                    this.setData({
+                        prescMainInfo: null,
+                        prescDataDetail: [],
+                        prescriptionDoctorSignUrl: '',
+                        prescriptionAuditSignUrl: '',
+                        prescriptionLoading: false
+                    });
                 }
             });
         }
     }
-}
+};
 </script>
 
-<style>
-/* pages/mine//myPrescription/prescriptionDetail/prescriptionDetail.wxss */
-.prescriptionDetail {
-    margin: 15rpx;
-    padding: 10rpx;
-    background-color: #fff;
+<style lang="scss" scoped>
+.medical-record-detail {
+    min-height: 100vh;
+    background: #f5f7fa;
+}
+
+.page-content {
+    box-sizing: border-box;
+    height: 100vh;
+}
+
+.visit-summary {
+    position: relative;
+    padding: 22rpx 30rpx 20rpx;
+    background: #fff;
+    border-bottom: 1rpx solid #eef1f5;
+}
+
+.summary-name {
+    color: #24364a;
+    font-size: 31rpx;
+    font-weight: 600;
+    letter-spacing: 1rpx;
+}
+
+.summary-time {
+    margin-top: 8rpx;
+    color: #8b99aa;
+    font-size: 25rpx;
+}
+
+.tabs {
+    display: flex;
+    height: 80rpx;
+    background: #fff;
+    box-shadow: 0 4rpx 12rpx rgba(30, 65, 110, 0.03);
 }
 
-.prescriptionDetail .top {
+.tab {
     position: relative;
+    flex: 1;
+    color: #68778a;
+    font-size: 28rpx;
+    line-height: 80rpx;
+    text-align: center;
 }
 
-.prescriptionDetail .top .buttom {
+.tab.active {
+    color: #2176e5;
+    font-weight: 600;
+}
+
+.tab.active::after {
     position: absolute;
-    right: 18rpx;
-    top: 68rpx;
-    padding: 3rpx 8rpx;
-    border: 2rpx silver solid;
-    color: #999;
+    bottom: 0;
+    left: 50%;
+    width: 46rpx;
+    height: 5rpx;
+    border-radius: 8rpx;
+    background: #287deb;
+    content: '';
+    transform: translateX(-50%);
+}
+
+.detail-scroll {
+    height: calc(100vh - 244rpx);
+    box-sizing: border-box;
+}
+
+.tab-content {
+    padding: 18rpx 24rpx 40rpx;
+}
+
+.record-card,
+.prescription-card {
+    overflow: hidden;
+    border: 1rpx solid #edf1f5;
     border-radius: 14rpx;
+    background: #fff;
+    box-shadow: 0 8rpx 24rpx rgba(32, 66, 110, 0.05);
 }
 
-.prescriptionDetail .top .tit {
-    text-align: center;
-    font-size: 37rpx;
-    font-weight: 700;
-    height: 48rpx;
+.record-card-head {
+    position: relative;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 18rpx 22rpx 18rpx 32rpx;
+    border-bottom: 1rpx solid #e9f0f8;
+    background: linear-gradient(90deg, #f4f9ff 0%, #ffffff 72%);
+    color: #2c4a6b;
+    font-size: 28rpx;
+    font-weight: 600;
 }
 
-.prescriptionDetail .top .tit-small {
-    text-align: center;
-    font-size: 33rpx;
-    font-weight: 700;
-    height: 42rpx;
+.record-card-head::before {
+    position: absolute;
+    left: 18rpx;
+    width: 5rpx;
+    height: 28rpx;
+    border-radius: 6rpx;
+    background: #3b8af3;
+    content: '';
 }
 
-.prescriptionDetail .top .NO {
-    text-align: right;
-    margin-top: 20rpx;
-    height: 38rpx;
+.record-card-head text:last-child {
+    color: #91a0b2;
+    font-size: 23rpx;
+    font-weight: 400;
+}
+
+.record-row {
+    display: flex;
+    align-items: flex-start;
+    padding: 15rpx 22rpx;
+    border-bottom: 1rpx solid #eff2f5;
+}
+
+.record-row:last-child {
+    border-bottom: 0;
+}
+
+.record-row:nth-child(2n + 1) {
+    background: #fcfdff;
+}
+
+.signature-row {
+    display: flex;
+    min-height: 88rpx;
+    align-items: center;
+    justify-content: flex-end;
+    padding: 10rpx 22rpx;
+    border-top: 1rpx dashed #dce5ef;
+    background: #fafcff;
+    color: #7d8ea2;
+    font-size: 24rpx;
+}
+
+.signature-row image {
+    width: 175rpx;
+    height: 70rpx;
+    margin-left: 18rpx;
+}
+
+.record-label {
+    flex: 0 0 158rpx;
+    color: #718196;
+    font-size: 25rpx;
+    line-height: 40rpx;
+}
+
+.record-value {
+    flex: 1;
+    color: #2d3c4d;
+    font-size: 26rpx;
+    line-height: 40rpx;
+    white-space: pre-wrap;
+    word-break: break-all;
+}
+
+.record-value.is-empty {
+    color: #aeb8c4;
+    font-size: 24rpx;
+}
+
+.prescription-switcher {
+    display: flex;
+    overflow-x: auto;
+    margin-bottom: 20rpx;
+    white-space: nowrap;
+}
+
+.prescription-pill {
+    margin-right: 16rpx;
+    padding: 10rpx 18rpx;
+    border-radius: 28rpx;
+    background: #eaf2ff;
+    color: #5085d5;
+    font-size: 24rpx;
+}
+
+.prescription-pill.active {
+    background: #277dea;
+    color: #fff;
 }
 
-.prescriptionDetail .top .NO .k {
-    color: red;
+.prescription-card {
+    padding: 30rpx;
+}
+
+.prescription-head {
+    position: relative;
+    padding-bottom: 24rpx;
+    border-bottom: 1rpx solid #e8e8e8;
+    text-align: center;
 }
 
-.prescriptionDetail .userInfo {
-    min-height: 160rpx;
-    margin-top: 20rpx;
-    padding: 13rpx;
+.hospital-name,
+.prescription-title {
     color: #333;
-    height: 186rpx;
-    border-bottom: 2rpx silver solid;
+    font-size: 34rpx;
+    font-weight: 700;
+}
+
+.prescription-title {
+    margin-top: 8rpx;
+    font-size: 30rpx;
 }
 
-.prescriptionDetail .room {
+.prescription-type {
+    position: absolute;
+    top: 0;
+    right: 0;
+    color: #999;
     font-size: 24rpx;
-    color: #666;
 }
 
-.prescriptionDetail .userInfo .left {
-    width: 49%;
-    float: left;
+.prescription-no {
+    margin-top: 18rpx;
+    color: #e33b3b;
+    font-size: 25rpx;
+    text-align: right;
+}
+
+.patient-info {
+    display: flex;
+    flex-wrap: wrap;
+    padding: 22rpx 0;
+    border-bottom: 1rpx solid #e8e8e8;
+    color: #333;
+    font-size: 26rpx;
+    line-height: 48rpx;
 }
 
-.prescriptionDetail .userInfo .right {
-    width: 49%;
-    float: left;
+.patient-info view {
+    width: 50%;
 }
 
-.prescriptionDetail .RP {
-    padding: 10rpx;
-    height: 580rpx;
-    overflow: auto;
+.patient-info .full-line {
+    width: 100%;
 }
 
-.prescriptionDetail .RP .T {
-    font-size: 35rpx;
+.patient-info text,
+.prescription-footer {
+    color: #888;
+}
+
+.rp-title {
+    margin: 24rpx 0 12rpx;
+    color: #333;
+    font-size: 36rpx;
+    font-weight: 700;
 }
 
-.prescriptionDetail .content {
-    margin-bottom: 15rpx;
+.medicine-item {
+    padding: 18rpx 0;
+    border-bottom: 1rpx dashed #ddd;
 }
 
-.prescriptionDetail .content-tit {
-    margin-top: 15rpx;
+.medicine-main {
+    color: #333;
+    font-size: 29rpx;
+    line-height: 42rpx;
 }
 
-.prescriptionDetail .content-tit .A {
-    margin-left: 15%;
+.medicine-main text {
+    margin-left: 12rpx;
+    color: #666;
+    font-size: 25rpx;
 }
 
-.prescriptionDetail .content-tit .N {
+.medicine-main .medicine-qty {
     float: right;
 }
 
-.prescriptionDetail .content-bottom {
-    margin-top: 15rpx;
+.medicine-usage {
+    margin-top: 10rpx;
+    color: #777;
+    font-size: 25rpx;
+    line-height: 38rpx;
 }
 
-.prescriptionDetail .content-bottom text {
-    margin-left: 50rpx;
+.prescription-footer {
+    display: flex;
+    min-height: 50rpx;
+    align-items: center;
+    justify-content: space-between;
+    margin-top: 24rpx;
+    font-size: 24rpx;
 }
 
-.prescriptionDetail .blank {
-    border-top: 2rpx dashed #999;
-    text-align: center;
-    height: 100rpx;
-    margin-top: 20rpx;
+.prescription-signature {
+    display: flex;
+    min-width: 0;
+    align-items: center;
 }
 
-.prescriptionDetail .doctor {
-    border-bottom: 0;
-    border-top: 2rpx silver solid;
-    height: 150rpx;
+.prescription-signature image {
+    width: 112rpx;
+    height: 46rpx;
 }
 
-.prescriptionDetail .last {
+.empty-text,
+.loading-text {
+    padding: 100rpx 20rpx;
+    color: #999;
+    font-size: 28rpx;
     text-align: center;
-    color: #999999;
-    height: 38rpx;
 }
-</style>
+</style>

+ 211 - 163
src/pages/mine/myPrescription/prescriptionList/prescription.vue

@@ -1,76 +1,48 @@
-<!-- 我的处方 -->
 <template>
-    <nav-bar :navbar-data="navbarData" />
-    <view :style="{ paddingTop: height +'px', height: '100vh', boxSizing: 'border-box', overflow: 'hidden' }">
-        <!-- <van-tabs active="{{ active }}" bind:change="onChange" tab-active-class="tabs-active">
-			<van-tab title="线上门诊">
-			</van-tab>
-			<van-tab title="线下门诊">
-			</van-tab>
-		</van-tabs> -->
-        <view :style="{ height: 'calc(100vh - '+ (height + 51) +'px)', overflowY: 'auto' }">
-            <view class="card" v-for="(item, index) in PrescData" :key="index">
-                <view class="card-show">
-                    <view>
-                        <!-- <image class="card-show-img" src="/images/photo/a0061261ab11da688ee4574cfc8e0994.jpg"></image> -->
-                    </view>
-                    <view class="card-show-intro">
-                        <view>
-                            <text class="text1">{{ item.doctorName }}</text>
-                            <text class="text2">{{ item.locDesc }}</text>
-                        </view>
-                        <view class="text3">就诊时间:{{ item.prescDate }}</view>
-                    </view>
-                </view>
-                <view class="card-reg">诊断:{{ item.diag }}</view>
-                <view class="card-pre">
-                    <view class="card-pre-item">
-                        <view class="card-pre-item-no">
-                            <!-- <image style="width:32rpx;height:36rpx" src="../../../../images/icon_prescrip.png"></image> -->
-                            <text style="margin-left:16rpx">西药处方</text>
-                            <text style="margin-left:16rpx">{{ item.prescNo }}</text>
-                        </view>
-                        <view class="card-pre-btn">
-                            <navigator :url="'../prescriptionDetail/prescriptionDetail?id=' + item.prescNo">
-                                查看处方
-                            </navigator>
+    <view class="medical-record-page">
+        <nav-bar :navbar-data="navbarData" />
+        <scroll-view scroll-y class="record-scroll" :style="{ paddingTop: height + 'px' }">
+            <view v-if="groupedRecords.length > 0" class="record-list">
+                <view v-for="group in groupedRecords" :key="group.date" class="date-group">
+                    <view class="date-title">{{ group.date }}</view>
+                    <view class="timeline">
+                        <view v-for="item in group.records" :key="item._key" class="timeline-item" @tap="goDetail(item)">
+                            <view class="timeline-line"></view>
+                            <view class="timeline-dot"></view>
+                            <view class="record-card">
+                                <view class="record-title">
+                                    {{ item.doctorName || '-' }}{{ item.consultType ? '(' + item.consultType + ')' : '' }}
+                                </view>
+                                <view class="record-subtitle">
+                                    {{ item.locDesc || '-' }}
+                                    <text v-if="item.orderTime" class="record-time">{{ formatTime(item.orderTime) }}</text>
+                                </view>
+                                <view class="record-status" v-if="item.statusDesc">{{ item.statusDesc }}</view>
+                                <view class="record-arrow">›</view>
+                            </view>
                         </view>
                     </view>
-                    <!-- <view class="card-pre-item">
-						<view class="card-pre-item-no">
-							<image style="width:32rpx;height:36rpx" src="../../../../images/icon_prescrip.png"></image>
-							<text style="margin-left:16rpx">OPO202011260019</text>
-							<text style="margin-left:16rpx">西药处方</text>
-						</view>
-						<view class="card-pre-btn2"> 
-							已失效
-						</view>
-					</view> -->
                 </view>
             </view>
-            <!-- <van-divider contentPosition="center">数据已全部加载</van-divider> -->
-			<view class="no-data" v-if="PrescData && PrescData.length == 0" :style="{height: 'calc(100% - '+ navHeight +'px)'}">
-				<van-icon name="orders-o" size="50px" color="#cccccc" />
-			    <view class="txt">暂无记录</view>
-			</view>
-        </view>
+            <view v-else-if="!loading" class="no-data">
+                <van-icon name="orders-o" size="50px" color="#cccccc" />
+                <view class="txt">暂无就诊记录</view>
+            </view>
+        </scroll-view>
     </view>
 </template>
 
 <script>
-import $http from "@/utils/https";
-import Util from '@/utils/utils';
-import VanDivider from '@/components/divider/index';
-import VanIcon from '@/components/icon/index';
-import NavBar from '@/components/navBar/index';
-import Loadmore from '@/components/loadmore/loadmore';
-const app = getApp()
+import $http from '@/utils/https';
+import NavBar from '@/components/navBar/index.vue';
+import VanIcon from '@/components/icon/index.vue';
+
+const app = getApp();
+
 export default {
     components: {
         'nav-bar': NavBar,
-        'van-divider': VanDivider,
-		'van-icon': VanIcon,
-		'loadmore': Loadmore
+        'van-icon': VanIcon
     },
     data() {
         return {
@@ -78,141 +50,217 @@ export default {
             navbarData: {
                 isGoHome: true,
                 isGoBack: true,
-                title: "我的处方"
+                title: '我的病历'
             },
-            PrescData: [],
-            active: 0
+            loading: true,
+            records: [],
+            prescriptionMap: {}
+        };
+    },
+    computed: {
+        groupedRecords() {
+            const groups = {};
+            this.records.forEach((item) => {
+                const date = this.getDate(item.orderTime || item.consultationDate);
+                if (!groups[date]) groups[date] = [];
+                groups[date].push(item);
+            });
+            return Object.keys(groups)
+                .sort((a, b) => b.localeCompare(a))
+                .map((date) => ({
+                    date,
+                    records: groups[date]
+                }));
         }
     },
-    onLoad: function () {
-        this.getPrescDataList();
+    onLoad() {
+        this.queryRecords();
+        this.queryPrescriptions();
     },
     methods: {
-        // 请求电子处方列表数据
-        getPrescDataList: function () {
-            let userData = this.$cache.get('userData') ? this.$cache.get('userData') : {};
-            let data = {
-                params: [{
-                    patID: userData.hisPatID,
-                    hospCode: userData.hisHospID
-                }]
-            }
-            $http.post("urlS", this, {
-                code: "03100091",
-                data: data,
+        queryRecords() {
+            const userData = this.$cache.get('userData') || {};
+            $http.post('urlS', this, {
+                code: '02090009',
+                data: {
+                    params: [{
+                        patID: userData.hisPatID || '',
+                        typeCode: []
+                    }]
+                },
+                namespace: 'Y',
+                success: function (res) {
+                    const rows = +res.errorCode === 0 && res.result && res.result.rows instanceof Array ? res.result.rows : [];
+                    this.setData({
+                        records: rows.map((item, index) => ({
+                            ...item,
+                            _key: (item.admID || item.consultID || 'record') + '-' + index
+                        })),
+                        loading: false
+                    });
+                },
+                error: function () {
+                    this.setData({ records: [], loading: false });
+                }
+            });
+        },
+        queryPrescriptions() {
+            const userData = this.$cache.get('userData') || {};
+            $http.post('urlS', this, {
+                code: '03100091',
+                data: {
+                    params: [{
+                        patID: userData.hisPatID || '',
+                        hospCode: userData.hisHospID || ''
+                    }]
+                },
                 namespace: 'Y',
                 success: function (res) {
-                    if (+res.errorCode === 0) {
-                        this.setData({ PrescData: res.rows });
-                    } else {
-                        this.setData({ PrescData: [] });
-                    }
+                    const rows = +res.errorCode === 0 && res.rows instanceof Array ? res.rows : [];
+                    const prescriptionMap = {};
+                    rows.forEach((item) => {
+                        if (!item || item.admID === undefined || item.admID === null || !item.prescNo) return;
+                        const key = String(item.admID);
+                        if (!prescriptionMap[key]) prescriptionMap[key] = [];
+                        prescriptionMap[key].push(item.prescNo);
+                    });
+                    this.setData({ prescriptionMap });
                 }
             });
         },
+        getDate(value) {
+            const source = String(value || '');
+            return source.length >= 10 ? source.slice(0, 10) : '未知日期';
+        },
+        formatTime(value) {
+            const source = String(value || '');
+            return source.length >= 16 ? source.slice(11, 16) : '';
+        },
+        goDetail(item) {
+            const prescNos = this.prescriptionMap[String(item.admID)] || [];
+            const params = [
+                'admID=' + encodeURIComponent(item.admID || ''),
+                'prescNos=' + encodeURIComponent(prescNos.join(',')),
+                'doctorName=' + encodeURIComponent(item.doctorName || ''),
+                'locDesc=' + encodeURIComponent(item.locDesc || ''),
+                'visitTime=' + encodeURIComponent(item.orderTime || item.consultationDate || '')
+            ].join('&');
+            uni.navigateTo({
+                url: '../prescriptionDetail/prescriptionDetail?' + params
+            });
+        }
     }
-}
+};
 </script>
 
-<style>
-.card {
-  min-height: 200rpx;
-  background: #FFFFFF;
-  margin-top: 20rpx;
-  padding: 30rpx;
+<style lang="scss" scoped>
+.medical-record-page {
+    min-height: 100vh;
+    background: #f6f7f9;
 }
 
-.card-show {
-  display: flex;
-  align-items: center;
+.record-scroll {
+    box-sizing: border-box;
+    height: 100vh;
 }
 
-.card-show-img {
-  width: 80rpx;
-  height: 80rpx;
-  border-radius: 50%;
+.record-list {
+    padding: 26rpx 30rpx 40rpx;
 }
 
-.card-show-intro {
-  margin-left: 24rpx;
+.date-group {
+    margin-bottom: 24rpx;
 }
 
-.card-show-intro .text1 {
-  font-size: 30rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 500;
-  color: #333333;
-  line-height: 42rpx;
+.date-title {
+    color: #3376d8;
+    font-size: 28rpx;
+    font-weight: 600;
+    margin-bottom: 16rpx;
 }
 
-.card-show-intro .text2 {
-  margin-left: 16rpx;
-  font-size: 26rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #999999;
-  line-height: 36rpx;
+.timeline-item {
+    position: relative;
+    padding: 0 0 18rpx 30rpx;
 }
 
-.card-show-intro .text3 {
-  font-size: 26rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #666666;
-  line-height: 36rpx;
-  margin-top: 4rpx;
+.timeline-line {
+    position: absolute;
+    top: 20rpx;
+    bottom: -2rpx;
+    left: 8rpx;
+    width: 2rpx;
+    background: #bdd6fb;
 }
 
-.card-reg {
-  padding: 20rpx 0;
-  font-size: 26rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 500;
-  color: #333333;
-  line-height: 36rpx;
-  border-bottom: 2rpx solid #E5E5E5;
+.timeline-item:last-child .timeline-line {
+    display: none;
 }
 
+.timeline-dot {
+    position: absolute;
+    z-index: 1;
+    top: 10rpx;
+    left: 0;
+    width: 18rpx;
+    height: 18rpx;
+    border: 4rpx solid #d8e8ff;
+    border-radius: 50%;
+    background: #4b91f5;
+}
 
+.record-card {
+    position: relative;
+    min-height: 76rpx;
+    padding: 22rpx 68rpx 22rpx 24rpx;
+    border-radius: 12rpx;
+    background: #fff;
+    box-shadow: 0 4rpx 16rpx rgba(45, 86, 142, 0.08);
+}
 
-.card-pre-item {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-top: 20rpx;
+.record-title {
+    color: #333;
+    font-size: 30rpx;
+    font-weight: 600;
 }
 
-.card-pre-btn {
-  width: 140rpx;
-  height: 56rpx;
-  background: #007AFF;
-  border-radius: 8rpx;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  font-size: 26rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #FFFFFF;
-  line-height: 36rpx;
+.record-subtitle {
+    margin-top: 10rpx;
+    color: #8a8a8a;
+    font-size: 25rpx;
 }
-.card-pre-item-no{
-  display: flex;
-  align-items: center;
+
+.record-time {
+    margin-left: 16rpx;
 }
-.card-pre-btn2 {
-  width: 140rpx;
-  height: 56rpx;
-  background:#F3F3F3;
-  border-radius: 8rpx;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  font-size: 26rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #999999;
-  line-height: 36rpx;
+
+.record-status {
+    margin-top: 10rpx;
+    color: #5c92e6;
+    font-size: 24rpx;
+}
+
+.record-arrow {
+    position: absolute;
+    top: 50%;
+    right: 22rpx;
+    color: #bbb;
+    font-size: 42rpx;
+    line-height: 42rpx;
+    transform: translateY(-50%);
+}
+
+.no-data {
+    display: flex;
+    height: calc(100vh - 120rpx);
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+}
+
+.txt {
+    margin-top: 20rpx;
+    color: #999;
+    font-size: 28rpx;
 }
-
-</style>
+</style>

+ 3 - 3
src/pages/tabBar/mine/mine.vue

@@ -41,10 +41,10 @@
                     </view>
                     <view @tap="prescriptiontNav" class="mine-head-func-item">
                         <image :src="imgHost + '/images/icon/Myprescription@2x.png'" alt=""></image>
-                        <view class="mine-head-func-item-title">我的处方</view>
+                        <view class="mine-head-func-item-title">我的病历</view>
                         <view class="mine-head-func-item-desc">
-                            <text>{{ userInfo.prescNum || 0 }}</text>
-                            
+                            <text>{{ userInfo.consultNum || 0 }}</text>
+                            
                         </view>
                     </view>
                     <!-- <view @tap="recordtNav" class="mine-head-func-item">