new_recover.html 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>新建计划</title>
  6. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  7. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  10. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet">
  11. <link rel="stylesheet" type="text/css" href="../../../css/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/new_recover.css" />
  13. <script src="../../../js/esModule.js" type="text/javascript"></script>
  14. <style>
  15. .c-row{
  16. width: 100%;
  17. }
  18. </style>
  19. </head>
  20. <body class="m0">
  21. <div id="app" v-cloak>
  22. <div class="c-position-a" style="top: -999px; left: -999px;" v-show="isTest"></div>
  23. <div class="c-h100 clearfix">
  24. <div class="fl c-h100 w400 person_info c-border-r" style="overflow: hidden;">
  25. <div v-if="!patiInfo" class="c-h100" style="overflow: auto;">
  26. <div class="c-border-b c-t-center pt20">
  27. <div class="set-photo imgw80">
  28. <img src="../../../images/p-female.png" alt="居民头像" />
  29. </div>
  30. <p class="ptb10">患者名</p>
  31. </div>
  32. <div>
  33. <div class="no-result c-t-center pt20">
  34. <img src="../images/wushuju01_img.png" alt="无数据" />
  35. <p class="c-999">暂无相关信息</p>
  36. <div class="pt30">
  37. <span class="c-fff btn cur-pit plr10 ptb5 bgc-12b7f5 b-r-3" @click="selectPatient()">同步信息</span>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div v-else class="c-h100 plr10" style="overflow: auto;">
  43. <div class="c-t-center pt20 c-position-r">
  44. <div class="set-photo imgw80">
  45. <img :src="setPatImg(patiInfo.photo)" alt="居民头像" />
  46. </div>
  47. <h3 class="ptb10 m0 c-f16">{{patiInfo.name}}</h3>
  48. <span v-if="!isEditConfig" class="c-position-a set-qiehuan cur-pit" @click="selectPatient()"></span>
  49. </div>
  50. <h4 class="h30 m0 c-f14 c-border-b f-w500">基本信息</h4>
  51. <ul class="c-333 m0 p0 pb20">
  52. <li class="pt10"><span class="c-999">性&emsp;&emsp;别:</span>{{patiInfo.sex == 1 ? "男" : "女"}}</li>
  53. <li class="pt10"><span class="c-999">年&emsp;&emsp;龄:</span>{{patiInfo.age}}岁</li>
  54. <li class="pt10"><span class="c-999">身份证号:</span>{{patiInfo.idcard}}</li>
  55. <li class="pt10"><span class="c-999">地&emsp;&emsp;址:</span>{{patiInfo.address}}</li>
  56. </ul>
  57. <h4 class="h30 m0 c-f14 c-border-b f-w500">家庭医生</h4>
  58. <ul class="c-333 m0 p0 pb20">
  59. <li class="pt10"><span class="c-999">签约社区:</span>{{patiInfo.ssHospitalName || patiInfo.jtHospitalName}}</li>
  60. <li class="pt10"><span class="c-999">全科医生:</span>{{patiInfo.ssDoctorName || patiInfo.jtDoctorName}}</li>
  61. <li class="pt10"><span class="c-999">健&ensp;管&ensp;师:</span>{{patiInfo.ssDoctorHealthName || patiInfo.jtDoctorHealthName}}</li>
  62. </ul>
  63. <h4 class="h30 m0 c-f14 c-border-b f-w500" style="overflow: hidden;">
  64. 康复建议
  65. <span v-if="!isEditConfig" class="click-text" @click="editAdviceTextarea">
  66. {{isEdit == true? '编辑':'保存'}}
  67. </span>
  68. </h4>
  69. <textarea v-bind:disabled="isEdit||isEditConfig" v-model="adviceContent" class="m0 p10 c-333 mt10" :class="{'bg-f5f5fa':isEdit, 'bd-red':showAdviceContentTip}" style="width: 100%;height: 200px; width: 100%; border:1px solid #e1e1e1; resize:none;" placeholder="请输入您的康复建议..."></textarea>
  70. <h4 class="h30 m0 c-f14 c-border-b f-w500" style="overflow: hidden;">
  71. 住院病历
  72. </h4>
  73. <div v-if="medicalRecordsList.length>0" v-for="(o, i) in medicalRecordsList" class="mt10">
  74. <div class="flex vc c-f14 c-border plr10 ptb5 link-control" style="cursor: pointer;" @click="editMedicalRecords(o, i)" :class="{'bd-12b7f5': curMedicalRecordsIndex==i}">
  75. <span class="c-666 mr15">
  76. {{formatter(o.admissionTime||o.createTime)}}
  77. </span>
  78. <div class="flex1 c-12b7f5 ellipsis-1">
  79. {{o.hospitalName}}
  80. </div>
  81. </div>
  82. </div>
  83. <div v-if="!isEditConfig&&medicalRecordsList.length==0" class="ui-grid">
  84. <button type="button" class="ui-col-1 btn btn-default fr mr5" style="width: 100%; background: #12B7F5; border-radius: 0px ;border: 0px ;padding: 10px;margin-top: 15px;" @click="comMedicalRecords()">同步病历</button>
  85. <button type="button" class="ui-col-1 btn btn-default fr ml5" style="width: 100%; background: #12B7F5; border-radius: 0px ;border: 0px ;padding: 10px;margin-top: 15px;" @click="addMedicalRecords()">手动上传</button>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="fl c-h100 w-100-400">
  90. <div class="c-h100 plr5" v-if="!isPlan&&!isEditConfig">
  91. <h4 class="m0 pl15 lh40 c-border-b f-w500 c-position-r"><span class="c-position-a set-blue-span"></span>配置康复计划</h4>
  92. <div style="overflow: hidden; height: calc(100% - 41px);">
  93. <div style="overflow: auto; height: 100%;">
  94. <div class="un-select c-t-center pt45" v-if="!patiInfo">
  95. <img src="../images/wushuju_img.png" alt="" />
  96. <p class="c-999">您还没有选择居民</p>
  97. </div>
  98. <ul class="muban_con lh40 c-t-center pt30" v-else>
  99. <li class="mb20" v-for="(muban, index) in mubanList" :key="index" @click="addMuban(muban.id)">{{muban.title}}</li>
  100. <li class="addmuban-btn c-fff" @click="addMuban()">新增模板</li>
  101. </ul>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="clearfix c-h100" v-else>
  106. <div class="fl c-h100" :class="{'c-row':isEditConfig, 'w-100-400':!isEditConfig}">
  107. <div class="plr5 c-h100-79">
  108. <h4 class="m0 pl15 lh40 c-border-b set-label f-w500 c-position-r">
  109. <em class="c-position-a set-blue-span"></em>
  110. 配置康复计划
  111. <!-- <span v-for="(label, index) in spanLabel" :key="index" class="fr ml20 pl20 c-f14 c-999 cur-pit" :class="{'active': index == labelIndex}" @click="setLabelIndex(index, label)">{{label.labelName}}</span> -->
  112. </h4>
  113. <div class="c-h100-41" style="overflow: hidden;">
  114. <ul class="c-h100 p0 m0" style="overflow: auto;">
  115. <li class="mt10 plr10 ptb5 c-border b-r-3 clearfix" v-for="(detail, index) in templateDetail" :key="index">
  116. <div v-if="detail.code=='2'||detail.code=='3'">
  117. <div class="fl w-100-78 c-333">
  118. <p :class='detail.isTimeSame ? "m0 p0 mb10 txt-ells cur-pit c-red" : "m0 p0 mb10 txt-ells cur-pit"'>{{detail.name}}</p>
  119. <div class="clearfix">
  120. <p class="w400 m0 mb10 p0 fl"><span class="c-999">医&emsp;&emsp;院:</span>{{docInfo.hospitalName}}</p>
  121. <p class="m0 p0 mb10 fl"><span class="c-999">费&emsp;&emsp;用:</span>0.00</p>
  122. </div>
  123. <div class="m0 p0 clearfix">
  124. <div class="w400 m0 mb10 p0 fl clearfix">
  125. <span class="fl c-999">选择频次:</span>
  126. <div class="fl c-position-r w100">
  127. 不限频次
  128. </div>
  129. </div>
  130. </div>
  131. <div class="clearfix">
  132. <span class="fl c-999">备&emsp;&emsp;注:</span>
  133. <div class="fl maxw600 plr15 ptb10 c-border set-textarea">
  134. <textarea placeholder="不补充说明特殊用法、方式" v-model="detail.remark" name="" rows="" cols=""></textarea>
  135. </div>
  136. </div>
  137. </div>
  138. <div class='fr w60 c-t-right clearfix'>
  139. <div class="clearfix mb10"><span class="fr sub-tap cur-pit" @click="subTemplate(index, detail)"></span></div>
  140. </div>
  141. </div>
  142. <div v-else>
  143. <div class="fl w-100-78 c-333">
  144. <p :class='detail.isTimeSame ? "m0 p0 mb10 txt-ells cur-pit c-red" : "m0 p0 mb10 txt-ells cur-pit"'>{{detail.name}}</p>
  145. <div class="clearfix">
  146. <p class="w400 m0 mb10 p0 fl"><span class="c-999">医&emsp;&emsp;院:</span>{{detail.executeHospitalName}}</p>
  147. <p class="m0 p0 mb10 fl"><span class="c-999">费&emsp;&emsp;用:</span>0.00</p>
  148. </div>
  149. <div class="m0 p0 clearfix">
  150. <div class="w400 m0 mb10 p0 fl clearfix">
  151. <span class="fl c-999">选择频次:</span>
  152. <div class="fl c-position-r custom-dropdown">
  153. <p class="m0 p0 plr10 c-border cur-pit set-xia" :class="{'set-shang':detail.selectFre}" @click="changeSelectFre(index, detail.selectFre)">{{detail.frequencyName}}</p>
  154. <ul class="m0 p0 c-border-b c-border-l c-border-r c-position-a doc_list" v-if="detail.selectFre" style="overflow-y: auto; height: 100px;">
  155. <li class="plr10 c-border-t cur-pit" v-for="(list, indDoc) in detail.frequencyList" :key="indDoc" @click="selectFre(index, list)">{{list.name}}</li>
  156. </ul>
  157. </div>
  158. </div>
  159. <div v-if="detail.frequencyName!='不限频次'" class="m0 mb10 p0 fl clearfix">
  160. <span class="fl c-999">执行人员:</span>
  161. <div class="fl c-position-r custom-dropdown">
  162. <p class="m0 p0 plr10 c-border cur-pit set-xia" :class="{'set-shang':detail.selectDoc}" @click="changeSelectDoc(index, detail.selectDoc)">{{detail.executeDoctorName}}</p>
  163. <ul class="m0 p0 c-border-b c-border-l c-border-r c-position-a doc_list" v-if="detail.selectDoc" style="overflow-y: auto; max-height: 100px;">
  164. <li class="plr10 c-border-t cur-pit" v-for="(list, indDoc) in detail.docList" :key="indDoc" @click="selectLi(index, list)">{{list.name}}</li>
  165. </ul>
  166. </div>
  167. </div>
  168. </div>
  169. <div v-if="detail.frequencyName!='不限频次'" class="pl65 mb10 set-label" v-if="detail.frequency.unit == 'H'">
  170. <span :class="detail.timeType == 1 ? 'pl20 mr5 cur-pit active' : 'pl20 mr5 cur-pit'" @click="selectTimeType(index, 1)">白天</span>
  171. <span :class="detail.timeType == 2 ? 'pl20 mr5 cur-pit active' : 'pl20 mr5 cur-pit'" @click="selectTimeType(index, 2)">晚上</span>
  172. <span :class="detail.timeType == 0 ? 'pl20 cur-pit active' : 'pl20 cur-pit'" @click="selectTimeType(index, 0)">全天</span>
  173. </div>
  174. <div v-if="detail.frequencyName!='不限频次'">
  175. <div class="clearfix">
  176. <span class="fl c-999 lh24">起始时间:</span>
  177. <div class="fl maxw600 mb10">
  178. <el-date-picker v-model="detail.value14[0]" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" :picker-options="pickerOptions1" @input="getRandgeDate(index, 0)">
  179. </el-date-picker>
  180. <span>—</span>
  181. <el-date-picker v-model="detail.value14[1]" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" :picker-options="pickerOptions1" @input="getRandgeDate(index, 1)">
  182. </el-date-picker>
  183. </div>
  184. </el-date-picker>
  185. <span class="fl lh24 mlr10 c-999">或</span>
  186. <div class="fl maxw600 mb10">
  187. <el-date-picker type="dates" :picker-options="pickerOptions1" v-model="detail.value15" value-format="yyyy-MM-dd" @input="getSelectDate(index)" placeholder="选择一个或者多个日期"></el-date-picker>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="clearfix">
  192. <span class="fl c-999">备&emsp;&emsp;注:</span>
  193. <div class="fl maxw600 plr15 ptb10 c-border set-textarea">
  194. <textarea placeholder="不补充说明特殊用法、方式" v-model="detail.remark" name="" rows="" cols=""></textarea>
  195. </div>
  196. </div>
  197. </div>
  198. <div class='fr w60 c-t-right clearfix'>
  199. <p v-if="detail.frequencyCode" class="m0 p0 mb10">×{{mul(detail.executeTime.length, detail.frequency.count)}}</p>
  200. <div v-if="detail.frequencyCode" class="clearfix mb10"><span class="fr sub-tap cur-pit" @click="subTemplate(index, detail)"></span></div>
  201. <div v-if="detail.frequencyCode" class="clearfix"><span class="fr fuzhi-tap cur-pit" @click="copyTemplate(index, detail)"></span></div>
  202. </div>
  203. </div>
  204. </li>
  205. <li class="pt100 c-t-center" v-if="!templateDetail.length">
  206. <span class="set-right-arraw pr20">请在右侧“服务项”列表中选择</span>
  207. </li>
  208. </ul>
  209. </div>
  210. </div>
  211. <div>
  212. <p class="m0 p0 pl20 ptb10 c-border-b set-label">支付方式:<span class="ml10 pl20 active">按服务支付</span><em class="c-red ml20">(按选择支付方式完成收费)</em></p>
  213. <div class="pl20 lh40">总费用:
  214. <span class="c-red c-f16">¥{{allFee}}</span>
  215. <span v-if="!isEditConfig" class="fr lh30 cur-pit plr15 c-t-center c-fff" :class="havePlan ? 'bgc-12b7f5' : 'bgc-d7dce6'" @click="createRehabilitationPlan()">生成计划</span>
  216. <span v-else class="fr lh30 cur-pit plr15 c-t-center c-fff" :class="havePlan ? 'bgc-12b7f5' : 'bgc-d7dce6'" @click="updateRehabilitationPlan()">完成编辑</span>
  217. <span class="fr lh30 cur-pit plr15 c-t-center bgc-green c-fff" @click="canclePlan()">取消</span>
  218. </div>
  219. </div>
  220. </div>
  221. <div v-if="!isEditConfig" class="fr w400 c-h100 c-border-l">
  222. <div class="plr5 c-h100">
  223. <h4 class="m0 pl15 lh40 c-border-b c-position-r f-w500">
  224. <em class="c-position-a set-blue-span"></em>添加其他项目
  225. </h4>
  226. <div class="clearfix mtb10 c-border">
  227. <input class="fl search-input plr10" type="text" v-model="searchKey" placeholder="输入项目名称" />
  228. <span class="fr search-btn" @click="searchProject()"></span>
  229. </div>
  230. <div class="c-h100-99" style="overflow: hidden;">
  231. <div class="c-h100 p0 m0" style="overflow: auto;">
  232. <ul class="p0 m0 pr10">
  233. <li v-for="(o, i) in serviceItems" :key="i" class="clearfix ptb5">
  234. <!-- @click="selectProject(i, o)" -->
  235. <div class="fl c-border w-100-66 cur-pit border-c12b7f5 ptb5 plr5 b-r-3 clearfix" :class="o.isSelect ? 'bgc-12b7f5' : 'bgc-fff'">
  236. <p class="fl w-100-78 txt-ells lh18" :class="o.isSelect ? 'c-fff' : 'c-666'">{{o.name}}</p>
  237. </div>
  238. <span class="fr h30 btn cur-pit plr10 bgc-12b7f5 c-fff b-r-3" style="padding: 0 10px;" v-if="!o.isSelect" @click="addProject(i, o)">添加</span>
  239. <span class="fr h30 btn plr10 bgc-e1e1e1 c-fff b-r-3" style="padding: 0 10px;" v-else>添加</span>
  240. </li>
  241. </ul>
  242. </div>
  243. </div>
  244. <!-- <div class="c-h100-99" style="overflow: hidden;">
  245. <ul class="c-h100 p0 m0" style="overflow: auto;">
  246. <li v-for="(project1, index) in projectList" :key="index">
  247. <h4 class="set-arrow c-f14 h30 p0 m0 pl20 f-w500 cur-pit" :class="{'active': index == proIndex1}" @click="selectPro(1, index)">{{project1.itemType == 1 ? '诊疗服务' : '健康服务'}}</h4>
  248. <ul class="c-h100 p0 m0 pl10" v-if="index == proIndex1">
  249. <li v-for="(project2, index2) in project1.item" :key="index2">
  250. <p class="set-arrow h30 c-f14 pl20 m0 c-333 cur-pit" :class="{'active': index2 == proIndex2}" @click="selectPro(2, index2)">{{project2.itemName}}</p>
  251. <ul class="p0 m0 pr10" v-if="index2 == proIndex2">
  252. <li v-for="(project3, index3) in project2.hospitalServiceItems" :key="index3" class="clearfix ptb5">
  253. <div class="fl c-border w-100-66 cur-pit border-c12b7f5 ptb5 plr5 b-r-3 clearfix" :class="project3.isSelect ? 'bgc-12b7f5' : 'bgc-fff'" @click="selectProject(index, index2, index3, project3)">
  254. <p class="fl w-100-78 txt-ells lh18" :class="project3.isSelect ? 'c-fff' : 'c-666'">{{project3.specialistServiceItemDO.title}}</p>
  255. <span class="fr lh18 b-r-3 c-f12 ml5 bgc-4dcd70 plr5 c-fff" v-if="project3.flag == 1 || project3.flag == 3">社区</span>
  256. <span class="fr lh18 b-r-3 c-f12 ml5 bgc-55cefc plr5 c-fff" v-if="project3.flag == 2 || project3.flag == 3">医院</span>
  257. </div>
  258. <span class="fr h30 btn cur-pit plr10 bgc-12b7f5 c-fff b-r-3" style="padding: 0 10px;" v-if="!project3.isSelect" @click="addProject(index, index2, index3, project3)">添加</span>
  259. <span class="fr h30 btn plr10 bgc-e1e1e1 c-fff b-r-3" style="padding: 0 10px;" v-else>添加</span>
  260. </li>
  261. </ul>
  262. </li>
  263. </ul>
  264. </li>
  265. </ul>
  266. </div> -->
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  274. <script src="../../../js/jquery-2.2.4.js"></script>
  275. <script src="../../../plugins/layer/layer.min.js"></script>
  276. <script src="../../../plugins/toastr/toastr.min.js"></script>
  277. <script src="../../../js/bootstrap.min.js"></script>
  278. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  279. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  280. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  281. <script src="../../../js/element-ui.js" type="text/javascript" charset="utf-8"></script>
  282. <script src="../../../api/http-request.js" type="text/javascript"></script>
  283. <script src="../../../api/recover_api.js" type="text/javascript"></script>
  284. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  285. <script type="text/javascript">
  286. var doctorType = (JSON.parse(window.localStorage.getItem('wlyyAgent'))||{}).doctorType,
  287. docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  288. console.log('docInfodocInfodocInfodocInfo', docInfo)
  289. var httpData=GetRequest()
  290. function showSuccessMessage(msg) {
  291. layer.msg(msg, {
  292. icon: 1
  293. })
  294. }
  295. function showErrorMessage(msg) {
  296. layer.msg(msg, {
  297. icon: 5
  298. })
  299. }
  300. function showWarningMessage(msg) {
  301. layer.msg(msg, {
  302. icon: 2
  303. })
  304. }
  305. function showInfoMessage(msg) {
  306. layer.msg(msg, {
  307. icon: 6
  308. })
  309. }
  310. top.recoverVue = new Vue({
  311. el: "#app",
  312. data: {
  313. pickerOptions1: {
  314. disabledDate: function(time) {
  315. return time.getTime() < Date.now() - 8.64e7;
  316. }
  317. },
  318. surefont: '添加',
  319. isTest: false,
  320. pati: null,
  321. isPlan: false,
  322. proIndex1: null,
  323. proIndex2: null,
  324. patiInfo: null,
  325. diseaseObj: null, // 疾病
  326. mubanList: [],
  327. templateDetail: [],
  328. templateResult: [],
  329. allFee: 0,
  330. projectList: null,
  331. serviceItems: null, // 服务项列表
  332. labelIndex: 2,
  333. labelCode: 1,
  334. spanLabel: [{
  335. labelName: "(转)家庭病床",
  336. code: 3
  337. }, {
  338. labelName: "(转)社区医院",
  339. code: 2
  340. }, {
  341. labelName: "康复计划",
  342. code: 1
  343. }],
  344. jDlist: [], //家签医生
  345. zDlist: [], //专科医生
  346. selectProjectDetail: null,
  347. searchKey: null,
  348. havePlan: false,
  349. frequencyList: [],
  350. frequencyListObj: {},
  351. diagnosisInfo:"",
  352. indexOrder:0,
  353. profileRes:[],
  354. nodata:false,
  355. subsidiaryInfo:{},
  356. edit:true,
  357. selectDiseaseIndex:'',
  358. isPlanId :'',
  359. selectPatientIndex: '',
  360. adviceContent: '', //康复建议
  361. isEdit: false,
  362. medicalRecordsList: [],
  363. docInfo: JSON.parse(window.localStorage.getItem('wlyyAgent')),
  364. showAdviceContentTip: false,
  365. curMedicalRecordsIndex: -1,
  366. healthCodeArr: [],
  367. diseaseCodeArr: [],
  368. diseaseNameArr: [],
  369. teamCode: httpData['teamCode'],
  370. isEditConfig: httpData['isEditConfig']||false,
  371. planId: httpData['planId'],
  372. planInfo: {},
  373. planDetailId: httpData['planDetailId'],
  374. service:{
  375. relationRecordImg:{},
  376. messageList:{},
  377. },
  378. patient: httpData.patient || undefined
  379. },
  380. mounted: function() {
  381. debugger
  382. this.selectFrequencys()
  383. if(this.patient) {
  384. this.isPlan = false
  385. this.allFee = 0
  386. this.templateDetail = []
  387. this.pati = {patient: this.patient}
  388. this.getPatientInfo()
  389. }
  390. if(this.teamCode){
  391. this.findTemplateList()
  392. }
  393. if(this.planId){
  394. this.planSchedule()
  395. }
  396. },
  397. watch: {
  398. adviceContent: function(){
  399. var vm = this
  400. if(vm.adviceContent.trim().length>0){
  401. vm.showAdviceContentTip = false
  402. } else {
  403. vm.showAdviceContentTip = true
  404. }
  405. },
  406. templateDetail: function(){
  407. if(this.templateDetail.length==0){
  408. this.havePlan = false
  409. }else{
  410. this.havePlan = true
  411. }
  412. }
  413. },
  414. methods: {
  415. getServiceItem: function() {
  416. var vm = this;
  417. var loadding = top.layer.load(0, {
  418. shade: false
  419. }); //0代表加载的风格,支持0-2
  420. rehaAPI.serviceItem({
  421. planDetailId: vm.planDetailId
  422. }).then(function(res) {
  423. top.layer.close(loadding);
  424. if(res.status == 200) {
  425. vm.service = res.data;
  426. var o1 = {}
  427. o1.isSelect = true
  428. o1.selectDoc = false
  429. o1.selectDate = 1
  430. o1.value14 = []
  431. o1.value15 = null
  432. o1.executeTime = []
  433. // 默认频次
  434. o1.selectFre = false
  435. if(vm.service.frequencyCode!=''){
  436. o1.frequencyCode = vm.service.frequencyCode
  437. o1.frequencyName = vm.frequencyListObj[vm.service.frequencyCode]
  438. o1.frequency = vm.frequencyList[1]
  439. } else {
  440. o1.frequencyCode = ''
  441. o1.frequencyName = '不限频次'
  442. o1.frequency = vm.frequencyList[0]
  443. }
  444. o1.frequencyList = vm.frequencyList
  445. o1.timeType = 0
  446. o1.remark = vm.service.remark
  447. o1.executeDoctor = vm.service.executeDoctorCode
  448. o1.executeDoctorName = vm.service.executeDoctorName
  449. o1.executeHospitalName = vm.service.hospitalName
  450. o1.docList = vm.jDlist
  451. o1.code = vm.service.type
  452. o1.name = vm.service.title
  453. vm.templateDetail.push(o1)
  454. vm.judgeHavePlan()
  455. } else {
  456. showErrorMessage(res.msg)
  457. }
  458. })
  459. },
  460. //获取计划表
  461. planSchedule:function(){
  462. var vm = this;
  463. var params = {
  464. planId: this.planId,
  465. patientCode: this.patient
  466. };
  467. rehaAPI.planSchedule(params).then(function(res){
  468. if(res.status == 200){
  469. vm.planInfo = res.data;
  470. vm.adviceContent = vm.planInfo.adviceContent
  471. vm.selectByMedicalCode(res.data.medicalRecordsCode)
  472. }else{
  473. showErrorMessage(res.msg)
  474. }
  475. })
  476. },
  477. // 获取住院病历列表
  478. selectByMedicalCode: function(medicalRecordsCode){
  479. var vm = this;
  480. var params = {
  481. medical: medicalRecordsCode
  482. };
  483. rehaAPI.selectByMedicalCode(params).then(function(res){
  484. if(res.status==200){
  485. vm.medicalRecordsList = res.data
  486. }else {
  487. showErrorMessage(res.msg);
  488. }
  489. })
  490. },
  491. comMedicalRecords:function(record,isEdit){
  492. var vm = this
  493. var loading = layer.load(0, {shade: false})
  494. var event=record&&record.event?record.event:""
  495. if(!isEdit){
  496. isEdit = ""
  497. }
  498. recoverAPI.getPatientAccetokenByIdcard({idcard:vm.pati.idcard}).then(function(res){
  499. layer.close(loading)
  500. if(res.status==200){
  501. this.selectPatientIndex = layer.open({
  502. type: 2,
  503. area: ['75%', '650px'],
  504. shade: 0.5,
  505. title: '住院病历',
  506. closeBtn: 1,
  507. shift: 5,
  508. shadeClose: false, //点击遮罩关闭层
  509. content: httpRequest.server+"profileweb/#/zhuyuan?patientCode="+res.data.patientCode+"&hospital="+docInfo.hospital+"&recoverDown="+isEdit+"&event="+event,
  510. end: function(){
  511. var comProfile = sessionStorage.getItem("comProfile")
  512. if(comProfile){
  513. sessionStorage.removeItem("comProfile")
  514. vm.comMedicalRecordsBack(JSON.parse(comProfile),event); //同步住院病历
  515. }
  516. }
  517. });
  518. }else{
  519. showErrorMessage(res.msg);
  520. }
  521. })
  522. },
  523. comMedicalRecordsBack:function(comProfile,event){
  524. var vm = this
  525. var jsonData = {
  526. admissionTime: comProfile.data['入院时间']||"",
  527. dischargeTime: comProfile.data['出院时间']||"",
  528. admittingDiagnosis: "", // 入院诊断
  529. admittingDiagnosisName: comProfile.data['入院诊断']||"", //入院诊断名称
  530. dischargeDiagnosis: "", // 出院诊断
  531. dischargeDiagnosisName: comProfile.data['出院诊断']||"", // 出院诊断名称,多个用逗号
  532. advice: comProfile.data['出院医嘱']||"出院继续观察",
  533. images: "",
  534. "event": comProfile.event.id,
  535. "dataFrom":comProfile.event.dataFrom,
  536. "hospital":comProfile.event.orgCode,
  537. "jwpatient":comProfile.event.patient,
  538. }
  539. var params = {
  540. doctorCode: docInfo.uid,
  541. patient: vm.pati.patient,
  542. patientName: vm.pati.patientName,
  543. jsonData: JSON.stringify(jsonData)
  544. }
  545. var loading = layer.load(0, {shade: false})
  546. rehaAPI.createMedicalRecords(params).then(function(res){
  547. layer.close(loading)
  548. if(res.status==200){
  549. if(!event){
  550. vm.medicalRecordsList.unshift(res.data)
  551. }else{
  552. vm.$set(vm.medicalRecordsList, vm.curMedicalRecordsIndex, res.data)
  553. }
  554. if(!vm.adviceContent){
  555. vm.adviceContent = res.data.advice
  556. }
  557. }else{
  558. showErrorMessage(res.msg);
  559. }
  560. })
  561. },
  562. // 添加住院病历
  563. addMedicalRecords: function(){
  564. var vm = this
  565. this.selectPatientIndex = layer.open({
  566. type: 2,
  567. area: ['480px', '650px'],
  568. shade: 0.5,
  569. title: '添加住院病历',
  570. closeBtn: 1,
  571. shift: 5,
  572. shadeClose: false, //点击遮罩关闭层
  573. content: "medical-records.html?patient="+vm.pati.patient+'&patientName='+vm.pati.patientName
  574. });
  575. },
  576. // 编辑住院病历
  577. editMedicalRecords: function(o, i){
  578. var vm = this
  579. if(vm.isEditConfig){
  580. if(o.event){
  581. vm.comMedicalRecords(o)
  582. }else{
  583. window.localStorage.setItem('curMedicalRecords', JSON.stringify(o))
  584. this.selectPatientIndex = layer.open({
  585. type: 2,
  586. area: ['480px', '650px'],
  587. shade: 0.5,
  588. title: '添加住院病历',
  589. closeBtn: 1,
  590. shift: 5,
  591. shadeClose: false, //点击遮罩关闭层
  592. content: "../../rehabilitation/html/medical-records-detail.html?medicalRecordsCode="+o.code
  593. });
  594. }
  595. }else{
  596. vm.curMedicalRecordsIndex = i
  597. if(o.event){
  598. vm.comMedicalRecords(o,true)
  599. }else{
  600. window.localStorage.setItem('curMedicalRecords', JSON.stringify(o))
  601. this.selectPatientIndex = layer.open({
  602. type: 2,
  603. area: ['480px', '650px'],
  604. shade: 0.5,
  605. title: '添加住院病历',
  606. closeBtn: 1,
  607. shift: 5,
  608. shadeClose: false, //点击遮罩关闭层
  609. content: "medical-records.html?patient="+vm.pati.patient+'&patientName='+vm.pati.patientName+'&medicalRecordsId='+o.id
  610. });
  611. }
  612. }
  613. },
  614. //关闭添加住院病历弹框
  615. closeMedicalRecords: function(){
  616. layer.close(this.selectPatientIndex)
  617. },
  618. completeMedicalRecords: function(type, data){
  619. var vm = this;
  620. if(type=='edit'){
  621. this.$set(this.medicalRecordsList, this.curMedicalRecordsIndex, data)
  622. } else {
  623. this.medicalRecordsList.unshift(data)
  624. }
  625. if(!vm.adviceContent){
  626. vm.adviceContent = data.advice
  627. }
  628. layer.close(this.selectPatientIndex)
  629. },
  630. //获取诊疗信息
  631. diagnosisQuery:function(){
  632. var vm = this;
  633. loadding = layer.load(0, {shade: false});
  634. params = {
  635. patient: this.pati.patient,
  636. // patient:"3b26a7905e034c36a5ba8e65bdc0dc7f",
  637. type: '2',
  638. page: 1,
  639. pageSize: 50,
  640. lastTime: ''
  641. }
  642. recoverAPI.diagnosisQuery(params).then(function(res){
  643. layer.close(loadding)
  644. if (res.status == 200) {
  645. if(res.data.length == 0){
  646. vm.diagnosisInfo = [{orgName:'无'}]
  647. console.log(vm.diagnosisInfo)
  648. vm.nodata = true
  649. }else{
  650. vm.diagnosisInfo = res.data;
  651. }
  652. vm.orderHospital(0)
  653. }else{
  654. vm.diagnosisInfo = [{orgName:'无'}]
  655. vm.orderHospital(0)
  656. showErrorMessage(res.msg);
  657. }
  658. })
  659. },
  660. //按照医院查询诊疗信息
  661. orderHospital:function(index){
  662. var vm = this;
  663. vm.indexOrder = index
  664. loadding = layer.load(0, {shade: false});
  665. var sec_params = {
  666. patient: vm.pati.patient,
  667. event:vm.diagnosisInfo[index].id || "",
  668. catalog:'0213',
  669. serial:"1"
  670. }
  671. recoverAPI.diagnosisSubsidiary(sec_params).then(function(res){
  672. layer.close(loadding)
  673. vm.subsidiaryInfo = vm.selectXmlDom(res,'0213')
  674. console.log(vm.subsidiaryInfo)
  675. })
  676. },
  677. //获取xml数据
  678. selectXmlDom: function (profileRes,tempalteCode) {
  679. var vm = this;
  680. if(profileRes.status == 200){
  681. var $dom = $(profileRes.data.replace(/<\?xml .*\?>/,'')),
  682. version = $dom.find(">version").length?$dom.find(">version").attr("code"):$dom.attr('version');
  683. $.trim(version) || (function () {
  684. version = $dom.find(">ClinicalDocument").length? '2.0.0.1' : '';
  685. })();
  686. if($.trim(version)) {
  687. var verNum = version.split('.')[0];
  688. var jsonData = {}
  689. // xml 转 json
  690. if((typeof profileRes.data=='string')&&profileRes.data.constructor==String) {
  691. // 去除携带的脚本内容
  692. profileRes.data = profileRes.data.replace(/<script[^>]*?>[\s\S]*?<\/script>/ig,'');
  693. // console.log(profileRes.data.replace(/<\?xml .*\?>/,''))
  694. jsonData = vm.handleData(profileRes.data.replace(/<\?xml .*\?>/,''));
  695. }
  696. }
  697. }else{
  698. showErrorMessage(profileRes.msg)
  699. jsonData = {data:{}}
  700. }
  701. return jsonData;
  702. },
  703. handleData :function (xmlStr) {
  704. var $xmlDom = $(xmlStr),
  705. $nodes = {
  706. } ;
  707. var resultData = [];
  708. return {
  709. data:{
  710. "department": $xmlDom.find('component section entry inDept').text(),//科室
  711. "dednumber": $xmlDom.find('component section entry bed').text(),//床号
  712. "HospitalizationNumber": "",//住院号
  713. "name": $xmlDom.find('recordTarget patient name').text(),//姓名
  714. "sex": $xmlDom.find('recordTarget patient sex').text(),//性别
  715. "nation": $xmlDom.find('recordTarget nation').text(),//民族
  716. "marriage": $xmlDom.find('recordTarget marriage').text(),//婚姻
  717. "admissionTime": $xmlDom.find('component section entry inTime').attr('value'),//入院时间
  718. "dischargeTime": $xmlDom.find('component section entry outTime').attr('value'),//出院时间
  719. "lengthStay": $xmlDom.find('component section entry inHospitalDay').text(),//住院天数
  720. "admissionStatus": $xmlDom.find('component section entry inCondition').text(),//入院情况
  721. "admissionDiagnosis": $xmlDom.find('component section entry inDiagnosis').text(),//入院诊断
  722. "dischargeDiagnosis": $xmlDom.find('component section entry outDiagnosis').text(),//出院诊断
  723. "DiagnosisProcess": $xmlDom.find('component section entry remedialCourse').text(),//诊疗经过
  724. "dischargeStatus": $xmlDom.find('component section entry outCondition').text(),//出院情况
  725. "dischargeOrder": $xmlDom.find('component section entry outOrder').text(),//出院医嘱
  726. "treatmentOutcome": $xmlDom.find('component section entry remedialResult').text(),//治疗结果
  727. "residentPhysician": $xmlDom.find('residentDoctor name').text(),//住院医师
  728. "attendingDoctor": $xmlDom.find('inChargeDoctor name').text(),//主治医师
  729. "time": $xmlDom.find('inChargeDoctor time').attr('value')//时间
  730. }
  731. }
  732. },
  733. //编辑诊疗
  734. editdiagnosis:function(){
  735. var vm = this;
  736. vm.edit = !vm.edit;
  737. vm.nodata = false
  738. vm.subsidiaryInfo.data.department = $('#department').find('input').val()
  739. vm.subsidiaryInfo.data.attendingDoctor = $('#attendingDoctor').find('input').val()
  740. vm.subsidiaryInfo.data.admissionDiagnosis = $('#department').find('input').val()
  741. vm.subsidiaryInfo.data.dischargeDiagnosis = $('#dischargeDiagnosis').find('input').val()
  742. },
  743. // 获取居民标签(健康情况、疾病类型、自定义分组)
  744. getPatientLabelInfo: function(){
  745. var vm = this,
  746. loading = layer.load(0, {shade: false})
  747. var params = {
  748. patient: this.pati.patient
  749. }
  750. rehaAPI.getPatientLabelInfo(params).then(function(res){
  751. layer.close(loading)
  752. if(res.status == 200) {
  753. var healthLabel = res.data['healthLabel']||[],
  754. diseaseLabel = res.data['diseaseServer']||[],
  755. customLabel = res.data['customLabel']||[];
  756. $.each(diseaseLabel, function(index, item){
  757. vm.diseaseCodeArr.push(item.disease)
  758. vm.diseaseNameArr.push(item.diseaseName)
  759. })
  760. $.each(healthLabel, function(index, item){
  761. vm.healthCodeArr.push(item.label)
  762. })
  763. } else {
  764. showErrorMessage(res.msg);
  765. }
  766. })
  767. },
  768. // 编辑康复建议
  769. editAdviceTextarea: function(){
  770. this.isEdit = !this.isEdit
  771. },
  772. // 获取频次列表
  773. selectFrequencys: function() {
  774. var vm = this,
  775. loadding = layer.load(0, {shade: false});
  776. recoverAPI.selectFrequencys().then(function(res) {
  777. layer.close(loadding)
  778. if(res.status == 200) {
  779. vm.frequencyList = [{code:'', name: '不限频次'}].concat(res.data)
  780. console.log('vm.frequencyList', vm.frequencyList)
  781. $.each(res.data, function(index, item){
  782. vm.frequencyListObj[item.code]=item.name
  783. })
  784. } else {
  785. showErrorMessage(res.msg);
  786. }
  787. })
  788. },
  789. // 获取居民信息
  790. getPatientInfo: function() {
  791. var vm = this,
  792. loadding = layer.load(0, {shade: false}),
  793. params = {
  794. patient: this.pati.patient
  795. }
  796. recoverAPI.getPatientInfo(params).then(function(res) {
  797. layer.close(loadding)
  798. if(res.status == 200) {
  799. vm.patiInfo = res.data
  800. vm.pati.patientName = res.data.name
  801. if(vm.planId){ // 编辑服务项时获取服务医生列表
  802. vm.selectPlanServerDoctor(vm.planId)
  803. } else {
  804. vm.jDlist.push({
  805. name: vm.patiInfo.ssDoctorName || vm.patiInfo.jtDoctorName,
  806. code: vm.patiInfo.ssDoctor || vm.patiInfo.jtDoctor,
  807. hospitalName: vm.patiInfo.jtHospitalName
  808. })
  809. vm.jDlist.push({
  810. name: vm.patiInfo.ssDoctorHealthName || vm.patiInfo.jtDoctorHealthName,
  811. code: vm.patiInfo.ssDoctorHealth || vm.patiInfo.jtDoctorHealth,
  812. hospitalName: vm.patiInfo.jtHospitalName
  813. })
  814. vm.jDlist.push({
  815. name: docInfo.name,
  816. code: docInfo.uid,
  817. hospitalName: docInfo.hospitalName
  818. })
  819. }
  820. // 获取居民标签
  821. vm.getPatientLabelInfo()
  822. if(vm.docInfo.doctorType==1){
  823. vm.findPatientSignSpecialistInfo()
  824. }
  825. } else {
  826. showErrorMessage(res.msg);
  827. }
  828. })
  829. },
  830. // 获取服务医生列表
  831. selectPlanServerDoctor: function(id){
  832. var vm = this,
  833. params = {
  834. planId: id
  835. }
  836. rehaAPI.selectPlanServerDoctor(params).then(function(res){
  837. var jtList = [], zkList = []
  838. if(res.status==200){
  839. $.each(res.data, function(index, item){
  840. if(item.level==1){
  841. zkList.push({
  842. name: item.name,
  843. code: item.code,
  844. hospitalName: item.hospitalName
  845. })
  846. } else {
  847. jtList.push({
  848. name: item.name,
  849. code: item.code,
  850. hospitalName: item.hospitalName
  851. })
  852. }
  853. })
  854. vm.jDlist = jtList.concat(zkList)
  855. vm.getServiceItem()
  856. }else{
  857. layer.msg(res.msg,{icon:5});
  858. }
  859. })
  860. },
  861. // 签约专科信息
  862. findPatientSignSpecialistInfo: function() {
  863. var vm = this,
  864. params = {
  865. patient: this.pati.patient,
  866. doctor: docInfo.uid
  867. }
  868. recoverAPI.findPatientSignSpecialistInfo(params).then(function(res) {
  869. if(res.status == 200) {
  870. vm.pati.teamCode = res.data.teamCode
  871. if(!vm.teamCode){
  872. vm.teamCode = res.data.teamCode
  873. }
  874. vm.specialistTeam(vm.teamCode)
  875. } else {
  876. showErrorMessage(res.msg);
  877. }
  878. })
  879. },
  880. // 获取专科团队
  881. specialistTeam: function(teamCode) {
  882. var vm = this,
  883. params = {
  884. teamId: teamCode
  885. }
  886. recoverAPI.specialistTeam(params).then(function(res) {
  887. if(res.status == 200) {
  888. vm.zDlist = res.data.members
  889. } else {
  890. showErrorMessage(res.msg);
  891. }
  892. })
  893. },
  894. // 模板列表
  895. findTemplateList: function() {
  896. var vm = this,
  897. loadding = layer.load(0, {shade: false}),
  898. params = {
  899. patient: this.pati.patient,
  900. doctor: docInfo.uid,
  901. adminTeamCode: vm.teamCode
  902. }
  903. recoverAPI.findTemplateList(params).then(function(res) {
  904. layer.close(loadding)
  905. if(res.status == 200) {
  906. vm.mubanList = res.data
  907. } else {
  908. showErrorMessage(res.msg);
  909. }
  910. })
  911. },
  912. // 模板详细
  913. findTemplateDetail: function(templateId) {
  914. var vm = this,
  915. loadding = layer.load(0, {shade: false}),
  916. params = {
  917. templateId: templateId
  918. }
  919. recoverAPI.findTemplateDetail(params).then(function(res) {
  920. layer.close(loadding)
  921. if(res.status == 200) {
  922. vm.templateDetail = []
  923. vm.templateResult = res.data
  924. vm.getServiceItemList().then(function(){
  925. var arr = []
  926. $.each(vm.serviceItems, function(index,o) {
  927. $.each(vm.templateResult, function(index1, o1) {
  928. if(o1.code == o.code) {
  929. o.isSelect = true
  930. o1.selectFre = true
  931. o1.isSelect = true
  932. o1.selectDoc = false
  933. o1.selectDate = 1
  934. o1.value14 = []
  935. o1.value15 = null
  936. o1.executeTime = []
  937. // 默认频次
  938. o1.selectFre = false
  939. o1.frequencyCode = ''
  940. o1.frequencyName = '不限频次'
  941. o1.frequency = vm.frequencyList[0]
  942. o1.frequencyList = vm.frequencyList
  943. o1.timeType = 0
  944. o1.remark = null
  945. o1.executeDoctor = vm.jDlist[0].code
  946. o1.executeDoctorName = vm.jDlist[0].name
  947. o1.executeHospitalName = vm.jDlist[0].hospitalName
  948. o1.docList = vm.jDlist
  949. arr.push(o1)
  950. }
  951. })
  952. })
  953. vm.templateDetail = arr
  954. vm.$forceUpdate()
  955. })
  956. // vm.findServiceItemsByHospital()
  957. } else {
  958. showErrorMessage(res.msg);
  959. }
  960. })
  961. },
  962. // 服务项目列表 2020-03-03 新增接口
  963. getServiceItemList: function(isSearch){
  964. var vm = this,
  965. loadding = layer.load(0, {shade: false}),
  966. params = {
  967. name: vm.searchKey
  968. }
  969. return rehaAPI.getServiceItemList(params).then(function(res) {
  970. layer.close(loadding)
  971. if(res.status == 200) {
  972. var serviceItems = res.data
  973. vm.serviceItems = $.each(serviceItems, function(index,o) {
  974. o.isSelect = false
  975. return o;
  976. })
  977. }else {
  978. showErrorMessage(res.msg);
  979. }
  980. })
  981. },
  982. searchProject: function() {
  983. this.getServiceItemList(true)
  984. },
  985. setPatImg: function(src) {
  986. if(!src) {
  987. return "../../../images/p-female.png"
  988. } else {
  989. var str = httpRequest.getImgUrl(src);
  990. return str
  991. }
  992. },
  993. changeSelectFre: function(index, bool) {
  994. this.templateDetail[index].selectFre = !bool
  995. this.isTest = !this.isTest
  996. },
  997. changeSelectDoc: function(index, bool) {
  998. this.templateDetail[index].selectDoc = !bool
  999. this.isTest = !this.isTest
  1000. },
  1001. // 选择频次
  1002. selectFre: function(index, list) {
  1003. this.templateDetail[index].selectFre = false
  1004. this.templateDetail[index].frequencyCode = list.code
  1005. this.templateDetail[index].frequencyName = list.name
  1006. this.templateDetail[index].frequency = list
  1007. this.templateDetail[index] = this.templateDetail[index]
  1008. this.isTest = !this.isTest
  1009. // if(this.templateDetail[index].frequencyCode==''&&this.isEditConfig){
  1010. // var obj = this.templateDetail[index]
  1011. // this.templateDetail = [].push(obj)
  1012. // }
  1013. this.judgeHavePlan()
  1014. },
  1015. // 选择时间段
  1016. selectTimeType: function(index, timetype) {
  1017. this.templateDetail[index].timeType = timetype
  1018. this.isTest = !this.isTest
  1019. },
  1020. // 选择执行医生
  1021. selectLi: function(index, list) {
  1022. this.templateDetail[index].selectDoc = false
  1023. this.templateDetail[index].executeDoctor = list.code
  1024. this.templateDetail[index].executeDoctorName = list.name
  1025. this.templateDetail[index].executeHospitalName = list.hospitalName
  1026. this.templateDetail[index] = this.templateDetail[index]
  1027. this.isTest = !this.isTest
  1028. },
  1029. // 删除配置计划
  1030. subTemplate: function(index, detail) {
  1031. var vm = this
  1032. this.isTest = !this.isTest
  1033. this.templateDetail.splice(index, 1)
  1034. var len = detail.executeTime.length
  1035. var deleteJudge = true
  1036. $.each(vm.templateDetail, function(index, o) {
  1037. if(o.code == detail.code) {
  1038. deleteJudge = false
  1039. }
  1040. });
  1041. if(deleteJudge) {
  1042. $.each(vm.serviceItems, function(index, o) {
  1043. if(detail.code == o.code) {
  1044. o.isSelect = false
  1045. o.executeTime = []
  1046. vm.serviceItems[index] = o
  1047. }
  1048. });
  1049. }
  1050. this.judgeHavePlan()
  1051. },
  1052. // 复制计划
  1053. copyTemplate: function(index, detail) {
  1054. var vm = this,
  1055. obj = JSON.parse(JSON.stringify(detail));
  1056. this.isTest = !this.isTest
  1057. obj.executeTime = []
  1058. obj.value14 = []
  1059. obj.value15 = null
  1060. this.templateDetail.push(obj)
  1061. if(obj.code!='2'&&obj.code!='3'){
  1062. this.havePlan = false
  1063. }
  1064. },
  1065. // 选择项目
  1066. selectProject: function(index, index2, index3, o) {
  1067. this.selectProjectDetail = o
  1068. this.selectPatientIndex = layer.open({
  1069. type: 2,
  1070. area: ['400px', '500px'],
  1071. shade: 0.5,
  1072. title: '选择项目',
  1073. closeBtn: 1,
  1074. shift: 5,
  1075. shadeClose: false, //点击遮罩关闭层
  1076. content: "select-project.html?isLook=true&projectId=" + o.id + "&index=" + index + "&index3=" + index3 + "&index2=" + index2
  1077. });
  1078. },
  1079. // 添加项目
  1080. addProject: function(index, obj) {
  1081. if(obj) {
  1082. this.selectProjectDetail = obj
  1083. }
  1084. if(this.selectProjectDetail.isSelect) {
  1085. showWarningMessage("已添加!")
  1086. return false;
  1087. }
  1088. this.selectProjectDetail.isSelect = true
  1089. this.selectProjectDetail.selectDoc = false
  1090. this.selectProjectDetail.selectDate = 1
  1091. this.selectProjectDetail.value14 = []
  1092. this.selectProjectDetail.value15 = null
  1093. this.selectProjectDetail.executeTime = []
  1094. // 频次选择
  1095. this.selectProjectDetail.selectFre = true
  1096. this.selectProjectDetail.frequencyCode = this.frequencyList[0].code
  1097. this.selectProjectDetail.frequencyName = this.frequencyList[0].name
  1098. this.selectProjectDetail.frequency = this.frequencyList[0]
  1099. this.selectProjectDetail.frequencyList = this.frequencyList
  1100. this.selectProjectDetail.timeType = 0
  1101. this.selectProjectDetail.remark = null
  1102. this.selectProjectDetail.executeDoctor = this.jDlist[0].code
  1103. this.selectProjectDetail.executeDoctorName = this.jDlist[0].name
  1104. this.selectProjectDetail.executeHospitalName = this.jDlist[0].hospitalName
  1105. this.selectProjectDetail.docList = this.jDlist
  1106. this.templateDetail.push(this.selectProjectDetail)
  1107. this.serviceItems[index] = this.selectProjectDetail
  1108. if(this.selectProjectDetail.code!='2'&&this.selectProjectDetail.code!='3'){
  1109. this.havePlan = false
  1110. }
  1111. this.judgeHavePlan()
  1112. },
  1113. // 选择居民
  1114. selectPatient: function() {
  1115. this.selectPatientIndex = layer.open({
  1116. type: 2,
  1117. area: ['400px', '500px'],
  1118. shade: 0.5,
  1119. title: '同步患者',
  1120. closeBtn: 1,
  1121. shift: 5,
  1122. shadeClose: false, //点击遮罩关闭层
  1123. content: "select-patient.html"
  1124. });
  1125. },
  1126. // 选择居民回调
  1127. selectPatientOk: function(pati) {
  1128. this.isPlan = false
  1129. this.allFee = 0
  1130. this.templateDetail = []
  1131. this.pati = pati
  1132. this.isEdit = false
  1133. this.showAdviceContentTip = false
  1134. this.medicalRecordsList = []
  1135. this.getPatientInfo()
  1136. this.findTemplateList()
  1137. // this.diagnosisQuery()
  1138. layer.close(this.selectPatientIndex)
  1139. },
  1140. // 添加模板
  1141. addMuban: function(oId) {
  1142. var vm = this
  1143. var templateId = oId||''
  1144. vm.newPlan(templateId)
  1145. },
  1146. // 取消计划
  1147. canclePlan: function(obj) {
  1148. var vm = this
  1149. cancleIndex = layer.open({
  1150. type: 2,
  1151. area: ['400px', '180px'],
  1152. shade: 0.5,
  1153. title: '取消确认',
  1154. closeBtn: 1,
  1155. shift: 5,
  1156. shadeClose: false, //点击遮罩关闭层
  1157. content: "cancle_sure.html"
  1158. });
  1159. },
  1160. cancleSure: function() {
  1161. this.isPlan = false
  1162. this.allFee = 0
  1163. this.templateDetail = []
  1164. },
  1165. // (disease, templateId)
  1166. newPlan: function(templateId) {
  1167. // this.diseaseObj = disease
  1168. // var templateId = this.templateId
  1169. this.isPlan = true
  1170. if(templateId) {
  1171. this.findTemplateDetail(templateId)
  1172. } else {
  1173. this.templateDetail = []
  1174. this.getServiceItemList()
  1175. // this.findServiceItemsByHospital()
  1176. }
  1177. },
  1178. selectPro: function(pro, index) {
  1179. if(pro == 1) {
  1180. this.proIndex2 = null;
  1181. this.proIndex1 == index ? this.proIndex1 = null : this.proIndex1 = index
  1182. } else {
  1183. this.proIndex2 == index ? this.proIndex2 = null : this.proIndex2 = index
  1184. }
  1185. },
  1186. setLabelIndex: function(index, label) {
  1187. this.labelIndex = index
  1188. this.labelCode = label.code
  1189. },
  1190. changeSelectDate: function(index, num) {
  1191. if(this.templateDetail[index].executeTime.length) {
  1192. showWarningMessage("请先清除此选项的计划时间!");
  1193. return false;
  1194. }
  1195. this.isTest = !this.isTest
  1196. this.templateDetail[index].selectDate = num
  1197. },
  1198. openSelectTime: function(index) {
  1199. var vm = this
  1200. selectTimeIndex = layer.open({
  1201. type: 2,
  1202. area: ['600px', '500px'],
  1203. shade: 0.5,
  1204. title: '服务时间选择',
  1205. closeBtn: 1,
  1206. shift: 5,
  1207. shadeClose: false, //点击遮罩关闭层
  1208. content: "select_timer.html"
  1209. });
  1210. },
  1211. formatter: function(time){
  1212. return new Date(time).format('yyyy-MM-dd')
  1213. },
  1214. // 选择日期
  1215. getSelectDate: function(index) {
  1216. var vm = this,
  1217. projectId = vm.templateDetail[index].code;
  1218. if(!this.templateDetail[index].value15) {
  1219. return false;
  1220. }
  1221. vm.templateDetail = $.map(vm.templateDetail, function(o, index) {
  1222. if(projectId == o.code) {
  1223. o.isTimeSame = false
  1224. }
  1225. return o
  1226. })
  1227. this.templateDetail[index].executeTime = []
  1228. var arr = this.templateDetail[index].value15
  1229. this.templateDetail[index].executeTime = arr
  1230. this.templateDetail[index].value14 = []
  1231. this.isTest = !this.isTest
  1232. this.judgeHavePlan()
  1233. },
  1234. // 选择周期
  1235. getRandgeDate: function(index, i) {
  1236. var vm = this
  1237. var templateDetail=this.templateDetail[index]
  1238. if(!templateDetail.value14[i]){
  1239. this.templateDetail[index].executeTime = []
  1240. this.havePlan = false
  1241. return false
  1242. }
  1243. if(templateDetail.value14[0]>templateDetail.value14[1]){
  1244. showWarningMessage("开始时间应小于结束时间!")
  1245. return false;
  1246. }
  1247. var projectId = vm.templateDetail[index].code;
  1248. vm.templateDetail = $.map(vm.templateDetail, function(o, index) {
  1249. if(projectId == o.code) {
  1250. o.isTimeSame = false
  1251. }
  1252. return o
  1253. })
  1254. this.templateDetail[index].executeTime = []
  1255. var arr = this.templateDetail[index].value14,
  1256. startTime = new Date(arr[0]).getTime(),
  1257. endTime = new Date(arr[1]).getTime(),
  1258. absTime = endTime - startTime,
  1259. oneday = 60 * 60 *24 * 1000,
  1260. i = 0;
  1261. for(i; i * oneday <= absTime; i++) {
  1262. var num = i * oneday + startTime,
  1263. str = new Date(num).format("yyyy-MM-dd")
  1264. this.templateDetail[index].executeTime.push(str)
  1265. }
  1266. var obj = {
  1267. startTime: arr[0],
  1268. endTime: arr[1],
  1269. length: i
  1270. }
  1271. this.templateDetail[index].value15 = null
  1272. this.isTest = !this.isTest
  1273. this.judgeHavePlan()
  1274. },
  1275. // 计算总费用
  1276. checkAllMoney: function() {
  1277. var vm = this
  1278. this.allFee = 0
  1279. $.each(vm.templateDetail, function(index, o) {
  1280. var fee = vm.mul(vm.mul(o.expense, o.frequency.count), o.executeTime.length)
  1281. vm.allFee = vm.add(vm.allFee, fee)
  1282. });
  1283. },
  1284. judgeHavePlan: function() {
  1285. var arr = []
  1286. for(var k = 0; k < this.templateDetail.length; k++) {
  1287. if(this.templateDetail[k].code=='2'||this.templateDetail[k].code=='3'){
  1288. arr.push(true)
  1289. } else if(this.templateDetail[k].frequencyCode){
  1290. if(this.templateDetail[k].executeTime[0]) {
  1291. arr.push(true)
  1292. }else {
  1293. arr.push(false)
  1294. }
  1295. } else {
  1296. arr.push(true)
  1297. }
  1298. }
  1299. var flag = _.every(arr, Boolean)
  1300. if(flag){
  1301. this.havePlan = true
  1302. }else{
  1303. this.havePlan = false
  1304. }
  1305. },
  1306. // 编辑居民康复计划详情
  1307. updateRehabilitationPlan: function(){
  1308. var vm = this
  1309. var loadding = layer.load(0, {shade: false}),
  1310. data = {
  1311. planId: vm.planId,
  1312. hospitalServiceItemId: vm.service.type,
  1313. detail: [],
  1314. };
  1315. $.each(vm.templateDetail, function(index, o) {
  1316. var obj;
  1317. if(o.code=='2'||o.code=='3'||!o.frequencyCode){
  1318. obj = {
  1319. hospitalServiceItemId: o.code,
  1320. type: 2,
  1321. doctor: vm.jDlist[0].code,
  1322. doctorName: vm.jDlist[0].name,
  1323. executeTimes: '',
  1324. frequencyCode: '',
  1325. timeType: 0,
  1326. remark: o.remark || ''
  1327. }
  1328. }else{
  1329. if(o.executeTime.length) {
  1330. var executeTime = []
  1331. $.each(o.executeTime, function(ind, v) {
  1332. v += ' 00:00'
  1333. executeTime.push(v)
  1334. });
  1335. obj = {
  1336. hospitalServiceItemId: o.code, // 服务项code
  1337. type: 2,
  1338. doctor: o.executeDoctor,
  1339. doctorName: o.executeDoctorName,
  1340. executeTimes: executeTime.length>0?executeTime.join(","):'',
  1341. frequencyCode: o.frequencyCode,
  1342. timeType: o.timeType,
  1343. remark: o.remark || ''
  1344. }
  1345. }
  1346. }
  1347. data.detail.push(obj)
  1348. });
  1349. var params = {
  1350. json: JSON.stringify(data)
  1351. }
  1352. recoverAPI.updateRehabilitationPlan(params).then(function(res){
  1353. layer.close(loadding)
  1354. if(res.status ==200){
  1355. showSuccessMessage('保存成功!')
  1356. window.history.go(-1)
  1357. } else {
  1358. showErrorMessage(res.msg);
  1359. }
  1360. })
  1361. },
  1362. createRehabilitationPlan: function() {
  1363. var vm = this
  1364. if(!this.adviceContent){
  1365. vm.showAdviceContentTip = true
  1366. showWarningMessage("请输入康复建议!")
  1367. return false;
  1368. }
  1369. if(vm.medicalRecordsList.length==0){
  1370. showWarningMessage("请选择住院病历!")
  1371. return false;
  1372. }
  1373. if(!this.havePlan) {
  1374. showWarningMessage("请选择计划时间!")
  1375. return false;
  1376. }
  1377. var codeArr=[];
  1378. $.each(vm.medicalRecordsList,function(i, o){
  1379. codeArr.push(o.code)
  1380. })
  1381. var loadding = layer.load(0, {shade: false}),
  1382. data = {
  1383. patient: this.pati.patient,
  1384. name: this.pati.patientName,
  1385. title: this.pati.patientName + "的康复计划",
  1386. healthStatusCode:this.healthCodeArr.join(','),
  1387. disease: this.diseaseCodeArr.join(','),
  1388. diseaseName: this.diseaseNameArr.join(','),
  1389. planType: this.labelCode || 1,
  1390. payment: 2,
  1391. totalExpense: this.allFee || 0,
  1392. adviceContent: this.adviceContent,
  1393. medicalRecordsCode: codeArr.join(','),
  1394. teamCode: vm.teamCode,
  1395. detail: [],
  1396. };
  1397. $.each(vm.templateDetail, function(index, o) {
  1398. var obj;
  1399. if(o.code=='2'||o.code=='3'||!o.frequencyCode){
  1400. obj = {
  1401. hospitalServiceItemId: o.code,
  1402. type: 2,
  1403. doctor: vm.jDlist[0].code,
  1404. doctorName: vm.jDlist[0].name,
  1405. executeTimes: '',
  1406. frequencyCode: '',
  1407. timeType: 0,
  1408. remark: o.remark || ''
  1409. }
  1410. }else{
  1411. if(o.executeTime.length) {
  1412. var executeTime = []
  1413. $.each(o.executeTime, function(ind, v) {
  1414. v += ' 00:00'
  1415. executeTime.push(v)
  1416. });
  1417. obj = {
  1418. hospitalServiceItemId: o.code,
  1419. type: 2,
  1420. doctor: o.executeDoctor,
  1421. doctorName: o.executeDoctorName,
  1422. executeTimes: executeTime.join(","),
  1423. frequencyCode: o.frequencyCode,
  1424. timeType: o.timeType,
  1425. remark: o.remark || ''
  1426. }
  1427. }
  1428. }
  1429. data.detail.push(obj)
  1430. });
  1431. var params = {
  1432. json: JSON.stringify(data)
  1433. }
  1434. // console.log('paramsparamsparamsparamsparams', data)
  1435. // return
  1436. recoverAPI.createRehabilitationPlan(params).then(function(res) {
  1437. layer.close(loadding)
  1438. if(res.status == 200) {
  1439. vm.isPlanId = res.data
  1440. setTimeout(function() {
  1441. window.location.href = "../../rehabilitation/html/health_control.html"
  1442. }, 1000)
  1443. showSuccessMessage("康复计划配置成功!")
  1444. } else {
  1445. showErrorMessage(res.msg || "同康复计划项目创建时间重复!");
  1446. vm.templateDetail = $.map(vm.templateDetail, function(o, index) {
  1447. $.each(res.data, function(ind, v) {
  1448. if(v == o.id) {
  1449. o.isTimeSame = true
  1450. }
  1451. });
  1452. return o
  1453. })
  1454. }
  1455. })
  1456. },
  1457. // 字符串方法计算加减乘除(精确度百分位)
  1458. add: function(num1,num2){
  1459. var r1,r2,m,n;
  1460. try{r1=num1.toString().split(".")[1].length}catch(e){r1=0}
  1461. try{r2=num2.toString().split(".")[1].length}catch(e){r2=0}
  1462. m = Math.pow(10,Math.max(r1,r2));
  1463. n = (r1>=r2)?r1:r2;
  1464. return ((num1*m + num2*m)/m).toFixed(n);
  1465. },
  1466. sub: function(num1,num2){
  1467. var r1,r2,m,n;
  1468. try{r1=num1.toString().split(".")[1].length}catch(e){r1=0}
  1469. try{r2=num2.toString().split(".")[1].length}catch(e){r2=0}
  1470. n = (r1>=r2)?r1:r2;
  1471. m = Math.pow(10,Math.max(r1,r2));
  1472. return ((num1*m - num2*m)/m).toFixed(n);
  1473. },
  1474. mul: function(num1,num2){
  1475. var m = 0;
  1476. try{m+=num1.toString().split(".")[1].length}catch(e){}
  1477. try{m+=num2.toString().split(".")[1].length}catch(e){}
  1478. return (Number(num1.toString().replace(".",""))*Number(num2.toString().replace(".","")))/Math.pow(10,m)
  1479. },
  1480. div: function(arg1,arg2){
  1481. var t1=0,t2=0,r1,r2;
  1482. try{t1=arg1.toString().split(".")[1].length}catch(e){}
  1483. try{t2=arg2.toString().split(".")[1].length}catch(e){}
  1484. r1=Number(arg1.toString().replace(".",""));
  1485. r2=Number(arg2.toString().replace(".",""));
  1486. return (r1/r2)*Math.pow(10,t2-t1);
  1487. }
  1488. }
  1489. })
  1490. </script>
  1491. </body>
  1492. </html>