Browse Source

书写病历

liudan 5 months ago
parent
commit
b50ebad00d

+ 234 - 0
src/pages/entryWrite/page/Entry/medicalRecord/InfoCollection.js

@@ -0,0 +1,234 @@
+/**
+ * 信息采集
+*/
+import { httpConfig } from '../../../../utils/httpConfig';
+import { $http } from "../../../../utils/https";
+const app = getApp()
+Page({
+  data: {
+    navbarData: {
+      isGoHome: true,
+      isGoBack: true,
+      title: '信息采集单', //导航栏 中间的标题
+    },
+    imgHost: httpConfig && httpConfig.imgHost,
+    windowHost: httpConfig && httpConfig.ipDeault ? httpConfig.ipDeault : "https://np.h03.p0551.com",
+    navHeight: app.globalData.navHeight,
+    spaceHeight: app.globalData.spaceHeight,
+    navTitleHeight: app.globalData.navTitleHeight,
+    statusBarHeight: app.globalData.statusBarHeight,
+    TempHtmlObj:{}, //病历信息OBJ
+    formDataSource:[],   //病历解析后的表单内容
+    formData:[],   //病历解析后的表单内容(下拉菜单数组调整为一维数组,没有id)
+    dataKeyObj:{},  //存值对象
+    userData: wx.getStorageSync('userData'),  
+    birthDate: '',   //出生日期
+    admID:''
+  },
+  onLoad (options) {
+    this.setData({admID:options.admID})
+    this.parseBirthDate();
+    this.getTempHtml();
+  },
+
+  ///调接口获取病历模板html
+  getTempHtml: function () {
+    let data = {
+      params: [{
+        templateID:'72'  //初次到院信息采集单
+      }]
+    }
+    $http.post("urlS", this, {
+      code: "17050038",
+      namespace: "Y",
+      data: data,
+      success: function (res) {
+        if (+res.errorCode === 0) {
+          this.setData({TempHtmlObj:res.result});
+          this.getPageItems(res.result.templateHtmlUrl);
+        } else {
+          wx.showToast({ title: '请求异常:'+res.errorCode+res.errorMessage })
+        }
+      }
+    });
+  },
+
+  // 获取页面有哪些组件及配置
+  getPageItems (url) {
+    let that = this;
+    wx.request({
+      // todo html模板链接
+      url: 'https://np.h03.p0551.com' + '/EMRFile/download/emr_html/' + url,
+      method: 'GET',
+      success: function (res) {
+        const htmlStr = res.data;
+        const regex = /<span[^>]*data-obj="([^"]*)"/ig;
+        let match;
+        let dataObjs = [];
+        while ((match = regex.exec(htmlStr)) !== null) {
+          const dataObjStr = match[1];
+          const decodedDataObjStr = decodeURIComponent(dataObjStr);
+          try {
+            const dataObj = JSON.parse(decodedDataObjStr);
+            dataObjs.push(dataObj);
+          } catch (error) {
+            console.error('JSON解析错误:', error);
+          }
+        }
+        let newDataObjs = JSON.parse(JSON.stringify(dataObjs));
+        newDataObjs = that.setSelectRange(newDataObjs);
+        // console.log(dataObjs);
+        // console.log(newDataObjs);
+        that.setData({
+          formDataSource:dataObjs,
+          formData:newDataObjs
+        });
+      },
+      fail: function (error) {
+        console.error("请求远程HTML文件失败:", error);
+      }
+    });
+  },
+
+  //调整选择项数组内容
+  setSelectRange (datas) {
+    let newDatas = datas;
+    for(let i=0;i<newDatas.length;i++){
+      let newItems = newDatas[i].datas;
+      if(newDatas[i].type === "select" || newDatas[i].type === "radio"){
+        let newAry = [];
+        for(let j=0;j<newItems.length;j++){
+          newAry.push(newItems[j].label)
+        }
+        newDatas[i].datas = newAry;
+      }
+    }
+    return newDatas;
+  },
+
+  //根据身份证号解析出生日期
+  parseBirthDate() {
+    let idCard = this.data.userData.idCardNo;
+    // 提取身份证号中的出生日期部分
+    let birthDate = idCard.substring(6, 14);
+    // 解析出生日期
+    let year = birthDate.substring(0, 4);
+    let month = birthDate.substring(4, 6);
+    let day = birthDate.substring(6, 8);
+    // 返回出生日期对象
+    this.setData({
+      birthDate: year+'-'+month+'-'+day
+    })
+  },
+
+  //picker选择器选择事件监听
+  pickerChange (e){
+    let newDataKeyObj = this.data.dataKeyObj;
+    newDataKeyObj[e.target.dataset.key] = e.detail.value;
+    newDataKeyObj[e.target.dataset.key+'text'] = e.target.dataset.ranges ? e.target.dataset.ranges[e.detail.value] : e.detail.value;
+    this.setData({
+      dataKeyObj : newDataKeyObj
+    })
+  },
+
+  //form表单提交事件
+  formSubmit(e) {
+    // console.log('form发生了submit事件,携带数据为:', e.detail.value)
+    //病历解析后的表单内容
+    const formDataSource = this.data.formDataSource;
+    //所有下拉选择组件选中的值封装的数组
+    const dataKeyObj = this.data.dataKeyObj;
+    //一个新的空数组,作为病历保存提交入参
+    let submitObjAry = [];
+    //form表单中获取的键值数组
+    const submitArray = Object.entries(e.detail.value).map(([key, value]) => ({ key, value }));
+    // console.log('form表单中获取的键值数组',submitArray)
+    for (let i = 0; i < submitArray.length; i++) {
+      let obj = {};
+      obj.metaDataCode = submitArray[i].key;
+      obj.filedText = submitArray[i].value;
+      obj.filedHtml = submitArray[i].value;
+      for(let j = 0; j < formDataSource.length; j++){
+        if(formDataSource[j].key == submitArray[i].key){
+          obj.filedType = formDataSource[j].type;
+          obj.value = formDataSource[j].id;
+          obj.uniqueID = formDataSource[j].id;
+          obj.label = formDataSource[j].label;
+          //处理type为 select 时 filedCode的赋值
+          if(formDataSource[j].type === 'select' || formDataSource[j].type === 'radio'){
+            const targetObj = formDataSource[j].datas.filter(obj => obj.label === dataKeyObj[formDataSource[j].key+'text']).map(obj => obj);
+            // console.log('返回值:',targetObj)
+            if(targetObj.length > 0){
+              obj.filedCode = targetObj[0].value+'';
+              obj.filedText = targetObj[0].label;
+              obj.filedHtml = formDataSource[j].type === 'select' ? targetObj[0].label : '';
+            }
+          }
+        }
+      }
+      submitObjAry.push(obj);
+    }
+    this.creatEmrRecord(submitObjAry);
+  },
+
+  //创建病历
+  creatEmrRecord (submitObjAry) {
+    let TempObj = this.data.TempHtmlObj;
+    let userData = this.data.userData;
+    let that = this;
+    let data = {
+      params: [{
+        admID:that.data.admID,
+        templateVersionID:TempObj.templateVersionID,
+        patID:userData.patID,
+        patName:userData.patDesc,
+        courseRecordID:'' //主病程ID,这里不用传
+      }]
+    }
+    $http.post("urlS", this, {
+      code: "17050039",
+      namespace: "Y",
+      data: data,
+      success: function (res) {
+        if (+res.errorCode === 0) {
+          that.saveEmrAction(submitObjAry,res.result);
+        } else {
+          wx.showToast({ title: '请求异常:'+res.errorCode+res.errorMessage })
+        }
+      }
+    });
+  },
+
+  //保存病历
+  saveEmrAction (submitObjAry,emrResult) {
+    let TempObj = this.data.TempHtmlObj;
+    let data = {
+      params: [{
+        admID:this.data.admID,
+        courseList: [],
+        recordID:emrResult.recordID,
+        templateID:emrResult.templateID,
+        templateVersionID:emrResult.templateVersionID,
+        imagePath: TempObj.pageImage,
+        data:submitObjAry
+      }]
+    }
+    $http.post("urlS", this, {
+      code: "17050040",
+      namespace: "Y",
+      data: data,
+      success: function (res) {
+        if (+res.errorCode === 0) {
+          wx.showToast({ title: '提交成功'})
+          setTimeout(() => {
+            wx.switchTab({
+              url: '../../../tabBar/index/index',
+            })
+          }, 1500)
+        } else {
+          wx.showToast({ title: '请求异常:'+res.errorCode+res.errorMessage })
+        }
+      }
+    });
+  }
+})

