callPrescription.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <el-dialog
  3. :title="name"
  4. :visible.sync="isLastOrNextVisible"
  5. @close="hide"
  6. width="1010px"
  7. class="callPrescription"
  8. :modal-append-to-body="false"
  9. >
  10. <el-date-picker
  11. v-model="start_time"
  12. prefix-icon="el-icon-date"
  13. @change="changeTime"
  14. :editable="false"
  15. style="width: 150px;"
  16. type="date"
  17. :picker-options="pickerOptions"
  18. placeholder="选择日期时间"
  19. align="right"
  20. format="yyyy-MM-dd"
  21. value-format="yyyy-MM-dd"
  22. ></el-date-picker>
  23. <span class>-</span>
  24. <el-date-picker
  25. v-model="end_time"
  26. prefix-icon="el-icon-date"
  27. @change="changeEndTime"
  28. :editable="false"
  29. :picker-options="pickerOptions"
  30. style="width: 150px;"
  31. type="date"
  32. placeholder="选择日期时间"
  33. align="right"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd"
  36. ></el-date-picker>
  37. <div v-for="(item,index) in allPrescription" :key="index">
  38. <div class="quote" v-if="item.prescriptions.length > 0">引用 {{getTime(item.record_date, '{y}年{m}月{d}日')}} 的处方</div>
  39. <el-checkbox-group v-model="item.check_group">
  40. <div v-for="(subItem,index2) in item.prescriptions" :key="index2">
  41. <el-checkbox style="margin:10px 0;" :label="subItem.id">{{'处方' + (index2+ 1)}}</el-checkbox>
  42. <el-table v-if="subItem.type == 1" :data="subItem.doctor_advice" border style="width: 99%;"
  43. :row-style="{ color: '#303133' }"
  44. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  45. <el-table-column align="center" type="index" width="60" label="序号"></el-table-column>
  46. <el-table-column align="center" prop="drug_name" width="160" label="名称">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.advice_name }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column align="center" prop="single_dose" width="90" label="单次用量">
  52. <template slot-scope="scope">
  53. <div>{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  57. <template slot-scope="scope">
  58. {{scope.row.delivery_way}}
  59. </template>
  60. </el-table-column>
  61. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  62. <template slot-scope="scope">
  63. {{scope.row.execution_frequency}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column align="center" prop="day" width="60" label="天数">
  67. <template slot-scope="scope">
  68. {{scope.row.day}}
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="prescribing_number" width="100" label="总量">
  72. <template slot-scope="scope">
  73. <div>{{scope.row.prescribing_number}} {{scope.row.prescribing_number_unit}}</div>
  74. </template>
  75. </el-table-column>
  76. <el-table-column align="center" prop="retail_price" width="80" label="单价">
  77. <template slot-scope="scope">
  78. <div>{{scope.row.retail_price}}</div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column align="center" prop="remark" label="备注">
  82. <template slot-scope="scope">
  83. <div>{{scope.row.remark}}</div>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <el-table v-if="subItem.type == 2" :data="subItem.project" border style="width: 99%;"
  88. :row-style="{ color: '#303133' }"
  89. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  90. <el-table-column align="center" type="index" width="60" label="序号"></el-table-column>
  91. <el-table-column align="center" prop="project_name" width="160" label="名称">
  92. <template slot-scope="scope">
  93. <span>{{ scope.row.project.project_name }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column align="center" prop="statistical_classification" width="100" label="组">
  97. <template slot-scope="scope">{{getGroup(scope.row.statistical_classification)}}</template>
  98. </el-table-column>
  99. <el-table-column align="center" prop="single_dose" width="90" label="单次用量">
  100. <template slot-scope="scope">
  101. <!--<el-input v-model="scope.row.single_dose" placeholder=""></el-input>-->
  102. <span>{{ scope.row.single_dose }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  106. <template slot-scope="scope">
  107. <!--<el-input v-model="scope.row.delivery_way" placeholder=""></el-input>-->
  108. <span>{{ scope.row.delivery_way }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  112. <template slot-scope="scope">
  113. <!--<el-input v-model="scope.row.execution_frequency" placeholder=""></el-input>-->
  114. <span>{{ scope.row.execution_frequency }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column align="center" prop="number_days" width="70" label="天数">
  118. <template slot-scope="scope">
  119. <!--<el-input v-model="scope.row.number_days" placeholder=""></el-input>-->
  120. <span>{{ scope.row.number_days }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" prop="total" width="70" label="总量">
  124. <template slot-scope="scope">
  125. <div>{{ scope.row.total }}{{scope.row.unit}}</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" prop="name" width="60" label="单价">
  129. <template slot-scope="scope">
  130. <!--<el-input v-model="scope.row.price" placeholder="" readonly></el-input>-->
  131. <span>{{ scope.row.price }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column align="center" prop="name" label="备注">
  135. <template slot-scope="scope">
  136. <!--<el-input v-model="scope.row.remark" :title="scope.row.remark"></el-input>-->
  137. <span>{{ scope.row.remark }}</span>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. </div>
  142. </el-checkbox-group>
  143. </div>
  144. <div slot="footer" class="dialog-footer">
  145. <el-button @click="isLastOrNextVisible = false">取 消</el-button>
  146. <el-button type="primary" @click="save">保存</el-button>
  147. </div>
  148. </el-dialog>
  149. </template>
  150. <script>
  151. import { uParseTime } from '@/utils/tools'
  152. import { getDictionaryDataConfig} from "@/utils/data";
  153. import {
  154. getCallHisPrescription
  155. } from '@/api/his/his'
  156. export default {
  157. name: "callPrescription",
  158. data() {
  159. return {
  160. start_time:"",
  161. end_time:"",
  162. srcPrescriptions:[],
  163. name:"",
  164. request_record_date:'',
  165. patient_id:0,
  166. allPrescription: [],
  167. isLastOrNextVisible: false,
  168. }
  169. }, methods: {
  170. changeTime(){
  171. let params={
  172. patient_id:this.patient_id,
  173. start_time: this.start_time,
  174. end_time:this.end_time
  175. }
  176. this.GetCallHisPrescription(params)
  177. },changeEndTime(){
  178. let params={
  179. patient_id:this.patient_id,
  180. start_time: this.start_time,
  181. end_time:this.end_time
  182. }
  183. this.GetCallHisPrescription(params)
  184. },
  185. GetCallHisPrescription(params){
  186. getCallHisPrescription(params).then(response => {
  187. if (response.data.state == 1) {
  188. this.allPrescription = response.data.data.prescriptions
  189. for (let i = 0; i < this.allPrescription.length; i++){
  190. this.allPrescription[i].check_group = []
  191. }
  192. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  193. } else {
  194. this.$message.error(response.data.msg)
  195. }
  196. })
  197. },
  198. save() {
  199. let replace_one = []
  200. let replace_two = []
  201. let checkGroup = []
  202. let allPrescriptions = []
  203. let targetPrescriptions = []
  204. let prescriptions = []
  205. for (let i = 0; i < this.allPrescription.length; i++) {
  206. for (let a = 0; a < this.allPrescription[i].check_group.length; a++) {
  207. checkGroup.push(this.allPrescription[i].check_group[a])
  208. }
  209. for (let a = 0; a < this.allPrescription[i].prescriptions.length; a++) {
  210. allPrescriptions.push(this.allPrescription[i].prescriptions[a])
  211. }
  212. }
  213. for (let i = 0; i < allPrescriptions.length; i++){
  214. for (let a = 0; a < checkGroup.length; a++){
  215. if(allPrescriptions[i].id == checkGroup[a]){
  216. targetPrescriptions.push(allPrescriptions[i])
  217. }
  218. }
  219. }
  220. if (targetPrescriptions.length > 0) {
  221. for (let i = 0; i < targetPrescriptions.length; i++) {
  222. var prescription = targetPrescriptions[i]
  223. let tempAdvice = []
  224. let tempProject = []
  225. let tempAddition = []
  226. for (let b = 0; b < prescription.doctor_advice.length; b++) {
  227. let obj = {
  228. advice_id: prescription.doctor_advice[b].id,
  229. drug_name: prescription.doctor_advice[b].advice_name,
  230. single_dose: prescription.doctor_advice[b].single_dose,
  231. delivery_way: prescription.doctor_advice[b].delivery_way,
  232. execution_frequency: prescription.doctor_advice[b].execution_frequency,
  233. retail_price: prescription.doctor_advice[b].price.toString(),
  234. remark: prescription.doctor_advice[b].remark,
  235. day:prescription.doctor_advice[b].day,
  236. prescribing_number:prescription.doctor_advice[b].prescribing_number.toString(),
  237. single_dose_unit:prescription.doctor_advice[b].single_dose_unit,
  238. prescribing_number_unit:prescription.doctor_advice[b].prescribing_number_unit,
  239. medical_insurance_number:prescription.doctor_advice[b].med_list_codg,
  240. id:prescription.doctor_advice[b].drug_id
  241. }
  242. tempAdvice.push(obj)
  243. }
  244. for (let b = 0; b < prescription.project.length; b++) {
  245. let obj = {
  246. id: prescription.project[b].id,
  247. project_id: prescription.project[b].project_id,
  248. project_name: prescription.project[b].project.project_name,
  249. statistical_classification: prescription.project[b].project.statistical_classification,
  250. single_dose: prescription.project[b].single_dose,
  251. delivery_way: prescription.project[b].delivery_way,
  252. execution_frequency: prescription.project[b].execution_frequency,
  253. number_days: prescription.project[b].day,
  254. total:prescription.project[b].count.toString(),
  255. price:prescription.project[b].price,
  256. remark:prescription.project[b].remark,
  257. medical_code:prescription.project[b].project.medical_code,
  258. }
  259. tempProject.push(obj)
  260. }
  261. let obj = {
  262. id: 0,
  263. advices: tempAdvice,
  264. project: tempProject,
  265. addition:tempAddition,
  266. order_status:0,
  267. }
  268. prescriptions.push(obj)
  269. }
  270. }
  271. if(this.srcPrescriptions.length == 1){
  272. if(this.srcPrescriptions[0].advices.length == 0 && this.srcPrescriptions[0].project.length == 0){
  273. this.srcPrescriptions = []
  274. this.srcPrescriptions = prescriptions
  275. this.$emit('call', this.srcPrescriptions)
  276. }else{
  277. this.srcPrescriptions = this.srcPrescriptions.concat(prescriptions)
  278. this.$emit('call', this.srcPrescriptions)
  279. }
  280. }else{
  281. this.srcPrescriptions = this.srcPrescriptions.concat(prescriptions)
  282. this.$emit('call', this.srcPrescriptions)
  283. }
  284. },show(name,id,end_time, start_time,srcPrescriptions,prescriptions){
  285. this.srcPrescriptions = srcPrescriptions
  286. this.start_time = start_time
  287. this.end_time = end_time
  288. this.patient_id = id
  289. this.name = '处方调用' + '('+name +')'
  290. this.allPrescription = prescriptions
  291. for (let i = 0; i < this.allPrescription.length; i++){
  292. this.allPrescription[i].check_group = []
  293. }
  294. this.isLastOrNextVisible = true
  295. },close(){
  296. this.isLastOrNextVisible = false
  297. },hide(){
  298. this.$emit('callCancel')
  299. },getTime(time, template){
  300. return uParseTime(time,template)
  301. }, getGroup(id){
  302. var name = ""
  303. var statistics_category = getDictionaryDataConfig('system','statistics_category')
  304. for(let i=0;i<statistics_category.length;i++){
  305. if(id == statistics_category[i].id){
  306. name = statistics_category[i].name
  307. }
  308. }
  309. return name
  310. }, getDictionaryDataConfig(module, filed_name) {
  311. return getDictionaryDataConfig(module, filed_name)
  312. },
  313. }
  314. }
  315. </script>
  316. <style lang="scss">
  317. .callPrescription{
  318. .el-dialog__body{
  319. padding:0px 20px 30px;
  320. }
  321. .quote{
  322. margin-top: 10px;
  323. font-size: 14px;
  324. }
  325. }
  326. </style>