Browse Source

保存时添加化验指标字段

zhouna 6 years atrás
parent
commit
830293b70f
3 changed files with 26 additions and 2 deletions
  1. 1 1
      src/common/js/func.js
  2. 20 1
      src/store/async-actions/print.js
  3. 5 0
      src/store/reducers/inspect.js

+ 1 - 1
src/common/js/func.js

@@ -22,7 +22,7 @@ export function dateParser(timestamp,link = '-'){
     let hour = time.getHours().toString().padStart(2,'0');
     let minute = time.getMinutes().toString().padStart(2,'0');
     // let result = year+link+month+link+date;
-    let result = year+link+month+link+date+' '+hour+':'+minute;
+    let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+hour+':'+minute;
     return result;
 }
 

+ 20 - 1
src/store/async-actions/print.js

@@ -16,14 +16,17 @@ export const saveMessage = (bool) => {
     let whichSign = baseList.typeConfig.typeConfig;
     let jsonStr = getAllDataStringList(baseList);
     let jsonData = getAllDataList(baseList);
+    const lisData = baseList.inspect.pushItem;
+    const lisArr = transferIndexData(lisData);
+    //transferIndexData(lisData);
     // console.log(jsonStr.diag,'保存历史病历')
-    
     json('/inquiryInfo/saveInquiry', {
         "doctorId": state.doctorId,
         "hospitalDeptId": state.hospitalDeptId,
         "hospitalId": state.hospitalId,
         "patientId": state.patientId,         //患者id              
         "dataJson": JSON.stringify(getAllDataList(baseList)),
+        "indexData":lisArr,
         "detailList": [{
             "content": jsonStr.chief,
             "contentValue":filterDataArr(JSON.parse(jsonStr.chief)),
@@ -103,6 +106,22 @@ export const saveMessage = (bool) => {
     }
 };
 
+//转换化验指标保存需要的数据
+function transferIndexData(data) {
+    const arr=[];
+   data.map((it)=>{
+       if(it.uniqueName&&it.value!=''){
+           arr.push({
+             creatTime:it.time,
+             indexUnique:it.uniqueName,
+             indexUnit:it.units,
+             indexValue:it.value,
+             isAbnormal:(it.maxValue||it.minValue)?(it.value<it.minValue||it.value>it.maxValue?1:0):0
+           });
+       }
+   });
+   return arr;
+}
 
 export const clearMessages = () => {
     let baseList = store.getState();

+ 5 - 0
src/store/reducers/inspect.js

@@ -12,6 +12,8 @@ import {
     ADD_LABEL
 } from '../types/inspect';
 import store from '@store'
+import {dateParser} from '@common/js/func';
+
 const initSearchList = {
     list: [], //搜索的结果
     labelList: [], //选中的结果,也是需要保存的数据
@@ -265,6 +267,7 @@ function getPushList(data1,data2){     //推送数据
     let tmpArr1 = [];
     let tmpArr2 = [];
     let totalTmpArr = [];
+    const now = dateParser(new Date());
     data1.length>0 && data1.map((items)=>{    //excel导入的数据拼接
         items.lisExcelRes.map((item)=>{
             item.lisExcelItem.map((part)=>{
@@ -275,6 +278,7 @@ function getPushList(data1,data2){     //推送数据
                 tmpObj.source = '1';//数据来源
                 tmpObj.maxValue = part.max || ''; 
                 tmpObj.minValue = part.min || '';
+                tmpObj.time = part.time ||now;
                 tmpObj.units = part.unit || '';//单位
                 tmpObj.value = (part.value-0) === (part.value-0) ? part.value:'';//值
                 tmpObj.otherValue = (part.value-0) === (part.value-0) ?'':part.value; //阴性阳性
@@ -292,6 +296,7 @@ function getPushList(data1,data2){     //推送数据
                 tmpObj.source = '0';     //数据来源
                 tmpObj.maxValue = val.maxValue ? val.maxValue : '';
                 tmpObj.minValue = val.minValue ? val.minValue : '';
+                tmpObj.time = val.time || now;
                 tmpObj.units = val.labelSuffix || '';
                 tmpObj.value = (val.value-0) === (val.value-0) ? val.value:'';
                 tmpObj.otherValue = (val.value-0) === (val.value-0) ?'':val.value;