questionnaire.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>筛选类型</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <meta name="renderer" content="webkit" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <meta name="keywords" content="筛选类型" />
  10. <meta name="description" content="筛选类型" />
  11. <link rel="shortcut icon" href="../../../favicon.ico" />
  12. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  13. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  14. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  15. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet" />
  16. <link rel="stylesheet" href="../css/questionnaire.css" />
  17. <link rel="stylesheet" type="text/css" href="../../../css/element-ui.css" />
  18. <!-- <link rel="stylesheet" type="text/css" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" /> -->
  19. </head>
  20. <body>
  21. <div class="ui-grid" id="app" style="align-items: flex-start" v-cloak>
  22. <div class="flex-box-item ptb20">
  23. <!--<div class="prompt-text">请认真填写本页面,方便医生进行综合评估【厦门i健康】</div>-->
  24. <div class="single-choice-question">
  25. <div class="question-title">问卷题目</div>
  26. <div class="question-content">
  27. <ul class="question-list">
  28. <li v-for="(qst,key,index) in questions">
  29. <p class="question-name" v-text="key+'、'+qst.question.title"></p>
  30. <div class="daan-list" v-if="qst.question.questionType!=2">
  31. <lable class="label-block" v-for="opt in qst.option" @click="selectItem(qst.question,opt,index)">
  32. <span class="pull-right" v-text="(opt.score || 0)+'分'" v-if="qst.isThird!=3"></span>
  33. <template v-if="qst.isThird==3&&qst.question.thirdKey=='sex'">
  34. <input
  35. :type="qst.questionType==1?'checkbox':'radio'"
  36. :checked="opt.thirdValue == sex"
  37. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  38. value="1" />
  39. <i></i>
  40. <span v-text="opt.content"></span>
  41. </template>
  42. <template v-if="qst.isThird==3&&qst.question.thirdKey=='acs'">
  43. <input
  44. :type="qst.questionType==1?'checkbox':'radio'"
  45. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS1)"
  46. id="myInput1"
  47. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  48. value="1" />
  49. <i></i>
  50. <span v-text="opt.content"></span>
  51. </template>
  52. <template v-if="qst.isThird==3&&qst.question.thirdKey=='myocardialInfarct'">
  53. <input
  54. :type="qst.questionType==1?'checkbox':'radio'"
  55. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS2)"
  56. id="myInput2"
  57. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  58. value="1" />
  59. <i></i>
  60. <span v-text="opt.content"></span>
  61. </template>
  62. <template v-if="qst.isThird==3&&qst.question.thirdKey=='ischemicStroke'">
  63. <input
  64. :type="qst.questionType==1?'checkbox':'radio'"
  65. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS3)"
  66. id="myInput3"
  67. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  68. value="1" />
  69. <i></i>
  70. <span v-text="opt.content"></span>
  71. </template>
  72. <template v-if="qst.isThird==3&&qst.question.thirdKey=='smoke'">
  73. <input
  74. :type="qst.questionType==1?'checkbox':'radio'"
  75. :checked="opt.thirdValue == smoke"
  76. id="myInput3"
  77. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  78. value="1" />
  79. <i></i>
  80. <span v-text="opt.content"></span>
  81. </template>
  82. <template v-if="qst.isThird==3&&qst.question.thirdKey=='diabetes'">
  83. <input
  84. :type="qst.questionType==1?'checkbox':'radio'"
  85. :checked="opt.thirdValue == diabetes"
  86. id="myInput3"
  87. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  88. value="1" />
  89. <i></i>
  90. <span v-text="opt.content"></span>
  91. </template>
  92. <template v-if="qst.isThird==3&&qst.question.thirdKey=='hypertension'">
  93. <input
  94. :type="qst.questionType==1?'checkbox':'radio'"
  95. :checked="opt.thirdValue == hypertension"
  96. id="myInput3"
  97. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  98. value="1" />
  99. <i></i>
  100. <span v-text="opt.content"></span>
  101. </template>
  102. <template v-if="qst.isThird==3&&qst.question.thirdKey=='seriousMedicalHistory'">
  103. <input
  104. :type="qst.questionType==1?'checkbox':'radio'"
  105. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS4)"
  106. id="myInput4"
  107. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  108. value="1" />
  109. <i></i>
  110. <span v-text="opt.content"></span>
  111. </template>
  112. <template
  113. v-if="qst.question.thirdKey!='sex'&&qst.question.thirdKey!='acs'&&qst.question.thirdKey!='myocardialInfarct'&&qst.question.thirdKey!='ischemicStroke'&&qst.question.thirdKey!='smoke'&&qst.question.thirdKey!='hypertension'&&qst.question.thirdKey!='diabetes'&&qst.question.thirdKey!='seriousMedicalHistory'">
  114. <input
  115. :type="qst.questionType==1||qst.question.questionType?'checkbox':'radio'"
  116. v-if="qst.question.thirdKey!='sex'"
  117. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  118. value="1" />
  119. <i></i>
  120. <span v-text="opt.content"></span>
  121. </template>
  122. </lable>
  123. </div>
  124. <div v-else>
  125. <template
  126. v-if="(qst.isThird=='3' && qst.question.thirdKey == 'assessTime')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='大肠癌筛查问卷(OB筛查)')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='脑卒中风险评估(冠心病、脑卒中、肾病)')">
  127. <div style="padding-left: 20px">
  128. <el-date-picker
  129. v-model="qst.question.content"
  130. type="datetime"
  131. format="yyyy-MM-dd HH:mm"
  132. value-format="yyyy-MM-dd HH:mm"
  133. placeholder="选择日期时间"
  134. @change="changeContent(qst.question,qst.question.content)"></el-date-picker>
  135. </div>
  136. </template>
  137. <template v-else>
  138. <div
  139. class="daan-list"
  140. v-if="qst.isThird==3 && (qst.question.thirdKey == 'assessDoctor' || qst.question.thirdKey == 'assessOrgId'||(!shaowas&&qst.question.thirdKey == 'bmi'))">
  141. <textarea class="wenjuan-textarea" disabled rows="2" v-model="qst.question.content"></textarea>
  142. </div>
  143. <div class="daan-list" v-else-if="qst.question.thirdKey != 'bmi'">
  144. <textarea class="wenjuan-textarea" @keyup="changeContent(qst.question,qst.question.content,1)" rows="2" v-model="qst.question.content"></textarea>
  145. </div>
  146. <div class="daan-list" v-if="(shaowas&&qst.question.thirdKey == 'bmi')">
  147. <textarea class="wenjuan-textarea" disabled rows="2" v-model="shaowas"></textarea>
  148. </div>
  149. </template>
  150. </div>
  151. </li>
  152. </ul>
  153. </div>
  154. </div>
  155. </div>
  156. <div class="w-250">
  157. <div class="base-info">
  158. <p class="f-16 mb0">基本信息</p>
  159. <div :class="`flex-box ${noswitch?'':'right-triangle'}`">
  160. <span class="w-70">类型</span>
  161. <a class="flex-box-item" :alt="screeningTitle" v-text="screeningTitle" @click="goBack">--</a>
  162. </div>
  163. <div :class="`flex-box ${noswitch?'':'right-triangle'}`">
  164. <span class="w-70">对象</span>
  165. <a class="flex-box-item" :alt="screeningResidentsName" v-text="screeningResidentsName" @click="goBack(1)">--</a>
  166. </div>
  167. <div class="flex-box">
  168. <span class="w-70">筛查人员</span>
  169. <div class="flex-box-item c-999" v-text="doctorInfo.name"></div>
  170. </div>
  171. <div class="flex-box" style="align-items: flex-start">
  172. <span class="w-70">体征记录</span>
  173. <div class="flex-box-item" v-if="tizhongRecord.value1 || tizhongRecord.value2">
  174. <p v-if="tizhongRecord.value1">
  175. 体重
  176. <input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value1" />
  177. kg
  178. </p>
  179. <p class="mb0" v-if="tizhongRecord.value2">
  180. 身高
  181. <input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value2" />
  182. cm
  183. </p>
  184. </div>
  185. <div class="flex-box-item" v-else>暂无体征</div>
  186. </div>
  187. </div>
  188. <div class="completion-of-progress">
  189. <p class="f16 mb0">完成情况</p>
  190. <div class="canvas-box">
  191. <canvas-progress :progress="progress" ref="progress"></canvas-progress>
  192. <p class="progress-number">
  193. <span>已完成</span>
  194. </p>
  195. </div>
  196. </div>
  197. <div class="btn-group-bottom">
  198. <button class="btn submit-btn" @click="save">提交</button>
  199. <button class="btn btn-exit" @click="signOut">退出</button>
  200. </div>
  201. </div>
  202. </div>
  203. <script type="text/javascript" src="../../../plugins/echarts/3.8.5/echarts.min.js"></script>
  204. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  205. <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
  206. <script src="../../../component/common/event-bus.js"></script>
  207. <script src="../../../js/element-ui.js" type="text/javascript" charset="utf-8"></script>
  208. <!-- <script src="https://unpkg.com/element-ui/lib/index.js" type="text/javascript" charset="utf-8"></script> -->
  209. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  210. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  211. <script src="../../../plugins/toastr/toastr.min.js"></script>
  212. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  213. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  214. <script src="../../../api/http-request.js" type="text/javascript" charset="utf-8"></script>
  215. <script type="text/javascript" src="../../../api/jbsc-api.js"></script>
  216. <script type="text/javascript" src="../component/canvas-progress.js"></script>
  217. <script type="text/javascript">
  218. var httpData = GetRequest()
  219. var docInfo = JSON.parse(window.localStorage.getItem('docInfo'))
  220. var question = new Vue({
  221. el: '#app',
  222. data: {
  223. //数据结果
  224. progress: 0,
  225. selectArr: [],
  226. screeningTitle: decodeURI(httpData['fliter_title']),
  227. screeningType: httpData['fliter_code'],
  228. screeningResidents: httpData['resident_code'],
  229. screeningResidentsName: decodeURI(httpData['resident_name']),
  230. sex: decodeURI(httpData['sex']),
  231. age: decodeURI(httpData['age']),
  232. doctorInfo: { code: docInfo.code },
  233. surveyStatus: httpData['surveyStatus'] || '',
  234. questions: [],
  235. tizhongRecord: {},
  236. labelType: 5, //问卷筛查labelType=5
  237. isAgain: httpData['isAgain'] || 0,
  238. ascvdShow: '',
  239. ascvdS1: '',
  240. ascvdS2: '',
  241. ascvdS3: '',
  242. ascvdS4: '',
  243. shaowas: '',
  244. smoke: '',
  245. hypertension: '',
  246. diabetes: '',
  247. noswitch: httpData['noswitch']
  248. },
  249. mounted: function () {
  250. // if (this.screeningType != '6bcd306aaafb4e4381071346d86fadbb1') {
  251. this.getHealth()
  252. // console.log(123456);
  253. // }
  254. this.getQuestion()
  255. this.getDoctorInfo()
  256. },
  257. methods: {
  258. getInitData() {
  259. var vm = this
  260. httpRequest.get('doctor/screen/physicalList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  261. var data = res.data
  262. if (res.status == 200 && data) {
  263. for (var i in vm.questions) {
  264. if (vm.questions[i].question.thirdKey == 'height' && data.height) {
  265. vm.questions[i].question.content = data.height + ''
  266. vm.changeContent(vm.questions[i].question, data.height + '')
  267. }
  268. if (vm.questions[i].question.thirdKey == 'weight' && data.weight) {
  269. vm.questions[i].question.content = data.weight + ''
  270. vm.changeContent(vm.questions[i].question, data.weight + '')
  271. }
  272. if (vm.questions[i].question.thirdKey == 'bmi') {
  273. if (data.height && data.weight) {
  274. var w = data.weight
  275. var h = data.height / 100
  276. var s = (w / (h * h)).toFixed(2)
  277. vm.questions[i].question.content = s
  278. vm.shaowas = s
  279. vm.changeContent(vm.questions[i].question, s + '')
  280. } else {
  281. vm.questions[i].question.content = ''
  282. vm.shaowas = ''
  283. vm.changeContent(vm.questions[i].question, '')
  284. }
  285. }
  286. if (vm.questions[i].question.thirdKey == 'systolicPressure' && data.systolicPressure) {
  287. vm.questions[i].question.content = data.systolicPressure + ''
  288. vm.changeContent(vm.questions[i].question, data.systolicPressure + '')
  289. }
  290. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && data.diastolicPressure) {
  291. vm.questions[i].question.content = data.diastolicPressure + ''
  292. vm.changeContent(vm.questions[i].question, data.diastolicPressure + '')
  293. }
  294. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && data.totalCholesterol) {
  295. vm.questions[i].question.content = data.totalCholesterol + ''
  296. vm.changeContent(vm.questions[i].question, data.totalCholesterol + '')
  297. }
  298. if (vm.questions[i].question.thirdKey == 'hdlc' && data.HDL) {
  299. vm.questions[i].question.content = data.HDL + ''
  300. vm.changeContent(vm.questions[i].question, data.HDL + '')
  301. }
  302. if (vm.questions[i].question.thirdKey == 'ldlc' && data.LDL) {
  303. vm.questions[i].question.content = data.LDL + ''
  304. vm.changeContent(vm.questions[i].question, data.LDL + '')
  305. }
  306. // if (vm.questions[i].question.thirdKey == 'ckd34' && data.height) {
  307. // vm.questions[i].question.content = data.height + ''
  308. // vm.changeContent(vm.questions[i].question, data.LDL + '')
  309. // }
  310. if (vm.questions[i].question.title == '既往有心肌梗死病史' && data.AMI) {
  311. var index = data.AMI == 1 ? 0 : data.AMI == 2 ? 1 : ''
  312. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  313. }
  314. if (vm.questions[i].question.title == '缺血性脑卒中病史' && data.CerebralIschemicStroke) {
  315. console.log('缺血性脑卒中病史', vm.questions[i], data.CerebralIschemicStroke)
  316. var index = data.CerebralIschemicStroke == 1 ? 0 : data.CerebralIschemicStroke == 2 ? 1 : ''
  317. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  318. }
  319. if (vm.questions[i].question.title == '高血压' && data.hypertension) {
  320. var index = data.hypertension == 1 ? 0 : data.hypertension == 2 ? 1 : ''
  321. vm.selectItem(vm.questions[i].question, vm.questions[i].option[index])
  322. }
  323. if (vm.questions[i].question.title == '糖尿病' && data.Diabetes) {
  324. console.log('vm.questions[i]', vm.questions[i])
  325. var index = data.Diabetes == 1 ? 0 : data.Diabetes == 2 ? 1 : ''
  326. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  327. }
  328. if (vm.questions[i].question.title == '吸烟' && (data.smoke || data.smoke == 0)) {
  329. var index = data.smoke == 1 ? 0 : data.smoke == 0 ? 1 : ''
  330. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  331. }
  332. }
  333. vm.$forceUpdate()
  334. }
  335. httpRequest.get('doctor/screen/checkUpList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  336. var obj = res.data
  337. if (res.status == 200 && obj) {
  338. for (var i in vm.questions) {
  339. if (vm.questions[i].question.thirdKey == 'hdlc' && !vm.questions[i].question.content) {
  340. vm.questions[i].question.content = obj.hdlc
  341. vm.changeContent(vm.questions[i].question, obj.hdlc)
  342. }
  343. if (vm.questions[i].question.thirdKey == 'ldlc' && !vm.questions[i].question.content) {
  344. vm.questions[i].question.content = obj.ldlc
  345. vm.changeContent(vm.questions[i].question, obj.ldlc + '')
  346. }
  347. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && !vm.questions[i].question.content) {
  348. vm.questions[i].question.content = obj.totalCholesterol
  349. vm.changeContent(vm.questions[i].question, obj.totalCholesterol + '')
  350. }
  351. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && !vm.questions[i].question.content) {
  352. vm.questions[i].question.content = obj.diastolicPressure
  353. vm.changeContent(vm.questions[i].question, obj.diastolicPressure + '')
  354. }
  355. if (vm.questions[i].question.thirdKey == 'systolicPressure' && !vm.questions[i].question.content) {
  356. vm.questions[i].question.content = obj.systolicPressure
  357. vm.changeContent(vm.questions[i].question, obj.systolicPressure + '')
  358. }
  359. }
  360. }
  361. // var data = res.data
  362. // if (!vm.form.totalCholesterol) {
  363. // vm.form.totalCholesterol = data.totalCholesterol
  364. // }
  365. // if (!vm.form.hdlc) {
  366. // vm.form.hdlc = data.hdlc
  367. // }
  368. // if (!vm.form.ldlc) {
  369. // vm.form.ldlc = data.ldlc
  370. // }
  371. // if (!vm.form.systolicPressure) {
  372. // vm.form.systolicPressure = data.systolicPressure
  373. // }
  374. // if (!vm.diastolicPressure) {
  375. // vm.form.diastolicPressure = data.diastolicPressure
  376. // }
  377. vm.$forceUpdate()
  378. })
  379. })
  380. },
  381. getDoctorInfo: function () {
  382. var vm = this
  383. var data = {
  384. code: vm.doctorInfo.code
  385. }
  386. jbscAPI.doctorBaseinfo(data).then(function (res) {
  387. if (res.status == 200) {
  388. vm.doctorInfo = res.data
  389. } else {
  390. top.layer.msg(res.msg, { icon: 5 })
  391. }
  392. })
  393. },
  394. //计算选中个数,组装成后台接收格式
  395. selectItem: function (qst, select, num) {
  396. var vm = this
  397. var isFlag = 1
  398. if (qst.title == '抗栓药物其他名称' && vm.screeningTitle == '大肠癌筛查问卷(OB筛查)') {
  399. vm.selectArr.forEach(function (item, index) {
  400. if (item.thirdKey == 'ksDrugName1') {
  401. item.options.forEach(function (v, i) {
  402. if (v.comment == '其他') {
  403. isFlag = 0
  404. return false
  405. }
  406. })
  407. }
  408. })
  409. // 如果没有勾选“其他”选项,提示并返回
  410. if (isFlag) {
  411. qst.content = '' // 清空当前输入的内容
  412. this.$message.error('请先勾选抗栓药物名称的其他选项')
  413. return false
  414. }
  415. }
  416. if (vm.ascvdShow) {
  417. if (select.thirdKey == 'acs' || select.thirdKey == 'myocardialInfarct' || select.thirdKey == 'ischemicStroke' || select.thirdKey == 'seriousMedicalHistory') {
  418. return false
  419. }
  420. }
  421. var data = {
  422. qstCode: qst.code,
  423. type: qst.questionType,
  424. content: qst.content,
  425. thirdKey: qst.thirdKey
  426. }
  427. var options = []
  428. var ls = []
  429. var lsTo = []
  430. if (select) {
  431. if (qst.questionType == '1') {
  432. // 处理多选题
  433. if (!qst.selectedOptions) {
  434. qst.selectedOptions = []
  435. }
  436. var optionIndex = qst.selectedOptions.findIndex(item => item.optionCode == select.code)
  437. if (optionIndex > -1) {
  438. // 如果已经选中,则取消选择
  439. qst.selectedOptions.splice(optionIndex, 1)
  440. } else {
  441. // 如果未选中,则添加选项
  442. qst.selectedOptions.push({
  443. optionCode: select.code,
  444. comment: select.content,
  445. score: select.score,
  446. thirdKey: select.thirdKey,
  447. thirdValue: select.thirdValue
  448. })
  449. }
  450. options = qst.selectedOptions // 将选中的所有选项赋值给options
  451. } else {
  452. options = [
  453. {
  454. optionCode: select.code,
  455. comment: select.content,
  456. score: select.score,
  457. thirdKey: select.thirdKey,
  458. thirdValue: select.thirdValue
  459. }
  460. ]
  461. }
  462. if (select.thirdKey == 'ascvd' && select.thirdValue == 0) {
  463. this.ascvdShow = '0'
  464. vm.spliceFunction()
  465. for (var i in this.questions) {
  466. if (
  467. this.questions[i].question.thirdKey == 'acs' ||
  468. this.questions[i].question.thirdKey == 'myocardialInfarct' ||
  469. this.questions[i].question.thirdKey == 'ischemicStroke' ||
  470. this.questions[i].question.thirdKey == 'seriousMedicalHistory'
  471. ) {
  472. var s = this.questions[i].option[1]
  473. var v = this.questions[i].question
  474. ls.push({
  475. qstCode: v.code,
  476. type: v.questionType,
  477. thirdKey: v.thirdKey,
  478. options: [
  479. {
  480. optionCode: s.code,
  481. comment: s.content,
  482. score: s.score,
  483. thirdKey: s.thirdKey,
  484. thirdValue: s.thirdValue
  485. }
  486. ]
  487. })
  488. }
  489. }
  490. document.getElementById('myInput1').disabled = true
  491. document.getElementById('myInput2').disabled = true
  492. document.getElementById('myInput3').disabled = true
  493. document.getElementById('myInput4').disabled = true
  494. } else if (select.thirdKey == 'ascvd' && select.thirdValue == 1) {
  495. this.ascvdShow = ''
  496. this.ascvdS1 = ''
  497. this.ascvdS2 = ''
  498. this.ascvdS3 = ''
  499. this.ascvdS4 = ''
  500. document.getElementById('myInput1').disabled = false
  501. document.getElementById('myInput2').disabled = false
  502. document.getElementById('myInput3').disabled = false
  503. document.getElementById('myInput4').disabled = false
  504. ls = []
  505. vm.spliceFunction()
  506. }
  507. if (select.thirdKey == 'acs') {
  508. vm.ascvdS1 = select.thirdValue
  509. }
  510. if (select.thirdKey == 'myocardialInfarct') {
  511. vm.ascvdS2 = select.thirdValue
  512. }
  513. if (select.thirdKey == 'ischemicStroke') {
  514. vm.ascvdS3 = select.thirdValue
  515. }
  516. if (select.thirdKey == 'seriousMedicalHistory') {
  517. vm.ascvdS4 = select.thirdValue
  518. }
  519. if (select.thirdKey == 'smoke') {
  520. vm.smoke = select.thirdValue
  521. }
  522. if (select.thirdKey == 'hypertension') {
  523. vm.hypertension = select.thirdValue
  524. }
  525. if (select.thirdKey == 'diabetes') {
  526. vm.diabetes = select.thirdValue
  527. }
  528. }
  529. if ((num && qst.thirdKey == 'weight') || qst.thirdKey == 'height') {
  530. var weight = ''
  531. var height = ''
  532. for (var i in vm.questions) {
  533. if (vm.questions[i].question.thirdKey == 'weight') {
  534. weight = vm.questions[i].question.content
  535. }
  536. if (vm.questions[i].question.thirdKey == 'height') {
  537. height = vm.questions[i].question.content
  538. }
  539. }
  540. var w = qst.thirdKey == 'weight' ? qst.content : weight
  541. var h = qst.thirdKey == 'height' ? qst.content : height / 100
  542. var s = (w / (h * h)).toFixed(2)
  543. vm.selectArr.forEach(function (v, i) {
  544. if (v.thirdKey == 'bmi') {
  545. vm.selectArr.splice(i, 1)
  546. }
  547. })
  548. for (var i in vm.questions) {
  549. if (vm.questions[i].question.thirdKey == 'bmi') {
  550. lsTo.push({
  551. qstCode: vm.questions[i].question.code,
  552. type: vm.questions[i].question.questionType,
  553. content: s,
  554. thirdKey: vm.questions[i].question.thirdKey,
  555. options: []
  556. })
  557. vm.shaowas = s
  558. // if(w && h) {
  559. // vm.shaowas = s
  560. // }
  561. // console.log(vm.questions[i].question.content,"0809")
  562. // vm.questions[i].question.content = ''
  563. // console.log(vm.questions[i].question.content,"00000---")
  564. }
  565. }
  566. }
  567. data.options = options
  568. var oldLen = this.selectArr.length
  569. this.selectArr =
  570. _.filter(this.selectArr, function (o) {
  571. return o.qstCode != data.qstCode
  572. }) || []
  573. this.selectArr = this.selectArr.concat(lsTo)
  574. this.selectArr = this.selectArr.concat(ls)
  575. this.selectArr.push(data)
  576. var len = this.selectArr.length
  577. // var questions=Object.values(this.questions)
  578. var questions = _.toArray(this.questions)
  579. var allLen = questions.length
  580. var progress = len === allLen ? 100 : (len / allLen) * 100
  581. if (select && select.thirdKey == 'ascvd') {
  582. this.$refs.progress.dataFunction(progress)
  583. } else {
  584. this.progress = progress
  585. }
  586. },
  587. spliceFunction: function () {
  588. var vm = this
  589. vm.selectArr.forEach(function (v, i) {
  590. if (v.thirdKey == 'acs') {
  591. vm.selectArr.splice(i, 1)
  592. }
  593. })
  594. vm.selectArr.forEach(function (v, i) {
  595. if (v.thirdKey == 'myocardialInfarct') {
  596. vm.selectArr.splice(i, 1)
  597. }
  598. })
  599. vm.selectArr.forEach(function (v, i) {
  600. if (v.thirdKey == 'ischemicStroke') {
  601. vm.selectArr.splice(i, 1)
  602. }
  603. })
  604. vm.selectArr.forEach(function (v, i) {
  605. if (v.thirdKey == 'seriousMedicalHistory') {
  606. vm.selectArr.splice(i, 1)
  607. }
  608. })
  609. },
  610. signOut: function () {
  611. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  612. var current = top.layer.confirm(
  613. '问卷还未提交,确定要关闭?',
  614. {
  615. btn: ['关闭', '取消'] //按钮
  616. },
  617. function () {
  618. top.layer.closeAll() //再执行关闭
  619. },
  620. function () {
  621. top.layer.close(current) //再执行关闭
  622. }
  623. )
  624. },
  625. changeContent: function (qst, content, num) {
  626. if (!content) return
  627. this.selectItem(qst, '', num)
  628. },
  629. getQuestion: function () {
  630. var vm = this
  631. var data = {
  632. surveyTemplateCode: vm.screeningType
  633. }
  634. jbscAPI.getAllQuestions(data).then(function (res) {
  635. if (res.status == 200) {
  636. // console.log(res.data,"res.data")
  637. for (var i in res.data) {
  638. if (res.data[i].isThird == 3) {
  639. if (res.data[i].question.questionType == '1') {
  640. res.data[i].question.selectedOptions = [] // 初始化多选项的数组
  641. }
  642. if (res.data[i].question.thirdKey == 'assessTime') {
  643. res.data[i].question.content = new Date()
  644. }
  645. if (res.data[i].option.length != 0) {
  646. res.data[i].question.thirdKey = res.data[i].option[0].thirdKey
  647. }
  648. if (res.data[i].question.thirdKey == 'assessDoctor') {
  649. res.data[i].question.content = docInfo.name
  650. }
  651. if (res.data[i].question.thirdKey == 'assessOrgId') {
  652. res.data[i].question.content = docInfo.hospitalName
  653. }
  654. if (res.data[i].question.thirdKey == 'name') {
  655. res.data[i].question.content = vm.screeningResidentsName
  656. }
  657. if (res.data[i].question.thirdKey == 'sex') {
  658. res.data[i].question.content = vm.sex
  659. }
  660. if (res.data[i].question.thirdKey == 'age') {
  661. res.data[i].question.content = vm.age
  662. }
  663. }
  664. if (res.data[i].question.thirdKey == 'belongCommunity') {
  665. res.data[i].question.content = docInfo.hospitalName
  666. }
  667. if (res.data[i].question.thirdKey == 'doctorName') {
  668. res.data[i].question.content = docInfo.name
  669. }
  670. if (res.data[i].question.thirdKey == 'doctorPhoneNo') {
  671. res.data[i].question.content = docInfo.mobile
  672. }
  673. if (res.data[i].question.thirdKey == 'userName') {
  674. res.data[i].question.content = decodeURI(httpData.resident_name)
  675. }
  676. if (res.data[i].question.thirdKey == 'idNo') {
  677. res.data[i].question.content = httpData.idcard
  678. }
  679. if (res.data[i].question.thirdKey == 'phoneNo') {
  680. res.data[i].question.content = httpData.mobile
  681. }
  682. if (res.data[i].question.thirdKey == 'assessDoctor') {
  683. res.data[i].question.content = docInfo.name
  684. }
  685. if (res.data[i].question.thirdKey == 'assessOrgId') {
  686. res.data[i].question.content = docInfo.hospitalName
  687. }
  688. if (res.data[i].question.thirdKey == 'age') {
  689. res.data[i].question.content = httpData.age
  690. }
  691. if (res.data[i].question.title == '性别') {
  692. var index = vm.sex == 1 ? '0' : '1'
  693. vm.selectItem(res.data[i].question, res.data[i].option[index])
  694. }
  695. if (res.data[i].question.thirdKey == 'createDate') {
  696. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  697. }
  698. if (res.data[i].question.thirdKey == 'assessTime') {
  699. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  700. }
  701. if (res.data[i].question.thirdKey == 'sex' && (vm.screeningTitle == '大肠癌筛查问卷(OB筛查)' || vm.screeningTitle == '脑卒中风险评估(冠心病、脑卒中、肾病)')) {
  702. var index = vm.sex == 1 ? '0' : '1'
  703. vm.selectItem(res.data[i].question, res.data[i].option[index])
  704. }
  705. }
  706. vm.questions = res.data
  707. for (var i in res.data) {
  708. if (res.data[i].isThird == 3) {
  709. if (res.data[i].question.thirdKey == 'assessTime') {
  710. vm.changeContent(res.data[i].question, new Date().format('yyyy-MM-dd HH:mm'))
  711. }
  712. if (res.data[i].question.thirdKey == 'assessDoctor') {
  713. vm.changeContent(res.data[i].question, docInfo.name)
  714. }
  715. if (res.data[i].question.thirdKey == 'assessOrgId') {
  716. vm.changeContent(res.data[i].question, docInfo.hospitalName)
  717. }
  718. if (res.data[i].question.thirdKey == 'name') {
  719. vm.changeContent(res.data[i].question, vm.screeningResidentsName)
  720. }
  721. if (res.data[i].question.thirdKey == 'age') {
  722. vm.changeContent(res.data[i].question, vm.age)
  723. }
  724. if (res.data[i].question.thirdKey == 'sex') {
  725. var index = vm.sex == 1 ? '0' : '1'
  726. vm.selectItem(res.data[i].question, res.data[i].option[index])
  727. }
  728. }
  729. }
  730. vm.$forceUpdate()
  731. }
  732. })
  733. },
  734. getHealth: function () {
  735. var vm = this
  736. jbscAPI
  737. .listMedical({
  738. patient: vm.screeningResidents,
  739. pageIndex: 1,
  740. pageSize: 1
  741. })
  742. .then(function (v) {
  743. if (v.status == 200) {
  744. if (v.list[0]) {
  745. jbscAPI
  746. .findMedicalDetail({
  747. medicalNo: v.list[0].medicalNo
  748. })
  749. .then(function (res) {
  750. if (res.status == 200) {
  751. var data = res.medical_detail
  752. console.log(data, 'data')
  753. for (var i in vm.questions) {
  754. if (vm.questions[i].question.thirdKey == 'height') {
  755. vm.questions[i].question.content = data.height
  756. vm.changeContent(vm.questions[i].question, data.height)
  757. }
  758. if (vm.questions[i].question.thirdKey == 'weight') {
  759. vm.questions[i].question.content = data.weight
  760. vm.changeContent(vm.questions[i].question, data.weight)
  761. }
  762. if (vm.questions[i].question.thirdKey == 'bmi') {
  763. if (data.height && data.weight) {
  764. var w = data.weight
  765. var h = data.height / 100
  766. var s = (w / (h * h)).toFixed(2)
  767. vm.questions[i].question.content = s
  768. vm.shaowas = s
  769. vm.changeContent(vm.questions[i].question, s)
  770. }
  771. }
  772. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  773. vm.questions[i].question.content = data.bloodPressureRigthU
  774. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthU)
  775. }
  776. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  777. vm.questions[i].question.content = data.bloodPressureRigthD
  778. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthD)
  779. }
  780. if (vm.questions[i].question.thirdKey == 'bpU') {
  781. vm.questions[i].question.content = data.bloodPressureLeftU || data.bloodPressureRigthU
  782. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftU || data.bloodPressureRigthU)
  783. }
  784. if (vm.questions[i].question.thirdKey == 'bpD') {
  785. vm.questions[i].question.content = data.bloodPressureLeftD || data.bloodPressureRigthD
  786. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftD || data.bloodPressureRigthD)
  787. }
  788. if (vm.questions[i].question.thirdKey == 'glycolatedHemoglobin') {
  789. vm.questions[i].question.content = data.glycolatedHemoglobin
  790. vm.changeContent(vm.questions[i].question, data.glycolatedHemoglobin)
  791. }
  792. if (vm.questions[i].question.thirdKey == 'fbg') {
  793. vm.questions[i].question.content = data.fastingPlasmaGlucoseL
  794. vm.changeContent(vm.questions[i].question, data.fastingPlasmaGlucoseL)
  795. }
  796. if (vm.questions[i].question.thirdKey == 'bloodPotassium') {
  797. vm.questions[i].question.content = data.renalFunctionBloodPotassium
  798. vm.changeContent(vm.questions[i].question, data.renalFunctionBloodPotassium)
  799. }
  800. if (vm.questions[i].question.thirdKey == 'renalFunctionCreatinine') {
  801. vm.questions[i].question.content = data.renalFunctionCreatinine
  802. vm.changeContent(vm.questions[i].question, data.renalFunctionCreatinine)
  803. }
  804. if (vm.questions[i].question.thirdKey == 'ckd34') {
  805. if (data.renalFunctionCreatinine) {
  806. var ckd34 = (((140 - vm.age) * data.weight) / (0.818 * data.renalFunctionCreatinine)).toFixed(2)
  807. vm.questions[i].question.content = ckd34
  808. vm.changeContent(vm.questions[i].question, ckd34)
  809. }
  810. }
  811. }
  812. if (vm.screeningType == '6bcd306aaafb4e4381071346d86fadbb1') {
  813. // 如果是ascvd筛查再调用第三方接口
  814. vm.getInitData()
  815. }
  816. }
  817. })
  818. vm.$forceUpdate()
  819. } else {
  820. var data = {
  821. patient: vm.screeningResidents
  822. }
  823. jbscAPI.getHealth(data).then(function (res) {
  824. if (res.status == 200) {
  825. vm.tizhongRecord =
  826. _.find(res.data, function (o) {
  827. return o.type == '3'
  828. }) || {}
  829. for (var i in vm.questions) {
  830. if (vm.questions[i].question.thirdKey == 'height') {
  831. vm.questions[i].question.content = vm.tizhongRecord.value2
  832. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value2)
  833. }
  834. if (vm.questions[i].question.thirdKey == 'weight') {
  835. vm.questions[i].question.content = vm.tizhongRecord.value1
  836. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value1)
  837. }
  838. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  839. vm.questions[i].question.content = res.data.xy.value1
  840. vm.changeContent(vm.questions[i].question, res.data.xy.value1)
  841. }
  842. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  843. vm.questions[i].question.content = res.data.xy.value2
  844. vm.changeContent(vm.questions[i].question, res.data.xy.value2)
  845. }
  846. if (vm.questions[i].question.thirdKey == 'bmi') {
  847. if (vm.tizhongRecord.value2 && vm.tizhongRecord.value1) {
  848. var w = vm.tizhongRecord.value1
  849. var h = vm.tizhongRecord.value2 / 100
  850. var s = (w / (h * h)).toFixed(2)
  851. vm.questions[i].question.content = s
  852. vm.shaowas = s
  853. vm.changeContent(vm.questions[i].question, s)
  854. }
  855. }
  856. }
  857. } else {
  858. top.layer.msg(res.msg, { icon: 5 })
  859. }
  860. vm.$forceUpdate()
  861. })
  862. }
  863. }
  864. })
  865. },
  866. save: function () {
  867. var vm = this
  868. if (vm.progress != 100) {
  869. top.layer.msg('问卷还未全部填写', { icon: 5 })
  870. return
  871. }
  872. var loadding = top.layer.load(0, { shade: false }) //0代表加载的风格,支持0-2
  873. vm.selectArr.forEach(function (v) {
  874. if (v.thirdKey == 'assessTime') {
  875. v.content = new Date(v.content).format('yyyy-MM-dd HH:mm')
  876. }
  877. })
  878. var data = {
  879. patientCode: vm.screeningResidents,
  880. labelType: vm.labelType,
  881. isAgain: vm.isAgain,
  882. source: 1,
  883. surveyStatus: vm.surveyStatus,
  884. jsonData: JSON.stringify({
  885. surveyCode: vm.screeningType,
  886. questions: vm.selectArr
  887. })
  888. }
  889. jbscAPI.saveAnswer(data).then(function (res) {
  890. top.layer.close(loadding)
  891. if (res.status == 200) {
  892. if (vm.questions[1].isThird == 3) {
  893. top.layer.open({
  894. type: 2,
  895. // offset: ['100px'], //右下角弹出
  896. area: ['568px', '100%'],
  897. shade: 0.5,
  898. title: '查看筛选结果',
  899. fixed: true, //不固定
  900. maxmin: true,
  901. closeBtn: 1,
  902. shift: 5,
  903. shadeClose: false, //点击遮罩关闭层
  904. content: '../../jbsc/html/view_screening_results.html?resultCode=' + res.data,
  905. end: function () {
  906. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  907. parent.eventBuss.$emit('guan_results', index)
  908. }
  909. })
  910. } else {
  911. top.layer.open({
  912. type: 2,
  913. area: ['820px', '648px'],
  914. shade: 0.5,
  915. title: '筛选统计',
  916. fixed: true, //不固定
  917. maxmin: true,
  918. closeBtn: 1,
  919. shift: 5,
  920. shadeClose: false, //点击遮罩关闭层
  921. content: '../../jbsc/html/filter_result.html?code=' + res.data + '&filter_type=' + vm.screeningType
  922. })
  923. }
  924. } else {
  925. top.layer.msg(res.msg, { icon: 5 })
  926. }
  927. })
  928. },
  929. // 返回选择居民或者问卷类型
  930. goBack: function (number) {
  931. if (this.noswitch) {
  932. return
  933. }
  934. var vm = this
  935. if (vm.isAgain) {
  936. var content
  937. if (number == 1) {
  938. content = '再次筛查无法选择居民'
  939. } else {
  940. content = '再次筛查无法选择问卷类型'
  941. }
  942. top.layer.msg(content, { icon: 5 })
  943. return
  944. }
  945. var content = '../../jbsc/html/filter_type.html?isReLoad=1'
  946. if (number === 1) {
  947. //选择居民
  948. content += '&goDenizen=1&fliter_code=' + vm.screeningType + '&fliter_title=' + vm.screeningTitle
  949. }
  950. layer.open({
  951. type: 2,
  952. offset: 'rb', //右下角弹出
  953. id: 'filter_type',
  954. background: 'transparent',
  955. area: ['280px', '100%'],
  956. shade: 0.5,
  957. title: false,
  958. fixed: true, //不固定
  959. maxmin: false,
  960. closeBtn: 0,
  961. shift: 5,
  962. shadeClose: true, //点击遮罩关闭层
  963. content: content
  964. })
  965. }
  966. },
  967. watch: {
  968. screeningType: function () {
  969. $('.daan-list input').attr('checked', false)
  970. }
  971. }
  972. })
  973. </script>
  974. </body>
  975. </html>