Quellcode durchsuchen

新增给药途径,修改剂型来源

zhouna vor 3 Jahren
Ursprung
Commit
7d2ed25951

+ 108 - 0
src/components/AddNewInspect/SearchSelect/index.jsx

@@ -0,0 +1,108 @@
+import React, { Component } from "react";
+import axios from '@utils/ajax';
+import styles from "./index.less";
+import {Notify,DelToast} from '@commonComp';
+import config from '@config/index';
+import $ from 'jquery';
+import dowm from '../img/down.png';
+
+class SearchSelect extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      show:false,
+      ata:[],
+      wayList:[],        //给药途径列表
+      pipeList:[],    //剂型列表
+    };
+    this.handleBlur = this.handleBlur.bind(this);
+    this.getDrugWayList = this.getDrugWayList.bind(this);
+  }
+  
+  componentDidMount() {
+      //关闭下拉弹窗
+    $(document).click((event) => {
+        const domClass=$(event.target).attr("class")||'';
+      if(domClass.indexOf(styles.selectLis)===-1&&domClass.indexOf(styles.inpSearch)===-1){
+        this.setState({
+          show:false
+        })
+      }
+    });
+  }
+  handleBlur(){
+    const {handlePush} = this.props;
+    handlePush && handlePush({mode:8});       //右侧推送
+  }
+
+  handleFocus(){
+    const {handlePush} = this.props;
+    handlePush&&handlePush({mode:8});
+  }
+  handleSelect(part,idx){
+    const {selectJiType,handlePush,type,hosId} = this.props;
+    const item = Object.assign(part,{uniqueName:hosId===-1?part.name:undefined});       //朗通的需要传uniqueName
+    selectJiType(item,idx,type)
+    handlePush&&handlePush({mode:8});
+  }
+  handleSelectShow (e){
+    const val = e.target.value;
+    //const {handleChange} = this.props;
+      this.setState({
+          show:true
+      });
+      //搜索
+      //handleChange(val);
+      this.getDrugWayList(val)
+  }
+    //获取药品剂型15,、给药途径16
+    getDrugWayList(val){
+      const {hosId,type} = this.props;
+      if(!val.trim()){
+          this.setState({
+              data:[]
+          });
+          return;
+      }
+         axios.json('/demo/retrieval/index',{
+             "inputStr": val.trim(),
+             "type": type,
+             "hospitalId":hosId
+         }).then((res)=>{
+             if(res.data.code==0){
+                 const data = res.data.data;
+                 //if(type===15){
+                     this.setState({
+                         data:data.nameList||[]
+                     })
+                 /*}else if(type===16){
+                     this.setState({
+                         pipeList:data.nameList||[]
+                     })
+                 }*/
+             }else{
+                 Notify.success(res.data.msg)
+             }
+         })
+    };
+  render() {
+    const {idx,title,selected} = this.props;
+    const {show,data} = this.state;
+    return (
+        <div className={styles.medType}>
+            <input placeholder={title} value={selected} className={styles.inpSearch} onChange={(e)=>this.handleSelectShow(e)} />
+                <img src={dowm} alt=""/>
+            {
+                show?<ul className={styles.selectLis}>
+                    {
+                        data&&data.map((part)=>{
+                            return <li onClick={()=>this.handleSelect(part,idx)}>{part.name}</li>
+                        })
+                    }
+                </ul>:''
+            }
+          </div>
+    );
+  }
+}
+export default SearchSelect;

+ 37 - 0
src/components/AddNewInspect/SearchSelect/index.less

@@ -0,0 +1,37 @@
+@import "~@less/variables.less";
+.medType{
+    display: inline-block;
+    width: 110px;
+    border:1px solid #aaa;
+    border-radius: 3px;
+    position: relative;
+    margin-right: 10px;
+    img{
+        width: 8px;
+        height: 5px;
+        position: absolute;
+        top:8px;
+        right: 5px;
+    }
+    .selectLis{
+        position: absolute;
+        top:24px;
+        background: #fff;
+        width: 100%;
+        max-height: 200px;
+        box-shadow: 0 10px 20px 0 #989da3;
+        z-index: 9;
+        overflow: auto;
+        li{
+            padding-left: 5px;
+            cursor: pointer;
+        }
+        li:hover{
+            background: #E2F1F8;
+        }
+    }
+}
+.inpSearch{
+    width: 100%;
+    padding-left: 5px;
+}