+ 525 - 44
src/pages/entryWrite/page/Entry/medicalRecord/medicalRecord.vue

@@ -21,7 +21,7 @@
                     </mp-cell>
                 </view>
             </view>
-            <view class="fixedTop" :style="'height:calc(100% - 330rpx - 100rpx - ' + height + 'rpx - 10rpx)'">
+            <view style="padding-bottom: 60rpx;">
                 <mp-cells ext-class="my-cells">
                     <view class="row" v-for="(item, index) in admList" :key="index">
                         <van-cell
@@ -241,12 +241,79 @@
                         </view>
                     </view>
                 </mp-cells>
+                <!-- 信息采集表单 -->
+                <view class="info-collection" v-if="formData.length > 0">
+                    <view class="info-item" v-for="(item, index) in formData" :key="index">
+                        <view class="info-label">{{ item.label }}</view>
+                        <!-- 下拉选择 -->
+                        <picker
+                            v-if="item.type === 'select' || item.type === 'checkbox'"
+                            mode="selector"
+                            :range="item.datas"
+                            range-key="label"
+                            :value="getSelectIndex(item.key)"
+                            :data-key="item.key"
+                            :data-ranges="item.datas"
+                            @change="pickerChange"
+                        >
+                            <view class="info-value" :class="{ 'info-placeholder': !dataKeyObj[item.key] }">
+                                {{ dataKeyObj[item.key] || '请选择' }}
+                            </view>
+                        </picker>
+                        <!-- 单选 -->
+                        <radio-group
+                            v-else-if="item.type === 'radio'"
+                            :data-key="item.key"
+                            @change="pickerChange"
+                        >
+                            <label class="info-radio-label" v-for="(option, idx) in item.datas" :key="idx">
+                                <radio :value="String(option.value)" :checked="String(dataKeyObj[item.key + 'code']) === String(option.value)" color="#1890ff" />{{ option.label }}
+                            </label>
+                        </radio-group>
+                        <!-- 日期选择 -->
+                        <picker
+                            v-else-if="item.type === 'date'"
+                            mode="date"
+                            :value="dataKeyObj[item.key]"
+                            :data-key="item.key"
+                            @change="pickerChange"
+                        >
+                            <view class="info-value" :class="{ 'info-placeholder': !dataKeyObj[item.key] }">
+                                {{ dataKeyObj[item.key] || '请选择日期' }}
+                            </view>
+                        </picker>
+                        <!-- 多行文本 -->
+                        <textarea
+                            v-else-if="item.type === 'textarea'"
+                            class="info-textarea"
+                            :value="dataKeyObj[item.key] || ''"
+                            :data-key="item.key"
+                            @input="inputChange"
+                            placeholder="请输入"
+                        />
+                        <!-- 单行文本 -->
+                        <input
+                            v-else
+                            class="info-input"
+                            :value="dataKeyObj[item.key] || ''"
+                            :data-key="item.key"
+                            @input="inputChange"
+                            placeholder="请输入"
+                        />
+                    </view>
+                </view>
             </view>
         </view>
