new_recover.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>新建计划</title>
  6. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  7. <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
  11. <link rel="stylesheet" type="text/css" href="../css/new_recover.css" />
  12. </head>
  13. <body class="m0">
  14. <div id="app" v-cloak>
  15. <div class="c-position-a" style="top: -999px; left: -999px;" v-show="isTest"></div>
  16. <div class="c-h100 clearfix">
  17. <div class="fl c-h100 w300 person_info c-border-r" style="overflow: hidden;">
  18. <div v-if="!patiInfo" class="c-h100" style="overflow: auto;">
  19. <div class="c-border-b c-t-center pt20">
  20. <div class="set-photo imgw80">
  21. <img src="../../../images/p-female.png" alt="居民头像" />
  22. </div>
  23. <p class="ptb10">患者名</p>
  24. </div>
  25. <div>
  26. <div class="no-result c-t-center pt20">
  27. <img src="../images/wushuju01_img.png" alt="无数据" />
  28. <p class="c-999">暂无相关信息</p>
  29. <div class="pt30">
  30. <span class="c-fff btn cur-pit plr10 ptb5 bgc-12b7f5 b-r-3" @click="selectPatient()">同步信息</span>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div v-else class="c-h100 plr10" style="overflow: auto;">
  36. <div class="c-t-center pt20 c-position-r">
  37. <div class="set-photo imgw80">
  38. <img :src="setPatImg(patiInfo.photo)" alt="居民头像" />
  39. </div>
  40. <h3 class="ptb10 m0 c-f16">{{patiInfo.name}}</h3>
  41. <span class="c-position-a set-qiehuan cur-pit" @click="selectPatient()"></span>
  42. </div>
  43. <h4 class="h30 m0 c-f14 c-border-b f-w500">基本信息</h4>
  44. <ul class="c-333 m0 p0 pb20">
  45. <li class="pt10"><span class="c-999">性&emsp;&emsp;别:</span>{{patiInfo.sex == 1 ? "男" : "女"}}</li>
  46. <li class="pt10"><span class="c-999">年&emsp;&emsp;龄:</span>{{patiInfo.age}}岁</li>
  47. <li class="pt10"><span class="c-999">身份证号:</span>{{patiInfo.idcard}}</li>
  48. <li class="pt10"><span class="c-999">地&emsp;&emsp;址:</span>{{patiInfo.address}}</li>
  49. </ul>
  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">签约社区:</span>{{patiInfo.ssHospitalName || patiInfo.jtHospitalName}}</li>
  53. <li class="pt10"><span class="c-999">全科医生:</span>{{patiInfo.ssDoctorName || patiInfo.jtDoctorName}}</li>
  54. <li class="pt10"><span class="c-999">健&ensp;管&ensp;师:</span>{{patiInfo.ssDoctorHealthName || patiInfo.jtDoctorHealthName}}</li>
  55. </ul>
  56. <!--<h4 class="h30 m0 c-f14 c-border-b">诊疗信息</h4>
  57. <ul class="c-333 m0 p0 pb20">
  58. <li class="pt10"><span class="c-999">诊疗医院:</span>男</li>
  59. <li class="pt10"><span class="c-999">入院科室:</span>男</li>
  60. <li class="pt10"><span class="c-999">主治医师:</span>男</li>
  61. <li class="pt10"><span class="c-999">入院诊断:</span>男</li>
  62. <li class="pt10"><span class="c-999">出院诊断:</span>男</li>
  63. </ul>
  64. <h4 class="h30 m0 c-f14 c-border-b">出院小结</h4>
  65. <p class="m0 pt10 c-333">依旧本次判断,对新消息进行出院诊断做出以下结论:忧郁啥啥事等等等问题</p>-->
  66. </div>
  67. </div>
  68. <div class="fl c-h100 w-100-300">
  69. <div class="c-h100 plr5" v-if="!isPlan">
  70. <h4 class="m0 pl15 lh40 c-border-b f-w500 c-position-r"><span class="c-position-a set-blue-span"></span>配置康复计划</h4>
  71. <div style="overflow: hidden; height: calc(100% - 41px);">
  72. <div style="overflow: auto; height: 100%;">
  73. <div class="un-select c-t-center pt45" v-if="!patiInfo">
  74. <img src="../images/wushuju_img.png" alt="" />
  75. <p class="c-999">您还没有选择居民</p>
  76. </div>
  77. <ul class="muban_con lh40 c-t-center pt30" v-else>
  78. <li class="mb20" v-for="(muban, index) in mubanList" :key="index" @click="addMuban(muban.id)">{{muban.title}}</li>
  79. <li class="addmuban-btn c-fff" @click="addMuban()">新增模板</li>
  80. </ul>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="clearfix c-h100" v-else>
  85. <div class="fl w-100-300 c-h100">
  86. <div class="plr5 c-h100-79">
  87. <h4 class="m0 pl15 lh40 c-border-b set-label f-w500 c-position-r">
  88. <em class="c-position-a set-blue-span"></em>
  89. 配置康复计划
  90. <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>
  91. </h4>
  92. <div class="c-h100-41" style="overflow: hidden;">
  93. <ul class="c-h100 p0 m0" style="overflow: auto;">
  94. <li class="mt10 plr10 ptb5 c-border b-r-3 clearfix" v-for="(detail, index) in templateDetail" :key="index">
  95. <div class="fl w-100-78 c-333">
  96. <p class="m0 p0 mb10 txt-ells cur-pit" @click="lookProject(detail)">{{detail.specialistServiceItemDO.title}}</p>
  97. <div class="clearfix">
  98. <p class="w300 m0 mb5 p0 fl"><span class="c-999">医&emsp;&emsp;院:</span>{{detail.hospitalName}}</p>
  99. <div class="m0 mb5 p0 fl clearfix">
  100. <span class="fl c-999">执行人员:</span>
  101. <div class="fl c-position-r w100">
  102. <p class="m0 p0 plr10 c-border cur-pit set-xia" :class="{'set-shang':detail.selectDoc}" @click="changeSelectDoc(index, detail.selectDoc)">{{detail.executeDoctorName}}</p>
  103. <ul class="m0 p0 c-border-b c-border-l c-border-r c-position-a doc_list" v-if="detail.selectDoc">
  104. <li class="plr10 c-border-t cur-pit" v-for="(list, indDoc) in detail.docList" :key="indDoc" @click="selectLi(index, list)">{{list.name}}</li>
  105. </ul>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="m0 p0 lh18 clearfix">
  110. <div class="w300 fl clearfix">
  111. <span class="fl c-999">计划时间:</span>
  112. <div class="fl set-label clearfix">
  113. <span class="fl mr20 pl20 c-f14 cur-pit" :class="{'active': detail.selectDate == 1}" @click="changeSelectDate(index, 1)">日期</span>
  114. <span class="fl mr20 pl20 c-f14 cur-pit" :class="{'active': detail.selectDate == 2}" @click="changeSelectDate(index, 2)">周期</span>
  115. </div>
  116. </div>
  117. <p class="m0 p0 fl"><span class="c-999">费&emsp;&emsp;用:</span>{{detail.expense}}{{detail.specialistServiceItemDO.unit}}</p>
  118. </div>
  119. <div class="pl56">
  120. <div class="maxw600 ptb10 bgc-f5f5fa" v-show="detail.selectDate == 1">
  121. <p class="fl pl10 lh24 mb5 mr20 clearfix" v-for="(time, ind) in detail.specialistServiceItemDO.executeTime" :key="ind" v-if="detail.specialistServiceItemDO.executeTime.length">
  122. <span class="fl pb10">{{time}}</span><span class="fl pb10 ml5 c-red cur-pit" @click="spliceTimeArr(index, ind)">删除</span>
  123. </p>
  124. <el-date-picker type="date" :picker-options="pickerOptions1" v-model="detail.value14" value-format="yyyy-MM-dd" @input="getSelectDate(index)" placeholder="选择日期"></el-date-picker>
  125. </div>
  126. <div class="maxw600 ptb10 bgc-f5f5fa" v-show="detail.selectDate == 2">
  127. <p class="lh24 pl10 mb5 mr20 clearfix" v-for="(time, ind) in detail.specialistServiceItemDO.selectDateRange" :key="ind" v-if="detail.specialistServiceItemDO.selectDateRange.length">
  128. <span class="pb10 mr10">{{time.startTime}}</span>至<span class="pb10 ml10">{{time.endTime}}</span><span class="pb10 ml5 c-red cur-pit" @click="spliceTimeRange(index, ind)">删除</span>
  129. </p>
  130. <el-date-picker v-model="detail.value14" type="daterange" :picker-options="pickerOptions1" value-format="yyyy-MM-dd" @input="getRandgeDate(index)" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  131. </div>
  132. </div>
  133. </div>
  134. <div class='fr w60 c-t-right clearfix'>
  135. <p class="m0 p0 mb10">×{{detail.specialistServiceItemDO.executeTime.length}}</p>
  136. <div class="fr sub-tap cur-pit" @click="subTemplate(index, detail)"></div>
  137. </div>
  138. </li>
  139. <li class="pt100 c-t-center" v-if="!templateDetail.length">
  140. <span class="set-right-arraw pr20">请在右侧“服务项”列表中选择</span>
  141. </li>
  142. </ul>
  143. </div>
  144. </div>
  145. <div>
  146. <p class="m0 p0 pl20 ptb10 c-border-b set-label">支付方式:<span class="ml10 pl20 active">按服务支付</span><em class="c-red ml20">(按选择支付方式完成收费)</em></p>
  147. <div class="pl20 lh40">总费用:
  148. <span class="c-red c-f16">¥{{allFee}}</span>
  149. <span class="fr lh30 cur-pit plr15 c-t-center bgc-green c-fff" @click="canclePlan()">取消</span>
  150. <span class="fr lh30 cur-pit plr15 c-t-center c-fff" :class="havePlan ? 'bgc-12b7f5' : 'bgc-d7dce6'" @click="createRehabilitationPlan()">生成计划</span>
  151. </div>
  152. </div>
  153. </div>
  154. <div class="fr w300 c-h100 c-border-l">
  155. <div class="plr5 c-h100">
  156. <h4 class="m0 pl15 lh40 c-border-b c-position-r f-w500">
  157. <em class="c-position-a set-blue-span"></em>添加其他项目
  158. </h4>
  159. <div class="clearfix mtb10 c-border">
  160. <input class="fl search-input plr10" type="text" v-model="searchKey" placeholder="输入项目名称" />
  161. <span class="fr search-btn" @click="searchProject()"></span>
  162. </div>
  163. <div class="c-h100-99" style="overflow: hidden;">
  164. <ul class="c-h100 p0 m0" style="overflow: auto;">
  165. <li v-for="(project1, index) in projectList" :key="index">
  166. <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>
  167. <ul class="c-h100 p0 m0 pl10" v-if="index == proIndex1">
  168. <li v-for="(project2, index2) in project1.item" :key="index2">
  169. <p class="set-arrow h30 c-f14 pl20 m0 c-333 cur-pit" :class="{'active': index2 == proIndex2}" @click="selectPro(2, index2)">{{project2.itemName}}</p>
  170. <ul class="p0 m0 pr10" v-if="index2 == proIndex2">
  171. <li v-for="(project3, index3) in project2.hospitalServiceItems" :key="index3" class="clearfix ptb5">
  172. <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)">
  173. <p class="fl w-100-78 txt-ells lh18" :class="project3.isSelect ? 'c-fff' : 'c-666'">{{project3.specialistServiceItemDO.title}}</p>
  174. <span class="fr lh18 b-r-3 c-f12 ml5 bgc-4dcd70 plr5 c-fff" v-if="project3.flag == 1 || project3.flag == 3">社区</span>
  175. <span class="fr lh18 b-r-3 c-f12 ml5 bgc-55cefc plr5 c-fff" v-if="project3.flag == 2 || project3.flag == 3">医院</span>
  176. </div>
  177. <span class="fr h30 btn cur-pit plr10 bgc-12b7f5 c-fff b-r-3" v-if="!project3.isSelect" @click="addProject(index, index2, index3, project3)">添加</span>
  178. <span class="fr h30 btn plr10 bgc-e1e1e1 c-fff b-r-3" v-else>添加</span>
  179. </li>
  180. </ul>
  181. </li>
  182. </ul>
  183. </li>
  184. </ul>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  193. <script src="../../../js/jquery-2.2.4.js"></script>
  194. <script src="../../../plugins/layer/layer.min.js"></script>
  195. <script src="../../../plugins/toastr/toastr.min.js"></script>
  196. <script src="../../../js/bootstrap.min.js"></script>
  197. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  198. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  199. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  200. <script src="https://unpkg.com/element-ui/lib/index.js" type="text/javascript" charset="utf-8"></script>
  201. <script src="../../../api/http-request.js" type="text/javascript"></script>
  202. <script src="../../../api/recover_api.js" type="text/javascript"></script>
  203. <script type="text/javascript">
  204. var doctorType = (JSON.parse(window.localStorage.getItem('wlyyAgent'))||{}).doctorType,
  205. docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  206. var httpData=GetRequest()
  207. function showSuccessMessage(msg) {
  208. layer.msg(msg, {
  209. icon: 1
  210. })
  211. }
  212. function showErrorMessage(msg) {
  213. layer.msg(msg, {
  214. icon: 5
  215. })
  216. }
  217. function showWarningMessage(msg) {
  218. layer.msg(msg, {
  219. icon: 2
  220. })
  221. }
  222. function showInfoMessage(msg) {
  223. layer.msg(msg, {
  224. icon: 6
  225. })
  226. }
  227. recoverVue = new Vue({
  228. el: "#app",
  229. data: {
  230. pickerOptions1: {
  231. disabledDate(time) {
  232. return time.getTime() < Date.now() - 8.64e7;
  233. }
  234. },
  235. surefont: '添加',
  236. isTest: false,
  237. pati: null,
  238. isPlan: false,
  239. proIndex1: null,
  240. proIndex2: null,
  241. patiInfo: null,
  242. diseaseObj: null,
  243. mubanList: [],
  244. templateDetail: [],
  245. templateResult: [],
  246. allFee: 0,
  247. projectList: null,
  248. labelIndex: 2,
  249. labelCode: 1,
  250. spanLabel: [{
  251. labelName: "(转)家庭病床",
  252. code: 3
  253. }, {
  254. labelName: "(转)社区医院",
  255. code: 2
  256. }, {
  257. labelName: "康复计划",
  258. code: 1
  259. }],
  260. jDlist: null,
  261. zDlist: null,
  262. selectProjectDetail: null,
  263. searchKey: null,
  264. havePlan: false
  265. },
  266. mounted: function() {
  267. if(httpData.patient) {
  268. this.isPlan = false
  269. this.allFee = 0
  270. this.templateDetail = []
  271. this.pati = {patient: httpData.patient}
  272. this.getPatientInfo()
  273. this.findTemplateList()
  274. }
  275. },
  276. methods: {
  277. // 获取居民信息
  278. getPatientInfo: function() {
  279. this.findPatientSignSpecialistInfo()
  280. var vm = this,
  281. loadding = layer.load(0, {shade: false}),
  282. params = {
  283. patient: this.pati.patient
  284. }
  285. recoverAPI.getPatientInfo(params).then(function(res) {
  286. layer.close(loadding)
  287. if(res.status == 200) {
  288. vm.patiInfo = res.data
  289. vm.pati.patientName = res.data.name
  290. vm.jDlist = [{
  291. name: vm.patiInfo.ssDoctorName || vm.patiInfo.jtDoctorName,
  292. code: vm.patiInfo.ssDoctor || vm.patiInfo.jtDoctor
  293. }, {
  294. name: vm.patiInfo.ssDoctorHealthName || vm.patiInfo.jtDoctorHealthName,
  295. code: vm.patiInfo.ssDoctorHealth || vm.patiInfo.jtDoctorHealth
  296. }]
  297. } else {
  298. showErrorMessage(res.msg);
  299. }
  300. })
  301. },
  302. findPatientSignSpecialistInfo: function() {
  303. var vm = this,
  304. params = {
  305. patient: this.pati.patient,
  306. doctor: docInfo.uid
  307. }
  308. recoverAPI.findPatientSignSpecialistInfo(params).then(function(res) {
  309. if(res.status == 200) {
  310. vm.pati.teamCode = res.data.teamCode
  311. vm.zDlist = [{
  312. name: res.data.doctorName,
  313. code: res.data.doctor
  314. }, {
  315. name: res.data.healthAssistantName,
  316. code: res.data.healthAssistant
  317. }]
  318. } else {
  319. showErrorMessage(res.msg);
  320. }
  321. })
  322. },
  323. // 模板列表
  324. findTemplateList: function() {
  325. var vm = this,
  326. loadding = layer.load(0, {shade: false}),
  327. params = {
  328. patient: this.pati.patient,
  329. doctor: docInfo.uid
  330. }
  331. recoverAPI.findTemplateList(params).then(function(res) {
  332. layer.close(loadding)
  333. if(res.status == 200) {
  334. vm.mubanList = res.data
  335. } else {
  336. showErrorMessage(res.msg);
  337. }
  338. })
  339. },
  340. // 模板详细
  341. findTemplateDetail: function(templateId) {
  342. var vm = this,
  343. loadding = layer.load(0, {shade: false}),
  344. params = {
  345. templateId: templateId
  346. }
  347. recoverAPI.findTemplateDetail(params).then(function(res) {
  348. layer.close(loadding)
  349. if(res.status == 200) {
  350. vm.templateDetail = []
  351. vm.templateResult = res.data
  352. vm.findServiceItemsByHospital()
  353. } else {
  354. showErrorMessage(res.msg);
  355. }
  356. })
  357. },
  358. // 服务项目列表
  359. findServiceItemsByHospital: function() {
  360. var vm = this,
  361. loadding = layer.load(0, {shade: false}),
  362. params = {
  363. doctor: docInfo.uid,
  364. patient: this.pati.patient,
  365. serviceItemName: this.searchKey
  366. }
  367. recoverAPI.findServiceItemsByHospital(params).then(function(res) {
  368. layer.close(loadding)
  369. if(res.status == 200) {
  370. vm.projectList = $.each(res.data[0], function(index, o) {
  371. $.each(vm.templateResult, function(index1, o1) {
  372. if(o1.specialistServiceItemDO.itemType == o.itemType) {
  373. $.each(o.item, function(index2, o2) {
  374. if(o1.specialistServiceItemDO.diseaseItem == o2.itemName) {
  375. $.each(o2.hospitalServiceItems, function(index3, o3) {
  376. if(o3.serviceItemId == o1.serviceItemId) {
  377. o3.isSelect = true
  378. o3.selectDoc = false
  379. o3.selectDate = 1
  380. o3.value14 = null
  381. o3.specialistServiceItemDO.executeTime = []
  382. o3.specialistServiceItemDO.selectDateRange = []
  383. if(o3.flag == 2) {
  384. o3.executeDoctor = vm.zDlist[0].code
  385. o3.executeDoctorName = vm.zDlist[0].name
  386. o3.docList = vm.zDlist
  387. } else {
  388. o3.executeDoctor = vm.jDlist[0].code
  389. o3.executeDoctorName = vm.jDlist[0].name
  390. o3.docList = vm.jDlist
  391. }
  392. vm.templateDetail.push(o3)
  393. }
  394. });
  395. }
  396. });
  397. }
  398. });
  399. return o;
  400. });
  401. } else {
  402. showErrorMessage(res.msg);
  403. }
  404. })
  405. },
  406. searchProject: function() {
  407. this.findServiceItemsByHospital()
  408. },
  409. setPatImg: function(src) {
  410. if(!src) {
  411. return "../../../images/p-female.png"
  412. } else {
  413. var str = httpRequest.getImgUrl(src);
  414. return str
  415. }
  416. },
  417. changeSelectDoc: function(index, bool) {
  418. this.templateDetail[index].selectDoc = !bool
  419. this.isTest = !this.isTest
  420. },
  421. selectLi: function(index, list) {
  422. this.templateDetail[index].selectDoc = false
  423. this.templateDetail[index].executeDoctor = list.code
  424. this.templateDetail[index].executeDoctorName = list.name
  425. this.templateDetail[index] = this.templateDetail[index]
  426. this.isTest = !this.isTest
  427. },
  428. subTemplate: function(index, detail) {
  429. var vm = this
  430. this.isTest = !this.isTest
  431. this.templateDetail.splice(index, 1)
  432. var len = detail.specialistServiceItemDO.executeTime.length
  433. if(len) {
  434. this.allFee = vm.sub(vm.allFee, vm.mul(len, detail.expense))
  435. }
  436. $.each(vm.projectList, function(index, o) {
  437. if(detail.specialistServiceItemDO.itemType == o.itemType) {
  438. $.each(o.item, function(index2, o2) {
  439. if(detail.specialistServiceItemDO.diseaseItem == o2.itemName) {
  440. $.each(o2.hospitalServiceItems, function(index3, o3) {
  441. if(o3.serviceItemId == detail.serviceItemId) {
  442. o3.isSelect = false
  443. o3.specialistServiceItemDO.executeTime = []
  444. }
  445. });
  446. }
  447. });
  448. }
  449. });
  450. vm.judgeHavePlan()
  451. },
  452. // 选择项目
  453. selectProject: function(index, index2, index3, o) {
  454. this.selectProjectDetail = o
  455. selectPatientIndex = layer.open({
  456. type: 2,
  457. area: ['400px', '500px'],
  458. shade: 0.5,
  459. title: '选择项目',
  460. closeBtn: 1,
  461. shift: 5,
  462. shadeClose: false, //点击遮罩关闭层
  463. content: "select-project.html?isLook=true&projectId=" + o.id + "&index=" + index + "&index3=" + index3 + "&index2=" + index2
  464. });
  465. },
  466. // 添加项目
  467. addProject: function(index, index2, index3, obj) {
  468. if(obj) {
  469. this.selectProjectDetail = obj
  470. }
  471. if(this.selectProjectDetail.isSelect) {
  472. showWarningMessage("已添加!")
  473. return false;
  474. }
  475. this.selectProjectDetail.isSelect = true
  476. this.selectProjectDetail.selectDoc = false
  477. this.selectProjectDetail.selectDate = 1
  478. this.selectProjectDetail.value14 = null
  479. this.selectProjectDetail.specialistServiceItemDO.executeTime = []
  480. this.selectProjectDetail.specialistServiceItemDO.selectDateRange = []
  481. if(this.selectProjectDetail.flag == 2) {
  482. this.selectProjectDetail.executeDoctor = this.zDlist[0].code
  483. this.selectProjectDetail.executeDoctorName = this.zDlist[0].name
  484. this.selectProjectDetail.docList = this.zDlist
  485. } else {
  486. this.selectProjectDetail.executeDoctor = this.jDlist[0].code
  487. this.selectProjectDetail.executeDoctorName = this.jDlist[0].name
  488. this.selectProjectDetail.docList = this.jDlist
  489. }
  490. this.templateDetail.push(this.selectProjectDetail)
  491. this.projectList[index].item[index2].hospitalServiceItems[index3] = this.selectProjectDetail
  492. },
  493. // 查看项目
  494. lookProject: function(o) {
  495. selectPatientIndex = layer.open({
  496. type: 2,
  497. area: ['400px', '500px'],
  498. shade: 0.5,
  499. title: '查看项目',
  500. closeBtn: 1,
  501. shift: 5,
  502. shadeClose: false, //点击遮罩关闭层
  503. content: "select-project.html?projectId=" + o.id
  504. });
  505. },
  506. // 选择居民
  507. selectPatient: function() {
  508. selectPatientIndex = layer.open({
  509. type: 2,
  510. area: ['400px', '500px'],
  511. shade: 0.5,
  512. title: '同步出院小结',
  513. closeBtn: 1,
  514. shift: 5,
  515. shadeClose: false, //点击遮罩关闭层
  516. content: "select-patient.html"
  517. });
  518. },
  519. // 选择居民回调
  520. selectPatientOk: function(pati) {
  521. this.isPlan = false
  522. this.allFee = 0
  523. this.templateDetail = []
  524. this.pati = pati
  525. this.getPatientInfo()
  526. this.findTemplateList()
  527. },
  528. // 添加模板
  529. addMuban: function(oId) {
  530. var vm = this
  531. selectDiseaseIndex = layer.open({
  532. type: 2,
  533. area: ['400px', '500px'],
  534. shade: 0.5,
  535. title: '选择疾病',
  536. closeBtn: 1,
  537. shift: 5,
  538. shadeClose: false, //点击遮罩关闭层
  539. content: "select-disease.html?teamCode=" + vm.pati.teamCode +"&templateId=" + oId || ''
  540. });
  541. },
  542. // 取消计划
  543. canclePlan: function(obj) {
  544. var vm = this
  545. cancleIndex = layer.open({
  546. type: 2,
  547. area: ['400px', '180px'],
  548. shade: 0.5,
  549. title: '取消确认',
  550. closeBtn: 1,
  551. shift: 5,
  552. shadeClose: false, //点击遮罩关闭层
  553. content: "cancle_sure.html"
  554. });
  555. },
  556. cancleSure: function() {
  557. this.isPlan = false
  558. this.allFee = 0
  559. this.templateDetail = []
  560. },
  561. newPlan: function(disease, templateId) {
  562. this.diseaseObj = disease
  563. this.isPlan = true
  564. if(templateId) {
  565. this.findTemplateDetail(templateId)
  566. } else {
  567. this.templateDetail = []
  568. this.findServiceItemsByHospital()
  569. }
  570. },
  571. selectPro: function(pro, index) {
  572. if(pro == 1) {
  573. this.proIndex2 = null;
  574. this.proIndex1 == index ? this.proIndex1 = null : this.proIndex1 = index
  575. } else {
  576. this.proIndex2 == index ? this.proIndex2 = null : this.proIndex2 = index
  577. }
  578. },
  579. setLabelIndex: function(index, label) {
  580. this.labelIndex = index
  581. this.labelCode = label.code
  582. },
  583. changeSelectDate: function(index, num) {
  584. if(this.templateDetail[index].specialistServiceItemDO.executeTime.length) {
  585. showWarningMessage("请先清除此选项的计划时间!");
  586. return false;
  587. }
  588. this.isTest = !this.isTest
  589. this.templateDetail[index].selectDate = num
  590. },
  591. openSelectTime: function(index) {
  592. var vm = this
  593. selectTimeIndex = layer.open({
  594. type: 2,
  595. area: ['600px', '500px'],
  596. shade: 0.5,
  597. title: '服务时间选择',
  598. closeBtn: 1,
  599. shift: 5,
  600. shadeClose: false, //点击遮罩关闭层
  601. content: "select_timer.html"
  602. });
  603. },
  604. // 选择日期
  605. getSelectDate: function(index) {
  606. var str = this.templateDetail[index].value14
  607. this.templateDetail[index].specialistServiceItemDO.executeTime.push(str)
  608. this.templateDetail[index].value14 = null
  609. this.isTest = !this.isTest
  610. this.allFee = this.add(this.allFee, this.templateDetail[index].expense)
  611. this.judgeHavePlan()
  612. },
  613. // 选择周期
  614. getRandgeDate: function(index) {
  615. var arr = this.templateDetail[index].value14,
  616. startTime = new Date(arr[0]).getTime(),
  617. endTime = new Date(arr[1]).getTime(),
  618. absTime = endTime - startTime,
  619. oneday = 60 * 60 *24 * 1000,
  620. i = 0;
  621. for(i; i * oneday <= absTime; i++) {
  622. var num = i * oneday + startTime,
  623. str = new Date(num).format("yyyy-MM-dd")
  624. this.templateDetail[index].specialistServiceItemDO.executeTime.push(str)
  625. this.allFee = this.add(this.allFee, this.templateDetail[index].expense)
  626. }
  627. var obj = {
  628. startTime: arr[0],
  629. endTime: arr[1],
  630. length: i
  631. }
  632. this.templateDetail[index].specialistServiceItemDO.selectDateRange.push(obj)
  633. this.templateDetail[index].value14 = null
  634. this.isTest = !this.isTest
  635. this.judgeHavePlan()
  636. },
  637. spliceTimeArr: function(index, ind) {
  638. var vm = this
  639. this.templateDetail[index].specialistServiceItemDO.executeTime.splice(ind, 1)
  640. this.isTest = !this.isTest
  641. vm.allFee = vm.sub(vm.allFee, vm.templateDetail[index].expense)
  642. vm.judgeHavePlan()
  643. },
  644. spliceTimeRange: function(index, ind) {
  645. var startPos = 0,
  646. len = this.templateDetail[index].specialistServiceItemDO.selectDateRange[ind].length,
  647. vm = this
  648. for(var i = 0; i < ind; i++) {
  649. startPos += this.templateDetail[index].specialistServiceItemDO.selectDateRange[i].length
  650. }
  651. this.templateDetail[index].specialistServiceItemDO.selectDateRange.splice(ind, 1)
  652. this.templateDetail[index].specialistServiceItemDO.executeTime.splice(startPos, len)
  653. this.isTest = !this.isTest
  654. vm.allFee = vm.sub(vm.allFee, vm.mul(vm.templateDetail[index].expense, len))
  655. vm.judgeHavePlan()
  656. },
  657. judgeHavePlan: function() {
  658. for(var k = 0; k < this.templateDetail.length; k++) {
  659. for(var i = 0; i < this.templateDetail[k].specialistServiceItemDO.executeTime.length; i++) {
  660. if(this.templateDetail[k].specialistServiceItemDO.executeTime[i]) {
  661. this.havePlan = true;
  662. return false;
  663. }
  664. }
  665. }
  666. this.havePlan = false
  667. },
  668. createRehabilitationPlan: function() {
  669. if(!this.havePlan) {
  670. showWarningMessage("请选择计划时间!")
  671. return false;
  672. }
  673. for(var k = 0; k < this.templateDetail.length; k++) {
  674. for(var i = 0; i < this.templateDetail[k].specialistServiceItemDO.executeTime.length; i++) {
  675. for(var j = i + 1; j < this.templateDetail[k].specialistServiceItemDO.executeTime.length; j++) {
  676. if(this.templateDetail[k].specialistServiceItemDO.executeTime[i] == this.templateDetail[k].specialistServiceItemDO.executeTime[j]) {
  677. showWarningMessage("请核对项目“" + this.templateDetail[k].specialistServiceItemDO.title + "”的计划时间选择!");
  678. return false;
  679. }
  680. }
  681. }
  682. }
  683. var vm = this,
  684. loadding = layer.load(0, {shade: false}),
  685. data = {
  686. patient: this.pati.patient,
  687. name: this.pati.patientName,
  688. title: this.pati.patientName + this.diseaseObj.diseaseName + "康复计划",
  689. disease: this.diseaseObj.diseaseCode,
  690. diseaseName: this.diseaseObj.diseaseName,
  691. planType: this.labelCode,
  692. payment: 2,
  693. totalExpense: this.allFee,
  694. detail: []
  695. },
  696. params = {};
  697. $.each(vm.templateDetail, function(index, o) {
  698. if(o.specialistServiceItemDO.executeTime.length) {
  699. var executeTime = []
  700. $.each(o.specialistServiceItemDO.executeTime, function(ind, v) {
  701. v += ' 00:00'
  702. executeTime.push(v)
  703. });
  704. var obj = {
  705. hospitalServiceItemId: o.id,
  706. type: o.flag == 2 ? 2 : 1,
  707. doctor: o.executeDoctor,
  708. doctorName: o.executeDoctorName,
  709. executeTime: executeTime.join(",")
  710. }
  711. data.detail.push(obj)
  712. }
  713. });
  714. params = {
  715. json: JSON.stringify(data)
  716. }
  717. recoverAPI.createRehabilitationPlan(params).then(function(res) {
  718. layer.close(loadding)
  719. if(res.status == 200) {
  720. showSuccessMessage("康复计划配置成功!")
  721. setTimeout(function() {
  722. window.location.href = "../../rehabilitation/html/health_control.html"
  723. }, 1000)
  724. } else {
  725. showErrorMessage(res.msg);
  726. }
  727. })
  728. },
  729. // 字符串方法计算加减乘除(精确度百分位)
  730. add: function(num1,num2){
  731. var r1,r2,m,n;
  732. try{r1=num1.toString().split(".")[1].length}catch(e){r1=0}
  733. try{r2=num2.toString().split(".")[1].length}catch(e){r2=0}
  734. m = Math.pow(10,Math.max(r1,r2));
  735. n = (r1>=r2)?r1:r2;
  736. return ((num1*m + num2*m)/m).toFixed(n);
  737. },
  738. sub: function(num1,num2){
  739. var r1,r2,m,n;
  740. try{r1=num1.toString().split(".")[1].length}catch(e){r1=0}
  741. try{r2=num2.toString().split(".")[1].length}catch(e){r2=0}
  742. n = (r1>=r2)?r1:r2;
  743. m = Math.pow(10,Math.max(r1,r2));
  744. return ((num1*m - num2*m)/m).toFixed(n);
  745. },
  746. mul: function(num1,num2){
  747. var m = 0;
  748. try{m+=num1.toString().split(".")[1].length}catch(e){}
  749. try{m+=num2.toString().split(".")[1].length}catch(e){}
  750. return (Number(num1.toString().replace(".",""))*Number(num2.toString().replace(".","")))/Math.pow(10,m)
  751. },
  752. div: function(arg1,arg2){
  753. var t1=0,t2=0,r1,r2;
  754. try{t1=arg1.toString().split(".")[1].length}catch(e){}
  755. try{t2=arg2.toString().split(".")[1].length}catch(e){}
  756. r1=Number(arg1.toString().replace(".",""));
  757. r2=Number(arg2.toString().replace(".",""));
  758. return (r1/r2)*Math.pow(10,t2-t1);
  759. }
  760. }
  761. })
  762. </script>
  763. </body>
  764. </html>