+ 6 - 29
src/components/AddNewInspect/SlidePic/index.jsx

@@ -7,10 +7,10 @@ import checkOff from '@common/images/check_off.png';
 import checkOn from '@common/images/check_on.png';
 import dowm from '../img/down.png';
 import SlideIpt from '../SlideIpt';
+import SearchSelect from '../SearchSelect';
 import singleB from '../img/singleB.png';
 import singleL from '../img/singleL.png';
 
-
 class SlidePic extends Component {
   constructor(props) {
     super(props);
@@ -98,51 +98,28 @@ class SlidePic extends Component {
     const {handlePush} = this.props;
     handlePush&&handlePush({mode:8});
   }
-  handleSelect(part,idx){
-    const {selectJiType,handleSelectShow,handlePush} = this.props;
-    selectJiType(part,idx)
-    handlePush&&handlePush({mode:8});
-    handleSelectShow(idx)
-  }
-  handleSelectShow (idx){
-    const {handleSelectShow} = this.props;
-    handleSelectShow(idx)
-  }
   handleSui(item,idx){
     const {handleSuiFang,handlePush} = this.props;
     handleSuiFang&&handleSuiFang(item,idx)
     handlePush&&handlePush({mode:8});
   }
   render() {
-    const {item,time,setTipValue,idx,handlePush,staticData,activeIdx,hosId} = this.props;
+    const {item,time,setTipValue,idx,handlePush,hosId,selectJiType} = this.props;
     const {selectShow,activeInd,activeName,value,style} = this.state;
     return (
-      <li key={item.time} className={`${styles.slideLi} clearfix`}> 
+      <li key={item.time} className={`${styles.slideLi} clearfix`}>
           <img className={styles.imgCheck} src={item.check?checkOn:checkOff} onClick={()=>this.checkOnOff(item,idx)} alt=""/>
           <span className={styles.bigname} title={item.detailName}>{item.detailName}</span>
           <span className={styles.smallname}>{item.flg == 5?'药品':item.flg == 6?'手术/操作':'输血'}</span>
-          <span className={styles.medType}>
-            <a style={{display:item.flg == 5&&hosId==-1?'block':'none',color:item.form=='选择剂型'||!item.form?"#AAAAAA":"#333"}} id="selectJiTypeWrap" onClick={()=>this.handleSelectShow(idx)}>
-              {item.form||'选择剂型'}
-              <img src={dowm} alt=""/>
-            </a>
-              {
-                hosId==-1&&item.flg == 5&&item.selectShow&&activeIdx==idx?<ul className={styles.selectLis} id="selectJiType">
-                  {
-                    staticData&&staticData.map((part)=>{
-                      return <li onClick={()=>this.handleSelect(part,idx)}>{part.name||'选择剂型'}</li>
-                    })
-                  }
-                </ul>:''
-              }
-          </span>
+          <SearchSelect title='选择剂型' hosId={hosId} selected={item.form} type={15} selectJiType={selectJiType} handlePush={handlePush} idx={idx}></SearchSelect>
+          <SearchSelect title='选择给药途径' hosId={hosId} selected={item.routeName} type={16} selectJiType={selectJiType} handlePush={handlePush} idx={idx}></SearchSelect>
           <span className={styles.edit}>
             {
               item.flg == 5||item.flg == 8?
               <input type="text" 
                 class="canEdit" 
                 style={{color:'#333'}}
-                placeholder={item.flg == 5?'(填写用法计量)':'(填写用量)'}
+                placeholder='(填写用量)'
                 autoComplete="off"
                 value={item.value}
                 title={item.value}

+ 5 - 27
src/components/AddNewInspect/SlidePic/index.less

@@ -46,39 +46,17 @@
     }
     .bigname {
         .ellipsis;
-        width: 400px;
+        width: 360px;
         font-weight: bold;
         margin-right: 15px;
     }
     .smallname {
-        width: 85px;
-        margin-right: 15px;
-    }
-    .medType {
-        width: 94px;
-        cursor: pointer;
-        margin-right: 30px;
-        position: relative;
-        padding: 0;
-        a {
-            padding: 0 5px;
-            box-sizing: border-box;
-            display: inline-block;
-            border: 1px solid #AAAAAA;
-            border-radius: 4px;
-            width: 100%;
-            position: relative;
-            img{
-                position: absolute;
-                right: 8px;
-                top: 9px;
-                width: 8px;
-            }
-        }
+        width: 80px;
+        margin-right: 10px;
     }
     .edit {
         width: 150px;
-        margin-right: 15px;
+        margin-right: 5px;
         input {
             width: 100%;
         }
@@ -94,7 +72,7 @@
     }
     .pass {
         text-align: right;
-        padding-left: 15px;
+        padding-left: 10px;
         box-sizing: border-box;
         width: 150px;
         margin-right: 15px;

+ 1 - 0
src/components/PreviewBody/MedicalAdvice/index.jsx

@@ -23,6 +23,7 @@ class MedicalAdvice extends Component {
                     
                     <td className={style.assistTableTdTrd}>药品</td>
                     <td className={style.assistTableTdSec}>{item.form}</td>
+                      <td className={style.assistTableTdSec}>{item.routeName}</td>
                     <td className={style.assistTableTdSec}>{item.value}</td>
                     <td className={style.assistTableTdFor}>{item.time}</td>
                   </tr>

+ 2 - 2
src/containers/NewAdvice.js

@@ -65,8 +65,8 @@ function mapDispatchToProps(dispatch) {
     handleSelectShow(idx,sign){
       dispatch(handleSelectShow(idx,sign))
     },
-    selectJiType(part,idx){
-      dispatch(selectJiType(part,idx))
+    selectJiType(part,idx,type){
+      dispatch(selectJiType(part,idx,type))
     },
     checkOnOff(item,idx){
       dispatch(checkOffOn(item,idx))

+ 2 - 2
src/store/actions/newAdvice.js

@@ -83,9 +83,9 @@ export const checkOffOn = (item,tip) => ({
     item,tip
 })
 
-export const selectJiType = (part,idx) => ({
+export const selectJiType = (part,idx,type) => ({
     type:SELECTJITYPE,
-    part,idx
+    part,idx,operType:type
 })
 export const handleSuiFang = (item,idx) => ({
     type:HANDLESUI,

+ 0 - 1
src/store/async-actions/newAdvice.js

@@ -14,7 +14,6 @@ export const getSearchList = (val) => {
     return (dispatch) => {
         axios.json('/demo/retrieval/index',{
             "inputStr": val.trim(),
-            "hospitalId": 2,
             "age": formatFormParmas('patientAge',baseList.patInfo.patInfoData),
             "sex": formatFormParmas('patientSex',baseList.patInfo.patInfoData),
             "type": type,

+ 6 - 1
src/store/reducers/newAdvice.js

@@ -89,7 +89,12 @@ export default (state = initSearchList, action) => {
         for (let i = 0; i < tempArr.length; i++) {
             if (action.idx == i) {
                 tempArr[i].selectShow = false
-                tempArr[i].form = action.part.name
+                if(+action.operType===16){   //给药途径
+                    tempArr[i].routeName=action.part.name;
+                    tempArr[i].routeUniqueName=action.part.uniqueName;
+                }else{      //剂型
+                    tempArr[i].form = action.part.name;
+                }
                 tempArr[i].selectVal = action.part.val
             }
         }

+ 1 - 1
src/utils/config.js

@@ -7,7 +7,7 @@ const { func } = require("prop-types");
 
 
 
-const host='http://192.168.2.241:6060';//后端接口访问地址
+const host='http://192.168.2.236:6060';//后端接口访问地址
 // const host='http://192.168.2.241:5050';//后端接口访问地址
 // const host='http://192.168.3.11:5050';//王宇
 //const host='http://192.168.2.164:8080';