-        <view class="row">
-            <view class="multiBtn-content">
-                <button v-if="patientData.changeDataFlag != 'N'" class="multiBtn-right" :disabled="isLoading" @tap="add">{{ isLoading ? '保存中' : '保存' }}</button>
-            </view>
+        <!-- 保存按钮固定底部 -->
+        <view class="fixed-save-bar">
+            <button
+                v-if="patientData.changeDataFlag != 'N'"
+                class="multiBtn-right"
+                :disabled="formData.length > 0 ? isInfoSubmitting : isLoading"
+                @tap="formData.length > 0 ? formSubmit() : add()"
+            >
+                {{ formData.length > 0 ? (isInfoSubmitting ? '提交中...' : '保存') : (isLoading ? '保存中' : '保存') }}
+            </button>
         </view>
     </view>
 </template>
@@ -306,7 +373,17 @@ export default {
                 qtyUomStr: '',
                 doseUnitStr: '',
                 durStr: ''
-            }
+            },
+            // 信息采集表单相关
+            TempHtmlObj: {}, //病历模板信息OBJ
+            formDataSource: [], //病历解析后的表单内容(原始)
+            formData: [], //病历解析后的表单内容(下拉菜单数组调整为一维数组)
+            dataKeyObj: {}, //存值对象
+            birthDate: '', //出生日期
+            admID: '', //就诊ID
+            isInfoSubmitting: false, //信息采集提交中
+            recordDetailList: [], //病历已填值列表
+            hisDataMap: {} //HIS默认值映射(以code为key,值为dataInfo)
         };
     },
     /**
@@ -335,7 +412,7 @@ export default {
         ready: function () {
             // this.getHistory();
             // 在组件在视图层布局完成后执行
-            this.selectData(); // 获取 下拉框数据
+            this.getTempHtml(); // 获取 下拉框数据
             this.getFind(); // 获取 下拉框数据
             let userData = Cache.get('userData');
             let { userName } = userData;
@@ -485,42 +562,366 @@ export default {
                 }
             });
         },
-
-        // 获取 下拉框数据
-        selectData: function () {
-            let userData = Cache.get('userData');
-            let patientData = Cache.get('patientData');
-            let { admID } = patientData;
-            $http.post('urlDeault', this, {
-                code: '10020001',
-                data: {
-                    params: [
-                        {
-                            admID: admID,
-                            hospID: userData.hospID
-                        }
-                    ]
-                },
-                success: function (res) {
-                    // console.log('res', res)
-                    let errorCode = res.errorCode;
-                    if (errorCode === '0') {
-                        for (var i = 0; i < res.result.TemplateList.length; i++) {
-                            res.result.TemplateList[i].text = res.result.TemplateList[i].name;
-                            res.result.TemplateList[i].color = res.result.TemplateList[i].entryedFlag;
-                            res.result.TemplateList[i].key = i;
-                        }
-                        this.setData(
-                            {
-                                diagType: res.result.TemplateList,
-                                entryedText: res.result.entryedText
-                            },
-                            () => this.getSearch(this.diagType[0].IEMRTemplateID)
-                        );
-                    }
-                }
-            });
-        },
+  // 获取页面有哪些组件及配置
+  getPageItems (url = 'daeccc6d0cd17de4a07af3d6cf62c701.html') {
+    let that = this;
+    // #ifdef H5
+    let baseUrl = '';
+    // #endif
+    // #ifndef H5
+    let baseUrl = 'https://hlwyy.scsmysgkyy.cn';
+    // #endif
+    uni.request({
+      // todo html模板链接
+      url: baseUrl + '/EMRFile/download/emr_html/' + url,
+      method: 'GET',
+      dataType: 'text',
+      timeout: 15000,
+      success: function (res) {
+        const htmlStr = res.data;
+        const regex = /<span[^>]*data-obj="([^"]*)"/ig;
+        let match;
+        let dataObjs = [];
+        while ((match = regex.exec(htmlStr)) !== null) {
+          const dataObjStr = match[1];
+          const decodedDataObjStr = decodeURIComponent(dataObjStr);
+          try {
+            const dataObj = JSON.parse(decodedDataObjStr);
+            dataObjs.push(dataObj);
+          } catch (error) {
+            console.error('JSON解析错误:', error);
+          }
+        }
+        let newDataObjs = JSON.parse(JSON.stringify(dataObjs));
+        newDataObjs = that.setSelectRange(newDataObjs);
+        that.formDataSource = dataObjs;
+        that.formData = newDataObjs;
+        // 回显默认值:recordDetail优先,其次hisData
+        that.initFormValues();
+      },
+      fail: function (error) {
+        console.error("请求远程HTML文件失败:", error);
+      }
+    });
+  },
+ //调整选择项数组内容
+  setSelectRange (datas) {
+    let newDatas = datas;
+    for(let i=0;i<newDatas.length;i++){
+      let newItems = newDatas[i].datas;
+      if(newDatas[i].type === "select" || newDatas[i].type === "radio" || newDatas[i].type === "checkbox"){
+        let newAry = [];
+        for(let j=0;j<newItems.length;j++){
+          newAry.push({
+            label: newItems[j].label,
+            value: newItems[j].value,
+          })
+        }
+        newDatas[i].datas = newAry;
+      }
+    }
+    return newDatas;
+  },
+
+  //去除首尾空格
+  trimSpace(str) {
+    if (str === null || str === undefined) return '';
+    return String(str).replace(/^\s+|\s+$/g, '');
+  },
+
+  //回显表单默认值:recordDetail优先,其次hisData
+  initFormValues() {
+    let that = this;
+    let formDataSource = this.formDataSource;
+    let recordDetailList = this.recordDetailList;
+    let hisDataMap = this.hisDataMap;
+    // 将recordDetail转成以uniqueCode为key的映射
+    let recordMap = {};
+    recordDetailList.forEach(function (item) {
+      let key = item.uniqueCode || item.metaDataCode;
+      if (key) {
+        recordMap[key] = item;
+      }
+    });
+    // 将hisData中所有dataInfo字段扁平化(以字段名为key)
+    let hisFlatMap = {};
+    Object.keys(hisDataMap).forEach(function (code) {
+      let dataInfo = hisDataMap[code];
+      if (dataInfo && typeof dataInfo === 'object') {
+        Object.keys(dataInfo).forEach(function (field) {
+          // 不覆盖已有值
+          if (!(field in hisFlatMap)) {
+            hisFlatMap[field] = dataInfo[field];
+          }
+        });
+      }
+    });
+    let newDataKeyObj = {};
+    for (let i = 0; i < formDataSource.length; i++) {
+      let item = formDataSource[i];
+      let key = item.key;
+      if (!key) continue;
+      let filedText = '';
+      let filedCode = '';
+      // 1.优先从recordDetail取值
+      if (recordMap[key]) {
+        filedText = that.trimSpace(recordMap[key].filedText);
+        filedCode = that.trimSpace(recordMap[key].filedCode);
+      }
+      // 2.recordDetail无值时,从hisData取值
+      if (!filedText && !filedCode) {
+        // 优先按dataObj的baseHisData配置取值
+        if (item.baseHisData && item.baseHisData.interfaceId && item.baseHisData.paramName) {
+          let interfaceId = item.baseHisData.interfaceId;
+          let paramName = item.baseHisData.paramName;
+          if (hisDataMap[interfaceId] && hisDataMap[interfaceId][paramName]) {
+            let val = that.trimSpace(hisDataMap[interfaceId][paramName]);
+            filedText = val;
+            filedCode = val;
+          }
+        }
+        // 兜底:用key直接在hisData扁平化字段中查找
+        if (!filedText && hisFlatMap[key]) {
+          let val = that.trimSpace(hisFlatMap[key]);
+          filedText = val;
+          filedCode = val;
+        }
+      }
+      if (!filedText && !filedCode) continue;
+      // 根据表单类型设置dataKeyObj
+      if (item.type === 'select' || item.type === 'radio' || item.type === 'checkbox') {
+        let datas = item.datas || [];
+        let selectedItem = null;
+        // 优先用filedCode匹配value
+        if (filedCode) {
+          for (let j = 0; j < datas.length; j++) {
+            if (String(datas[j].value) == String(filedCode)) {
+              selectedItem = datas[j];
+              break;
+            }
+          }
+        }
+        // 未匹配到再用filedText匹配label
+        if (!selectedItem && filedText) {
+          for (let j = 0; j < datas.length; j++) {
+            if (datas[j].label === filedText) {
+              selectedItem = datas[j];
+              break;
+            }
+          }
+        }
+        if (selectedItem) {
+          // 用匹配到的选项值回显,避免filedCode为空时radio无法回显
+          newDataKeyObj[key + 'code'] = String(selectedItem.value);
+          newDataKeyObj[key] = selectedItem.label;
+        } else if (filedText || filedCode) {
+          newDataKeyObj[key + 'code'] = filedCode;
+          newDataKeyObj[key] = filedText || filedCode;
+        }
+      } else {
+        // input/date/textarea等直接存值
+        newDataKeyObj[key] = filedText || filedCode;
+        newDataKeyObj[key + 'code'] = filedCode;
+      }
+    }
+    this.dataKeyObj = Object.assign({}, this.dataKeyObj, newDataKeyObj);
+  },
+  //根据key获取select类型的当前索引(用于picker绑定)
+  getSelectIndex(key) {
+    let value = this.dataKeyObj[key];
+    let code = this.dataKeyObj[key + 'code'];
+    if (!value && !code) return -1;
+    let item = this.formDataSource.find(function (i) { return i.key === key; });
+    if (!item || !item.datas || !item.datas.length) return -1;
+    for (let idx = 0; idx < item.datas.length; idx++) {
+      if (item.datas[idx].label === value) return idx;
+    }
+    for (let idx = 0; idx < item.datas.length; idx++) {
+      if (String(item.datas[idx].value) === String(value) || String(item.datas[idx].value) === String(code)) return idx;
+    }
+    return -1;
+  },
+
+  //根据key获取select/radio类型的显示label(兼容dataKeyObj[key]是label或value)
+  getSelectLabel(key) {
+    let value = this.dataKeyObj[key];
+    if (!value) return '';
+    let item = this.formDataSource.find(function (i) { return i.key === key; });
+    if (!item || !item.datas || !item.datas.length) return value;
+    // 优先匹配label
+    for (let idx = 0; idx < item.datas.length; idx++) {
+      if (item.datas[idx].label === value) return item.datas[idx].label;
+    }
+    // 再匹配value
+    for (let idx = 0; idx < item.datas.length; idx++) {
+      if (String(item.datas[idx].value) == String(value)) return item.datas[idx].label;
+    }
+    return value;
+  },
+  getTempHtml() {
+    let that = this;
+    let patientData = Cache.get('patientData');
+    let data = {
+      params: [{
+        admID: patientData.admID,
+      }]
+    };
+    $http.post('urlS', this, {
+      code: '06010115',
+      data: data,
+      success: function (res) {
+        if (+res.errorCode === 0) {
+          that.TempHtmlObj = res.result;
+          // 保存已填值和HIS默认值,用于表单回显
+          that.recordDetailList = (res.result && res.result.recordDetail) || [];
+          let hisData = (res.result && res.result.hisData && res.result.hisData.data) || [];
+          let hisMap = {};
+          hisData.forEach(function (item) {
+            if (item.code && item.dataInfo) {
+              hisMap[item.code] = item.dataInfo;
+            }
+          });
+          that.hisDataMap = hisMap;
+          that.getPageItems(res.result.templateHtmlUrl);
+        } else {
+          uni.showToast({ title: '请求异常:' + res.errorCode + res.errorMessage, icon: 'none' });
+        }
+      }
+    });
+  },
+
+  //根据身份证号解析出生日期
+  parseBirthDate() {
+    let userData = Cache.get('userData');
+    let idCard = userData.idCardNo;
+    if (!idCard || idCard.length < 14) return;
+    let birthDate = idCard.substring(6, 14);
+    let year = birthDate.substring(0, 4);
+    let month = birthDate.substring(4, 6);
+    let day = birthDate.substring(6, 8);
+    this.birthDate = year + '-' + month + '-' + day;
+  },
+
+  //picker选择器选择事件监听
+  pickerChange(e) {
+    let key = e.currentTarget.dataset.key;
+    let ranges = e.currentTarget.dataset.ranges;
+    let value = e.detail.value;
+    let newDataKeyObj = Object.assign({}, this.dataKeyObj);
+    // 优先从 formDataSource 查找对应数据源,避免 data-ranges 被序列化后丢失结构
+    let item = this.formDataSource.find(function (i) { return i.key === key; });
+    let datas = (item && item.datas) || [];
+    let targetObj = null;
+    if (datas.length > 0 && typeof datas[0] === 'object') {
+      targetObj = datas[value];
+    }
+    if (targetObj) {
+      // select/checkbox:value是索引,从对象数组中取label/value
+      newDataKeyObj[key + 'code'] = String(targetObj.value);
+      newDataKeyObj[key] = targetObj.label;
+    } else if (ranges && Array.isArray(ranges) && ranges.length > 0 && typeof ranges[0] === 'object') {
+      newDataKeyObj[key + 'code'] = String(ranges[value].value);
+      newDataKeyObj[key] = ranges[value].label;
+    } else if (ranges && Array.isArray(ranges)) {
+      // 兼容旧格式:数组元素为字符串
+      newDataKeyObj[key + 'code'] = ranges[value];
+      newDataKeyObj[key] = ranges[value];
+    } else {
+      // radio/date:value直接是值
+      newDataKeyObj[key + 'code'] = String(value);
+      newDataKeyObj[key] = value;
+    }
+    this.dataKeyObj = newDataKeyObj;
+  },
+
+  //input/textarea输入事件监听
+  inputChange(e) {
+    let key = e.currentTarget.dataset.key;
+    let value = e.detail.value;
+    let newDataKeyObj = Object.assign({}, this.dataKeyObj);
+    newDataKeyObj[key] = value;
+    newDataKeyObj[key + 'code'] = '';
+    this.dataKeyObj = newDataKeyObj;
+  },
+
+  //信息采集表单提交
+  formSubmit() {
+    const formDataSource = this.formDataSource;
+    const dataKeyObj = this.dataKeyObj;
+    let submitObjAry = [];
+    for (let i = 0; i < formDataSource.length; i++) {
+      let item = formDataSource[i];
+      let obj = {};
+      obj.metaDataCode = item.key;
+      obj.filedType = item.type;
+      obj.value = item.id;
+      obj.uniqueID = item.id;
+      obj.label = item.label;
+      if (item.type === 'select' || item.type === 'radio' || item.type === 'checkbox') {
+        let selectedText = dataKeyObj[item.key + 'text'] || dataKeyObj[item.key];
+        let selectedValue = dataKeyObj[item.key + 'code'];
+        let targetObj = [];
+        if (selectedText) {
+          targetObj = item.datas.filter(function (d) { return d.label === selectedText; });
+        }
+        if (targetObj.length === 0 && selectedValue) {
+          targetObj = item.datas.filter(function (d) { return String(d.value) == String(selectedValue); });
+        }
+        if (targetObj.length > 0) {
+          obj.filedCode = targetObj[0].value + '';
+          obj.filedText = targetObj[0].label;
+          obj.filedHtml = item.type === 'select' ? targetObj[0].label : '';
+        } else {
+          obj.filedText = selectedText || selectedValue || '';
+          obj.filedHtml = selectedText || selectedValue || '';
+        }
+      } else {
+        obj.filedText = dataKeyObj[item.key] || '';
+        obj.filedHtml = dataKeyObj[item.key] || '';
+      }
+      submitObjAry.push(obj);
+    }
+    this.creatEmrRecord(submitObjAry);
+  },
+
+  //创建病历
+  creatEmrRecord(submitObjAry) {
+    let TempObj = this.TempHtmlObj;
+    let userData = Cache.get('userData');
+    let patientData = Cache.get('patientData');
+    let that = this;
+    this.isInfoSubmitting = true;
+    let data = {
+      params: [{
+        courseList: [],
+        admID: patientData.admID,
+        templateID: TempObj.templateID || 1,
+        templateVersionID: TempObj.templateVersionID,
+        patID: userData.patID,
+        patName: userData.patDesc,
+        courseRecordID: '',
+        data: submitObjAry,
+        recordID: TempObj.recordID,
+      }]
+    };
+    $http.post('urlS', this, {
+      code: '06010116',
+      namespace: 'Y',
+      data: data,
+      success: function (res) {
+        if (+res.errorCode === 0) {
+          uni.showToast({ title: '保存成功' , icon: 'success' });
+          that.isInfoSubmitting = false;
+        } else {
+          that.isInfoSubmitting = false;
+          uni.showToast({ title: '请求异常:' + res.errorCode + res.errorMessage, icon: 'none' });
+        }
+      },
+      fail: function () {
+        that.isInfoSubmitting = false;
+      }
+    });
+  },
 
         // clearn 清空
         // clearn: function () {
@@ -658,7 +1059,7 @@ export default {
                             title: res.errorMessage,
                             icon: 'none'
                         });
-                        this.selectData();
+                        this.getTempHtml();
                         this.getFind();
                     }
                 },
@@ -1062,4 +1463,84 @@ export default {
 .leftFont {
     text-align: left !important;
 }
+
+/* 信息采集表单 */
+.info-collection {
+    background: #fff;
+    padding: 20rpx 30rpx;
+    margin-top: 20rpx;
+    min-height: calc(100vh - 330rpx - 100rpx);
+    padding-bottom: 140rpx;
+}
+
+.info-item {
+    padding: 20rpx 0;
+    border-bottom: 1px solid #f5f5f5;
+}
+
+.info-label {
+    font-size: 30rpx;
+    color: #333;
+    margin-bottom: 10rpx;
+}
+
+.info-value {
+    font-size: 30rpx;
+    color: #333;
+    padding: 10rpx 0;
+}
+
+.info-placeholder {
+    color: #999;
+}
+
+.info-input {
+    font-size: 30rpx;
+    padding: 10rpx 0;
+    height: 80rpx;
+    border-bottom: 1px solid #eee;
+}
+
+.info-textarea {
+    font-size: 30rpx;
+    width: 100%;
+    min-height: 120rpx;
+    padding: 10rpx 0;
+    border-bottom: 1px solid #eee;
+}
+
+.info-radio-label {
+    display: inline-flex;
+    align-items: center;
+    margin-right: 40rpx;
+    font-size: 30rpx;
+    margin-top: 10rpx;
+}
+
+/* 保存按钮固定底部 */
+.fixed-save-bar {
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    padding: 20rpx 30rpx;
+    background: #fff;
+    box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
+    z-index: 100;
+}
+
+.fixed-save-bar .multiBtn-right {
+    width: 100%;
+    height: 80rpx;
+    line-height: 80rpx;
+    font-size: 32rpx;
+    color: #fff;
+    background: #1890ff;
+    border-radius: 8rpx;
+}
+
+.fixed-save-bar .multiBtn-right[disabled] {
+    background: #a0cfff;
+    color: #fff;
+}
 </style>

+ 4 - 0
vite.config.js

@@ -103,6 +103,10 @@ export default defineConfig({
 				changeOrigin: true,
 				rewrite: (path) => path.replace('/ws/', '/ws/')
 			},
+			'/EMRFile': {
+				target: 'https://hlwyy.scsmysgkyy.cn',
+				changeOrigin: true,
+			},
 			'/fileUp/': {
 				target: 'https://np.h03.p0551.com',
 				changeOrigin: true,