From c6e38b6c66de5f5a8df5b8b2ab03a82c3b605db8 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 03 十二月 2025 00:48:44 +0800
Subject: [PATCH] feat:优化同步

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java              |    4 
 ruoyi-ui/src/views/task/general/detail.vue                                                  |  320 ++++++++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AdditionalFeeSyncServiceImpl.java  |   62 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacySystemSyncServiceImpl.java   |    5 
 app/pagesTask/edit.vue                                                                      |   53 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java            |  633 +++++++++++----
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/LegacySystemSyncTask.java                  |    8 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacyTransferSyncServiceImpl.java |   89 ++
 ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml                             |    1 
 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskUpdateVO.java                     |  519 -------------
 app/pagesTask/edit-emergency.vue                                                            |  226 ++++-
 app/pagesTask/edit-welfare.vue                                                              |   66 +
 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java                    |   27 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentSyncServiceImpl.java     |   28 
 app/pagesTask/detail.vue                                                                    |  169 ++++
 ruoyi-system/src/main/java/com/ruoyi/system/service/IAdditionalFeeSyncService.java          |   11 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskPaymentServiceImpl.java     |    2 
 ruoyi-system/src/main/resources/mapper/system/SysTaskAdditionalFeeMapper.xml                |    6 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskVehicleController.java       |   10 
 ruoyi-system/src/main/resources/mapper/system/LegacyTransferSyncMapper.xml                  |    2 
 20 files changed, 1,364 insertions(+), 877 deletions(-)

diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index 214bb7b..0e96658 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -28,9 +28,44 @@
           <view class="label">鎵ц杞﹁締</view>
           <view class="value">{{ getVehicleInfo(taskDetail) }}</view>
         </view>
-        <view class="info-item">
-          <view class="label">鎵ц浜哄憳</view>
-          <view class="value">{{ taskDetail.assigneeName || '鏈垎閰�' }}</view>
+      </view>
+      
+      <!-- 鎵ц浜哄憳鍒楄〃 -->
+      <view class="detail-section">
+        <view class="section-title">鎵ц浜哄憳</view>
+        <view v-if="taskDetail.assignees && taskDetail.assignees.length > 0" class="assignee-list">
+          <view 
+            class="assignee-item" 
+            v-for="(assignee, index) in taskDetail.assignees" 
+            :key="assignee.userId || index"
+          >
+            <view class="assignee-index">{{ index + 1 }}</view>
+            <view class="assignee-info">
+              <view class="assignee-name">
+                {{ assignee.userName }}
+                <view v-if="assignee.isPrimary === '1'" class="primary-badge">
+                  <uni-icons type="star-filled" size="12" color="#ff9500"></uni-icons>
+                  <text>璐熻矗浜�</text>
+                </view>
+              </view>
+              <view class="assignee-role">
+                <view 
+                  class="role-tag"
+                  :class="{
+                    'role-driver': assignee.userType === 'driver',
+                    'role-doctor': assignee.userType === 'doctor',
+                    'role-nurse': assignee.userType === 'nurse'
+                  }"
+                >
+                  {{ getUserTypeLabel(assignee.userType) }}
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+        <view v-else class="empty-assignee">
+          <uni-icons type="info" size="40" color="#ccc"></uni-icons>
+          <text>鏆傛棤鎵ц浜哄憳</text>
         </view>
       </view>
       
