prescriptionTable.vue 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. <template>
  2. <div class="prescriptionTable">
  3. <el-table v-if="activeType == 1" :data="prescription.advices" border style="width: 99%;"
  4. :row-style="{ color: '#303133' }"
  5. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  6. <el-table-column align="center" prop="day" width="70" label="序号" fixed>
  7. <template slot-scope="scope">
  8. <div style="display:flex;align-items:center;">
  9. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.groupno" placeholder="" @input="getAllIndex(scope.row)"></el-input>
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column align="center" prop="drug_name" label="名称" fixed>
  14. <template slot-scope="scope"><span :title="scope.row.drug_name">{{ scope.row.drug_name }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column align="center" prop="drug_name" label="规格">
  18. <template slot-scope="scope">
  19. <span>
  20. {{ scope.row.drug.dose }}{{ scope.row.drug.dose_unit }}*{{ scope.row.drug.min_number }}{{ scope.row.drug.min_unit }}/{{ scope.row.drug.max_unit }}
  21. </span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column align="center" prop="single_dose" width="120" label="单次用量">
  25. <template slot-scope="scope">
  26. <div style="display:flex;align-items:center;">
  27. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.single_dose" @input="getAllChangeTwo(scope)"
  28. style="width:50%;"></el-input>
  29. <!-- <div>{{scope.row.single_dose_unit}}</div> -->
  30. <el-select v-model="scope.row.single_dose_unit" placeholder="请选择" style="width:50%;"
  31. @change="getAllChangeTwo(scope)" :disabled="scope.row.is_medicine == 1" >
  32. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  33. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  34. <el-option :label="scope.row.drug.dose_unit"
  35. v-if="scope.row.drug.dose_unit != scope.row.drug.min_unit"
  36. :value="scope.row.drug.dose_unit"></el-option>
  37. </el-select>
  38. </div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  42. <template slot-scope="scope">
  43. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.delivery_way" placeholder="请选择">
  44. <el-option
  45. v-for="(item,index) in drugways"
  46. :key="index"
  47. :label="item.name"
  48. :value="item.name">
  49. </el-option>
  50. </el-select>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  54. <template slot-scope="scope">
  55. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.execution_frequency" placeholder="请选择" @change="getAllChangeTwo(scope)">
  56. <el-option
  57. v-for="item,index in efs"
  58. :key="index"
  59. :label="item.name"
  60. :value="item.name">
  61. </el-option>
  62. </el-select>
  63. </template>
  64. </el-table-column>
  65. <el-table-column align="center" prop="day" width="70" label="天数">
  66. <template slot-scope="scope">
  67. <div style="display:flex;align-items:center;">
  68. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.day" @input="getAllChangeTwo(scope)" placeholder=""></el-input>
  69. {{'天'}}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column align="center" prop="prescribing_number" width="120" label="总量">
  74. <template slot-scope="scope">
  75. <div style="display:flex;align-items:center;">
  76. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.prescribing_number" @input="changePrescribingNumber(scope)"
  77. style="width:50%" placeholder=""></el-input>
  78. <!-- <div> {{scope.row.prescribing_number_unit}}</div> -->
  79. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.prescribing_number_unit" placeholder="请选择" style="width:50%;"
  80. @change="getPrescribingNumberUnit(scope)">
  81. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  82. <el-option :label="scope.row.drug.max_unit"
  83. v-if="scope.row.drug.min_unit != scope.row.drug.max_unit"
  84. :value="scope.row.drug.max_unit"></el-option>
  85. </el-select>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column align="center" prop="retail_price" width="80" label="单价">
  90. <template slot-scope="scope">
  91. <div style="display:flex;align-items:center;">
  92. <el-input v-model="scope.row.retail_price" placeholder="" readonly></el-input>
  93. <div>{{'元'}}</div>
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column align="center" prop="hosp_appr_flag" width="100" label="医院审批标志">
  98. <template slot-scope="scope">
  99. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.hosp_appr_flag" placeholder="请选择">
  100. <el-option label="审批通过" value="1"></el-option>
  101. <el-option label="无须审批" value="3"></el-option>
  102. <el-option label="审批不通过" value="2"></el-option>
  103. </el-select>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" prop="remark" width="80" label="国家编码">
  107. <template slot-scope="scope">
  108. <el-input v-model="scope.row.drug.medical_insurance_number" placeholder=""></el-input>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" prop="is_self_drug" width="100" label="医嘱性质" v-if="this.$store.getters.xt_user.org_id == 10206 || this.$store.getters.xt_user.org_id == 0">
  112. <template slot-scope="scope">
  113. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.is_self_drug" placeholder="请选择">
  114. <el-option label="非自备药" value="0"></el-option>
  115. <el-option label="自备药" value="1"></el-option>
  116. </el-select>
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="center" prop="drug_way_count" width="100" label="给药途径次数" >
  120. <template slot-scope="scope">
  121. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.drug_way_count" :title="scope.row.drug_way_count" placeholder=""></el-input>
  122. </template>
  123. </el-table-column>
  124. <el-table-column align="center" prop="remark" width="50" label="备注">
  125. <template slot-scope="scope">
  126. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.remark" :title="scope.row.remark" placeholder=""></el-input>
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="center" width="40" prop="name" label="操作" fixed="right">
  130. <template slot-scope="scope">
  131. <i class="el-icon-delete" @click="deleteDrug(scope.$index, scope.row)"></i>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <el-table v-if="activeType == 2" :data="prescription.project" border style="width: 99%;"
  136. :row-style="{ color: '#303133' }"
  137. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  138. <el-table-column align="center" type="index" width="40" label="序号" fixed></el-table-column>
  139. <el-table-column align="center" prop="project_name" label="名称" fixed>
  140. <template slot-scope="scope">
  141. <span :title="scope.row.project_name" v-if="org_id != 10206">{{ scope.row.project_name }}</span>
  142. <span v-if="org_id == 10206&&scope.row.type==3">{{ scope.row.project_name }}{{scope.row.good_info.specification_name}}{{scope.row.good_info.good_number}}</span>
  143. <span v-if="org_id == 10206&&scope.row.type==2">{{ scope.row.project_name }}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column align="center" prop="project_name" label="规格">
  147. <template slot-scope="scope">
  148. <span v-if="scope.row.type==2">{{ scope.row.project_name }}</span>
  149. <span v-if="scope.row.type==3">{{ scope.row.good_info.specification_name }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column align="center" prop="statistical_classification" width="100" label="组">
  153. <template slot-scope="scope">{{scope.row.statistical_classification}}
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="center" prop="single_dose" width="80" label="单次用量">
  157. <template slot-scope="scope">
  158. <div style="display:flex;align-items:center;">
  159. <el-input v-model="scope.row.single_dose" @input="getProjectSingleDose(scope)"
  160. placeholder=""></el-input>
  161. <div>{{scope.row.unit}}</div>
  162. </div>
  163. </template>
  164. </el-table-column>
  165. <el-table-column align="center" prop="delivery_way" width="80" label="用法">
  166. <template slot-scope="scope">
  167. <el-autocomplete
  168. style="width:100%;"
  169. class="inline-input"
  170. v-model="scope.row.delivery_way"
  171. :fetch-suggestions="querySearch2"
  172. placeholder="请输入内容"
  173. ></el-autocomplete>
  174. </template>
  175. </el-table-column>
  176. <el-table-column align="center" prop="execution_frequency" width="80" label="频率">
  177. <template slot-scope="scope">
  178. <el-input v-model="scope.row.execution_frequency" @input="getProjectSingleDose(scope)"
  179. placeholder=""></el-input>
  180. </template>
  181. </el-table-column>
  182. <el-table-column align="center" prop="number_days" width="70" label="天数">
  183. <template slot-scope="scope">
  184. <div style="display:flex;align-items:center;">
  185. <el-input v-model="scope.row.number_days" @input="getProjectSingleDose(scope)"
  186. placeholder=""></el-input>
  187. <div>{{'天'}}</div>
  188. </div>
  189. </template>
  190. </el-table-column>
  191. <el-table-column align="center" prop="total" width="70" label="总量">
  192. <template slot-scope="scope">
  193. <div style="display:flex;align-items:center;">
  194. <el-input v-model="scope.row.total" style="width:60%" placeholder=""></el-input>
  195. <div>{{scope.row.unit}}</div>
  196. </div>
  197. </template>
  198. </el-table-column>
  199. <el-table-column align="center" prop="name" width="70" label="单价">
  200. <template slot-scope="scope">
  201. <div style="display:flex;align-items:center;">
  202. <el-input v-model="scope.row.price" placeholder="" readonly></el-input>
  203. <div>{{'元'}}</div>
  204. </div>
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="center" prop="name" width="50" label="国家编码">
  208. <template slot-scope="scope" v-if="scope.row.type==3">
  209. <el-input v-model="scope.row.good_info.medical_insurance_number"></el-input>
  210. </template>
  211. <template slot-scope="scope" v-if="scope.row.type==2">
  212. <el-input v-model="scope.row.project.medical_code"></el-input>
  213. </template>
  214. </el-table-column>
  215. <el-table-column align="center" prop="name" width="50" label="备注">
  216. <template slot-scope="scope">
  217. <el-input v-model="scope.row.remark" :title="scope.row.remark"></el-input>
  218. </template>
  219. </el-table-column>
  220. <el-table-column align="center" width="40" prop="name" label="操作" fixed="right">
  221. <template slot-scope="scope">
  222. <i class="el-icon-delete" @click="deleteProject(scope.row,scope.$index)"></i>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. <div class="additionalBox">
  227. <div class="additionalOne" v-for="(item,index) in prescription.addition" :key="index">
  228. <span :title="item.item_name">{{item.item_name}}</span>
  229. <el-input v-model="item.price" placeholder="" style="width:50px;"></el-input>
  230. <el-input v-model="item.count" placeholder="" style="width:50px;"></el-input>
  231. <i class="el-icon-delete deleteIcon" @click="delAddition(index,item)"></i>
  232. </div>
  233. </div>
  234. </div>
  235. </template>
  236. <script>
  237. import { getDictionaryDataConfig } from '@/utils/data'
  238. import { delHisAddition, delHisAdvice, delHisProject, getInitData,getHisDoctorAdviceInfo } from '@/api/his/his'
  239. export default {
  240. props: {
  241. preDrugs: Array,
  242. activeType: Number,
  243. addtions_charge: Array,
  244. prescription: {
  245. type: Object,
  246. default: function() {
  247. return {
  248. name: '',
  249. advices: [],
  250. project: [],
  251. drugways: [],
  252. efs: [],
  253. drugList:[],
  254. adviceList:{}
  255. }
  256. }
  257. }
  258. },
  259. data() {
  260. return {
  261. org_id:this.$store.getters.xt_user.org_id,
  262. advices: [],
  263. tableData: [],
  264. newoptions: [{
  265. value: '1',
  266. label: '1'
  267. }, {
  268. value: '2',
  269. label: '2'
  270. }, {
  271. value: '3',
  272. label: '3'
  273. }, {
  274. value: '4',
  275. label: '4'
  276. }, {
  277. value: '5',
  278. label: '5'
  279. }],
  280. value: '1',
  281. input: 1,
  282. efs: [],
  283. drugways: []
  284. }
  285. },
  286. methods: {
  287. createFilter(queryString) {
  288. return (restaurant) => {
  289. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  290. }
  291. },
  292. querySearch2(queryString, cb) {
  293. var restaurants = this.getDictionaryDataConfig('system', 'project_use')
  294. restaurants.map(item => {
  295. item.value = item.name
  296. })
  297. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  298. // 调用 callback 返回建议列表的数据
  299. cb(results)
  300. },
  301. delAddition(index, addition) {
  302. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  303. this.$message.error('该处方已经结算或记账,无法删除')
  304. return
  305. }
  306. this.$confirm('附加费删除后不可恢复,是否确认删除', '删除', {
  307. confirmButtonText: '确 定',
  308. cancelButtonText: '取 消',
  309. type: 'warning'
  310. }).then(() => {
  311. this.$nextTick(function() {
  312. if (addition.id == 0) {
  313. this.prescription.addition.splice(index, 1)
  314. } else {
  315. let params = {
  316. 'id': addition.id
  317. }
  318. delHisAddition(params).then(response => {
  319. if (response.data.state == 0) {
  320. this.$message.error(response.data.msg)
  321. return false
  322. } else {
  323. var temp2 = this.deepClone(this.prescription.addition)
  324. temp2.splice(index, 1)
  325. this.prescription.addition = temp2
  326. this.$message.success(response.data.data.msg)
  327. }
  328. })
  329. }
  330. })
  331. })
  332. .catch(() => {
  333. })
  334. },
  335. getInitData() {
  336. getInitData().then(response => {
  337. if (response.data.state == 0) {
  338. this.$message.error(response.data.msg)
  339. return false
  340. } else {
  341. this.drugways = response.data.data.drugways
  342. this.efs = response.data.data.efs
  343. this.drugList = response.data.data.drugs
  344. }
  345. })
  346. }, deleteDrug: function(index, row) {
  347. if (row.hasOwnProperty('is_medicine')&&row.is_medicine == 1){
  348. this.$message.error('该处方包含已发药的药品,无法删除')
  349. return
  350. }
  351. if (this.prescription.order_status == 2 || this.prescription.order_status ==5) {
  352. this.$message.error('该处方已经结算或记账,无法删除')
  353. return
  354. }
  355. this.$confirm('药品删除后不可恢复,是否确认删除', '删除', {
  356. confirmButtonText: '确 定',
  357. cancelButtonText: '取 消',
  358. type: 'warning'
  359. }).then(() => {
  360. this.$nextTick(function() {
  361. if (row.advice_id == 0) {
  362. this.prescription.advices.splice(index, 1)
  363. } else {
  364. let params = {
  365. 'id': row.advice_id
  366. }
  367. delHisAdvice(params).then(response => {
  368. if (response.data.state == 0) {
  369. this.$message.error(response.data.msg)
  370. return false
  371. } else {
  372. var temp2 = this.deepClone(this.prescription.advices)
  373. temp2.splice(index, 1)
  374. this.prescription.advices = temp2
  375. this.$message.success(response.data.data.msg)
  376. this.$emit("getSunziValue",temp2)
  377. }
  378. })
  379. }
  380. })
  381. })
  382. .catch(() => {
  383. })
  384. }, deepClone(source) {
  385. if (!source && typeof source !== 'object') {
  386. throw new Error('error arguments', 'shallowClone')
  387. }
  388. const targetObj = source.constructor === Array ? [] : {}
  389. Object.keys(source).forEach((keys) => {
  390. if (source[keys] && typeof source[keys] === 'object') {
  391. targetObj[keys] = this.deepClone(source[keys])
  392. } else {
  393. targetObj[keys] = source[keys]
  394. }
  395. })
  396. return targetObj
  397. },
  398. setNewData: function(data) {
  399. this.prescription = data
  400. // this.prescription.advices = data.advices
  401. },
  402. getDictionaryDataConfig(module, filed_name) {
  403. return getDictionaryDataConfig(module, filed_name)
  404. },
  405. getGroup(id) {
  406. var name = ''
  407. var statistics_category = getDictionaryDataConfig('system', 'statistics_category')
  408. // console.log('2235', statistics_category)
  409. for (let i = 0; i < statistics_category.length; i++) {
  410. if (id == statistics_category[i].id) {
  411. name = statistics_category[i].name
  412. }
  413. }
  414. return name
  415. },
  416. deleteProject(row, i) {
  417. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  418. this.$message.error('该处方已经结算或记账,无法删除')
  419. return
  420. }
  421. this.$confirm('项目删除后不可恢复,是否确认删除', '删除', {
  422. confirmButtonText: '确 定',
  423. cancelButtonText: '取 消',
  424. type: 'warning'
  425. }).then(() => {
  426. if (row.id == 0) {
  427. this.prescription.project.splice(i, 1)
  428. } else {
  429. let params = {
  430. 'id': row.id
  431. }
  432. delHisProject(params).then(response => {
  433. if (response.data.state == 0) {
  434. this.$message.error(response.data.msg)
  435. return false
  436. } else {
  437. for (let i = 0; i < this.prescription.project.length; i++) {
  438. if (this.prescription.project[i].id == row.id) {
  439. this.prescription.project.splice(i, 1)
  440. }
  441. }
  442. this.$message.success(response.data.data.msg)
  443. }
  444. })
  445. }
  446. })
  447. .catch(() => {
  448. })
  449. },
  450. getAllChange(scope) {
  451. console.log("scope23322332233232",scope)
  452. // if (this.prescription.is_medicine_status){
  453. // this.$message.error('该处方已经结算或记账,无法删除')
  454. //
  455. // }
  456. if(this.$store.getters.xt_user.org_id != 10206) {
  457. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  458. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  459. console.log(1)
  460. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  461. } else {
  462. console.log(12)
  463. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  464. }
  465. } else {
  466. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  467. console.log(123)
  468. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose)
  469. } else {
  470. console.log(1234)
  471. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose / scope.row.drug.min_number)
  472. }
  473. }
  474. if (scope.row.prescribing_number == 0) {
  475. scope.row.prescribing_number = 1
  476. }
  477. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  478. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  479. if (scope.row.prescribing_number > scope.row.drug.sum_count) {
  480. this.$message.error(scope.row.drug_name + '库存不足')
  481. }
  482. } else {
  483. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  484. this.$message.error(scope.row.drug_name + '库存不足')
  485. }
  486. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  487. }
  488. }
  489. },
  490. getAllChangeTwo(scope) {
  491. if(this.$store.getters.xt_user.org_id != 10206) {
  492. console.log('yyyyyyyy',scope);
  493. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  494. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  495. console.log(1)
  496. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  497. } else {
  498. console.log(12)
  499. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  500. }
  501. } else {
  502. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  503. console.log('123',scope.row.drug.dose,scope.row.execution_frequency,scope.row.drug.min_unit)
  504. // 单次用量single_dose,用量单位single_dose_unit,用法delivery_way,频率execution_frequency 总量prescribing_number,规格drug.dose
  505. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / parseInt(this.getdrugdose(scope.row.drug.dose)) ) // / scope.row.drug.dose
  506. } else {
  507. console.log(1234)
  508. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / parseInt(this.getdrugdose(scope.row.drug.dose)) / scope.row.drug.min_number)//
  509. }
  510. }
  511. if (scope.row.prescribing_number == 0) {
  512. scope.row.prescribing_number = 1
  513. }
  514. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  515. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  516. if (scope.row.drug.is_user != 1) {
  517. if (scope.row.prescribing_number > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  518. this.$message.error(scope.row.drug_name + '库存不足')
  519. }
  520. }
  521. } else {
  522. if (scope.row.drug.is_user != 1) {
  523. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  524. this.$message.error(scope.row.drug_name + '库存不足')
  525. }
  526. }
  527. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  528. }
  529. }
  530. },
  531. getPrescribingNumberUnit(scope) {
  532. if (scope.row.hasOwnProperty('is_medicine')&&scope.row.is_medicine == 1){
  533. this.$message.error('该处方包含已发药的药品,无法修改')
  534. return
  535. }
  536. console.log('scope',scope)
  537. // if(scope.row.drug.min_unit == scope.row.single_dose_unit){
  538. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  539. // scope.row.prescribing_number = scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day
  540. // }else{
  541. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency)) * scope.row.day / scope.row.drug.min_number)
  542. // }
  543. // }else{
  544. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  545. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose)
  546. // }else{
  547. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose / scope.row.drug.min_number)
  548. // }
  549. // }
  550. // if(scope.row.prescribing_number == 0){
  551. // scope.row.prescribing_number = 1
  552. // }
  553. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  554. scope.row.retail_price = scope.row.drug.min_price
  555. // if (scope.row.prescribing_number > scope.row.drug.total) {
  556. // this.$message.error(scope.row.drug_name + '库存不足')
  557. // }
  558. } else {
  559. // if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total) {
  560. // this.$message.error(scope.row.drug_name + '库存不足')
  561. // }
  562. scope.row.retail_price = scope.row.drug.retail_price
  563. }
  564. },
  565. changePrescribingNumber(scope) {
  566. // if (scope.row.hasOwnProperty('is_medicine')&&scope.row.is_medicine == 1){
  567. // this.$message.error('该处方包含已发药的药品,无法修改')
  568. // return
  569. // }
  570. // var max_number = 0
  571. // if(scope.row.prescribing_number_unit == scope.row.drug.max_unit){
  572. // max_number = parseInt(scope.row.prescribing_number) * scope.row.drug.min_number
  573. // }
  574. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  575. // max_number = parseInt(scope.row.prescribing_number)
  576. // }
  577. // console.log("修改的数量",max_number)
  578. // //查询该药品库存
  579. // if(this.drugList.length > 0){
  580. // var stock_number = 0
  581. // for(let i=0;i<this.drugList.length;i++){
  582. // if(scope.row.id == this.drugList[i].id){
  583. // for(let j=0;j<this.drugList[i].stock_in.length;j++){
  584. // stock_number += this.drugList[i].stock_in[j].stock_max_number * this.drugList[i].min_number + this.drugList[i].stock_in[j].stock_min_number
  585. // }
  586. // }
  587. // }
  588. // console.log("库存数量",stock_number)
  589. // }
  590. // if(scope.row.advice_id > 0){
  591. // //获取该药品上一次出库的的数量
  592. // getHisDoctorAdviceInfo(scope.row.advice_id).then(response=>{
  593. // if(response.data.state == 1){
  594. // var out_count = 0
  595. // var adviceList = response.data.data.advice
  596. // if(adviceList.prescribing_number_unit == adviceList.drug.max_number){
  597. // out_count = adviceList.prescribing_number * adviceList.drug.min_number
  598. // }
  599. // if(adviceList.prescribing_number_unit == adviceList.drug.min_unit){
  600. // out_count = adviceList.prescribing_number
  601. // }
  602. // //如果更改的数量大于修改之前的数量
  603. // if(max_number > out_count){
  604. // if((max_number - out_count)>stock_number){
  605. // this.$message.error(scope.row.drug_name + '库存不足')
  606. // }
  607. // }
  608. // }
  609. // })
  610. // }
  611. // if(scope.row.advice_id == 0){
  612. // if(max_number > stock_number){
  613. // this.$message.error(scope.row.drug_name + '库存不足')
  614. // }
  615. // }
  616. if(this.$store.getters.xt_user.org_id != 10206) {
  617. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  618. if (scope.row.drug.is_user != 1) {
  619. if (parseInt(scope.row.prescribing_number) > scope.row.drug.sum_count) {
  620. this.$message.error(scope.row.drug_name + '库存不足')
  621. }
  622. }
  623. } else {
  624. if (scope.row.drug.is_user != 1 && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  625. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  626. this.$message.error(scope.row.drug_name + '库存不足')
  627. }
  628. }
  629. }
  630. }
  631. },
  632. getProjectSingleDose(scope) {
  633. this.prescription.project[scope.$index].total = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.number_days ? scope.row.number_days : 1)
  634. if (this.prescription.project[scope.$index].total == 0) {
  635. this.prescription.project[scope.$index].total = 1
  636. }
  637. },
  638. getProjectDay(scope) {
  639. this.prescription.project[scope.$index].total = scope.row.single_dose * scope.row.number_days
  640. if (this.prescription.project[scope.$index].total == 0) {
  641. this.prescription.project[scope.$index].total = 1
  642. }
  643. },
  644. getNum(execution_frequency) {
  645. let arr = [
  646. { name: '立即执行', count: 1 },
  647. { name: '透析时', count: 1 },
  648. { name: '透析1h一次', count: 1 },
  649. { name: '透析2h一次', count: 1 },
  650. { name: '透析3h一次', count: 1 },
  651. { name: '每日一次', count: 12 },
  652. { name: '每日两次', count: 6 },
  653. { name: '每日三次', count: 4 },
  654. { name: '每晚一次', count: 1 },
  655. { name: '每晚', count: 1 },
  656. { name: '上机前', count: 1 },
  657. { name: '下机前', count: 1 },
  658. { name: '透析后立即', count: 1 },
  659. { name: '持续使用', count: 1 },
  660. { name: '临时开药', count: 1 },
  661. { name: '临睡前', count: 1 },
  662. { name: '隔日一次', count: 1 },
  663. { name: '隔三日一次', count: 1 },
  664. { name: '每二小时一次', count: 12 },
  665. { name: '每四小时一次', count: 6 },
  666. { name: '每六小时一次', count: 4 },
  667. { name: '每八小时一次', count: 3 }
  668. ]
  669. if(this.efs!=null && this.efs.length >0){
  670. for(let i=0;i<this.efs.length;i++){
  671. arr.push(this.efs[i])
  672. }
  673. }
  674. let num = ''
  675. arr.map(item => {
  676. if (item.name == execution_frequency) {
  677. num = item.count
  678. }
  679. })
  680. if (num == '') {
  681. num = 1
  682. }
  683. console.log("numerreerr",num)
  684. return num
  685. },
  686. getAllIndex(val){
  687. console.log("val",val)
  688. console.log("prescription.advices",this.prescription.advices)
  689. var obj = {id:0,day:"",delivery_way:"",execution_frequency:""}
  690. if(this.prescription.advices!=null && this.prescription.advices.length>0){
  691. for(let i=0;i<this.prescription.advices.length;i++){
  692. if(parseInt(val.groupno) == parseInt(this.prescription.advices[i].groupno) && parseInt(val.id)!= parseInt(this.prescription.advices[i].id)){
  693. console.log("this.prescription.advices[i]",this.prescription.advices[i])
  694. obj.id = val.id
  695. obj.day = this.prescription.advices[i].day
  696. obj.delivery_way = this.prescription.advices[i].delivery_way
  697. obj.execution_frequency = this.prescription.advices[i].execution_frequency
  698. console.log("-----------------",obj)
  699. } else
  700. if(parseInt(val.id)== parseInt(this.prescription.advices[i].id)){
  701. obj.id = val.id
  702. obj.day = this.prescription.advices[i].day
  703. obj.delivery_way = this.prescription.advices[i].delivery_way
  704. obj.execution_frequency = this.prescription.advices[i].execution_frequency
  705. }
  706. }
  707. }
  708. console.log("-----------------",obj)
  709. if(this.prescription.advices!=null && this.prescription.advices.length>0){
  710. for(let i=0;i<this.prescription.advices.length;i++){
  711. if(this.prescription.advices[i].id == parseInt(val.id)){
  712. console.log("进啦")
  713. this.prescription.advices[i].delivery_way = obj.delivery_way
  714. this.prescription.advices[i].execution_frequency =obj.execution_frequency
  715. this.prescription.advices[i].day = obj.day
  716. }
  717. }
  718. }
  719. console.log("hahhhahdhha",this.prescription.advices)
  720. },
  721. getdrugdose(val){
  722. if(val !=''){
  723. const arr = val.split(':')[1]
  724. console.log('yyyytrrrreee',arr);
  725. return arr
  726. }
  727. }
  728. }, mounted() {
  729. this.getInitData()
  730. },
  731. created(){
  732. console.log('prescription',this.prescription);
  733. },
  734. watch: {
  735. 'prescription.advices': {
  736. handler(newVal, oldVal) {
  737. console.log("检查我我我我",this.prescription)
  738. },
  739. deep: true
  740. }
  741. // "prescription.project":{
  742. // handler(newVal,oldVal){
  743. // newVal.map((item,index) => {
  744. // if(item.single_dose != oldVal[index].single_dose || item.number_days != oldVal[index].number_days){
  745. // item.total = item.single_dose * item.number_days
  746. // }
  747. // })
  748. // },
  749. // deep:true
  750. // }
  751. }
  752. }
  753. </script>
  754. <style lang="scss">
  755. .prescriptionTable {
  756. .el-input__inner {
  757. padding: 0 5px;
  758. }
  759. .additionalBox {
  760. margin-top: 20px;
  761. display: flex;
  762. flex-wrap: wrap;
  763. .additionalOne {
  764. margin-right: 20px;
  765. margin-bottom: 10px;
  766. display: flex;
  767. align-items: center;
  768. > span {
  769. white-space: nowrap;
  770. overflow: hidden;
  771. text-overflow: ellipsis;
  772. width: 80px;
  773. display: inline-block;
  774. font-size: 14px;
  775. }
  776. }
  777. .deleteIcon {
  778. color: red;
  779. margin-left: 5px;
  780. }
  781. }
  782. .el-table th .cell, .el-table td .cell {
  783. padding: 0 2px;
  784. white-space: pre-line;
  785. }
  786. .el-icon-delete {
  787. color: red;
  788. }
  789. }
  790. </style>