|
@@ -9,16 +9,10 @@ import {
|
|
|
CLEAR_ALL_LABEL,
|
|
|
DEL_PART_ITEM,
|
|
|
DEL_EXCEL_LIST,
|
|
|
- ADD_LABEL,
|
|
|
- SEARCH_HOSPITAL_INSPECT,
|
|
|
- SEARCH_HOSPITAL_INSPECT_SON,
|
|
|
- SET_ALLCHECK,
|
|
|
- SELECT_ONE_CHECK,
|
|
|
- SELECT_WARING,
|
|
|
- SHOW_IN_ICSS
|
|
|
+ ADD_LABEL
|
|
|
} from '../types/inspect';
|
|
|
import store from '@store';
|
|
|
-import {dateParser} from '@utils/tools.js';
|
|
|
+import { getStringPlus, getPushLists, getPushList} from '@utils/tools.js';
|
|
|
|
|
|
const initSearchList = {
|
|
|
list: [], //搜索的结果
|
|
@@ -33,209 +27,9 @@ const initSearchList = {
|
|
|
pushItem:[], //推送的数据
|
|
|
pushItems:[], //右侧模板预览的数据
|
|
|
inspectVal:'',
|
|
|
-
|
|
|
- hospitalInspect:[],//医院检索到的
|
|
|
- hospitalInspectObj:{},//组对应的明细(单选多选全选)
|
|
|
- selectGroupList:[],//选的组的明细可能有多个组
|
|
|
- allCheck:false,//全选反选
|
|
|
- checkedList:[],//选中的小项
|
|
|
}
|
|
|
|
|
|
export default (state = initSearchList, action) => {
|
|
|
- if (action.type == SHOW_IN_ICSS) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- let tmpGroup = JSON.parse(JSON.stringify(newState.selectGroupList))
|
|
|
- let tmpArr = newState.getExcelDataList;
|
|
|
- let tmpArr2 = newState.labelList;
|
|
|
- let excelDataLis = {
|
|
|
- lisExcelRes:[],
|
|
|
- messages:[]
|
|
|
- }
|
|
|
- for(let i = 0;i < tmpGroup.length;i++){
|
|
|
- let tmpObj = {//excelDataLis.lisExcelRes[0]
|
|
|
- menus:'',
|
|
|
- lisExcelItem:[]
|
|
|
- }
|
|
|
- for(let k = 0;k < tmpGroup[i].lisExcelWrapper.length;k++){
|
|
|
- tmpGroup[i].lisExcelWrapper[k].time = tmpGroup[i].Rtime
|
|
|
- }
|
|
|
- tmpObj.menus = tmpGroup[i].groupName
|
|
|
- tmpObj.lisExcelItem = tmpGroup[i].lisExcelWrapper
|
|
|
- excelDataLis.lisExcelRes.push(tmpObj)
|
|
|
- }
|
|
|
- newState.getExcelData = excelDataLis
|
|
|
- tmpArr.push(excelDataLis)
|
|
|
- newState.getExcelDataList = [...tmpArr]
|
|
|
- newState.pushItem = getPushList(tmpArr,tmpArr2);
|
|
|
- newState.pushItems = getPushLists(tmpArr,tmpArr2);
|
|
|
- newState.inspectStrPlus = getStringPlus(newState.pushItems)
|
|
|
-
|
|
|
- newState.hospitalInspect = [] //医院检索到的
|
|
|
- newState.hospitalInspectObj = {} //组对应的明细(单选多选全选)
|
|
|
- newState.selectGroupList = [] //选的组的明细可能有多个组
|
|
|
- newState.allCheck = false //全选反选
|
|
|
- newState.checkedList = [] //选中的小项
|
|
|
-
|
|
|
- return newState;
|
|
|
- }
|
|
|
- if (action.type == SELECT_WARING) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- let listWrap = JSON.parse(JSON.stringify(newState.hospitalInspectObj))
|
|
|
- let tmpGroup = JSON.parse(JSON.stringify(newState.selectGroupList))
|
|
|
- let tmpCheckedLis = JSON.parse(JSON.stringify(newState.checkedList))
|
|
|
- let warArr = [],checked = [],numS=0
|
|
|
- for(let m =0;m < listWrap.lisExcelWrapper.length;m++){
|
|
|
- for(let n = 0;n < tmpCheckedLis.length;n++){
|
|
|
- if(listWrap.lisExcelWrapper[m].type == 0 && listWrap.lisExcelWrapper[m].itemName == tmpCheckedLis[n]){
|
|
|
- warArr.push(listWrap.lisExcelWrapper[m])
|
|
|
- checked.push(listWrap.lisExcelWrapper[m].itemName)
|
|
|
- }
|
|
|
- }
|
|
|
- if(listWrap.lisExcelWrapper[m].type != 0){
|
|
|
- warArr.push(listWrap.lisExcelWrapper[m])
|
|
|
- checked.push(listWrap.lisExcelWrapper[m].itemName)
|
|
|
- }
|
|
|
- }
|
|
|
- for(let i = 0;i < tmpGroup.length;i++){
|
|
|
- if(tmpGroup[i].groupName == listWrap.groupName){//右侧有选中相同组的明细
|
|
|
- tmpGroup[i].lisExcelWrapper = warArr
|
|
|
- }else{//右侧没有选中相同组的明细
|
|
|
- ++numS
|
|
|
- }
|
|
|
- }
|
|
|
- if(numS == tmpGroup.length){//直接添加到右侧
|
|
|
- listWrap.lisExcelWrapper = warArr
|
|
|
- tmpGroup.push(listWrap)
|
|
|
- }
|
|
|
- if(checked.length == listWrap.lisExcelWrapper.length){
|
|
|
- newState.allCheck = true;
|
|
|
- }else{
|
|
|
- newState.allCheck = false;
|
|
|
- }
|
|
|
- newState.selectGroupList = [...tmpGroup]//右侧已选中的项目
|
|
|
- newState.checkedList = [...checked]
|
|
|
- return newState;
|
|
|
- }
|
|
|
- if (action.type == SELECT_ONE_CHECK) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- let listWrap = JSON.parse(JSON.stringify(newState.hospitalInspectObj))
|
|
|
- let tmpLen = listWrap.lisExcelWrapper.length;
|
|
|
- let tmpGroup = JSON.parse(JSON.stringify(newState.selectGroupList))
|
|
|
- let tmpCheckedLis = JSON.parse(JSON.stringify(newState.checkedList))
|
|
|
- let numS = 0;
|
|
|
- if (tmpCheckedLis.indexOf(action.name) == -1) {//添加选中
|
|
|
- let tempArr = newState.checkedList;
|
|
|
- tempArr.push(action.name);
|
|
|
- newState.checkedList = [...tempArr]
|
|
|
- for(let m = 0;m < tmpGroup.length;m++){
|
|
|
- if(tmpGroup[m].groupName == action.groupName){//右侧有选中相同组的明细
|
|
|
- tmpGroup[m].lisExcelWrapper.push(action.item)
|
|
|
- }else{
|
|
|
- ++numS
|
|
|
- }
|
|
|
- }
|
|
|
- if(numS == tmpGroup.length){//直接添加到右侧
|
|
|
- listWrap.lisExcelWrapper = []
|
|
|
- listWrap.lisExcelWrapper.push(action.item)
|
|
|
- tmpGroup.push(listWrap)
|
|
|
- }
|
|
|
- newState.selectGroupList = [...tmpGroup]//右侧已选中的项目
|
|
|
- if(tempArr.length == tmpLen){
|
|
|
- newState.allCheck = true;
|
|
|
- }else{
|
|
|
- newState.allCheck = false;
|
|
|
- }
|
|
|
- } else {//去除选中
|
|
|
- let tempArr = newState.checkedList;
|
|
|
- tempArr.splice(tempArr.findIndex(item => item === action.name), 1)
|
|
|
- newState.checkedList = [...tempArr]
|
|
|
- for(let i = 0;i < tmpGroup.length;i++){
|
|
|
- if(tmpGroup[i].groupName == action.groupName){//右侧肯定有相同组的
|
|
|
- let tmpArr = []
|
|
|
- for(let k = 0;k < tmpGroup[i].lisExcelWrapper.length;k++){
|
|
|
- if(action.name != tmpGroup[i].lisExcelWrapper[k].itemName){
|
|
|
- tmpArr.push(tmpGroup[i].lisExcelWrapper[k])
|
|
|
- }
|
|
|
- }
|
|
|
- if(tmpArr.length == 0){
|
|
|
- tmpGroup.splice(i,1)
|
|
|
- }else{
|
|
|
- tmpGroup[i].lisExcelWrapper = [...tmpArr]
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- newState.selectGroupList = tmpGroup//右侧已选中的项目
|
|
|
- if(tempArr.length == listWrap.lisExcelWrapper.length){
|
|
|
- newState.allCheck = true;
|
|
|
- }else{
|
|
|
- newState.allCheck = false;
|
|
|
- }
|
|
|
- }
|
|
|
- return newState;
|
|
|
- }
|
|
|
- if (action.type == SET_ALLCHECK) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- let flg = newState.allCheck
|
|
|
- let listWrap = newState.hospitalInspectObj
|
|
|
- let tmpGroup = newState.selectGroupList
|
|
|
- let tmpCheckedLis = []
|
|
|
- newState.allCheck = !flg
|
|
|
- if(!flg){//全选
|
|
|
- let numFst=0
|
|
|
- for(let i = 0;i < tmpGroup.length;i++){
|
|
|
- if(listWrap.groupName == tmpGroup[i].groupName){
|
|
|
- ++numFst
|
|
|
- tmpGroup[i].lisExcelWrapper = listWrap.lisExcelWrapper
|
|
|
- }
|
|
|
- }
|
|
|
- for(let m =0;m < listWrap.lisExcelWrapper.length;m++){
|
|
|
- tmpCheckedLis.push(listWrap.lisExcelWrapper[m].itemName)
|
|
|
- }
|
|
|
- if(numFst==0){
|
|
|
- tmpGroup.push(listWrap)
|
|
|
- }
|
|
|
- newState.checkedList=[...tmpCheckedLis]
|
|
|
- newState.selectGroupList = [...tmpGroup]
|
|
|
- }else{//反选
|
|
|
- for(let j = 0;j < tmpGroup.length;j++){
|
|
|
- if(listWrap.groupName == tmpGroup[j].groupName){
|
|
|
- tmpGroup.splice(j,1)
|
|
|
- }
|
|
|
- }
|
|
|
- newState.checkedList=[]
|
|
|
- newState.selectGroupList = [...tmpGroup]
|
|
|
- }
|
|
|
- return newState;
|
|
|
- }
|
|
|
- if (action.type == SEARCH_HOSPITAL_INSPECT) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- newState.hospitalInspect = action.list
|
|
|
- newState.allCheck = false
|
|
|
- newState.hospitalInspectObj={}
|
|
|
- return newState;
|
|
|
- }
|
|
|
- if (action.type == SEARCH_HOSPITAL_INSPECT_SON) {
|
|
|
- const newState = Object.assign({}, state);
|
|
|
- let tmpArr = action.list
|
|
|
- let tmpSelect = newState.selectGroupList
|
|
|
- let tmpSelectSon = []
|
|
|
- for(let i = 0;i < tmpSelect.length;i++){
|
|
|
- if(tmpSelect[i].groupName == action.name){
|
|
|
- for(let k = 0;k < tmpSelect[i].lisExcelWrapper.length;k++){
|
|
|
- tmpSelectSon.push(tmpSelect[i].lisExcelWrapper[k].itemName)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- newState.checkedList = [...tmpSelectSon]
|
|
|
- if(tmpSelectSon.length == tmpArr.lisExcelWrapper.length){
|
|
|
- newState.allCheck = true;
|
|
|
- }else{
|
|
|
- newState.allCheck = false;
|
|
|
- }
|
|
|
- tmpArr.Rtime = action.time
|
|
|
- newState.hospitalInspectObj = tmpArr
|
|
|
- return newState;
|
|
|
- }
|
|
|
if (action.type == SEARCH_LIST) {
|
|
|
const newState = Object.assign({}, state);
|
|
|
newState.list = action.list
|
|
@@ -437,114 +231,3 @@ function getString(lists) {
|
|
|
})
|
|
|
return tmpString;
|
|
|
}
|
|
|
-
|
|
|
-function getStringPlus(dataList){
|
|
|
- let strPlus = '';
|
|
|
- dataList && dataList.map((item)=>{
|
|
|
- if(item.detailName){
|
|
|
- let strTmp = item.name + ',' + item.detailName + ',' + (item.otherValue ? item.otherValue : (item.value + item.units)) +';'
|
|
|
- strPlus += strTmp;
|
|
|
- }else{
|
|
|
- let strTmp = item.name+';'
|
|
|
- strPlus += strTmp;
|
|
|
- }
|
|
|
- })
|
|
|
- return strPlus;
|
|
|
-}
|
|
|
-/**
|
|
|
- *
|
|
|
- * @param {data1} excel导入的数据 getExcelDataList
|
|
|
- * @param {data2} 填写单数据 labelList
|
|
|
- */
|
|
|
-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)=>{
|
|
|
- let tmpObj = {};
|
|
|
- tmpObj.name = part.mealName || '';//套餐名
|
|
|
- tmpObj.detailName = part.itemName || '';//化验项名
|
|
|
- tmpObj.uniqueName = part.uniqueName || '';//公表名称
|
|
|
- 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; //阴性阳性
|
|
|
- tmpArr1.push(tmpObj);
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- data2.length>0 && data2.map((item)=>{ //填写单数据拼接
|
|
|
- item.details && item.details.map((val)=>{
|
|
|
- if(val.value != undefined && val.value != ''){
|
|
|
- let tmpObj = {};
|
|
|
- tmpObj.name = item.name || '';
|
|
|
- tmpObj.detailName = val.name || '';
|
|
|
- tmpObj.uniqueName = val.uniqueName || '';//公表名称
|
|
|
- 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;
|
|
|
- tmpArr2.push(tmpObj);
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- totalTmpArr = tmpArr1.concat(tmpArr2);
|
|
|
- return totalTmpArr;
|
|
|
-}
|
|
|
-function getPushLists(data1,data2){ //推送数据
|
|
|
- let tmpArr1 = [];
|
|
|
- let tmpArr2 = [];
|
|
|
- let totalTmpArr = [];
|
|
|
- data1.length>0 && data1.map((items)=>{ //excel导入的数据拼接
|
|
|
- items.lisExcelRes.map((item)=>{
|
|
|
- item.lisExcelItem.map((part)=>{
|
|
|
- let tmpObj = {};
|
|
|
- tmpObj.name = part.mealName || '';//套餐名
|
|
|
- tmpObj.detailName = part.itemName || '';//化验项名
|
|
|
- tmpObj.uniqueName = part.uniqueName || '';//公表名称
|
|
|
- tmpObj.source = '1';//数据来源
|
|
|
- tmpObj.maxValue = part.max || '';
|
|
|
- tmpObj.minValue = part.min || '';
|
|
|
- tmpObj.units = part.unit || '';//单位
|
|
|
- tmpObj.value = (part.value-0) === (part.value-0) ? part.value:'';//值
|
|
|
- tmpObj.otherValue = (part.value-0) === (part.value-0) ?'':part.value; //阴性阳性
|
|
|
- tmpArr1.push(tmpObj);
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- data2.length>0 && data2.map((item)=>{ //填写单数据拼接
|
|
|
- if(item.show){
|
|
|
- item.details.map((val)=>{
|
|
|
- if(val.value != undefined && val.value != ''){
|
|
|
- let tmpObj = {};
|
|
|
- tmpObj.name = item.name || '';
|
|
|
- tmpObj.detailName = val.name || '';
|
|
|
- tmpObj.uniqueName = val.uniqueName || '';//公表名称
|
|
|
- tmpObj.source = '0'; //数据来源
|
|
|
- tmpObj.maxValue = val.maxValue ? val.maxValue : '';
|
|
|
- tmpObj.minValue = val.minValue ? val.minValue : '';
|
|
|
- tmpObj.units = val.labelSuffix || '';
|
|
|
- tmpObj.value = (val.value-0) === (val.value-0) ? val.value:'';
|
|
|
- tmpObj.otherValue = (val.value-0) === (val.value-0) ?'':val.value;
|
|
|
- tmpArr2.push(tmpObj);
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- let tmpObj = {};
|
|
|
- tmpObj.name = item.name;
|
|
|
- tmpArr2.push(tmpObj);
|
|
|
- }
|
|
|
- })
|
|
|
- totalTmpArr = tmpArr1.concat(tmpArr2);
|
|
|
- return totalTmpArr;
|
|
|
-}
|
|
|
-
|