@@ -531,12 +566,12 @@
         getTask(this.taskId).then(response => {
           this.taskDetail = response.data || response
           // 璋冭瘯锛氭墦鍗拌繑鍥炵殑鏁版嵁
-          console.log('浠诲姟璇︽儏瀹屾暣鏁版嵁:', JSON.stringify(this.taskDetail, null, 2))
-          console.log('浠诲姟绫诲瀷瀛楁鍊�:', this.taskDetail.taskType)
-          console.log('浠诲姟鐘舵�佸瓧娈靛��:', this.taskDetail.taskStatus)
-          console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
-          console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
-          console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
+          // console.log('浠诲姟璇︽儏瀹屾暣鏁版嵁:', JSON.stringify(this.taskDetail, null, 2))
+          // console.log('浠诲姟绫诲瀷瀛楁鍊�:', this.taskDetail.taskType)
+          // console.log('浠诲姟鐘舵�佸瓧娈靛��:', this.taskDetail.taskStatus)
+          // console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
+          // console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
+          // console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
           
           // 濡傛灉鏄浆杩愪换鍔★紝鍔犺浇鏀粯淇℃伅
           if (this.taskDetail.taskType === 'EMERGENCY_TRANSFER') {
@@ -600,9 +635,9 @@
         return remaining > 0 ? remaining.toFixed(2) : '0.00'
       },
       
-      // 鑾峰彇杞﹁締淇℃伅
+      // 鑾峰彇杞﹁締淇℃伅锛堜慨澶嶏細闃叉 assignedVehicles 涓� null锛�
       getVehicleInfo(task) {
-        if (task.assignedVehicles && task.assignedVehicles.length > 0) {
+        if (task.assignedVehicles && Array.isArray(task.assignedVehicles) && task.assignedVehicles.length > 0) {
           const firstVehicle = task.assignedVehicles[0]
           let vehicleInfo = firstVehicle.vehicleNo || '鏈煡杞︾墝'
           if (task.assignedVehicles.length > 1) {
@@ -705,6 +740,16 @@
         return typeMap[type] || '鏈煡绫诲瀷'
       },
       
+      // 鑾峰彇鐢ㄦ埛绫诲瀷鏍囩
+      getUserTypeLabel(userType) {
+        const typeMap = {
+          'driver': '鍙告満',
+          'doctor': '鍖荤敓',
+          'nurse': '鎶ゅ+'
+        }
+        return typeMap[userType] || userType || '鏈煡'
+      },
+      
       // 澶勭悊缁撶畻
       handleSettlement() {
         uni.navigateTo({
@@ -776,8 +821,8 @@
           
           const activeTasks = response.data || [];
           
-          // 杩囨护鎺夊綋鍓嶄换鍔℃湰韬�
-          const otherActiveTasks = activeTasks.filter(task => task.taskId !== this.taskId);
+          // 杩囨护鎺夊綋鍓嶄换鍔℃湰韬紙淇锛氶槻姝� activeTasks 涓� null锛�
+          const otherActiveTasks = (activeTasks && Array.isArray(activeTasks)) ? activeTasks.filter(task => task.taskId !== this.taskId) : [];
           
           if (otherActiveTasks.length > 0) {
             // 杞﹁締鏈夊叾浠栨鍦ㄨ繘琛屼腑鐨勪换鍔�
@@ -1225,6 +1270,104 @@
         }
       }
       
+      // 鎵ц浜哄憳鍒楄〃鏍峰紡
+      .assignee-list {
+        .assignee-item {
+          display: flex;
+          align-items: center;
+          padding: 20rpx;
+          margin-bottom: 15rpx;
+          background-color: #f9f9f9;
+          border-radius: 10rpx;
+          
+          &:last-child {
+            margin-bottom: 0;
+          }
+          
+          .assignee-index {
+            width: 50rpx;
+            height: 50rpx;
+            border-radius: 50%;
+            background-color: #007AFF;
+            color: white;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-size: 24rpx;
+            font-weight: bold;
+            margin-right: 20rpx;
+            flex-shrink: 0;
+          }
+          
+          .assignee-info {
+            flex: 1;
+            display: flex;
+            flex-direction: column;
+            gap: 10rpx;
+            
+            .assignee-name {
+              display: flex;
+              align-items: center;
+              font-size: 30rpx;
+              color: #333;
+              font-weight: 500;
+              
+              .primary-badge {
+                display: inline-flex;
+                align-items: center;
+                gap: 4rpx;
+                margin-left: 12rpx;
+                padding: 4rpx 12rpx;
+                background-color: #fff3e0;
+                border-radius: 6rpx;
+                
+                text {
+                  font-size: 20rpx;
+                  color: #ff9500;
+                  font-weight: normal;
+                }
+              }
+            }
+            
+            .assignee-role {
+              .role-tag {
+                display: inline-block;
+                padding: 4rpx 12rpx;
+                border-radius: 6rpx;
+                font-size: 22rpx;
+                color: white;
+                
+                &.role-driver {
+                  background-color: #007AFF;
+                }
+                
+                &.role-doctor {
+                  background-color: #34C759;
+                }
+                
+                &.role-nurse {
+                  background-color: #AF52DE;
+                }
+              }
+            }
+          }
+        }
+      }
+      
+      .empty-assignee {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        padding: 60rpx 0;
+        color: #999;
+        
+        text {
+          margin-top: 20rpx;
+          font-size: 28rpx;
+        }
+      }
+      
       .info-item {
         display: flex;
         margin-bottom: 20rpx;
diff --git a/app/pagesTask/edit-emergency.vue b/app/pagesTask/edit-emergency.vue
index e23f4b5..4b133bf 100644
--- a/app/pagesTask/edit-emergency.vue
+++ b/app/pagesTask/edit-emergency.vue
@@ -27,6 +27,16 @@
         />
       </view>
       
+      <DepartureSelector
+        :address.sync="departureAddress"
+        :longitude.sync="departureLongitude"
+        :latitude.sync="departureLatitude"
+        :region="selectedRegion"
+        :required="false"
+        @address-selected="onDepartureAddressSelected"
+        @location-success="onDepartureLocationSuccess"
+      />
+      
       <view class="form-item">
         <view class="form-label required">杞繍鏃堕棿</view>
         <uni-datetime-picker 
@@ -278,6 +288,7 @@
 import OrganizationSelector from './components/OrganizationSelector.vue'
 import HospitalSelector from './components/HospitalSelector.vue'
 import DiseaseSelector from './components/DiseaseSelector.vue'
+import DepartureSelector from './components/DepartureSelector.vue'
 import distanceCalculator from '@/mixins/distanceCalculator.js'
 
 export default {
@@ -288,7 +299,8 @@
     VehicleSelector,
     OrganizationSelector,
     HospitalSelector,
-    DiseaseSelector
+    DiseaseSelector,
+    DepartureSelector
   },
   mixins: [distanceCalculator],
   data() {
@@ -300,12 +312,19 @@
       selectedOrganizationId: null,
       selectedRegion: '',
       mapSelectorType: '',
+      // 鎵╁睍 addressCoordinates 鏀寔澶氱閿悕
+      addressCoordinates: {
+        start: null,
+        end: null,
+        hospitalOutAddress: null,
+        hospitalInAddress: null
+      },
       // 鍑哄彂鍦颁俊鎭�
       departureAddress: '',
       departureLongitude: null,
       departureLatitude: null,
-      selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛�
-      selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
+      selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛紙纭繚鍒濆鍖栦负绌烘暟缁勶級
+      selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛紙纭繚鍒濆鍖栦负绌烘暟缁勶級
       allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
       filteredStaffList: [], // 杩囨护鍚庣殑浜哄憳鍒楄〃
       staffSearchKeyword: '', // 浜哄憳鎼滅储鍏抽敭璇�
@@ -403,8 +422,8 @@
           this.taskForm.patient.idCard = info.patientIdCard || ''
           this.taskForm.patient.condition = info.patientCondition || ''
           
-          // 瑙f瀽鐥呮儏淇℃伅
-          this.parseDiseaseInfo(info.patientCondition, info.diseaseIds)
+          // 瑙f瀽鐥呮儏淇℃伅锛堜慨澶嶏細浣跨敤涓庡垱寤虹晫闈竴鑷寸殑閫昏緫锛�
+          this.parseDiseaseInfo(info.patientCondition, info.diseases)
           
           // 杞嚭鍖婚櫌淇℃伅
           this.taskForm.hospitalOut.id = info.hospitalOutId || null
@@ -489,8 +508,8 @@
           console.log('璁剧疆鐩爣鍦板潗鏍�:', this.taskDetail.destinationLongitude, this.taskDetail.destinationLatitude)
         }
         
-        // 璁剧疆鎵ц浜哄憳
-        if (this.taskDetail.assignees && this.taskDetail.assignees.length > 0) {
+        // 璁剧疆鎵ц浜哄憳锛堜慨澶嶏細纭繚 assignees 涓嶄负 null锛�
+        if (this.taskDetail.assignees && Array.isArray(this.taskDetail.assignees) && this.taskDetail.assignees.length > 0) {
           console.log('鍘熷鎵ц浜哄憳鏁版嵁:', this.taskDetail.assignees)
           this.selectedStaff = this.taskDetail.assignees.map(assignee => ({
             userId: assignee.userId,
@@ -503,6 +522,8 @@
         } else {
           console.warn('浠诲姟娌℃湁鍒嗛厤鎵ц浜哄憳鎴朼ssignees涓虹┖')
           console.log('taskDetail.assignees:', this.taskDetail.assignees)
+          // 纭繚 selectedStaff 鍒濆鍖栦负绌烘暟缁�
+          this.selectedStaff = []
         }
         
         console.log('琛ㄥ崟鏁版嵁濉厖瀹屾垚:', this.taskForm)
@@ -523,9 +544,33 @@
     
     // 褰掑睘鏈烘瀯閫夋嫨鍙樺寲
     onOrganizationChange(orgData) {
-      // orgData 鍖呭惈锛歞eptId, deptName, serviceOrderClass, region
+      // orgData 鍖呭惈锛歞eptId, deptName, serviceOrderClass, region, departureAddress, departureLongitude, departureLatitude
       this.selectedOrganizationId = orgData.deptId
-      console.log('閫変腑褰掑睘鏈烘瀯:', orgData.deptName, '閮ㄩ棬ID:', orgData.deptId)
+      this.selectedRegion = orgData.region
+      
+      // 鑷姩濉厖鍑哄彂鍦颁俊鎭紙鏈烘瀯鐨勫湴鍧�鍜屽潗鏍囷級
+      if (orgData.departureAddress) {
+        this.departureAddress = orgData.departureAddress
+        this.departureLongitude = orgData.departureLongitude || null
+        this.departureLatitude = orgData.departureLatitude || null
+        console.log('鑷姩濉厖鏈烘瀯鍑哄彂鍦�:', this.departureAddress, '鍧愭爣:', this.departureLongitude, this.departureLatitude)
+      }
+      
+      console.log('閫変腑褰掑睘鏈烘瀯:', orgData.deptName, '閮ㄩ棬ID:', orgData.deptId, '鍦板煙:', orgData.region)
+    },
+    
+    // 鍑哄彂鍦板湴鍧�閫夋嫨锛堜粠鍦板浘寤鸿涓�夋嫨锛�
+    onDepartureAddressSelected(data) {
+      // data 鍖呭惈: address, longitude, latitude, location
+      console.log('鍑哄彂鍦板湴鍧�閫夋嫨:', data)
+      // 缁勪欢宸茬粡閫氳繃 .sync 鏇存柊浜� departureAddress, departureLongitude, departureLatitude
+    },
+    
+    // 鍑哄彂鍦癎PS瀹氫綅鎴愬姛
+    onDepartureLocationSuccess(data) {
+      // data 鍖呭惈: address, longitude, latitude
+      console.log('鍑哄彂鍦癎PS瀹氫綅鎴愬姛:', data)
+      // 缁勪欢宸茬粡閫氳繃 .sync 鏇存柊浜� departureAddress, departureLongitude, departureLatitude
     },
     
     // 杞嚭鍖婚櫌鍙樺寲
@@ -732,61 +777,101 @@
       this.selectedStaff.splice(index, 1)
     },
     
-    // 瑙f瀽鐥呮儏淇℃伅锛堜粠瀛楃涓茶В鏋愬嚭ICD-10鐤剧梾鍒楄〃锛�
-    parseDiseaseInfo(conditionText, diseaseIds) {
+    // 瑙f瀽鐥呮儏淇℃伅锛堜粠瀛楃涓茶В鏋愬嚭ICD-10鐤剧梾鍒楄〃锛�- 淇锛氫笌鍒涘缓鐣岄潰淇濇寔涓�鑷�
+    parseDiseaseInfo(conditionText, diseases) {
+      console.log('========== 寮�濮嬭В鏋愮梾鎯呬俊鎭� ==========')
+      console.log('conditionText:', conditionText)
+      console.log('diseases鏁扮粍:', diseases)
+      
       if (!conditionText) {
+        console.log('鐥呮儏鏂囨湰涓虹┖锛屾竻绌洪�変腑鐥呮儏')
         this.selectedDiseases = []
         this.taskForm.patient.otherCondition = ''
         return
       }
-      
-      // 瑙f瀽diseaseIds锛堥�楀彿鍒嗛殧鐨勫瓧绗︿覆杞负鏁扮粍锛�
-      const diseaseIdArray = diseaseIds ? diseaseIds.split(',').map(id => parseInt(id.trim())).filter(id => !isNaN(id)) : []
       
       // 濡傛灉鍖呭惈"鍏朵粬锛�"鍒嗛殧绗︼紝鎷嗗垎鐥呮儏鍜屽叾浠栨弿杩�
       if (conditionText.includes('\n鍏朵粬锛�')) {
         const parts = conditionText.split('\n鍏朵粬锛�')
         const diseasePart = parts[0]
         this.taskForm.patient.otherCondition = parts[1] || ''
+        console.log('鐥呮儏閮ㄥ垎:', diseasePart)
+        console.log('鍏朵粬鎻忚堪:', this.taskForm.patient.otherCondition)
         
         // 瑙f瀽鐥呮儏閮ㄥ垎
-        this.parseDiseaseList(diseasePart, diseaseIdArray)
+        this.parseDiseaseList(diseasePart, diseases)
       } else {
-        // 娌℃湁"鍏朵粬"閮ㄥ垎锛屽叏閮ㄤ綔涓哄叾浠栨弿杩�
-        this.taskForm.patient.otherCondition = conditionText
-        this.selectedDiseases = []
+        // 娌℃湁"鍏朵粬"閮ㄥ垎锛屽皾璇曡В鏋愭槸鍚︽湁鐤剧梾鍒楄〃
+        const hasDiseasesFormat = /([^(]+)\(([^)]+)\)/.test(conditionText)
+        console.log('鏄惁鍖呭惈鐤剧梾鏍煎紡:', hasDiseasesFormat)
+        
+        if (hasDiseasesFormat) {
+          // 鏈夌柧鐥呮牸寮忥紝瑙f瀽鐤剧梾鍒楄〃
+          this.parseDiseaseList(conditionText, diseases)
+          this.taskForm.patient.otherCondition = ''
+        } else {
+          // 娌℃湁鐤剧梾鏍煎紡锛屽叏閮ㄤ綔涓哄叾浠栨弿杩�
+          console.log('鏃犵柧鐥呮牸寮忥紝浣滀负鍏朵粬鎻忚堪')
+          this.taskForm.patient.otherCondition = conditionText
+          this.selectedDiseases = []
+        }
       }
+      
+      console.log('瑙f瀽瀹屾垚锛宻electedDiseases:', JSON.stringify(this.selectedDiseases))
+      console.log('瑙f瀽瀹屾垚锛宱therCondition:', this.taskForm.patient.otherCondition)
+      console.log('========================================\n')
     },
     
     // 瑙f瀽鐥呮儏鍒楄〃锛堟牸寮忥細鐤剧梾鍚�(缂栫爜)銆佺柧鐥呭悕(缂栫爜)锛�
-    parseDiseaseList(diseasePart, diseaseIdArray) {
+    parseDiseaseList(diseasePart, diseasesData) {
+      console.log('--- parseDiseaseList 寮�濮� ---')
+      console.log('diseasePart:', diseasePart)
+      console.log('diseasesData:', diseasesData)
+      
       if (!diseasePart) {
+        console.log('鐥呮儏閮ㄥ垎涓虹┖')
         this.selectedDiseases = []
         return
       }
       
+      // 濡傛灉鍚庣宸茬粡杩斿洖浜哾iseases鏁扮粍锛岀洿鎺ヤ娇鐢�
+      if (diseasesData && Array.isArray(diseasesData) && diseasesData.length > 0) {
+        console.log('浣跨敤鍚庣杩斿洖鐨刣iseases鏁扮粍锛屾暟閲�:', diseasesData.length)
+        this.selectedDiseases = diseasesData.map(d => ({
+          id: d.icdId || null,
+          icdCode: d.icdCode || '',
+          icdName: d.icdName || ''
+        }))
+        console.log('瑙f瀽鍚庣殑selectedDiseases:', JSON.stringify(this.selectedDiseases))
+        return
+      }
+      
+      // 鍚﹀垯锛屼粠瀛楃涓茶В鏋�
+      console.log('浠庡瓧绗︿覆瑙f瀽鐥呮儏')
       // 鍖归厤鏍煎紡锛氱柧鐥呭悕(缂栫爜)
       const regex = /([^(]+)\(([^)]+)\)/g
       const diseases = []
       let match
-      let index = 0
       
       while ((match = regex.exec(diseasePart)) !== null) {
         const icdName = match[1].replace(/[銆�,\s]+$/, '').replace(/^[銆�,\s]+/, '').trim()
         const icdCode = match[2].trim()
         
+        console.log('鍖归厤鍒扮梾鎯� - 鍚嶇О:', icdName, '缂栫爜:', icdCode)
+        
         // 鍙坊鍔犵梾鎯呭悕绉颁笉涓虹┖鐨勯」
         if (icdName) {
           diseases.push({
-            icdName: icdName,
+            id: null, // 浠庡瓧绗︿覆瑙f瀽鏃讹紝娌℃湁ID
             icdCode: icdCode,
-            id: diseaseIdArray && index < diseaseIdArray.length ? diseaseIdArray[index] : null
+            icdName: icdName
           })
-          index++
         }
       }
       
+      console.log('浠庡瓧绗︿覆瑙f瀽瀹屾垚锛屾暟閲�:', diseases.length)
       this.selectedDiseases = diseases
+      console.log('--- parseDiseaseList 缁撴潫 ---\n')
     },
     
     // 閫夋嫨杞嚭鍖婚櫌鍦板潃
@@ -889,6 +974,14 @@
     },
     
     buildSubmitData() {
+      // 纭繚 selectedDiseases 鍜� selectedStaff 涓嶄负 null锛堜慨澶嶏細闃叉杩唬 null 瀵艰嚧閿欒锛�
+      if (!this.selectedDiseases) {
+        this.selectedDiseases = []
+      }
+      if (!this.selectedStaff) {
+        this.selectedStaff = []
+      }
+      
       // 鍚堝苟鐥呮儏淇℃伅锛氶�変腑鐨処CD-10鐤剧梾 + 鍏朵粬鎻忚堪
       let conditionText = ''
       if (this.selectedDiseases.length > 0) {
@@ -909,47 +1002,46 @@
         }
       }
       
+      // 鏋勫缓鎻愪氦鏁版嵁 - 浣跨敤涓� TaskCreateVO 涓�鑷寸殑缁撴瀯
       const submitData = {
         taskId: this.taskId,
         taskType: 'EMERGENCY_TRANSFER',
         deptId: this.selectedOrganizationId,
         vehicleIds: this.selectedVehicleId ? [this.selectedVehicleId] : [],
         plannedStartTime: this.taskForm.transferTime,
-        // 鍑哄彂鍦颁娇鐢� departureAddress锛堝鏋滄湁锛夛紝鍚﹀垯浣跨敤杞嚭鍖婚櫌鍦板潃
+        
+        // 鍑哄彂鍦板湴鍧�鍜屽潗鏍囷紙浣跨敤杞嚭鍖婚櫌鍦板潃锛�
         departureAddress: this.departureAddress || this.taskForm.hospitalOut.address,
-        // 鐩爣鍦颁娇鐢ㄨ浆鍏ュ尰闄㈠湴鍧�
+        departureLongitude: this.departureLongitude || (this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lng : null),
+        departureLatitude: this.departureLatitude || (this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lat : null),
+        
+        // 鐩爣鍦板湴鍧�鍜屽潗鏍囷紙浣跨敤杞叆鍖婚櫌鍦板潃锛�
         destinationAddress: this.taskForm.hospitalIn.address,
+        destinationLongitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lng : null,
+        destinationLatitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lat : null,
+        
+        // 杞繍璺濈鍜屼环鏍硷紙涓讳换鍔″瓧娈碉級
+        distance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
+        price: this.taskForm.price ? parseFloat(this.taskForm.price) : null,
+        
         // 鐥呮儏ID鍒楄〃锛堢敤浜庡悓姝ヨ皟搴﹀崟鐨凮rdICD_ID鍙傛暟锛�
         diseaseIds: this.selectedDiseases.map(d => d.id).filter(id => id !== null),
-        // 鎵ц浜哄憳鍒楄〃
-        assignees: this.selectedStaff.map(staff => ({
+        
+        // 鎵ц浜哄憳鍒楄〃锛堢‘淇濅笉涓� null锛�
+        assignees: (this.selectedStaff && Array.isArray(this.selectedStaff)) ? this.selectedStaff.map(staff => ({
           userId: staff.userId,
           userName: staff.nickName,
           userType: staff.type
-        })),
-        emergencyInfo: {
-          patientContact: this.taskForm.patient.contact,
-          patientPhone: this.taskForm.patient.phone,
-          patientName: this.taskForm.patient.name,
-          patientGender: this.taskForm.patient.gender,
-          patientIdCard: this.taskForm.patient.idCard,
-          patientCondition: conditionText, // 浣跨敤鍚堝苟鍚庣殑鐥呮儏淇℃伅
-          hospitalOutName: this.taskForm.hospitalOut.name,
-          hospitalOutDepartment: this.taskForm.hospitalOut.department,
-          hospitalOutBedNumber: this.taskForm.hospitalOut.bedNumber,
-          hospitalOutAddress: this.taskForm.hospitalOut.address,
-          // 杞嚭鍖婚櫌GPS鍧愭爣锛堜繚瀛樺埌鎵╁睍琛級
-          hospitalOutLongitude: this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lng : null,
-          hospitalOutLatitude: this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lat : null,
-          hospitalInName: this.taskForm.hospitalIn.name,
-          hospitalInDepartment: this.taskForm.hospitalIn.department,
-          hospitalInBedNumber: this.taskForm.hospitalIn.bedNumber,
-          hospitalInAddress: this.taskForm.hospitalIn.address,
-          // 杞叆鍖婚櫌GPS鍧愭爣锛堜繚瀛樺埌鎵╁睍琛級
-          hospitalInLongitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lng : null,
-          hospitalInLatitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lat : null,
-          transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
-          transferPrice: this.taskForm.price ? parseFloat(this.taskForm.price) : null,
+        })) : [],
+        
+        // 鎮h�呬俊鎭紙宓屽瀵硅薄锛�
+        patient: {
+          contact: this.taskForm.patient.contact,
+          phone: this.taskForm.patient.phone,
+          name: this.taskForm.patient.name,
+          gender: this.taskForm.patient.gender,
+          idCard: this.taskForm.patient.idCard,
+          condition: conditionText, // 浣跨敤鍚堝苟鍚庣殑鐥呮儏淇℃伅
           // 鐥呮儏璇︾粏淇℃伅锛堣繃婊ゆ帀绌虹殑鐥呮儏鍚嶇О锛�
           diseases: this.selectedDiseases
             .filter(d => d.icdName && d.icdName.trim())
@@ -958,16 +1050,32 @@
               icdCode: d.icdCode,
               icdName: d.icdName
             }))
+        },
+        
+        // 杞嚭鍖婚櫌淇℃伅锛堝祵濂楀璞★級
+        hospitalOut: {
+          id: this.taskForm.hospitalOut.id,
+          name: this.taskForm.hospitalOut.name,
+          address: this.taskForm.hospitalOut.address,
+          longitude: this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lng : null,
+          latitude: this.addressCoordinates.hospitalOutAddress ? this.addressCoordinates.hospitalOutAddress.lat : null,
+          department: this.taskForm.hospitalOut.department,
+          departmentId: this.taskForm.hospitalOut.departmentId,
+          bedNumber: this.taskForm.hospitalOut.bedNumber
+        },
+        
+        // 杞叆鍖婚櫌淇℃伅锛堝祵濂楀璞★級
+        hospitalIn: {
+          id: this.taskForm.hospitalIn.id,
+          name: this.taskForm.hospitalIn.name,
+          address: this.taskForm.hospitalIn.address,
+          longitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lng : null,
+          latitude: this.addressCoordinates.hospitalInAddress ? this.addressCoordinates.hospitalInAddress.lat : null,
+          department: this.taskForm.hospitalIn.department,
+          departmentId: this.taskForm.hospitalIn.departmentId,
+          bedNumber: this.taskForm.hospitalIn.bedNumber
         }
       }
-      
-      // 鍑哄彂鍦癎PS鍧愭爣
-      if (this.departureLongitude && this.departureLatitude) {
-        submitData.departureLongitude = this.departureLongitude
-        submitData.departureLatitude = this.departureLatitude
-      }
-      
-      // 鐩爣鍦癎PS鍧愭爣鐢卞悗绔嚜鍔ㄨ幏鍙�
       
       return submitData
     },
diff --git a/app/pagesTask/edit-welfare.vue b/app/pagesTask/edit-welfare.vue
index 22d9ea6..ec5c362 100644
--- a/app/pagesTask/edit-welfare.vue
+++ b/app/pagesTask/edit-welfare.vue
@@ -171,6 +171,13 @@
       selectedVehicleId: null,
       selectedOrganization: '',
       mapSelectorType: '',
+      // 鎵╁睍 addressCoordinates 鏀寔澶氱閿悕
+      addressCoordinates: {
+        start: null,
+        end: null,
+        startAddress: null,
+        endAddress: null
+      },
       taskForm: {
         serviceTime: '',
         passenger: {
@@ -237,16 +244,22 @@
         
         // 璁剧疆鍦板潃鍧愭爣锛堜娇鐢╩ixin涓殑鏂规硶锛�
         if (this.taskDetail.departureLongitude && this.taskDetail.departureLatitude) {
-          this.setStartLocation({
+          const startLocation = {
             lng: this.taskDetail.departureLongitude,
             lat: this.taskDetail.departureLatitude
-          })
+          }
+          this.setStartLocation(startLocation)
+          // 鍚屾椂淇濆瓨鍒� startAddress 閿�
+          this.addressCoordinates.startAddress = startLocation
         }
         if (this.taskDetail.destinationLongitude && this.taskDetail.destinationLatitude) {
-          this.setEndLocation({
+          const endLocation = {
             lng: this.taskDetail.destinationLongitude,
             lat: this.taskDetail.destinationLatitude
-          })
+          }
+          this.setEndLocation(endLocation)
+          // 鍚屾椂淇濆瓨鍒� endAddress 閿�
+          this.addressCoordinates.endAddress = endLocation
         }
       }).catch(error => {
         console.error('鍔犺浇浠诲姟璇︽儏澶辫触:', error)
@@ -288,10 +301,14 @@
       
       if (this.mapSelectorType === 'startAddress') {
         this.taskForm.startAddress = formattedAddress
-        this.setLocationByAddress('start', address)
+        const location = this.setLocationByAddress('start', address)
+        // 鍚屾椂淇濆瓨鍒� startAddress 閿�
+        this.addressCoordinates.startAddress = location
       } else if (this.mapSelectorType === 'endAddress') {
         this.taskForm.endAddress = formattedAddress
-        this.setLocationByAddress('end', address)
+        const location = this.setLocationByAddress('end', address)
+        // 鍚屾椂淇濆瓨鍒� endAddress 閿�
+        this.addressCoordinates.endAddress = location
       }
       
       // 鐩戝惉mixin涓殑璺濈璁$畻瀹屾垚浜嬩欢
@@ -345,29 +362,32 @@
     },
     
     buildSubmitData() {
+      // 鏋勫缓鎻愪氦鏁版嵁 - 浣跨敤涓� TaskCreateVO 涓�鑷寸殑缁撴瀯
       const submitData = {
         taskId: this.taskId,
         taskType: 'WELFARE',
         vehicleIds: this.selectedVehicleId ? [this.selectedVehicleId] : [],
         plannedStartTime: this.taskForm.serviceTime,
-        welfareInfo: {
-          passengerContact: this.taskForm.passenger.contact,
-          passengerPhone: this.taskForm.passenger.phone,
-          pickupAddress: this.taskForm.startAddress,
-          destinationAddress: this.taskForm.endAddress,
-          serviceDistance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
-          servicePrice: this.taskForm.price ? parseFloat(this.taskForm.price) : null
+        
+        // 鍑哄彂鍦板湴鍧�鍜屽潗鏍�
+        departureAddress: this.taskForm.startAddress,
+        departureLongitude: this.addressCoordinates.startAddress ? this.addressCoordinates.startAddress.lng : null,
+        departureLatitude: this.addressCoordinates.startAddress ? this.addressCoordinates.startAddress.lat : null,
+        
+        // 鐩爣鍦板湴鍧�鍜屽潗鏍�
+        destinationAddress: this.taskForm.endAddress,
+        destinationLongitude: this.addressCoordinates.endAddress ? this.addressCoordinates.endAddress.lng : null,
+        destinationLatitude: this.addressCoordinates.endAddress ? this.addressCoordinates.endAddress.lat : null,
+        
+        // 璺濈鍜屼环鏍硷紙涓讳换鍔″瓧娈碉級
+        distance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        price: this.taskForm.price ? parseFloat(this.taskForm.price) : null,
+        
+        // 涔樺淇℃伅锛堝祵濂楀璞★級
+        passenger: {
+          contact: this.taskForm.passenger.contact,
+          phone: this.taskForm.passenger.phone
         }
-      }
-      
-      if (this.addressCoordinates.startAddress) {
-        submitData.departureLongitude = this.addressCoordinates.startAddress.lng
-        submitData.departureLatitude = this.addressCoordinates.startAddress.lat
-      }
-      
-      if (this.addressCoordinates.endAddress) {
-        submitData.destinationLongitude = this.addressCoordinates.endAddress.lng
-        submitData.destinationLatitude = this.addressCoordinates.endAddress.lat
       }
       
       return submitData
diff --git a/app/pagesTask/edit.vue b/app/pagesTask/edit.vue
index 0404fc5..ee17c8b 100644
--- a/app/pagesTask/edit.vue
+++ b/app/pagesTask/edit.vue
@@ -150,6 +150,13 @@
       taskId: null,
       taskDetail: null,
       mapSelectorType: '',
+      // 鎵╁睍 addressCoordinates 鏀寔澶氱閿悕
+      addressCoordinates: {
+        start: null,
+        end: null,
+        startLocation: null,
+        endLocation: null
+      },
       taskForm: {
         taskDescription: '',
         taskType: '',
@@ -213,16 +220,22 @@
         
         // 璁剧疆鍦板潃鍧愭爣锛堜娇鐢╩ixin涓殑鏂规硶锛�
         if (this.taskDetail.departureLongitude && this.taskDetail.departureLatitude) {
-          this.setStartLocation({
+          const startLocation = {
             lng: this.taskDetail.departureLongitude,
             lat: this.taskDetail.departureLatitude
-          })
+          }
+          this.setStartLocation(startLocation)
+          // 鍚屾椂淇濆瓨鍒� startLocation 閿�
+          this.addressCoordinates.startLocation = startLocation
         }
         if (this.taskDetail.destinationLongitude && this.taskDetail.destinationLatitude) {
-          this.setEndLocation({
+          const endLocation = {
             lng: this.taskDetail.destinationLongitude,
             lat: this.taskDetail.destinationLatitude
-          })
+          }
+          this.setEndLocation(endLocation)
+          // 鍚屾椂淇濆瓨鍒� endLocation 閿�
+          this.addressCoordinates.endLocation = endLocation
         }
       }).catch(error => {
         console.error('鍔犺浇浠诲姟璇︽儏澶辫触:', error)
@@ -264,10 +277,14 @@
       
       if (this.mapSelectorType === 'startLocation') {
         this.taskForm.startLocation = formattedAddress
-        this.setLocationByAddress('start', address)
+        const location = this.setLocationByAddress('start', address)
+        // 鍚屾椂淇濆瓨鍒� startLocation 閿�
+        this.addressCoordinates.startLocation = location
       } else if (this.mapSelectorType === 'endLocation') {
         this.taskForm.endLocation = formattedAddress
-        this.setLocationByAddress('end', address)
+        const location = this.setLocationByAddress('end', address)
+        // 鍚屾椂淇濆瓨鍒� endLocation 閿�
+        this.addressCoordinates.endLocation = location
       }
       
       // 鐩戝惉mixin涓殑璺濈璁$畻瀹屾垚浜嬩欢
@@ -323,6 +340,7 @@
     },
     
     buildSubmitData() {
+      // 鏋勫缓鎻愪氦鏁版嵁 - 浣跨敤涓� TaskCreateVO 涓�鑷寸殑缁撴瀯
       const submitData = {
         taskId: this.taskId,
         taskDescription: this.taskForm.taskDescription,
@@ -330,20 +348,21 @@
         vehicleIds: this.taskForm.vehicleId ? [this.taskForm.vehicleId] : [],
         plannedStartTime: this.taskForm.plannedStartTime,
         plannedEndTime: this.taskForm.plannedEndTime,
+        
+        // 鍑哄彂鍦板湴鍧�鍜屽潗鏍�
         departureAddress: this.taskForm.startLocation,
+        departureLongitude: this.addressCoordinates.startLocation ? this.addressCoordinates.startLocation.lng : null,
+        departureLatitude: this.addressCoordinates.startLocation ? this.addressCoordinates.startLocation.lat : null,
+        
+        // 鐩爣鍦板湴鍧�鍜屽潗鏍�
         destinationAddress: this.taskForm.endLocation,
-        estimatedDistance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        destinationLongitude: this.addressCoordinates.endLocation ? this.addressCoordinates.endLocation.lng : null,
+        destinationLatitude: this.addressCoordinates.endLocation ? this.addressCoordinates.endLocation.lat : null,
+        
+        // 璺濈锛堜富浠诲姟瀛楁锛�
+        distance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        
         remark: this.taskForm.remark
-      }
-      
-      if (this.addressCoordinates.startLocation) {
-        submitData.departureLongitude = this.addressCoordinates.startLocation.lng
-        submitData.departureLatitude = this.addressCoordinates.startLocation.lat
-      }
-      
-      if (this.addressCoordinates.endLocation) {
-        submitData.destinationLongitude = this.addressCoordinates.endLocation.lng
-        submitData.destinationLatitude = this.addressCoordinates.endLocation.lat
       }
       
       return submitData
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
index e1d9527..30081ad 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
@@ -136,7 +136,7 @@
     @Log(title = "浠诲姟绠$悊", businessType = BusinessType.UPDATE)
     @PutMapping("/admin")
     public AjaxResult adminEdit(@RequestBody TaskUpdateVO updateVO) {
-        return toAjax(sysTaskService.updateSysTask(updateVO));
+        return toAjax(sysTaskService.updateSysTask(updateVO,false));
     }
 
     /**
@@ -145,7 +145,7 @@
     @Log(title = "浠诲姟淇敼", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult appEdit(@RequestBody TaskUpdateVO updateVO) {
-        return toAjax(sysTaskService.updateSysTask(updateVO));
+        return toAjax(sysTaskService.updateSysTask(updateVO,false));
     }
 
     /**
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskVehicleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskVehicleController.java
index 6560bd5..0fa7ef8 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskVehicleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskVehicleController.java
@@ -1,6 +1,8 @@
 package com.ruoyi.web.controller.task;
 
 import java.util.List;
+
+import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -69,7 +71,9 @@
     @PostMapping("/assign/{taskId}")
     public AjaxResult assignVehicle(@PathVariable("taskId") Long taskId, @RequestBody AssignVehicleRequest request) {
         try {
-            int result = sysTaskService.assignVehicleToTask(taskId, request.getVehicleId(), request.getRemark());
+            Long userId= SecurityUtils.getUserId();
+            String username = SecurityUtils.getUsername();
+            int result = sysTaskService.assignVehicleToTask(taskId, request.getVehicleId(), request.getRemark(), userId, username);
             if (result > 0) {
                 return success("鍒嗛厤鎴愬姛");
             } else {
@@ -89,7 +93,9 @@
         try {
             // 璁剧疆璇锋眰瀵硅薄涓殑taskId锛岀‘淇濆弬鏁颁竴鑷存��
             request.setTaskId(taskId);
-            int result = sysTaskService.assignMultipleVehiclesToTask(request.getTaskId(), request.getVehicleIds(), request.getRemark());
+            Long userId= SecurityUtils.getUserId();
+            String username = SecurityUtils.getUsername();
+            int result = sysTaskService.assignMultipleVehiclesToTask(request.getTaskId(), request.getVehicleIds(), request.getRemark(), userId, username);
             if (result > 0) {
                 return success("鎵归噺鍒嗛厤鎴愬姛锛屽叡鍒嗛厤 " + result + " 杈嗚溅");
             } else {
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/LegacySystemSyncTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/LegacySystemSyncTask.java
index af6c684..c55b98f 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/LegacySystemSyncTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/LegacySystemSyncTask.java
@@ -228,7 +228,7 @@
      * cron琛ㄨ揪寮�: 0 0/10 * * * ? (姣�10鍒嗛挓鎵ц涓�娆�)
      */
     public void syncAdditionalFeeToLegacy() {
-        log.info("寮�濮嬫墽琛岄檮鍔犺垂鐢ㄥ悓姝ュ畾鏃朵换鍔★紙鏂扮郴缁� -> 鏃х郴缁燂級");
+        log.info("寮�濮嬫墽琛屾柊绯荤粺闄勫姞璐圭敤鍚屾瀹氭椂浠诲姟锛堟柊绯荤粺 -> 鏃х郴缁燂級");
         try {
             int successCount = additionalFeeSyncService.batchSyncAdditionalFeeToLegacy();
             log.info("闄勫姞璐圭敤鍚屾瀹屾垚锛屾垚鍔熷悓姝�: {} 鏉¤褰�", successCount);
@@ -248,11 +248,11 @@
      * cron琛ㄨ揪寮忥細 0 0/15 * * * ? (姣�15鍒嗛挓鎵ц涓�娆�)
      */
     public void syncAdditionalFeeFromLegacy() {
-        log.info("寮�濮嬫墽琛岄檮鍔犺垂鐢ㄥ悓姝ュ畾鏃朵换鍔★紙鏃х郴缁� -> 鏂扮郴缁燂級");
+        log.info("寮�濮嬫墽琛屾棫绯荤粺闄勫姞璐圭敤鍚屾瀹氭椂浠诲姟锛堟棫绯荤粺 -> 鏂扮郴缁燂級");
         try {
             // 鍚屾鏈�杩�24灏忔椂鍐呯殑璁板綍
-            int successCount = additionalFeeSyncService.batchSyncAdditionalFeeFromLegacy(24);
-            log.info("闄勫姞璐圭敤鍚屾瀹屾垚锛屾垚鍔熷悓姝�: {} 鏉¤褰�", successCount);
+            int successCount = additionalFeeSyncService.batchSyncAdditionalFeeFromLegacy(72);
+            log.info("鏃х郴缁熼檮鍔犺垂鐢ㄥ悓姝ュ畬鎴愶紝鎴愬姛鍚屾: {} 鏉¤褰�", successCount);
         } catch (Exception e) {
             log.error("闄勫姞璐圭敤鍚屾寮傚父", e);
         }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskUpdateVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskUpdateVO.java
index 5bad9f2..b2528e6 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskUpdateVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TaskUpdateVO.java
@@ -1,523 +1,24 @@
 package com.ruoyi.system.domain.vo;
 
-import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 /**
- * 浠诲姟鏇存柊瀵硅薄
+ * 浠诲姟鏇存柊瀵硅薄锛堢户鎵胯嚜TaskCreateVO锛�
  * 
  * @author ruoyi
  * @date 2024-01-15
  */
-public class TaskUpdateVO {
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TaskUpdateVO extends TaskCreateVO {
     
-    /** 浠诲姟ID */
+    /** 浠诲姟ID锛堝繀濉紝鐢ㄤ簬鏇存柊鎸囧畾浠诲姟锛� */
     private Long taskId;
-
-    /** 浠诲姟鎻忚堪 */
-    private String taskDescription;
-
-    /** 鍑哄彂鍦板潃 */
-    private String departureAddress;
-
-    /** 鐩殑鍦板潃 */
-    private String destinationAddress;
-
-    /** 璁″垝寮�濮嬫椂闂� */
+    
+    /** 鏇存柊鏃堕棿 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date plannedStartTime;
-
-    /** 璁″垝缁撴潫鏃堕棿 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date plannedEndTime;
-
-    /** 鎵ц浜篒D */
-    private Long assigneeId;
-
-    /** 澶囨敞 */
-    private String remark;
-
-    /** 鍑哄彂鍦扮粡搴� */
-    private BigDecimal departureLongitude;
-
-    /** 鍑哄彂鍦扮含搴� */
-    private BigDecimal departureLatitude;
-
-    /** 鐩殑鍦扮粡搴� */
-    private BigDecimal destinationLongitude;
-
-    /** 鐩殑鍦扮含搴� */
-    private BigDecimal destinationLatitude;
-
-    /** 浠诲姟绫诲瀷 */
-    private String taskType;
-
-    /** 閮ㄩ棬ID */
-    private Long deptId;
-
-    /** 杞﹁締ID鍒楄〃 */
-    private List<Long> vehicleIds;
-
-    /** 鐥呮儏ID鍒楄〃锛堢敤浜庡悓姝ヨ皟搴﹀崟鐨凮rdICD_ID鍙傛暟锛� */
-    private List<Long> diseaseIds;
-
-    /** 鎵ц浜哄憳鍒楄〃锛堝寘鍚鑹茬被鍨嬶級 */
-    private List<AssigneeInfo> assignees;
-
-    /** 鎬ユ晳杞繍浠诲姟鎵╁睍淇℃伅 */
-    private EmergencyInfoVO emergencyInfo;
-
-    public Long getTaskId() {
-        return taskId;
-    }
-
-    public void setTaskId(Long taskId) {
-        this.taskId = taskId;
-    }
-
-    public String getTaskDescription() {
-        return taskDescription;
-    }
-
-    public void setTaskDescription(String taskDescription) {
-        this.taskDescription = taskDescription;
-    }
-
-    public String getDepartureAddress() {
-        return departureAddress;
-    }
-
-    public void setDepartureAddress(String departureAddress) {
-        this.departureAddress = departureAddress;
-    }
-
-    public String getDestinationAddress() {
-        return destinationAddress;
-    }
-
-    public void setDestinationAddress(String destinationAddress) {
-        this.destinationAddress = destinationAddress;
-    }
-
-    public Date getPlannedStartTime() {
-        return plannedStartTime;
-    }
-
-    public void setPlannedStartTime(Date plannedStartTime) {
-        this.plannedStartTime = plannedStartTime;
-    }
-
-    public Date getPlannedEndTime() {
-        return plannedEndTime;
-    }
-
-    public void setPlannedEndTime(Date plannedEndTime) {
-        this.plannedEndTime = plannedEndTime;
-    }
-
-    public Long getAssigneeId() {
-        return assigneeId;
-    }
-
-    public void setAssigneeId(Long assigneeId) {
-        this.assigneeId = assigneeId;
-    }
-
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    public BigDecimal getDepartureLongitude() {
-        return departureLongitude;
-    }
-
-    public void setDepartureLongitude(BigDecimal departureLongitude) {
-        this.departureLongitude = departureLongitude;
-    }
-
-    public BigDecimal getDepartureLatitude() {
-        return departureLatitude;
-    }
-
-    public void setDepartureLatitude(BigDecimal departureLatitude) {
-        this.departureLatitude = departureLatitude;
-    }
-
-    public BigDecimal getDestinationLongitude() {
-        return destinationLongitude;
-    }
-
-    public void setDestinationLongitude(BigDecimal destinationLongitude) {
-        this.destinationLongitude = destinationLongitude;
-    }
-
-    public BigDecimal getDestinationLatitude() {
-        return destinationLatitude;
-    }
-
-    public void setDestinationLatitude(BigDecimal destinationLatitude) {
-        this.destinationLatitude = destinationLatitude;
-    }
-
-    public String getTaskType() {
-        return taskType;
-    }
-
-    public void setTaskType(String taskType) {
-        this.taskType = taskType;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public List<Long> getVehicleIds() {
-        return vehicleIds;
-    }
-
-    public void setVehicleIds(List<Long> vehicleIds) {
-        this.vehicleIds = vehicleIds;
-    }
-
-    public List<Long> getDiseaseIds() {
-        return diseaseIds;
-    }
-
-    public void setDiseaseIds(List<Long> diseaseIds) {
-        this.diseaseIds = diseaseIds;
-    }
-
-    public EmergencyInfoVO getEmergencyInfo() {
-        return emergencyInfo;
-    }
-
-    public void setEmergencyInfo(EmergencyInfoVO emergencyInfo) {
-        this.emergencyInfo = emergencyInfo;
-    }
-
-    public List<AssigneeInfo> getAssignees() {
-        return assignees;
-    }
-
-    public void setAssignees(List<AssigneeInfo> assignees) {
-        this.assignees = assignees;
-    }
-
-    /**
-     * 鎬ユ晳杞繍浠诲姟鎵╁睍淇℃伅鍐呴儴绫�
-     */
-    public static class EmergencyInfoVO {
-        /** 鎮h�呰仈绯讳汉 */
-        private String patientContact;
-        
-        /** 鎮h�呰仈绯荤數璇� */
-        private String patientPhone;
-        
-        /** 鎮h�呭鍚� */
-        private String patientName;
-        
-        /** 鎮h�呮�у埆 */
-        private String patientGender;
-        
-        /** 鎮h�呰韩浠借瘉鍙� */
-        private String patientIdCard;
-        
-        /** 鎮h�呯梾鎯呮弿杩� */
-        private String patientCondition;
-        
-        /** 杞嚭鍖婚櫌ID */
-        private Long hospitalOutId;
-        
-        /** 杞嚭鍖婚櫌鍚嶇О */
-        private String hospitalOutName;
-        
-        /** 杞嚭鍖婚櫌绉戝 */
-        private String hospitalOutDepartment;
-        
-        /** 杞嚭鍖婚櫌绉戝ID */
-        private String hospitalOutDepartmentId;
-        
-        /** 杞嚭鍖婚櫌搴婂彿 */
-        private String hospitalOutBedNumber;
-        
-        /** 杞嚭鍖婚櫌鍦板潃 */
-        private String hospitalOutAddress;
-        
-        /** 杞嚭鍖婚櫌缁忓害 */
-        private BigDecimal hospitalOutLongitude;
-        
-        /** 杞嚭鍖婚櫌绾害 */
-        private BigDecimal hospitalOutLatitude;
-        
-        /** 杞叆鍖婚櫌ID */
-        private Long hospitalInId;
-        
-        /** 杞叆鍖婚櫌鍚嶇О */
-        private String hospitalInName;
-        
-        /** 杞叆鍖婚櫌绉戝 */
-        private String hospitalInDepartment;
-        
-        /** 杞叆鍖婚櫌绉戝ID */
-        private String hospitalInDepartmentId;
-        
-        /** 杞叆鍖婚櫌搴婂彿 */
-        private String hospitalInBedNumber;
-        
-        /** 杞叆鍖婚櫌鍦板潃 */
-        private String hospitalInAddress;
-        
-        /** 杞叆鍖婚櫌缁忓害 */
-        private BigDecimal hospitalInLongitude;
-        
-        /** 杞叆鍖婚櫌绾害 */
-        private BigDecimal hospitalInLatitude;
-        
-        /** 杞繍鍏噷鏁� */
-        private BigDecimal transferDistance;
-        
-        /** 杞繍璐圭敤 */
-        private BigDecimal transferPrice;
-
-        // Getters and Setters
-        public String getPatientContact() {
-            return patientContact;
-        }
-
-        public void setPatientContact(String patientContact) {
-            this.patientContact = patientContact;
-        }
-
-        public String getPatientPhone() {
-            return patientPhone;
-        }
-
-        public void setPatientPhone(String patientPhone) {
-            this.patientPhone = patientPhone;
-        }
-
-        public String getPatientName() {
-            return patientName;
-        }
-
-        public void setPatientName(String patientName) {
-            this.patientName = patientName;
-        }
-
-        public String getPatientGender() {
-            return patientGender;
-        }
-
-        public void setPatientGender(String patientGender) {
-            this.patientGender = patientGender;
-        }
-
-        public String getPatientIdCard() {
-            return patientIdCard;
-        }
-
-        public void setPatientIdCard(String patientIdCard) {
-            this.patientIdCard = patientIdCard;
-        }
-
-        public String getPatientCondition() {
-            return patientCondition;
-        }
-
-        public void setPatientCondition(String patientCondition) {
-            this.patientCondition = patientCondition;
-        }
-
-        public Long getHospitalOutId() {
-            return hospitalOutId;
-        }
-
-        public void setHospitalOutId(Long hospitalOutId) {
-            this.hospitalOutId = hospitalOutId;
-        }
-
-        public String getHospitalOutName() {
-            return hospitalOutName;
-        }
-
-        public void setHospitalOutName(String hospitalOutName) {
-            this.hospitalOutName = hospitalOutName;
-        }
-
-        public String getHospitalOutDepartment() {
-            return hospitalOutDepartment;
-        }
-
-        public void setHospitalOutDepartment(String hospitalOutDepartment) {
-            this.hospitalOutDepartment = hospitalOutDepartment;
-        }
-
-        public String getHospitalOutDepartmentId() {
-            return hospitalOutDepartmentId;
-        }
-
-        public void setHospitalOutDepartmentId(String hospitalOutDepartmentId) {
-            this.hospitalOutDepartmentId = hospitalOutDepartmentId;
-        }
-
-        public String getHospitalOutBedNumber() {
-            return hospitalOutBedNumber;
-        }
-
-        public void setHospitalOutBedNumber(String hospitalOutBedNumber) {
-            this.hospitalOutBedNumber = hospitalOutBedNumber;
-        }
-
-        public String getHospitalOutAddress() {
-            return hospitalOutAddress;
-        }
-
-        public void setHospitalOutAddress(String hospitalOutAddress) {
-            this.hospitalOutAddress = hospitalOutAddress;
-        }
-
-        public BigDecimal getHospitalOutLongitude() {
-            return hospitalOutLongitude;
-        }
-
-        public void setHospitalOutLongitude(BigDecimal hospitalOutLongitude) {
-            this.hospitalOutLongitude = hospitalOutLongitude;
-        }
-
-        public BigDecimal getHospitalOutLatitude() {
-            return hospitalOutLatitude;
-        }
-
-        public void setHospitalOutLatitude(BigDecimal hospitalOutLatitude) {
-            this.hospitalOutLatitude = hospitalOutLatitude;
-        }
-
-        public Long getHospitalInId() {
-            return hospitalInId;
-        }
-
-        public void setHospitalInId(Long hospitalInId) {
-            this.hospitalInId = hospitalInId;
-        }
-
-        public String getHospitalInName() {
-            return hospitalInName;
-        }
-
-        public void setHospitalInName(String hospitalInName) {
-            this.hospitalInName = hospitalInName;
-        }
-
-        public String getHospitalInDepartment() {
-            return hospitalInDepartment;
-        }
-
-        public void setHospitalInDepartment(String hospitalInDepartment) {
-            this.hospitalInDepartment = hospitalInDepartment;
-        }
-
-        public String getHospitalInDepartmentId() {
-            return hospitalInDepartmentId;
-        }
-
-        public void setHospitalInDepartmentId(String hospitalInDepartmentId) {
-            this.hospitalInDepartmentId = hospitalInDepartmentId;
-        }
-
-        public String getHospitalInBedNumber() {
-            return hospitalInBedNumber;
-        }
-
-        public void setHospitalInBedNumber(String hospitalInBedNumber) {
-            this.hospitalInBedNumber = hospitalInBedNumber;
-        }
-
-        public String getHospitalInAddress() {
-            return hospitalInAddress;
-        }
-
-        public void setHospitalInAddress(String hospitalInAddress) {
-            this.hospitalInAddress = hospitalInAddress;
-        }
-
-        public BigDecimal getHospitalInLongitude() {
-            return hospitalInLongitude;
-        }
-
-        public void setHospitalInLongitude(BigDecimal hospitalInLongitude) {
-            this.hospitalInLongitude = hospitalInLongitude;
-        }
-
-        public BigDecimal getHospitalInLatitude() {
-            return hospitalInLatitude;
-        }
-
-        public void setHospitalInLatitude(BigDecimal hospitalInLatitude) {
-            this.hospitalInLatitude = hospitalInLatitude;
-        }
-
-        public BigDecimal getTransferDistance() {
-            return transferDistance;
-        }
-
-        public void setTransferDistance(BigDecimal transferDistance) {
-            this.transferDistance = transferDistance;
-        }
-
-        public BigDecimal getTransferPrice() {
-            return transferPrice;
-        }
-
-        public void setTransferPrice(BigDecimal transferPrice) {
-            this.transferPrice = transferPrice;
-        }
-    }
-
-    /**
-     * 鎵ц浜哄憳淇℃伅鍐呴儴绫�
-     */
-    public static class AssigneeInfo {
-        /** 鐢ㄦ埛ID */
-        private Long userId;
-        
-        /** 鐢ㄦ埛濮撳悕 */
-        private String userName;
-        
-        /** 鐢ㄦ埛绫诲瀷锛堣鑹诧級锛歞river-鍙告満, doctor-鍖荤敓, nurse-鎶ゅ+ */
-        private String userType;
-
-        public Long getUserId() {
-            return userId;
-        }
-
-        public void setUserId(Long userId) {
-            this.userId = userId;
-        }
-
-        public String getUserName() {
-            return userName;
-        }
-
-        public void setUserName(String userName) {
-            this.userName = userName;
-        }
-
-        public String getUserType() {
-            return userType;
-        }
-
-        public void setUserType(String userType) {
-            this.userType = userType;
-        }
-    }
+    private Date updateTime;
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IAdditionalFeeSyncService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAdditionalFeeSyncService.java
index 561f550..21928be 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IAdditionalFeeSyncService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAdditionalFeeSyncService.java
@@ -1,5 +1,8 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.system.domain.PaidMoneyAdd;
+import com.ruoyi.system.domain.SysTaskAdditionalFee;
+
 /**
  * 闄勫姞璐圭敤鍚屾Service鎺ュ彛
  * 
@@ -14,16 +17,16 @@
      * @param feeId 闄勫姞璐圭敤ID
      * @return 鏄惁鍚屾鎴愬姛
      */
-    boolean syncAdditionalFeeToLegacy(Long feeId);
+    boolean syncAdditionalFeeToLegacy(SysTaskAdditionalFee fee);
     
     /**
      * 灏嗘棫绯荤粺PaidMoney_Add璁板綍鍚屾鍒版柊绯荤粺
      * 
-     * @param paidMoneyAddId 鏃х郴缁熼檮鍔犺垂鐢ㄨ褰旾D
+     * @param paidMoneyAdd 鏃х郴缁熼檮鍔犺垂鐢ㄨ褰旾D
      * @return 鏄惁鍚屾鎴愬姛
      */
-    boolean syncAdditionalFeeFromLegacy(Long paidMoneyAddId);
-    
+    boolean syncAdditionalFeeFromLegacy(PaidMoneyAdd paidMoneyAdd);
+
     /**
      * 鎵归噺鍚屾鏂扮郴缁熸湭鍚屾鐨勯檮鍔犺垂鐢ㄥ埌鏃х郴缁�
      * 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
index a4c900b..9fbe692 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
@@ -2,15 +2,13 @@
 
 import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.system.domain.vo.*;
 import org.springframework.web.multipart.MultipartFile;
 import com.ruoyi.system.domain.SysTask;
 import com.ruoyi.system.domain.SysTaskLog;
 import com.ruoyi.system.domain.SysTaskVehicle;
 import com.ruoyi.system.domain.SysTaskAttachment;
-import com.ruoyi.system.domain.vo.TaskQueryVO;
-import com.ruoyi.system.domain.vo.TaskCreateVO;
-import com.ruoyi.system.domain.vo.TaskUpdateVO;
-import com.ruoyi.system.domain.vo.TaskStatisticsVO;
 import com.ruoyi.system.domain.enums.TaskStatus;
 
 /**
@@ -63,7 +61,22 @@
      * @param updateVO 浠诲姟鏇存柊瀵硅薄
      * @return 缁撴灉
      */
-    public int updateSysTask(TaskUpdateVO updateVO);
+    public int updateSysTask(TaskUpdateVO updateVO,Boolean updateFromLegacy);
+
+    /**
+     * 淇敼浠诲姟绠$悊锛堝厑璁镐粠澶栭儴浼犲叆鐢ㄦ埛淇℃伅銆侀儴闂ㄤ俊鎭拰鏃堕棿淇℃伅锛� 鐢ㄤ簬浠庢棫绯荤粺涓悓姝ヨ繃鏉�
+     * @param updateVO
+     * @param serviceOrderId
+     * @param dispatchOrderId
+     * @param serviceOrdNo
+     * @param userId
+     * @param userName
+     * @param deptId
+     * @param createTime
+     * @param updateTime
+     * @return
+     */
+    public int updateTask(TaskUpdateVO updateVO, String serviceOrderId, String dispatchOrderId, String serviceOrdNo, Long userId, String userName, Long deptId, Date createTime, Date updateTime);
 
     /**
      * 鎵归噺鍒犻櫎浠诲姟绠$悊
@@ -151,7 +164,7 @@
      * @param remark 澶囨敞
      * @return 缁撴灉
      */
-    public int assignVehicleToTask(Long taskId, Long vehicleId, String remark);
+    public int assignVehicleToTask(Long taskId, Long vehicleId, String remark,Long userId,String userName);
 
     /**
      * 鍙栨秷浠诲姟杞﹁締鍒嗛厤
@@ -170,7 +183,7 @@
      * @param remark 澶囨敞
      * @return 缁撴灉
      */
-    public int assignMultipleVehiclesToTask(Long taskId, List<Long> vehicleIds, String remark);
+    public int assignMultipleVehiclesToTask(Long taskId, List<Long> vehicleIds, String remark,Long userId,String userName);
 
     /**
      * 鏌ヨ浠诲姟鍏宠仈鐨勮溅杈�
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AdditionalFeeSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AdditionalFeeSyncServiceImpl.java
index 01a593a..ee5f42c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AdditionalFeeSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AdditionalFeeSyncServiceImpl.java
@@ -1,6 +1,5 @@
 package com.ruoyi.system.service.impl;
 
-import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -9,11 +8,7 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
-import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.PaidMoneyAdd;
 import com.ruoyi.system.domain.SysTask;
 import com.ruoyi.system.domain.SysTaskAdditionalFee;
@@ -92,19 +87,13 @@
     }
     
     @Override
-    public boolean syncAdditionalFeeToLegacy(Long feeId) {
+    public boolean syncAdditionalFeeToLegacy(SysTaskAdditionalFee fee) {
+        Long feeId= fee.getId();
         try {
-            // 1. 鏌ヨ鏂扮郴缁熼檮鍔犺垂鐢ㄨ褰�
-            SysTaskAdditionalFee fee = additionalFeeMapper.selectByTaskId(null).stream()
-                .filter(f -> f.getId().equals(feeId))
-                .findFirst()
-                .orElse(null);
+
             
-            if (fee == null) {
-                log.info("鏂扮郴缁熼檮鍔犺垂鐢ㄨ褰曚笉瀛樺湪锛宖eeId: {}", feeId);
-                return false;
-            }
-            
+
+         // 1. 妫�鏌ユ槸鍚﹀凡鍚屾
             // 2. 濡傛灉宸插悓姝ヨ繃锛岃烦杩�
             if (fee.getPid() != null && fee.getPid() > 0) {
                 log.info("闄勫姞璐圭敤宸插悓姝ワ紝feeId: {}, pid: {}", feeId, fee.getPid());
@@ -172,44 +161,47 @@
             return false;
         }
     }
-    
+
+    /**
+     * 浠庢棫绯荤粺鍚屾闄勫姞璐圭敤
+     * @param paidMoneyAdd 鏃х郴缁熼檮鍔犺垂鐢ㄨ褰旾D
+     * @return
+     */
     @Override
-    public boolean syncAdditionalFeeFromLegacy(Long paidMoneyAddId) {
+    public boolean syncAdditionalFeeFromLegacy(PaidMoneyAdd paidMoneyAdd) {
         try {
-            // 1. 鏌ヨ鏃х郴缁烶aidMoney_Add璁板綍
-            PaidMoneyAdd paidMoneyAdd = paidMoneyAddMapper.selectById(paidMoneyAddId);
-            if (paidMoneyAdd == null) {
-                log.error("鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曚笉瀛樺湪锛宲aidMoneyAddId: {}", paidMoneyAddId);
-                return false;
-            }
-            
+            Long paidMoneyAddId = paidMoneyAdd.getId();
+            log.info("1.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}", paidMoneyAddId);
             // 2. 妫�鏌ユ槸鍚﹀凡鍚屾杩�
             SysTaskAdditionalFee existFee = additionalFeeMapper.selectByPid(paidMoneyAddId);
             if (existFee != null) {
                 log.info("鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曞凡鍚屾锛宲aidMoneyAddId: {}, feeId: {}", paidMoneyAddId, existFee.getId());
                 return true;
             }
+            log.info("2.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}", paidMoneyAddId);
             
             // 3. 鏍规嵁ServiceOrdID鏌ヨ鏂扮郴缁熶换鍔�
             if (paidMoneyAdd.getToServiceOrdID() == null) {
                 log.warn("鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曠己灏慡erviceOrdID锛宲aidMoneyAddId: {}锛岃烦杩囧悓姝�", paidMoneyAddId);
                 return false;
             }
+            log.info("3.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}, ServiceOrdID: {}", paidMoneyAddId, paidMoneyAdd.getToServiceOrdID());
             
             SysTaskEmergency emergency = sysTaskEmergencyMapper.selectByLegacyServiceOrdId(paidMoneyAdd.getToServiceOrdID());
             if (emergency == null) {
-                log.warn("鏈壘鍒板搴旂殑杞繍浠诲姟锛孲erviceOrdID: {}锛岃烦杩囧悓姝�", paidMoneyAdd.getToServiceOrdID());
+                log.warn("4.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤,鏈壘鍒板搴旂殑杞繍浠诲姟锛孲erviceOrdID: {}锛岃烦杩囧悓姝�", paidMoneyAdd.getToServiceOrdID());
                 return false;
             }
-            
+
+            log.info("4.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}, ServiceOrdID: {}, DispatchOrdID: {}", paidMoneyAddId, paidMoneyAdd.getToServiceOrdID(), paidMoneyAdd.getToDispatchOrdID());
             // 4. 楠岃瘉DispatchOrdID鏄惁鍖归厤
             if (paidMoneyAdd.getToDispatchOrdID() == null) {
                 log.warn("鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曠己灏慏ispatchOrdID锛宲aidMoneyAddId: {}锛岃烦杩囧悓姝�", paidMoneyAddId);
                 return false;
             }
-            
+            log.info("5.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}, ServiceOrdID: {}, DispatchOrdID: {}", paidMoneyAddId, paidMoneyAdd.getToServiceOrdID(), paidMoneyAdd.getToDispatchOrdID());
             if (!paidMoneyAdd.getToDispatchOrdID().equals(emergency.getLegacyDispatchOrdId())) {
-                log.warn("杞繍浠诲姟DispatchOrdID涓嶅尮閰嶏紝ServiceOrdID: {}, 闄勫姞璐圭敤DispatchOrdID: {} vs 浠诲姟DispatchOrdID: {}锛岃烦杩囧悓姝�",
+                log.warn("5.杞繍浠诲姟DispatchOrdID涓嶅尮閰嶏紝ServiceOrdID: {}, 闄勫姞璐圭敤DispatchOrdID: {} vs 浠诲姟DispatchOrdID: {}锛岃烦杩囧悓姝�",
                     paidMoneyAdd.getToServiceOrdID(), paidMoneyAdd.getToDispatchOrdID(), emergency.getLegacyDispatchOrdId());
                 return false;
             }
@@ -228,19 +220,19 @@
             fee.setPid(paidMoneyAddId);
             fee.setSyncStatus(2); // 鍚屾鎴愬姛
             fee.setSyncTime(new Date());
-            
+            log.info("6.寮�濮嬪悓姝ユ棫绯荤粺闄勫姞璐圭敤锛宲aidMoneyAddId: {}, ServiceOrdID: {}, DispatchOrdID: {}, feeId: {}", paidMoneyAddId, paidMoneyAdd.getToServiceOrdID(), paidMoneyAdd.getToDispatchOrdID(), fee.getId());
             // 6. 鎻掑叆鏂扮郴缁熼檮鍔犺垂鐢ㄨ褰�
             int result = additionalFeeMapper.insert(fee);
             if (result > 0) {
-                log.info("鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曞悓姝ュ埌鏂扮郴缁熸垚鍔燂紝paidMoneyAddId: {}, feeId: {}", paidMoneyAddId, fee.getId());
+                log.info("6.鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曞悓姝ュ埌鏂扮郴缁熸垚鍔燂紝paidMoneyAddId: {}, feeId: {}", paidMoneyAddId, fee.getId());
                 return true;
             } else {
-                log.error("鎻掑叆鏂扮郴缁熼檮鍔犺垂鐢ㄨ褰曞け璐ワ紝paidMoneyAddId: {}", paidMoneyAddId);
+                log.error("6.鎻掑叆鏂扮郴缁熼檮鍔犺垂鐢ㄨ褰曞け璐ワ紝paidMoneyAddId: {}", paidMoneyAddId);
                 return false;
             }
             
         } catch (Exception e) {
-            log.error("鍚屾鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曞埌鏂扮郴缁熷紓甯革紝paidMoneyAddId: {}", paidMoneyAddId, e);
+            log.error("8.鍚屾鏃х郴缁熼檮鍔犺垂鐢ㄨ褰曞埌鏂扮郴缁熷紓甯革紝paidMoneyAddId: {}", paidMoneyAdd.getId(), e);
             return false;
         }
     }
@@ -256,7 +248,7 @@
             
             for (SysTaskAdditionalFee fee : unsyncedFees) {
                 try {
-                    if (syncAdditionalFeeToLegacy(fee.getId())) {
+                    if (syncAdditionalFeeToLegacy(fee)) {
                         successCount++;
                     }
                     // 姣忔潯璁板綍闂撮殧1绉掞紝閬垮厤杩囦簬棰戠箒
@@ -290,7 +282,7 @@
             
             for (PaidMoneyAdd paidMoneyAdd : recentRecords) {
                 try {
-                    if (syncAdditionalFeeFromLegacy(paidMoneyAdd.getId())) {
+                    if (syncAdditionalFeeFromLegacy(paidMoneyAdd)) {
                         successCount++;
                     }
                     // 姣忔潯璁板綍闂撮殧1绉掞紝閬垮厤杩囦簬棰戠箒
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentSyncServiceImpl.java
index 2fbce75..5e1cf76 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DepartmentSyncServiceImpl.java
@@ -88,11 +88,32 @@
                 if (parts.length != 2)
                 {
                     log.warn("閮ㄩ棬鍚嶇О鏍煎紡涓嶆纭紝璺宠繃: {}", fullName);
-                    continue;
+                   parts= fullName.split("-");
+                   if(parts.length != 2) {
+                       continue;
+                   }
+                }
+                String part="";
+                //鍙鍙戠幇鏈�(鏂�)鎴栵紙鏂帮級灏卞湪branchName涓姞涓柊 瀛�
+                if(fullName.contains("(鏂�)") || fullName.contains("锛堟柊锛�")) {
+                    part="锛堟柊锛�";
                 }
 
                 String branchName = parts[0].trim() + "鍒嗗叕鍙�";  // 婀涙睙 -> 婀涙睙鍒嗗叕鍙�
                 String deptName = parts[1].trim();              // 鎶ゅ+
+                String cityName=parts[0].trim();
+                String namePart=parts[0].trim();
+                if(namePart.contains("(鏂�)") || namePart.contains("锛堟柊锛�")) {
+                    branchName=namePart+"鍒嗗叕鍙�";
+                    cityName=namePart;
+                    deptName=parts[1].trim();
+                }
+                else{
+                    branchName=namePart+part+"鍒嗗叕鍙�";
+                    cityName=namePart+ part;
+                    deptName=parts[1].trim();
+                }
+
 
                 // 鑾峰彇鎴栧垱寤哄垎鍏徃
                 Long branchDeptId = branchMap.get(branchName);
@@ -107,7 +128,7 @@
                         branchMap.put(branchName, branchDeptId);
                         
                         // 妫�鏌ュ苟鏇存柊缂栫爜
-                        syncOrderClassCodes(existingBranch, parts[0].trim(), serviceOrderList, dispatchOrderList,addressList);
+                        syncOrderClassCodes(existingBranch, cityName, serviceOrderList, dispatchOrderList,addressList);
 //                        existingBranch.setDepartmentId(dto.getDepartmentId());
                         sysDeptMapper.updateDept(existingBranch);
                         log.info("鏇存柊鍒嗗叕鍙哥紪鐮�: {}, 鏈嶅姟鍗曠紪鐮�: {}, 璋冨害鍗曠紪鐮�: {}", 
@@ -126,7 +147,7 @@
 //                        newBranch.setDepartmentId(dto.getDepartmentId());
 
                         // 鑷姩鍖归厤骞惰缃湇鍔″崟鍜岃皟搴﹀崟缂栫爜
-                        syncOrderClassCodes(newBranch, parts[0].trim(), serviceOrderList, dispatchOrderList,addressList);
+                        syncOrderClassCodes(newBranch, cityName, serviceOrderList, dispatchOrderList,addressList);
 
                         sysDeptMapper.insertDept(newBranch);
                         branchDeptId = newBranch.getDeptId();
@@ -479,6 +500,7 @@
         // 閬嶅巻缂栫爜鍒楄〃锛屾煡鎵惧寘鍚煄甯傚悕绉扮殑椤�
         for (OrderClassDTO dto : orderClassList)
         {
+            //鏈変簺鍔犱簡鏂� TODO
             if (dto.getVtext() != null && dto.getVtext().contains(cityName))
             {
                 log.debug("鍩庡競鍚嶇О鍖归厤鎴愬姛 - 鍩庡競: {}, vtext: {}, vOrder2: {}", 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacySystemSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacySystemSyncServiceImpl.java
index 10b6db7..25ac645 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacySystemSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacySystemSyncServiceImpl.java
@@ -525,7 +525,7 @@
         params.put("ServiceOrdCoName", StringUtils.nvl(emergency.getPatientContact(), ""));
         params.put("ServiceOrdCoPhone", StringUtils.nvl(emergency.getPatientPhone(), ""));
         params.put("ServiceOrdPtName", StringUtils.nvl(emergency.getPatientName(), ""));
-        
+        params.put("ServiceOrdTraStreet",StringUtils.nvl(task.getDepartureAddress(), StringUtils.nvl(emergency.getHospitalOutAddress(), "")));
         // 鍦板潃淇℃伅
         params.put("DispatchOrdTraStreet", StringUtils.nvl(task.getDepartureAddress(), StringUtils.nvl(emergency.getHospitalOutAddress(), "")));
         params.put("DispatchOrdTraEnd", StringUtils.nvl(task.getDestinationAddress(), StringUtils.nvl(emergency.getHospitalInAddress(), "")));
@@ -1188,9 +1188,10 @@
             params.put("DispatchOrdID", emergency.getLegacyDispatchOrdId().toString());
             params.put("ServiceOrdID", emergency.getLegacyServiceOrdId().toString());
             params.put("DispatchOrdState", "3");
+            log.info("閲嶆柊鍚屾璋冨害鍗曞埌鏃х郴缁熻姹傚弬鏁�: {}", params);
             // 鍙戦�丠TTP璇锋眰鍒版棫绯荤粺锛堜娇鐢╝dmin_save_25.asp鎺ュ彛锛�
             String response = sendHttpPost(legacyConfig.getDispatchUpdateUrl(), params);
-            
+            log.info("閲嶆柊鍚屾璋冨害鍗曞埌鏃х郴缁熷搷搴�: ServiceOrdID:{},DispatchOrdId:{},Result: {}",emergency.getLegacyServiceOrdId(),emergency.getLegacyDispatchOrdId(), response);
             // 瑙f瀽鍝嶅簲
             Long dispatchOrdId = parseResponse(response);
             
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacyTransferSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacyTransferSyncServiceImpl.java
index be0888b..fed2d84 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacyTransferSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LegacyTransferSyncServiceImpl.java
@@ -1,15 +1,13 @@
 package com.ruoyi.system.service.impl;
 
-import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
-import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.system.domain.SysTask;
 import com.ruoyi.system.domain.SysTaskEmergency;
 import com.ruoyi.system.domain.VehicleInfo;
 import com.ruoyi.system.domain.vo.TaskCreateVO;
+import com.ruoyi.system.domain.vo.TaskUpdateVO;
 import com.ruoyi.system.mapper.SysTaskEmergencyMapper;
 import com.ruoyi.system.mapper.SysTaskMapper;
 import com.ruoyi.system.service.ILegacyTransferSyncService;
@@ -19,9 +17,9 @@
 import com.ruoyi.system.mapper.VehicleInfoMapper;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.system.service.IWechatTaskNotifyService;
-import org.apache.poi.ss.usermodel.DateUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -31,7 +29,6 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 /**
  * 鏃х郴缁熻浆杩愬崟鍚屾Service涓氬姟灞傚鐞�
@@ -67,7 +64,9 @@
 
     @Autowired
     private IWechatTaskNotifyService wechatTaskNotifyService;
-    
+
+
+
     /**
      * 鍚屾鎸囧畾鏃ユ湡鑼冨洿鐨勬棫绯荤粺杞繍鍗曞埌鏂扮郴缁�
      * 
@@ -121,6 +120,8 @@
                     // 妫�鏌ユ槸鍚﹀凡鍚屾
                     if (isTransferOrderSynced(serviceOrdID, dispatchOrdID)) {
                         log.debug("杞繍鍗曞凡鍚屾锛岃烦杩�: ServiceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID);
+                        //杩涜鏇存柊鎿嶄綔
+                        updateTransferOrder(serviceOrdID, dispatchOrdID, order);
                         continue;
                     }
                     
@@ -194,7 +195,71 @@
             return false;
         }
     }
-    
+
+    private boolean updateTransferOrder(String serviceOrdID, String dispatchOrdID, Map<String, Object> order){
+        log.info("寮�濮嬪悓姝ュ崟涓浆杩愬崟: ServiceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID);
+        String sysTaskCode="";
+        try {
+            SysTaskEmergency emergency=sysTaskEmergencyMapper.selectByLegacyServiceOrdId(Long.parseLong(serviceOrdID));
+            if(emergency.getNeedResync().equals(1)){
+                log.info("鏂扮郴缁熼渶瑕佸悓姝ュ埌鏃х郴缁熼偅閲岋紝鎵�浠ヤ笉瑕佸悓姝ユ棫鏁版嵁鍒版柊绯荤粺,serviceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID);
+                return false;
+            }
+            // 鏋勯�燭askCreateVO瀵硅薄
+            TaskCreateVO createTaskVo = buildCreateTaskVo(serviceOrdID, dispatchOrdID, order);
+
+            sysTaskCode = createTaskVo.getTaskCode();
+            if (createTaskVo == null) {
+                log.error("鏋勯�燭askCreateVO澶辫触: ServiceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID);
+                return false;
+            }
+
+            // 璁板綍鍒涘缓鐨勪换鍔′俊鎭�
+            log.debug("鍑嗗鍒涘缓浠诲姟: ServiceOrdID={}, DispatchOrdID={}, 鎮h�呭鍚�={}, 杞嚭鍖婚櫌={}, 杞叆鍖婚櫌={}",
+                    serviceOrdID, dispatchOrdID,
+                    createTaskVo.getPatient() != null ? createTaskVo.getPatient().getName() : "鏈煡",
+                    createTaskVo.getHospitalOut() != null ? createTaskVo.getHospitalOut().getName() : "鏈煡",
+                    createTaskVo.getHospitalIn() != null ? createTaskVo.getHospitalIn().getName() : "鏈煡");
+            /**
+             * 寮�鍗曟椂闂�
+             */
+            Date ServiceOrd_CC_Time= getDateValue(order, "ServiceOrd_CC_Time");
+            // 璋冪敤sysTaskService鍒涘缓浠诲姟
+            String serviceOrdClass = getStringValue(order,"ServiceOrdClass");
+            String serviceOrdNo = getStringValue(order,"ServiceOrdNo");
+
+            Integer oauserId=getIntegerValue(order,"ServiceOrd_NS_ID");
+            SysUser sysUser=sysUserService.selectUserByOaUserId(oauserId);
+            Long taskCreatorId=sysUser==null?null:sysUser.getUserId();
+            String createUserName=sysUser==null?"system":sysUser.getUserName();
+            SysDept dept=sysDeptService.selectDeptByServiceClass(serviceOrdClass);
+            Long deptId=dept==null?null:dept.getDeptId();
+            TaskUpdateVO updateTaskVo = new TaskUpdateVO();
+            BeanUtils.copyProperties(createTaskVo, updateTaskVo);
+
+
+            int result = sysTaskService.updateTask(updateTaskVo,serviceOrdID,dispatchOrdID, serviceOrdNo, taskCreatorId,createUserName, deptId, ServiceOrd_CC_Time, ServiceOrd_CC_Time);
+
+            if (result > 0) {
+                log.info("杞繍鍗曞悓姝ユ垚鍔�: ServiceOrdID={}, DispatchOrdID={}, 鍒涘缓鐨勪换鍔D={}", serviceOrdID, dispatchOrdID, result);
+
+                try {
+                    notifyTransferOrderByWechat((long) result, serviceOrdID, dispatchOrdID, serviceOrdNo, ServiceOrd_CC_Time, dept, order);
+                } catch (Exception e) {
+                    log.error("杞繍鍗曞悓姝ユ垚鍔熷悗鍙戦�佸井淇¢�氱煡澶辫触: ServiceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID, e);
+                }
+
+                return true;
+            } else {
+                log.error("杞繍鍗曞悓姝ュけ璐�: ServiceOrdID={}, DispatchOrdID={}", serviceOrdID, dispatchOrdID);
+                return false;
+            }
+
+        } catch (Exception e) {
+            log.error("鍚屾鍗曚釜杞繍鍗曞紓甯�: ServiceOrdID={}, DispatchOrdID={},sysTaskCode:{}", serviceOrdID, dispatchOrdID,sysTaskCode, e);
+            return false;
+        }
+    }
     /**
      * 鍚屾鍗曚釜鏃х郴缁熻浆杩愬崟鍒版柊绯荤粺锛堝甫璇︾粏淇℃伅锛�
      * 
@@ -414,9 +479,6 @@
 
 
             String hospitalOutDeptId = getStringValue(order, "ServiceOrdPtServicesID");
-
-            //杞嚭搴婁綅
-            String serviceOrdPtServices=getStringValue(order, "ServiceOrdPtServices");
             hospitalOutInfo.setDepartmentId(hospitalOutDeptId);
             if (StringUtils.isNotEmpty(hospitalOutDeptId)) {
                 String hospitalOutDeptName = legacyTransferSyncMapper.selectDepartmentNameByDeptID(hospitalOutDeptId);
@@ -424,6 +486,8 @@
                     hospitalOutInfo.setDepartment(hospitalOutDeptName);
                 }
             }
+            //杞嚭搴婁綅
+            String serviceOrdPtServices=getStringValue(order, "ServiceOrdPtServices");
             if(serviceOrdPtServices!= null){
                 hospitalOutInfo.setBedNumber(serviceOrdPtServices);
             }
@@ -471,6 +535,9 @@
             // 璁剧疆鎵ц浜轰俊鎭�
             List<TaskCreateVO.AssigneeInfo> assignees = queryAssignees(dispatchOrdID);
             createTaskVo.setAssignees(assignees);
+            if(!assignees.isEmpty()){
+                createTaskVo.setAssigneeId(assignees.get(0).getUserId());
+            }
             
             // 璁剧疆杞﹁締淇℃伅
             // 杞﹁締ID闇�瑕佹牴鎹瓺ispatchOrdCarID鏌ヨ鑾峰彇
@@ -602,7 +669,7 @@
             if (assigneeList != null && !assigneeList.isEmpty()) {
                 for (Map<String, Object> assigneeMap : assigneeList) {
                     String entourageOAId = getStringValue(assigneeMap, "EntourageOAId");
-                    String entourageState = getStringValue(assigneeMap, "EntourageState");
+                    String entourageState = getStringValue(assigneeMap, "EntourageID");
                     
                     if (StringUtils.isNotEmpty(entourageOAId)) {
                         try {
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskPaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskPaymentServiceImpl.java
index be42618..d527724 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskPaymentServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskPaymentServiceImpl.java
@@ -175,7 +175,7 @@
         
         // 寮傛鍚屾鍒版棫绯荤粺
         try {
-            additionalFeeSyncService.syncAdditionalFeeToLegacy(fee.getId());
+            additionalFeeSyncService.syncAdditionalFeeToLegacy(fee);
         } catch (Exception e) {
             log.error("鍚屾闄勫姞璐圭敤鍒版棫绯荤粺澶辫触", e);
         }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
index afde674..233a8cf 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
@@ -8,6 +8,7 @@
 import java.net.URL;
 
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.domain.vo.*;
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.utils.TaskCodeGenerator;
 import com.ruoyi.common.config.ImageUrlConfig;
@@ -28,10 +29,6 @@
 import com.ruoyi.system.domain.SysTaskEmergency;
 import com.ruoyi.system.domain.SysTaskWelfare;
 import com.ruoyi.system.domain.SysTaskAssignee;
-import com.ruoyi.system.domain.vo.TaskQueryVO;
-import com.ruoyi.system.domain.vo.TaskCreateVO;
-import com.ruoyi.system.domain.vo.TaskUpdateVO;
-import com.ruoyi.system.domain.vo.TaskStatisticsVO;
 import com.ruoyi.system.domain.enums.TaskStatus;
 import com.ruoyi.system.domain.VehicleInfo;
 import com.ruoyi.system.service.ISysTaskService;
@@ -259,11 +256,11 @@
                 taskVehicle.setTaskId(task.getTaskId());
                 taskVehicle.setVehicleId(vehicleId);
                 taskVehicle.setAssignTime(DateUtils.getNowDate());
-                taskVehicle.setAssignBy(SecurityUtils.getUsername());
+                taskVehicle.setAssignBy(username);
                 taskVehicle.setStatus("ASSIGNED");
-                taskVehicle.setCreateBy(SecurityUtils.getUsername());
+                taskVehicle.setCreateBy(username);
                 taskVehicle.setCreateTime(DateUtils.getNowDate());
-                taskVehicle.setUpdateBy(SecurityUtils.getUsername());
+                taskVehicle.setUpdateBy(username);
                 taskVehicle.setUpdateTime(DateUtils.getNowDate());
                 
                 sysTaskVehicleMapper.insertSysTaskVehicle(taskVehicle);
@@ -549,49 +546,70 @@
      */
     @Override
     @Transactional
-    public int updateSysTask(TaskUpdateVO updateVO) {
+    public int updateSysTask(TaskUpdateVO updateVO, Boolean updateFromLegacy) {
         SysTask oldTask = sysTaskMapper.selectSysTaskByTaskId(updateVO.getTaskId());
         if (oldTask == null) {
             throw new RuntimeException("浠诲姟涓嶅瓨鍦�");
         }
+        String userName = SecurityUtils.getUsername();
         
         SysTask task = new SysTask();
         task.setTaskId(updateVO.getTaskId());
         task.setTaskDescription(updateVO.getTaskDescription());
+        task.setPlannedStartTime(updateVO.getPlannedStartTime());
+        task.setPlannedEndTime(updateVO.getPlannedEndTime());
+        task.setAssigneeId(updateVO.getAssigneeId());
+        task.setUpdateBy(userName);
+        task.setUpdateTime(updateVO.getUpdateTime() != null ? updateVO.getUpdateTime() : DateUtils.getNowDate());
+        task.setRemark(updateVO.getRemark());
+        
+        // 璁剧疆閫氱敤鍦板潃鍜屽潗鏍囦俊鎭�
         task.setDepartureAddress(updateVO.getDepartureAddress());
         task.setDestinationAddress(updateVO.getDestinationAddress());
         task.setDepartureLongitude(updateVO.getDepartureLongitude());
         task.setDepartureLatitude(updateVO.getDepartureLatitude());
         task.setDestinationLongitude(updateVO.getDestinationLongitude());
         task.setDestinationLatitude(updateVO.getDestinationLatitude());
-        task.setPlannedStartTime(updateVO.getPlannedStartTime());
-        task.setPlannedEndTime(updateVO.getPlannedEndTime());
-        task.setAssigneeId(updateVO.getAssigneeId());
-        task.setUpdateBy(SecurityUtils.getUsername());
-        task.setUpdateTime(DateUtils.getNowDate());
-        task.setRemark(updateVO.getRemark());
+        
+        // 璁剧疆棰勮璺濈
+        if (updateVO.getEstimatedDistance() != null) {
+            task.setEstimatedDistance(updateVO.getEstimatedDistance());
+        } else if (updateVO.getTransferDistance() != null) {
+            // 鍏煎鎬ユ晳杞繍瀛楁
+            task.setEstimatedDistance(updateVO.getTransferDistance());
+        } else if (updateVO.getDistance() != null) {
+            // 鍏煎绂忕杞﹀瓧娈�
+            task.setEstimatedDistance(updateVO.getDistance());
+        }
         
         // 濡傛灉鏇存柊浜嗛儴闂↖D
         if (updateVO.getDeptId() != null) {
             task.setDeptId(updateVO.getDeptId());
         }
         
+        // 濡傛灉鏇存柊浜嗕换鍔$紪鍙�
+        if (updateVO.getTaskCode() != null) {
+            task.setTaskCode(updateVO.getTaskCode());
+        }
+        
         // 鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣锛堝鏋滄洿鏂颁簡鍦板潃浣嗙己澶卞潗鏍囷級
         if (updateVO.getDepartureAddress() != null && 
             (updateVO.getDepartureLongitude() == null || updateVO.getDepartureLatitude() == null) && 
             mapService != null) {
-            try {
-                Map<String, Double> coords = mapService.geocoding(
-                    updateVO.getDepartureAddress(), 
-                    extractCityFromAddress(updateVO.getDepartureAddress())
-                );
-                if (coords != null) {
-                    task.setDepartureLongitude(BigDecimal.valueOf(coords.get("lng")));
-                    task.setDepartureLatitude(BigDecimal.valueOf(coords.get("lat")));
-                    log.info("鍑哄彂鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+            if (!updateVO.getDepartureAddress().equals(oldTask.getDepartureAddress())) {
+                try {
+                    Map<String, Double> coords = mapService.geocoding(
+                        updateVO.getDepartureAddress(),
+                        extractCityFromAddress(updateVO.getDepartureAddress())
+                    );
+                    if (coords != null) {
+                        task.setDepartureLongitude(BigDecimal.valueOf(coords.get("lng")));
+                        task.setDepartureLatitude(BigDecimal.valueOf(coords.get("lat")));
+                        log.info("鍑哄彂鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                    }
+                } catch (Exception e) {
+                    log.error("鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣澶辫触", e);
                 }
-            } catch (Exception e) {
-                log.error("鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣澶辫触", e);
             }
         }
         
@@ -599,23 +617,22 @@
         if (updateVO.getDestinationAddress() != null && 
             (updateVO.getDestinationLongitude() == null || updateVO.getDestinationLatitude() == null) && 
             mapService != null) {
-            try {
-                Map<String, Double> coords = mapService.geocoding(
-                    updateVO.getDestinationAddress(), 
-                    extractCityFromAddress(updateVO.getDestinationAddress())
-                );
-                if (coords != null) {
-                    task.setDestinationLongitude(BigDecimal.valueOf(coords.get("lng")));
-                    task.setDestinationLatitude(BigDecimal.valueOf(coords.get("lat")));
-                    log.info("鐩殑鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+            if (!updateVO.getDestinationAddress().equals(oldTask.getDestinationAddress())) {
+                try {
+                    Map<String, Double> coords = mapService.geocoding(
+                        updateVO.getDestinationAddress(),
+                        extractCityFromAddress(updateVO.getDestinationAddress())
+                    );
+                    if (coords != null) {
+                        task.setDestinationLongitude(BigDecimal.valueOf(coords.get("lng")));
+                        task.setDestinationLatitude(BigDecimal.valueOf(coords.get("lat")));
+                        log.info("鐩殑鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                    }
+                } catch (Exception e) {
+                    log.error("鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣澶辫触", e);
                 }
-            } catch (Exception e) {
-                log.error("鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣澶辫触", e);
             }
         }
-        
-        // 閲嶆柊璁$畻棰勮鍏噷鏁�
-        calculateEstimatedDistance(task);
         
         int result = sysTaskMapper.updateSysTask(task);
         
@@ -640,7 +657,7 @@
                 
                 // 娣诲姞鏂扮殑杞﹁締鍏宠仈
                 Date now = DateUtils.getNowDate();
-                String currentUser = SecurityUtils.getUsername();
+                String currentUser = userName;
                 for (Long vehicleId : updateVO.getVehicleIds()) {
                     SysTaskVehicle taskVehicle = new SysTaskVehicle();
                     taskVehicle.setTaskId(updateVO.getTaskId());
@@ -665,7 +682,7 @@
                 .collect(Collectors.toList());
             
             List<Long> newAssigneeIds = updateVO.getAssignees().stream()
-                .map(TaskUpdateVO.AssigneeInfo::getUserId)
+                .map(TaskCreateVO.AssigneeInfo::getUserId)
                 .collect(Collectors.toList());
             
             // 姣旇緝鏂版棫鎵ц浜哄憳ID鍒楄〃锛屽垽鏂槸鍚︽湁鍙樺寲
@@ -678,17 +695,7 @@
                 
                 // 娣诲姞鏂扮殑鎵ц浜哄憳鍏宠仈
                 if (!updateVO.getAssignees().isEmpty()) {
-                    // 灏� TaskUpdateVO.AssigneeInfo 杞崲涓� TaskCreateVO.AssigneeInfo
-                    List<TaskCreateVO.AssigneeInfo> createAssignees = updateVO.getAssignees().stream()
-                        .map(assignee -> {
-                            TaskCreateVO.AssigneeInfo createAssignee = new TaskCreateVO.AssigneeInfo();
-                            createAssignee.setUserId(assignee.getUserId());
-                            createAssignee.setUserName(assignee.getUserName());
-                            createAssignee.setUserType(assignee.getUserType());
-                            return createAssignee;
-                        })
-                        .collect(Collectors.toList());
-                    saveTaskAssignees(updateVO.getTaskId(), createAssignees, SecurityUtils.getUsername());
+                    saveTaskAssignees(updateVO.getTaskId(), updateVO.getAssignees(), userName);
                 }
                 
                 // 鏍囪闇�瑕侀噸鏂板悓姝ワ紙浜哄憳鍙樻洿锛�
@@ -697,37 +704,41 @@
         }
         
         // 鏇存柊鎬ユ晳杞繍鎵╁睍淇℃伅锛堟娴嬪湴鍧�鍜屾垚浜や环鍙樻洿锛�
-        if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType()) && updateVO.getEmergencyInfo() != null) {
+        if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType())) {
             // 鑾峰彇鏃х殑鎬ユ晳杞繍淇℃伅
             SysTaskEmergency oldEmergency = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(updateVO.getTaskId());
             
             // 妫�娴嬭浆鍑哄尰闄㈠湴鍧�鍙樻洿
             boolean hospitalOutAddressChanged = false;
-            if (updateVO.getEmergencyInfo().getHospitalOutAddress() != null 
-                && oldEmergency != null 
-                && !updateVO.getEmergencyInfo().getHospitalOutAddress().equals(oldEmergency.getHospitalOutAddress())) {
+            if (updateVO.getHospitalOut() != null && updateVO.getHospitalOut().getAddress() != null
+                && oldEmergency != null
+                && !updateVO.getHospitalOut().getAddress().equals(oldEmergency.getHospitalOutAddress())) {
                 hospitalOutAddressChanged = true;
             }
             
             // 妫�娴嬭浆鍏ュ尰闄㈠湴鍧�鍙樻洿
             boolean hospitalInAddressChanged = false;
-            if (updateVO.getEmergencyInfo().getHospitalInAddress() != null 
-                && oldEmergency != null 
-                && !updateVO.getEmergencyInfo().getHospitalInAddress().equals(oldEmergency.getHospitalInAddress())) {
+            if (updateVO.getHospitalIn() != null && updateVO.getHospitalIn().getAddress() != null
+                && oldEmergency != null
+                && !updateVO.getHospitalIn().getAddress().equals(oldEmergency.getHospitalInAddress())) {
                 hospitalInAddressChanged = true;
             }
             
             // 妫�娴嬫垚浜や环鍙樻洿
             boolean transferPriceChanged = false;
-            if (updateVO.getEmergencyInfo().getTransferPrice() != null 
-                && oldEmergency != null 
+            if (updateVO.getPrice() != null
+                && oldEmergency != null
                 && oldEmergency.getTransferPrice() != null
-                && updateVO.getEmergencyInfo().getTransferPrice().compareTo(oldEmergency.getTransferPrice()) != 0) {
+                && updateVO.getPrice().compareTo(oldEmergency.getTransferPrice()) != 0) {
                 transferPriceChanged = true;
             }
+
+            ;
             
             // 鏇存柊鎬ユ晳杞繍淇℃伅
-            updateEmergencyInfo(updateVO.getTaskId(), updateVO);
+            if (updateVO.getHospitalOut() != null || updateVO.getHospitalIn() != null || updateVO.getPatient() != null) {
+                updateEmergencyInfoFromCreateVO(updateVO.getTaskId(), updateVO, userName);
+            }
             
             // 濡傛灉鍦板潃鎴栨垚浜や环鍙戠敓鍙樻洿锛屾爣璁伴渶瑕侀噸鏂板悓姝�
             if (hospitalOutAddressChanged || hospitalInAddressChanged || transferPriceChanged) {
@@ -735,8 +746,15 @@
             }
         }
         
+        // 鏇存柊绂忕杞︽墿灞曚俊鎭�
+        if (result > 0 && "WELFARE".equals(oldTask.getTaskType())) {
+            if (updateVO.getPassenger() != null || updateVO.getStartAddress() != null || updateVO.getEndAddress() != null) {
+                updateWelfareInfoFromCreateVO(updateVO.getTaskId(), updateVO, userName);
+            }
+        }
+        
         // 濡傛灉鏄�ユ晳杞繍浠诲姟涓旀湁鍙樻洿锛屾爣璁伴渶瑕侀噸鏂板悓姝�
-        if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType()) && needResync) {
+        if (result > 0 && "EMERGENCY_TRANSFER".equals(oldTask.getTaskType()) && needResync && !updateFromLegacy) {
             try {
                 sysTaskEmergencyService.markNeedResync(updateVO.getTaskId());
             } catch (Exception e) {
@@ -746,9 +764,183 @@
         
         // 璁板綍鎿嶄綔鏃ュ織
         if (result > 0) {
-            recordTaskLog(updateVO.getTaskId(), "UPDATE", "鏇存柊浠诲姟", 
-                         buildTaskDescription(oldTask), buildTaskDescription(task), 
-                         SecurityUtils.getUserId(), SecurityUtils.getUsername());
+            recordTaskLog(updateVO.getTaskId(), "UPDATE", "鏇存柊浠诲姟",
+                buildTaskDescription(oldTask), buildTaskDescription(task),
+                SecurityUtils.getUserId(), userName);
+        }
+        
+        return result;
+    }
+
+    /**
+     * 鏇存柊浠诲姟锛堢敤浜庢棫绯荤粺鍚屾锛�
+     * 
+     * @param updateVO 浠诲姟鏇存柊瀵硅薄
+     * @param serviceOrderId 鏃х郴缁熸湇鍔″崟ID
+     * @param dispatchOrderId 鏃х郴缁熻皟搴﹀崟ID
+     * @param serviceOrdNo 鏃х郴缁熸湇鍔″崟缂栧彿
+     * @param userId 鐢ㄦ埛ID
+     * @param userName 鐢ㄦ埛鍚�
+     * @param deptId 閮ㄩ棬ID
+     * @param createTime 鍒涘缓鏃堕棿
+     * @param updateTime 鏇存柊鏃堕棿
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateTask(TaskUpdateVO updateVO, String serviceOrderId, String dispatchOrderId, String serviceOrdNo,
+                         Long userId, String userName, Long deptId, Date createTime, Date updateTime) {
+        // 閫氳繃鏃х郴缁熸湇鍔″崟ID鏌ユ壘浠诲姟
+        SysTaskEmergency taskEmergency = sysTaskEmergencyMapper.selectByLegacyServiceOrdId(Long.parseLong(serviceOrderId));
+        Long taskId = taskEmergency.getTaskId();
+        updateVO.setTaskId(taskId);
+        SysTask task = new SysTask();
+        task.setTaskId(taskId);
+        task.setTaskDescription(updateVO.getTaskDescription());
+        task.setPlannedStartTime(updateVO.getPlannedStartTime());
+        task.setPlannedEndTime(updateVO.getPlannedEndTime());
+        task.setAssigneeId(updateVO.getAssigneeId());
+        task.setUpdateBy(userName);
+        task.setUpdateTime(DateUtils.getNowDate());
+        task.setRemark(updateVO.getRemark());
+
+        
+        // 璁剧疆鍦板潃鍜屽潗鏍囦俊鎭�
+        task.setDepartureAddress(updateVO.getDepartureAddress());
+        task.setDestinationAddress(updateVO.getDestinationAddress());
+        task.setDepartureLongitude(updateVO.getDepartureLongitude());
+        task.setDepartureLatitude(updateVO.getDepartureLatitude());
+        task.setDestinationLongitude(updateVO.getDestinationLongitude());
+        task.setDestinationLatitude(updateVO.getDestinationLatitude());
+        
+        // 濡傛灉鏇存柊浜嗛儴闂↖D
+        if (updateVO.getDeptId() != null) {
+            task.setDeptId(updateVO.getDeptId());
+        }
+        
+        // 濡傛灉鏇存柊浜嗕换鍔$紪鍙�
+        if (updateVO.getTaskCode() != null) {
+            task.setTaskCode(updateVO.getTaskCode());
+        }
+        
+        // 鑾峰彇鏃т换鍔′俊鎭紝鐢ㄤ簬鍒ゆ柇鍦板潃鏄惁鍙樻洿
+        SysTask oldTask = sysTaskMapper.selectSysTaskByTaskId(taskId);
+        
+        // 鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣锛堝鏋滃湴鍧�鍙樻洿涓旂己澶卞潗鏍囷級
+        if (oldTask != null && updateVO.getDepartureAddress() != null
+            && !updateVO.getDepartureAddress().equals(oldTask.getDepartureAddress())
+            && (updateVO.getDepartureLongitude() == null || updateVO.getDepartureLatitude() == null)
+            && mapService != null) {
+            try {
+                Map<String, Double> coords = mapService.geocoding(
+                    updateVO.getDepartureAddress(),
+                    extractCityFromAddress(updateVO.getDepartureAddress())
+                );
+                if (coords != null) {
+                    task.setDepartureLongitude(BigDecimal.valueOf(coords.get("lng")));
+                    task.setDepartureLatitude(BigDecimal.valueOf(coords.get("lat")));
+                    log.info("鍑哄彂鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                }
+            } catch (Exception e) {
+                log.error("鑷姩鑾峰彇鍑哄彂鍦癎PS鍧愭爣澶辫触", e);
+            }
+        }
+        
+        // 鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣锛堝鏋滃湴鍧�鍙樻洿涓旂己澶卞潗鏍囷級
+        if (oldTask != null && updateVO.getDestinationAddress() != null
+            && !updateVO.getDestinationAddress().equals(oldTask.getDestinationAddress())
+            && (updateVO.getDestinationLongitude() == null || updateVO.getDestinationLatitude() == null)
+            && mapService != null) {
+            try {
+                Map<String, Double> coords = mapService.geocoding(
+                    updateVO.getDestinationAddress(),
+                    extractCityFromAddress(updateVO.getDestinationAddress())
+                );
+                if (coords != null) {
+                    task.setDestinationLongitude(BigDecimal.valueOf(coords.get("lng")));
+                    task.setDestinationLatitude(BigDecimal.valueOf(coords.get("lat")));
+                    log.info("鐩殑鍦癎PS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                }
+            } catch (Exception e) {
+                log.error("鑷姩鑾峰彇鐩殑鍦癎PS鍧愭爣澶辫触", e);
+            }
+        }
+        
+        int result = sysTaskMapper.updateSysTask(task);
+        
+        // 鏇存柊杞﹁締鍏宠仈
+        if (result > 0 && updateVO.getVehicleIds() != null && !updateVO.getVehicleIds().isEmpty()) {
+            // 鏌ヨ鐜版湁鐨勮溅杈嗗叧鑱�
+            List<SysTaskVehicle> existingVehicles = sysTaskVehicleMapper.selectSysTaskVehicleByTaskId(taskId);
+            List<Long> existingVehicleIds = existingVehicles.stream()
+                .map(SysTaskVehicle::getVehicleId)
+                .collect(Collectors.toList());
+            
+            // 姣旇緝鏂版棫杞﹁締ID鍒楄〃锛屽垽鏂槸鍚︽湁鍙樺寲
+            boolean vehiclesChanged = !new HashSet<>(existingVehicleIds).equals(new HashSet<>(updateVO.getVehicleIds()));
+            
+            // 鍙湁杞﹁締鍙戠敓鍙樺寲鏃舵墠鏇存柊
+            if (vehiclesChanged) {
+                // 鍒犻櫎鏃х殑杞﹁締鍏宠仈
+                sysTaskVehicleMapper.deleteSysTaskVehicleByTaskId(taskId);
+                
+                // 娣诲姞鏂扮殑杞﹁締鍏宠仈
+                Date now = DateUtils.getNowDate();
+                for (Long vehicleId : updateVO.getVehicleIds()) {
+                    SysTaskVehicle taskVehicle = new SysTaskVehicle();
+                    taskVehicle.setTaskId(taskId);
+                    taskVehicle.setVehicleId(vehicleId);
+                    taskVehicle.setAssignTime(now);
+                    taskVehicle.setAssignBy(userName);
+                    taskVehicle.setCreateTime(now);
+                    sysTaskVehicleMapper.insertSysTaskVehicle(taskVehicle);
+                }
+            }
+        }
+        
+        // 鏇存柊鎵ц浜哄憳锛堟娴嬩汉鍛樺彉鏇达級
+        if (result > 0 && updateVO.getAssignees() != null) {
+            // 鏌ヨ鐜版湁鐨勬墽琛屼汉鍛�
+            List<SysTaskAssignee> existingAssignees = sysTaskAssigneeMapper.selectSysTaskAssigneeByTaskId(taskId);
+            List<Long> existingAssigneeIds = existingAssignees.stream()
+                .map(SysTaskAssignee::getUserId)
+                .collect(Collectors.toList());
+            
+            List<Long> newAssigneeIds = updateVO.getAssignees().stream()
+                .map(TaskCreateVO.AssigneeInfo::getUserId)
+                .collect(Collectors.toList());
+            
+            // 姣旇緝鏂版棫鎵ц浜哄憳ID鍒楄〃锛屽垽鏂槸鍚︽湁鍙樺寲
+            boolean assigneesChanged = !new HashSet<>(existingAssigneeIds).equals(new HashSet<>(newAssigneeIds));
+            
+            // 鍙湁鎵ц浜哄憳鍙戠敓鍙樺寲鏃舵墠鏇存柊
+            if (assigneesChanged) {
+                // 鍒犻櫎鏃х殑鎵ц浜哄憳鍏宠仈
+                sysTaskAssigneeMapper.deleteSysTaskAssigneeByTaskId(taskId);
+                
+                // 娣诲姞鏂扮殑鎵ц浜哄憳鍏宠仈
+                if (!updateVO.getAssignees().isEmpty()) {
+                    saveTaskAssignees(taskId, updateVO.getAssignees(), userName);
+                }
+            }
+        }
+        
+        // 鏇存柊鎬ユ晳杞繍鎵╁睍淇℃伅
+        if (result > 0) {
+            // 鏇存柊鏃х郴缁烮D
+            if (serviceOrderId != null) {
+                taskEmergency.setLegacyServiceOrdId(Long.parseLong(serviceOrderId));
+            }
+            if (dispatchOrderId != null) {
+                taskEmergency.setLegacyDispatchOrdId(Long.parseLong(dispatchOrderId));
+            }
+            if (serviceOrdNo != null) {
+                taskEmergency.setLegacyServiceOrdNo(serviceOrdNo);
+            }
+            
+            // 浣跨敤TaskCreateVO鐨勫瓧娈垫潵鏇存柊鎬ユ晳杞繍淇℃伅
+            if (updateVO.getHospitalOut() != null || updateVO.getHospitalIn() != null || updateVO.getPatient() != null) {
+                updateEmergencyInfoFromCreateVO(taskId, updateVO, userName);
+            }
         }
         
         return result;
@@ -1165,7 +1357,7 @@
      */
     @Override
     @Transactional
-    public int assignVehicleToTask(Long taskId, Long vehicleId, String remark) {
+    public int assignVehicleToTask(Long taskId, Long vehicleId, String remark,Long userId,String userName) {
         // 妫�鏌ユ槸鍚﹀凡缁忓垎閰�
         int exists = sysTaskVehicleMapper.checkTaskVehicleExists(taskId, vehicleId);
         if (exists > 0) {
@@ -1176,7 +1368,7 @@
         taskVehicle.setTaskId(taskId);
         taskVehicle.setVehicleId(vehicleId);
         taskVehicle.setAssignTime(DateUtils.getNowDate());
-        taskVehicle.setAssignBy(SecurityUtils.getUsername());
+        taskVehicle.setAssignBy(userName);
         taskVehicle.setStatus("ASSIGNED");
         taskVehicle.setRemark(remark);
         
@@ -1186,7 +1378,7 @@
         if (result > 0) {
             recordTaskLog(taskId, "ASSIGN", "鍒嗛厤杞﹁締", null, 
                          "鍒嗛厤杞﹁締ID锛�" + vehicleId + "锛屽娉細" + remark, 
-                         SecurityUtils.getUserId(), SecurityUtils.getUsername());
+                         userId, userName);
         }
         
         return result;
@@ -1224,10 +1416,10 @@
      */
     @Override
     @Transactional
-    public int assignMultipleVehiclesToTask(Long taskId, List<Long> vehicleIds, String remark) {
+    public int assignMultipleVehiclesToTask(Long taskId, List<Long> vehicleIds, String remark,Long userId,String userName) {
         List<SysTaskVehicle> taskVehicles = new ArrayList<>();
         Date now = DateUtils.getNowDate();
-        String assignBy = SecurityUtils.getUsername();
+        String assignBy = userName;
         
         for (Long vehicleId : vehicleIds) {
             // 妫�鏌ユ槸鍚﹀凡缁忓垎閰�
@@ -1253,7 +1445,7 @@
         if (result > 0) {
             recordTaskLog(taskId, "ASSIGN", "鎵归噺鍒嗛厤杞﹁締", null, 
                          "鍒嗛厤杞﹁締鏁伴噺锛�" + result + "锛屽娉細" + remark, 
-                         SecurityUtils.getUserId(), SecurityUtils.getUsername());
+                         userId,userName);
         }
         
         return result;
@@ -1768,12 +1960,13 @@
     }
 
     /**
-     * 鏇存柊鎬ユ晳杞繍浠诲姟鎵╁睍淇℃伅
+     * 浠� TaskCreateVO 鏇存柊鎬ユ晳杞繍浠诲姟鎵╁睍淇℃伅
      * 
      * @param taskId 浠诲姟ID
-     * @param updateVO 浠诲姟鏇存柊瀵硅薄
+     * @param createVO 浠诲姟鍒涘缓/鏇存柊瀵硅薄
+     * @param userName 鎿嶄綔浜哄悕
      */
-    private void updateEmergencyInfo(Long taskId, TaskUpdateVO updateVO) {
+    private void updateEmergencyInfoFromCreateVO(Long taskId, TaskCreateVO createVO, String userName) {
         // 鏌ヨ鐜版湁鐨勬墿灞曚俊鎭�
         SysTaskEmergency existingInfo = sysTaskEmergencyMapper.selectSysTaskEmergencyByTaskId(taskId);
         if (existingInfo == null) {
@@ -1781,143 +1974,223 @@
             existingInfo = new SysTaskEmergency();
             existingInfo.setTaskId(taskId);
             existingInfo.setCreateTime(DateUtils.getNowDate());
-            existingInfo.setCreateBy(SecurityUtils.getUsername());
+            existingInfo.setCreateBy(userName);
         }
-        
-        TaskUpdateVO.EmergencyInfoVO emergencyInfo = updateVO.getEmergencyInfo();
         
         // 鏇存柊鎮h�呬俊鎭�
-        if (emergencyInfo.getPatientContact() != null) {
-            existingInfo.setPatientContact(emergencyInfo.getPatientContact());
-        }
-        if (emergencyInfo.getPatientPhone() != null) {
-            existingInfo.setPatientPhone(emergencyInfo.getPatientPhone());
-        }
-        if (emergencyInfo.getPatientName() != null) {
-            existingInfo.setPatientName(emergencyInfo.getPatientName());
-        }
-        if (emergencyInfo.getPatientGender() != null) {
-            existingInfo.setPatientGender(emergencyInfo.getPatientGender());
-        }
-        if (emergencyInfo.getPatientIdCard() != null) {
-            existingInfo.setPatientIdCard(emergencyInfo.getPatientIdCard());
-        }
-        if (emergencyInfo.getPatientCondition() != null) {
-            existingInfo.setPatientCondition(emergencyInfo.getPatientCondition());
+        if (createVO.getPatient() != null) {
+            if (createVO.getPatient().getContact() != null) {
+                existingInfo.setPatientContact(createVO.getPatient().getContact());
+            }
+            if (createVO.getPatient().getPhone() != null) {
+                existingInfo.setPatientPhone(createVO.getPatient().getPhone());
+            }
+            if (createVO.getPatient().getName() != null) {
+                existingInfo.setPatientName(createVO.getPatient().getName());
+            }
+            if (createVO.getPatient().getGender() != null) {
+                existingInfo.setPatientGender(createVO.getPatient().getGender());
+            }
+            if (createVO.getPatient().getIdCard() != null) {
+                existingInfo.setPatientIdCard(createVO.getPatient().getIdCard());
+            }
+            if (createVO.getPatient().getCondition() != null) {
+                existingInfo.setPatientCondition(createVO.getPatient().getCondition());
+            }
         }
         
         // 鏇存柊杞嚭鍖婚櫌淇℃伅
-        if (emergencyInfo.getHospitalOutId() != null) {
-            existingInfo.setHospitalOutId(emergencyInfo.getHospitalOutId());
-        }
-        if (emergencyInfo.getHospitalOutName() != null) {
-            existingInfo.setHospitalOutName(emergencyInfo.getHospitalOutName());
-        }
-        if (emergencyInfo.getHospitalOutDepartment() != null) {
-            existingInfo.setHospitalOutDepartment(emergencyInfo.getHospitalOutDepartment());
-        }
-        if (emergencyInfo.getHospitalOutDepartmentId() != null) {
-            existingInfo.setHospitalOutDepartmentId(emergencyInfo.getHospitalOutDepartmentId());
-        }
-        if (emergencyInfo.getHospitalOutBedNumber() != null) {
-            existingInfo.setHospitalOutBedNumber(emergencyInfo.getHospitalOutBedNumber());
-        }
-        if (emergencyInfo.getHospitalOutAddress() != null) {
-            existingInfo.setHospitalOutAddress(emergencyInfo.getHospitalOutAddress());
-            
-            // 濡傛灉鏇存柊浜嗗湴鍧�浣嗘病鏈塆PS鍧愭爣锛屽悗绔嚜鍔ㄨ幏鍙�
-            if (emergencyInfo.getHospitalOutLongitude() == null && emergencyInfo.getHospitalOutLatitude() == null && mapService != null) {
-                try {
-                    Map<String, Double> coords = mapService.geocoding(
-                        emergencyInfo.getHospitalOutAddress(), 
-                        extractCityFromAddress(emergencyInfo.getHospitalOutAddress())
-                    );
-                    if (coords != null) {
-                        existingInfo.setHospitalOutLongitude(BigDecimal.valueOf(coords.get("lng")));
-                        existingInfo.setHospitalOutLatitude(BigDecimal.valueOf(coords.get("lat")));
-                        log.info("杞嚭鍖婚櫌GPS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+        if (createVO.getHospitalOut() != null) {
+            if (createVO.getHospitalOut().getId() != null) {
+                existingInfo.setHospitalOutId(createVO.getHospitalOut().getId());
+            }
+            if (createVO.getHospitalOut().getName() != null) {
+                existingInfo.setHospitalOutName(createVO.getHospitalOut().getName());
+            }
+            if (createVO.getHospitalOut().getDepartment() != null) {
+                existingInfo.setHospitalOutDepartment(createVO.getHospitalOut().getDepartment());
+            }
+            if (createVO.getHospitalOut().getDepartmentId() != null) {
+                existingInfo.setHospitalOutDepartmentId(createVO.getHospitalOut().getDepartmentId());
+            }
+            if (createVO.getHospitalOut().getBedNumber() != null) {
+                existingInfo.setHospitalOutBedNumber(createVO.getHospitalOut().getBedNumber());
+            }
+            if (createVO.getHospitalOut().getAddress() != null && !createVO.getHospitalOut().getAddress().equals(existingInfo.getHospitalOutAddress())) {
+                existingInfo.setHospitalOutAddress(createVO.getHospitalOut().getAddress());
+                
+                // 濡傛灍鏇存柊浜嗗湴鍧�浣嗘病鏈塆PS鍧愭爣锛屽悗绔嚜鍔ㄨ幏鍙�
+                if (createVO.getHospitalOut().getLongitude() == null && createVO.getHospitalOut().getLatitude() == null && mapService != null) {
+                    try {
+
+                        Map<String, Double> coords = mapService.geocoding(
+                            createVO.getHospitalOut().getAddress(),
+                            extractCityFromAddress(createVO.getHospitalOut().getAddress())
+                        );
+                        if (coords != null) {
+                            existingInfo.setHospitalOutLongitude(BigDecimal.valueOf(coords.get("lng")));
+                            existingInfo.setHospitalOutLatitude(BigDecimal.valueOf(coords.get("lat")));
+                            log.info("杞嚭鍖婚櫌GPS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                        }
+                    } catch (Exception e) {
+                        log.error("鑷姩鑾峰彇杞嚭鍖婚櫌GPS鍧愭爣澶辫触", e);
                     }
-                } catch (Exception e) {
-                    log.error("鑷姩鑾峰彇杞嚭鍖婚櫌GPS鍧愭爣澶辫触", e);
                 }
             }
-        }
-        if (emergencyInfo.getHospitalOutLongitude() != null) {
-            existingInfo.setHospitalOutLongitude(emergencyInfo.getHospitalOutLongitude());
-        }
-        if (emergencyInfo.getHospitalOutLatitude() != null) {
-            existingInfo.setHospitalOutLatitude(emergencyInfo.getHospitalOutLatitude());
+            if (createVO.getHospitalOut().getLongitude() != null) {
+                existingInfo.setHospitalOutLongitude(createVO.getHospitalOut().getLongitude());
+            }
+            if (createVO.getHospitalOut().getLatitude() != null) {
+                existingInfo.setHospitalOutLatitude(createVO.getHospitalOut().getLatitude());
+            }
         }
         
         // 鏇存柊杞叆鍖婚櫌淇℃伅
-        if (emergencyInfo.getHospitalInId() != null) {
-            existingInfo.setHospitalInId(emergencyInfo.getHospitalInId());
-        }
-        if (emergencyInfo.getHospitalInName() != null) {
-            existingInfo.setHospitalInName(emergencyInfo.getHospitalInName());
-        }
-        if (emergencyInfo.getHospitalInDepartment() != null) {
-            existingInfo.setHospitalInDepartment(emergencyInfo.getHospitalInDepartment());
-        }
-        if (emergencyInfo.getHospitalInDepartmentId() != null) {
-            existingInfo.setHospitalInDepartmentId(emergencyInfo.getHospitalInDepartmentId());
-        }
-        if (emergencyInfo.getHospitalInBedNumber() != null) {
-            existingInfo.setHospitalInBedNumber(emergencyInfo.getHospitalInBedNumber());
-        }
-        if (emergencyInfo.getHospitalInAddress() != null) {
-            existingInfo.setHospitalInAddress(emergencyInfo.getHospitalInAddress());
-            
-            // 濡傛灉鏇存柊浜嗗湴鍧�浣嗘病鏈塆PS鍧愭爣锛屽悗绔嚜鍔ㄨ幏鍙�
-            if (emergencyInfo.getHospitalInLongitude() == null && emergencyInfo.getHospitalInLatitude() == null && mapService != null) {
-                try {
-                    Map<String, Double> coords = mapService.geocoding(
-                        emergencyInfo.getHospitalInAddress(), 
-                        extractCityFromAddress(emergencyInfo.getHospitalInAddress())
-                    );
-                    if (coords != null) {
-                        existingInfo.setHospitalInLongitude(BigDecimal.valueOf(coords.get("lng")));
-                        existingInfo.setHospitalInLatitude(BigDecimal.valueOf(coords.get("lat")));
-                        log.info("杞叆鍖婚櫌GPS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+        if (createVO.getHospitalIn() != null) {
+            if (createVO.getHospitalIn().getId() != null) {
+                existingInfo.setHospitalInId(createVO.getHospitalIn().getId());
+            }
+            if (createVO.getHospitalIn().getName() != null) {
+                existingInfo.setHospitalInName(createVO.getHospitalIn().getName());
+            }
+            if (createVO.getHospitalIn().getDepartment() != null) {
+                existingInfo.setHospitalInDepartment(createVO.getHospitalIn().getDepartment());
+            }
+            if (createVO.getHospitalIn().getDepartmentId() != null) {
+                existingInfo.setHospitalInDepartmentId(createVO.getHospitalIn().getDepartmentId());
+            }
+            if (createVO.getHospitalIn().getBedNumber() != null) {
+                existingInfo.setHospitalInBedNumber(createVO.getHospitalIn().getBedNumber());
+            }
+            if (createVO.getHospitalIn().getAddress() != null && !createVO.getHospitalIn().getAddress().equals(existingInfo.getHospitalInAddress())) {
+                existingInfo.setHospitalInAddress(createVO.getHospitalIn().getAddress());
+                
+                // 濡傛灉鏇存柊浜嗗湴鍧�浣嗘病鏈塆PS鍧愭爣锛屽悗绔嚜鍔ㄨ幏鍙�
+                if (createVO.getHospitalIn().getLongitude() == null && createVO.getHospitalIn().getLatitude() == null && mapService != null) {
+                    try {
+                        Map<String, Double> coords = mapService.geocoding(
+                            createVO.getHospitalIn().getAddress(),
+                            extractCityFromAddress(createVO.getHospitalIn().getAddress())
+                        );
+                        if (coords != null) {
+                            existingInfo.setHospitalInLongitude(BigDecimal.valueOf(coords.get("lng")));
+                            existingInfo.setHospitalInLatitude(BigDecimal.valueOf(coords.get("lat")));
+                            log.info("杞叆鍖婚櫌GPS鍧愭爣鑷姩鑾峰彇鎴愬姛: {}, {}", coords.get("lng"), coords.get("lat"));
+                        }
+                    } catch (Exception e) {
+                        log.error("鑷姩鑾峰彇杞叆鍖婚櫌GPS鍧愭爣澶辫触", e);
                     }
-                } catch (Exception e) {
-                    log.error("鑷姩鑾峰彇杞叆鍖婚櫌GPS鍧愭爣澶辫触", e);
                 }
             }
-        }
-        if (emergencyInfo.getHospitalInLongitude() != null) {
-            existingInfo.setHospitalInLongitude(emergencyInfo.getHospitalInLongitude());
-        }
-        if (emergencyInfo.getHospitalInLatitude() != null) {
-            existingInfo.setHospitalInLatitude(emergencyInfo.getHospitalInLatitude());
+            if (createVO.getHospitalIn().getLongitude() != null) {
+                existingInfo.setHospitalInLongitude(createVO.getHospitalIn().getLongitude());
+            }
+            if (createVO.getHospitalIn().getLatitude() != null) {
+                existingInfo.setHospitalInLatitude(createVO.getHospitalIn().getLatitude());
+            }
         }
         
         // 鏇存柊璐圭敤淇℃伅
-        if (emergencyInfo.getTransferDistance() != null) {
-            existingInfo.setTransferDistance(emergencyInfo.getTransferDistance());
+        if (createVO.getTransferDistance() != null) {
+            existingInfo.setTransferDistance(createVO.getTransferDistance());
         }
-        if (emergencyInfo.getTransferPrice() != null) {
-            existingInfo.setTransferPrice(emergencyInfo.getTransferPrice());
+        if (createVO.getPrice() != null) {
+            existingInfo.setTransferPrice(createVO.getPrice());
+        }
+        
+        // 鏇存柊鍗曟嵁绫诲瀷ID
+        if (createVO.getDocumentTypeId() != null) {
+            existingInfo.setDocumentTypeId(createVO.getDocumentTypeId());
+        }
+        
+        // 鏇存柊浠诲姟绫诲瀷ID
+        if (createVO.getTaskTypeId() != null) {
+            existingInfo.setTaskTypeId(createVO.getTaskTypeId());
         }
         
         // 鏇存柊鐥呮儏ID鍒楄〃
-        if (updateVO.getDiseaseIds() != null && !updateVO.getDiseaseIds().isEmpty()) {
-            String diseaseIdsStr = updateVO.getDiseaseIds().stream()
+        if (createVO.getDiseaseIds() != null && !createVO.getDiseaseIds().isEmpty()) {
+            String diseaseIdsStr = createVO.getDiseaseIds().stream()
                 .map(String::valueOf)
                 .collect(Collectors.joining(","));
             existingInfo.setDiseaseIds(diseaseIdsStr);
-        } else {
-            // 濡傛灉鐥呮儏ID鍒楄〃涓虹┖锛屾竻绌鸿瀛楁
-            existingInfo.setDiseaseIds(null);
         }
         
         // 绯荤粺瀛楁
         existingInfo.setUpdateTime(DateUtils.getNowDate());
-        existingInfo.setUpdateBy(SecurityUtils.getUsername());
+        existingInfo.setUpdateBy(userName);
         
         // 鎵ц鏇存柊
         sysTaskEmergencyMapper.updateSysTaskEmergency(existingInfo);
     }
+    
+    /**
+     * 浠� TaskCreateVO 鏇存柊绂忕杞︿换鍔℃墿灞曚俊鎭�
+     * 
+     * @param taskId 浠诲姟ID
+     * @param createVO 浠诲姟鍒涘缓/鏇存柊瀵硅薄
+     * @param userName 鎿嶄綔浜哄悕
+     */
+    private void updateWelfareInfoFromCreateVO(Long taskId, TaskCreateVO createVO, String userName) {
+        // 鏌ヨ鐜版湁鐨勬墿灞曚俊鎭�
+        SysTaskWelfare existingInfo = sysTaskWelfareMapper.selectSysTaskWelfareByTaskId(taskId);
+        if (existingInfo == null) {
+            // 濡傛灉涓嶅瓨鍦紝鍒欏垱寤烘柊鐨�
+            existingInfo = new SysTaskWelfare();
+            existingInfo.setTaskId(taskId);
+            existingInfo.setCreateTime(DateUtils.getNowDate());
+            existingInfo.setCreateBy(userName);
+        }
+        
+        // 鏇存柊涔樺淇℃伅
+        if (createVO.getPassenger() != null) {
+            if (createVO.getPassenger().getContact() != null) {
+                existingInfo.setPassengerContact(createVO.getPassenger().getContact());
+            }
+            if (createVO.getPassenger().getPhone() != null) {
+                existingInfo.setPassengerPhone(createVO.getPassenger().getPhone());
+            }
+        }
+        
+        // 鏇存柊鍦板潃淇℃伅
+        if (createVO.getStartAddress() != null) {
+            existingInfo.setPickupAddress(createVO.getStartAddress());
+        }
+        if (createVO.getEndAddress() != null) {
+            existingInfo.setDestinationAddress(createVO.getEndAddress());
+        }
+        
+        // 鏇存柊GPS鍧愭爣
+        if (createVO.getDepartureLongitude() != null) {
+            existingInfo.setPickupLongitude(createVO.getDepartureLongitude());
+        }
+        if (createVO.getDepartureLatitude() != null) {
+            existingInfo.setPickupLatitude(createVO.getDepartureLatitude());
+        }
+        if (createVO.getDestinationLongitude() != null) {
+            existingInfo.setDestinationLongitude(createVO.getDestinationLongitude());
+        }
+        if (createVO.getDestinationLatitude() != null) {
+            existingInfo.setDestinationLatitude(createVO.getDestinationLatitude());
+        }
+        
+        // 鏇存柊璺濈鍜岃垂鐢�
+        if (createVO.getDistance() != null) {
+            existingInfo.setServiceDistance(createVO.getDistance());
+        } else if (createVO.getEstimatedDistance() != null) {
+            existingInfo.setServiceDistance(createVO.getEstimatedDistance());
+        }
+        if (createVO.getPrice() != null) {
+            existingInfo.setServicePrice(createVO.getPrice());
+        }
+        
+        // 绯荤粺瀛楁
+        existingInfo.setUpdateTime(DateUtils.getNowDate());
+        existingInfo.setUpdateBy(userName);
+        
+        // 鎵ц鏇存柊
+        sysTaskWelfareMapper.updateSysTaskWelfare(existingInfo);
+    }
 
     /**
      * 淇濆瓨绂忕杞︿换鍔℃墿灞曚俊鎭�
diff --git a/ruoyi-system/src/main/resources/mapper/system/LegacyTransferSyncMapper.xml b/ruoyi-system/src/main/resources/mapper/system/LegacyTransferSyncMapper.xml
index f3aad10..8000982 100644
--- a/ruoyi-system/src/main/resources/mapper/system/LegacyTransferSyncMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/LegacyTransferSyncMapper.xml
@@ -48,6 +48,7 @@
     <!-- 鎵ц浜虹粨鏋滄槧灏� -->
     <resultMap type="java.util.HashMap" id="AssigneeResult">
         <result property="EntourageOAId" column="EntourageOAId" />
+        <result property="EntourageID" column="EntourageID" />
         <result property="EntourageState" column="EntourageState" />
     </resultMap>
     
@@ -156,6 +157,7 @@
     <select id="selectAssigneesByDispatchOrdID" resultMap="AssigneeResult">
         SELECT 
             EntourageOAId,
+            EntourageID,
             EntourageState
         FROM DispatchOrd_Entourage 
         WHERE DispatchOrdIDDt = #{dispatchOrdID}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysTaskAdditionalFeeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysTaskAdditionalFeeMapper.xml
index 8afa1e2..9b3e0fd 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysTaskAdditionalFeeMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysTaskAdditionalFeeMapper.xml
@@ -41,6 +41,9 @@
             <if test="quantity != null">quantity,</if>
             <if test="totalAmount != null">total_amount,</if>
             <if test="remark != null">remark,</if>
+            <if test="pid != null">pid,</if>
+            <if test="syncStatus != null">sync_status,</if>
+            <if test="syncTime != null">sync_time,</if>
             <if test="createdBy != null and createdBy != ''">created_by,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -51,6 +54,9 @@
             <if test="quantity != null">#{quantity},</if>
             <if test="totalAmount != null">#{totalAmount},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="pid != null">#{pid},</if>
+            <if test="syncStatus != null">#{syncStatus},</if>
+            <if test="syncTime != null">#{syncTime},</if>
             <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
         </trim>
     </insert>
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
index 18f75f9..d8abfba 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
@@ -251,6 +251,7 @@
             <if test="actualEndTime != null">actual_end_time = #{actualEndTime},</if>
             <if test="creatorId != null">creator_id = #{creatorId},</if>
             <if test="assigneeId != null">assignee_id = #{assigneeId},</if>
+
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
diff --git a/ruoyi-ui/src/views/task/general/detail.vue b/ruoyi-ui/src/views/task/general/detail.vue
index 3685884..e65a2a7 100644
--- a/ruoyi-ui/src/views/task/general/detail.vue
+++ b/ruoyi-ui/src/views/task/general/detail.vue
@@ -33,11 +33,11 @@
       <!-- 鎬ユ晳杞繍浠诲姟鎵╁睍淇℃伅 -->
       <el-descriptions v-if="taskDetail.taskType === 'EMERGENCY_TRANSFER' && taskDetail.emergencyInfo" title="鎬ユ晳杞繍淇℃伅" :column="2" border style="margin-top: 20px;">
         <el-descriptions-item label="鑱旂郴浜�">
-          <span v-if="taskDetail.emergencyInfo.contactPerson">{{ taskDetail.emergencyInfo.contactPerson }}</span>
+          <span v-if="taskDetail.emergencyInfo.patientContact">{{ taskDetail.emergencyInfo.patientContact }}</span>
           <span v-else style="color: #C0C4CC;">--</span>
         </el-descriptions-item>
         <el-descriptions-item label="鑱旂郴鐢佃瘽">
-          <span v-if="taskDetail.emergencyInfo.contactPhone">{{ taskDetail.emergencyInfo.contactPhone }}</span>
+          <span v-if="taskDetail.emergencyInfo.patientPhone">{{ taskDetail.emergencyInfo.patientPhone }}</span>
           <span v-else style="color: #C0C4CC;">--</span>
         </el-descriptions-item>
         <el-descriptions-item label="鎮h�呭鍚�">
@@ -53,7 +53,7 @@
           <span v-else style="color: #C0C4CC;">--</span>
         </el-descriptions-item>
         <el-descriptions-item label="鐥呮儏鎻忚堪" :span="2">
-          <span v-if="taskDetail.emergencyInfo.illnessDescription">{{ taskDetail.emergencyInfo.illnessDescription }}</span>
+          <span v-if="taskDetail.emergencyInfo.patientCondition">{{ taskDetail.emergencyInfo.patientCondition }}</span>
           <span v-else style="color: #C0C4CC;">--</span>
         </el-descriptions-item>
       </el-descriptions>
@@ -120,6 +120,166 @@
         </el-descriptions-item>
       </el-descriptions>
 
+      <!-- 鏀粯淇℃伅锛堜粎鎬ユ晳杞繍浠诲姟鏄剧ず锛� -->
+      <el-card v-if="taskDetail.taskType === 'EMERGENCY_TRANSFER' && paymentInfo" class="box-card" style="margin-top: 20px;">
+        <div slot="header" class="clearfix">
+          <span>鏀粯淇℃伅</span>
+        </div>
+        
+        <!-- 鏀粯姒傝 -->
+        <el-descriptions :column="3" border>
+          <el-descriptions-item label="鍩烘湰浠锋牸">
+            <span style="color: #409EFF; font-weight: bold;">楼{{ paymentInfo.transferPrice || '0.00' }}</span>
+          </el-descriptions-item>
+          <el-descriptions-item label="闄勫姞璐圭敤鎬婚">
+            <span style="color: #E6A23C; font-weight: bold;">楼{{ paymentInfo.additionalAmount || '0.00' }}</span>
+          </el-descriptions-item>
+          <el-descriptions-item label="鎬婚噾棰�">
+            <span style="color: #67C23A; font-weight: bold;">楼{{ paymentInfo.totalAmount || '0.00' }}</span>
+          </el-descriptions-item>
+          <el-descriptions-item label="宸叉敮浠橀噾棰�">
+            <span style="color: #67C23A; font-weight: bold;">楼{{ paymentInfo.paidAmount || '0.00' }}</span>
+          </el-descriptions-item>
+          <el-descriptions-item label="鍓╀綑鏈粯閲戦">
+            <span style="color: #F56C6C; font-weight: bold;">楼{{ getRemainingAmount() }}</span>
+          </el-descriptions-item>
+          <el-descriptions-item label="鏀粯鐘舵��">
+            <el-tag v-if="getRemainingAmount() <= 0" type="success" size="small">
+              <i class="el-icon-success"></i> 宸茬粨娓�
+            </el-tag>
+            <el-tag v-else-if="paymentInfo.paidAmount > 0" type="warning" size="small">
+              <i class="el-icon-warning"></i> 閮ㄥ垎鏀粯
+            </el-tag>
+            <el-tag v-else type="info" size="small">
+              <i class="el-icon-warning"></i> 鏈敮浠�
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <!-- 闄勫姞璐圭敤鏄庣粏 -->
+        <div style="margin-top: 20px;">
+          <h4 style="margin-bottom: 10px;">闄勫姞璐圭敤鏄庣粏</h4>
+          <el-table :data="paymentInfo.additionalFees" border>
+            <el-table-column label="璐圭敤绫诲瀷" align="center" prop="feeType" width="120">
+              <template slot-scope="scope">
+                <dict-tag :options="dict.type.task_additional_fee_type" :value="scope.row.feeType"/>
+              </template>
+            </el-table-column>
+            <el-table-column label="璐圭敤鍚嶇О" align="center" prop="feeName" />
+            <el-table-column label="鍗曚环" align="center" prop="unitAmount" width="120">
+              <template slot-scope="scope">
+                <span>楼{{ scope.row.unitAmount }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="鏁伴噺" align="center" prop="quantity" width="80" />
+            <el-table-column label="灏忚" align="center" prop="totalAmount" width="120">
+              <template slot-scope="scope">
+                <span style="color: #E6A23C; font-weight: bold;">楼{{ scope.row.totalAmount }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="鍚屾鐘舵��" align="center" width="120">
+              <template slot-scope="scope">
+                <el-tag v-if="scope.row.syncStatus === 0" type="info" size="small">
+                  <i class="el-icon-warning"></i> 鏈悓姝�
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 1" type="warning" size="small">
+                  <i class="el-icon-loading"></i> 鍚屾涓�
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 2" type="success" size="small">
+                  <i class="el-icon-success"></i> 鍚屾鎴愬姛
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 3" type="danger" size="small">
+                  <i class="el-icon-error"></i> 鍚屾澶辫触
+                </el-tag>
+                <span v-else style="color: #C0C4CC;">--</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="澶囨敞" align="center" prop="remark" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <span v-if="scope.row.remark">{{ scope.row.remark }}</span>
+                <span v-else style="color: #C0C4CC;">--</span>
+              </template>
+            </el-table-column>
+          </el-table>
+          
+          <!-- 绌虹姸鎬佹彁绀� -->
+          <div v-if="!paymentInfo.additionalFees || paymentInfo.additionalFees.length === 0" style="text-align: center; padding: 40px 0; color: #909399;">
+            <i class="el-icon-document" style="font-size: 48px; display: block; margin-bottom: 12px;"></i>
+            <span>鏆傛棤闄勫姞璐圭敤</span>
+          </div>
+        </div>
+
+        <!-- 宸叉敮浠樿褰� -->
+        <div style="margin-top: 20px;">
+          <h4 style="margin-bottom: 10px;">宸叉敮浠樿褰�</h4>
+          <el-table :data="paymentInfo.paidPayments" border>
+            <el-table-column label="鍟嗘埛璁㈠崟鍙�" align="center" prop="outTradeNo" width="200" show-overflow-tooltip />
+            <el-table-column label="鏀粯閲戦" align="center" prop="settlementAmount" width="120">
+              <template slot-scope="scope">
+                <span style="color: #67C23A; font-weight: bold;">楼{{ scope.row.settlementAmount }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="鏀粯鏂瑰紡" align="center" prop="paymentMethod" width="120">
+              <template slot-scope="scope">
+                <dict-tag :options="dict.type.task_payment_method" :value="scope.row.paymentMethod"/>
+              </template>
+            </el-table-column>
+            <el-table-column label="鏀粯鐘舵��" align="center" prop="payStatus" width="120">
+              <template slot-scope="scope">
+                <el-tag v-if="scope.row.payStatus === 'PAID'" type="success" size="small">
+                  <i class="el-icon-success"></i> 宸叉敮浠�
+                </el-tag>
+                <el-tag v-else-if="scope.row.payStatus === 'PENDING'" type="warning" size="small">
+                  <i class="el-icon-time"></i> 寰呮敮浠�
+                </el-tag>
+                <el-tag v-else-if="scope.row.payStatus === 'FAILED'" type="danger" size="small">
+                  <i class="el-icon-error"></i> 澶辫触
+                </el-tag>
+                <el-tag v-else type="info" size="small">
+                  {{ scope.row.payStatus }}
+                </el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column label="浜ゆ槗鍙�" align="center" prop="tradeNo" width="150" show-overflow-tooltip />
+            <el-table-column label="鏀粯鏃堕棿" align="center" prop="payTime" width="180">
+              <template slot-scope="scope">
+                <span v-if="scope.row.payTime">{{ parseTime(scope.row.payTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+                <span v-else style="color: #C0C4CC;">--</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="鍚屾鐘舵��" align="center" width="120">
+              <template slot-scope="scope">
+                <el-tag v-if="scope.row.syncStatus === 0" type="info" size="small">
+                  <i class="el-icon-warning"></i> 鏈悓姝�
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 1" type="warning" size="small">
+                  <i class="el-icon-loading"></i> 鍚屾涓�
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 2" type="success" size="small">
+                  <i class="el-icon-success"></i> 鍚屾鎴愬姛
+                </el-tag>
+                <el-tag v-else-if="scope.row.syncStatus === 3" type="danger" size="small">
+                  <i class="el-icon-error"></i> 鍚屾澶辫触
+                </el-tag>
+                <span v-else style="color: #C0C4CC;">--</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="澶囨敞" align="center" prop="remark" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <span v-if="scope.row.remark">{{ scope.row.remark }}</span>
+                <span v-else style="color: #C0C4CC;">--</span>
+              </template>
+            </el-table-column>
+          </el-table>
+          
+          <!-- 绌虹姸鎬佹彁绀� -->
+          <div v-if="!paymentInfo.paidPayments || paymentInfo.paidPayments.length === 0" style="text-align: center; padding: 40px 0; color: #909399;">
+            <i class="el-icon-document" style="font-size: 48px; display: block; margin-bottom: 12px;"></i>
+            <span>鏆傛棤鏀粯璁板綍</span>
+          </div>
+        </div>
+      </el-card>
+
       <!-- 绂忕杞︿换鍔℃墿灞曚俊鎭� -->
       <el-descriptions v-if="taskDetail.taskType === 'WELFARE' && taskDetail.welfareInfo" title="绂忕杞︽湇鍔′俊鎭�" :column="2" border style="margin-top: 20px;">
         <el-descriptions-item label="涔樺濮撳悕">{{ taskDetail.welfareInfo.passengerName }}</el-descriptions-item>
@@ -151,6 +311,48 @@
         <el-button type="success" @click="handleAssign" v-hasPermi="['task:general:assign']">鍒嗛厤浠诲姟</el-button>
         <el-button type="warning" @click="handleStatusChange" v-hasPermi="['task:general:status']">鐘舵�佸彉鏇�</el-button>
         <el-button type="info" @click="handleVehicleAssign" v-hasPermi="['task:general:assign']">鍒嗛厤杞﹁締</el-button>
+      </div>
+    </el-card>
+    
+    <!-- 鎵ц浜哄憳鍒楄〃 -->
+    <el-card class="box-card" style="margin-top: 20px;">
+      <div slot="header" class="clearfix">
+        <span>鎵ц浜哄憳</span>
+      </div>
+        
+      <el-table :data="taskDetail.assignees" v-loading="assigneeLoading">
+        <el-table-column label="搴忓彿" align="center" width="60">
+          <template slot-scope="scope">
+            <span>{{ scope.$index + 1 }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="濮撳悕" align="center" prop="userName">
+          <template slot-scope="scope">
+            <span>{{ scope.row.userName }}</span>
+            <el-tag v-if="scope.row.isPrimary === '1'" type="warning" size="mini" style="margin-left: 8px;">
+              <i class="el-icon-star-on"></i> 璐熻矗浜�
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="瑙掕壊绫诲瀷" align="center" prop="userType" width="120">
+          <template slot-scope="scope">
+            <el-tag v-if="scope.row.userType === 'driver'" type="primary" size="small">鍙告満</el-tag>
+            <el-tag v-else-if="scope.row.userType === 'doctor'" type="success" size="small">鍖荤敓</el-tag>
+            <el-tag v-else-if="scope.row.userType === 'nurse'" type="info" size="small">鎶ゅ+</el-tag>
+            <el-tag v-else type="" size="small">{{ scope.row.userType }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+        
+      <!-- 绌虹姸鎬佹彁绀� -->
+      <div v-if="!taskDetail.assignees || taskDetail.assignees.length === 0" style="text-align: center; padding: 40px 0; color: #909399;">
+        <i class="el-icon-user" style="font-size: 48px; display: block; margin-bottom: 12px;"></i>
+        <span>鏆傛棤鎵ц浜哄憳</span>
       </div>
     </el-card>
 
@@ -261,6 +463,74 @@
           </template>
         </el-table-column>
       </el-table>
+    </el-card>
+
+    <!-- 闄勫姞璐圭敤鍒楄〃 -->
+    <el-card class="box-card" style="margin-top: 20px;">
+      <div slot="header" class="clearfix">
+        <span>闄勫姞璐圭敤鍒楄〃</span>
+      </div>
+      
+      <el-table :data="additionalFeeList" v-loading="feeLoading">
+        <el-table-column label="璐圭敤绫诲瀷" align="center" prop="feeType" width="120">
+          <template slot-scope="scope">
+            <dict-tag :options="dict.type.task_additional_fee_type" :value="scope.row.feeType"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="璐圭敤鍚嶇О" align="center" prop="feeName" />
+        <el-table-column label="鍗曚环" align="center" prop="unitAmount" width="120">
+          <template slot-scope="scope">
+            <span>楼{{ scope.row.unitAmount }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鏁伴噺" align="center" prop="quantity" width="80" />
+        <el-table-column label="鎬婚噾棰�" align="center" prop="totalAmount" width="120">
+          <template slot-scope="scope">
+            <span style="color: #E6A23C; font-weight: bold;">楼{{ scope.row.totalAmount }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍚屾鐘舵��" align="center" width="120">
+          <template slot-scope="scope">
+            <el-tag v-if="scope.row.syncStatus === 0" type="info" size="small">
+              <i class="el-icon-warning"></i> 鏈悓姝�
+            </el-tag>
+            <el-tag v-else-if="scope.row.syncStatus === 1" type="warning" size="small">
+              <i class="el-icon-loading"></i> 鍚屾涓�
+            </el-tag>
+            <el-tag v-else-if="scope.row.syncStatus === 2" type="success" size="small">
+              <i class="el-icon-success"></i> 鍚屾鎴愬姛
+            </el-tag>
+            <el-tag v-else-if="scope.row.syncStatus === 3" type="danger" size="small">
+              <i class="el-icon-error"></i> 鍚屾澶辫触
+            </el-tag>
+            <span v-else style="color: #C0C4CC;">--</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍚屾鏃堕棿" align="center" prop="syncTime" width="180">
+          <template slot-scope="scope">
+            <span v-if="scope.row.syncTime">{{ parseTime(scope.row.syncTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+            <span v-else style="color: #C0C4CC;">--</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createdTime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍒涘缓鑰�" align="center" prop="createdBy" width="100" />
+        <el-table-column label="澶囨敞" align="center" prop="remark" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <span v-if="scope.row.remark">{{ scope.row.remark }}</span>
+            <span v-else style="color: #C0C4CC;">--</span>
+          </template>
+        </el-table-column>
+      </el-table>
+      
+      <!-- 绌虹姸鎬佹彁绀� -->
+      <div v-if="!additionalFeeList || additionalFeeList.length === 0" style="text-align: center; padding: 40px 0; color: #909399;">
+        <i class="el-icon-document" style="font-size: 48px; display: block; margin-bottom: 12px;"></i>
+        <span>鏆傛棤闄勫姞璐圭敤</span>
+      </div>
     </el-card>
 
     <!-- 鎿嶄綔鏃ュ織 -->
@@ -456,13 +726,13 @@
 </template>
 
 <script>
-import { getTask, updateTask, assignTask, changeTaskStatus, uploadAttachment, deleteAttachment, getTaskVehicles, getAvailableVehicles, assignVehiclesToTask, unassignVehicleFromTask } from "@/api/task";
+import { getTask, updateTask, assignTask, changeTaskStatus, uploadAttachment, deleteAttachment, getTaskVehicles, getAvailableVehicles, assignVehiclesToTask, unassignVehicleFromTask, getPaymentInfo } from "@/api/task";
 import { listUser } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 
 export default {
   name: "TaskDetail",
-  dicts: ['sys_task_type', 'sys_task_status', 'sys_vehicle_type', 'sys_task_vehicle_status', 'sys_user_sex', 'hospital_department', 'sys_attachment_category'],
+  dicts: ['sys_task_type', 'sys_task_status', 'sys_vehicle_type', 'sys_task_vehicle_status', 'sys_user_sex', 'hospital_department', 'sys_attachment_category', 'task_additional_fee_type', 'task_payment_method'],
   data() {
     return {
       // 浠诲姟璇︽儏
@@ -502,6 +772,12 @@
       // 鍔犺浇鐘舵��
       vehicleLoading: false,
       attachmentLoading: false,
+      feeLoading: false,
+      assigneeLoading: false,
+      // 闄勫姞璐圭敤鍒楄〃
+      additionalFeeList: [],
+      // 鏀粯淇℃伅
+      paymentInfo: null,
       // 涓婁紶鐩稿叧
       uploadUrl: process.env.VUE_APP_BASE_API + "/task/attachment/upload/" + (new URLSearchParams(window.location.search).get('taskId') || ''),
       uploadHeaders: {
@@ -545,6 +821,7 @@
   created() {
     this.getTaskDetail();
     this.getUserList();
+    this.getAdditionalFeeList();
     // 鍒濆鍖栦笂浼燯RL
     this.uploadUrl = process.env.VUE_APP_BASE_API + "/task/attachment/upload/" + this.$route.params.taskId;
   },
@@ -553,8 +830,41 @@
     getTaskDetail() {
       getTask(this.$route.params.taskId).then(response => {
         this.taskDetail = response.data;
+        // 浠诲姟璇︽儏鍔犺浇瀹屾垚鍚庯紝鍔犺浇鏀粯淇℃伅
+        // console.log("TaskDetail", this.taskDetail);
+        this.loadPaymentInfo();
       });
     },
+    /** 鑾峰彇闄勫姞璐圭敤鍒楄〃 */
+    getAdditionalFeeList() {
+      this.feeLoading = true;
+      getPaymentInfo(this.$route.params.taskId).then(response => {
+        this.additionalFeeList = response.data.additionalFees || [];
+        this.feeLoading = false;
+      }).catch(() => {
+        this.feeLoading = false;
+      });
+    },
+    /** 鍔犺浇鏀粯淇℃伅 */
+    loadPaymentInfo() {
+      //EMERGENCY_TRANSFER
+      if (this.taskDetail.taskType === 'EMERGENCY_TRANSFER') {
+        getPaymentInfo(this.$route.params.taskId).then(response => {
+          // console.log("PaymentInfo", response.data);
+          this.paymentInfo = response.data;
+        }).catch(() => {
+          this.paymentInfo = null;
+        });
+      }
+    },
+    /** 璁$畻鍓╀綑鏈粯閲戦 */
+    getRemainingAmount() {
+      if (!this.paymentInfo) return '0.00';
+      const total = parseFloat(this.paymentInfo.totalAmount || 0);
+      const paid = parseFloat(this.paymentInfo.paidAmount || 0);
+      const remaining = total - paid;
+      return remaining > 0 ? remaining.toFixed(2) : '0.00';
+    },
     /** 鑾峰彇鐢ㄦ埛鍒楄〃 */
     getUserList() {
       listUser().then(response => {

--
Gitblit v1.9.1