questionnaire.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  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 == (ascvdShow?ascvdShow: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 == (ascvdShow?ascvdShow: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 == (ascvdShow?ascvdShow: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. console.log('screeningTitle', this.screeningTitle)
  251. if (this.screeningType != '6bcd306aaafb4e4381071346d86fadbb1') {
  252. this.getHealth()
  253. }
  254. this.getQuestion()
  255. this.getDoctorInfo()
  256. },
  257. methods: {
  258. getInitData() {
  259. var vm = this
  260. console.log('sssssssssssxxxxxxxxx', vm.questions)
  261. httpRequest.get('doctor/screen/physicalList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  262. var data = res.data
  263. if (res.status == 200 && data) {
  264. for (var i in vm.questions) {
  265. if (vm.questions[i].question.thirdKey == 'height' && data.height) {
  266. vm.questions[i].question.content = data.height + ''
  267. vm.changeContent(vm.questions[i].question, data.height + '')
  268. }
  269. if (vm.questions[i].question.thirdKey == 'weight' && data.weight) {
  270. vm.questions[i].question.content = data.weight + ''
  271. vm.changeContent(vm.questions[i].question, data.weight + '')
  272. }
  273. if (vm.questions[i].question.thirdKey == 'bmi') {
  274. if (data.height && data.weight) {
  275. var w = data.weight
  276. var h = data.height / 100
  277. var s = (w / (h * h)).toFixed(2)
  278. vm.questions[i].question.content = s
  279. vm.shaowas = s
  280. vm.changeContent(vm.questions[i].question, s + '')
  281. } else {
  282. vm.questions[i].question.content = ''
  283. vm.shaowas = ''
  284. vm.changeContent(vm.questions[i].question, '')
  285. }
  286. }
  287. if (vm.questions[i].question.thirdKey == 'systolicPressure' && data.systolicPressure) {
  288. vm.questions[i].question.content = data.systolicPressure + ''
  289. vm.changeContent(vm.questions[i].question, data.systolicPressure + '')
  290. }
  291. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && data.diastolicPressure) {
  292. vm.questions[i].question.content = data.diastolicPressure + ''
  293. vm.changeContent(vm.questions[i].question, data.diastolicPressure + '')
  294. }
  295. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && data.totalCholesterol) {
  296. vm.questions[i].question.content = data.totalCholesterol + ''
  297. vm.changeContent(vm.questions[i].question, data.totalCholesterol + '')
  298. }
  299. if (vm.questions[i].question.thirdKey == 'hdlc' && data.HDL) {
  300. vm.questions[i].question.content = data.HDL + ''
  301. vm.changeContent(vm.questions[i].question, data.HDL + '')
  302. }
  303. if (vm.questions[i].question.thirdKey == 'ldlc' && data.LDL) {
  304. vm.questions[i].question.content = data.LDL + ''
  305. vm.changeContent(vm.questions[i].question, data.LDL + '')
  306. }
  307. // if (vm.questions[i].question.thirdKey == 'ckd34' && data.height) {
  308. // vm.questions[i].question.content = data.height + ''
  309. // vm.changeContent(vm.questions[i].question, data.LDL + '')
  310. // }
  311. if (vm.questions[i].question.title == '既往有心肌梗死病史' && data.AMI) {
  312. var index = data.AMI == 1 ? 0 : data.AMI == 2 ? 1 : ''
  313. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  314. }
  315. if (vm.questions[i].question.title == '缺血性脑卒中病史' && data.CerebralIschemicStroke) {
  316. console.log('缺血性脑卒中病史', vm.questions[i], data.CerebralIschemicStroke)
  317. var index = data.CerebralIschemicStroke == 1 ? 0 : data.CerebralIschemicStroke == 2 ? 1 : ''
  318. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  319. }
  320. if (vm.questions[i].question.title == '高血压' && data.hypertension) {
  321. var index = data.hypertension == 1 ? 0 : data.hypertension == 2 ? 1 : ''
  322. vm.selectItem(vm.questions[i].question, vm.questions[i].option[index])
  323. }
  324. if (vm.questions[i].question.title == '糖尿病' && data.Diabetes) {
  325. console.log('vm.questions[i]', vm.questions[i])
  326. var index = data.Diabetes == 1 ? 0 : data.Diabetes == 2 ? 1 : ''
  327. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  328. }
  329. if (vm.questions[i].question.title == '吸烟' && (data.smoke || data.smoke == 0)) {
  330. var index = data.smoke == 1 ? 0 : data.smoke == 0 ? 1 : ''
  331. console.log('222222222222222222222222', data.smoke)
  332. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  333. }
  334. }
  335. vm.$forceUpdate()
  336. }
  337. httpRequest.get('doctor/screen/checkUpList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  338. var obj = res.data
  339. if (res.status == 200 && obj) {
  340. for (var i in vm.questions) {
  341. if (vm.questions[i].question.thirdKey == 'hdlc' && !vm.questions[i].question.content) {
  342. vm.questions[i].question.content = obj.hdlc
  343. vm.changeContent(vm.questions[i].question, obj.hdlc)
  344. }
  345. if (vm.questions[i].question.thirdKey == 'ldlc' && !vm.questions[i].question.content) {
  346. vm.questions[i].question.content = obj.ldlc
  347. vm.changeContent(vm.questions[i].question, obj.ldlc + '')
  348. }
  349. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && !vm.questions[i].question.content) {
  350. vm.questions[i].question.content = obj.totalCholesterol
  351. vm.changeContent(vm.questions[i].question, obj.totalCholesterol + '')
  352. }
  353. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && !vm.questions[i].question.content) {
  354. vm.questions[i].question.content = obj.diastolicPressure
  355. vm.changeContent(vm.questions[i].question, obj.diastolicPressure + '')
  356. }
  357. if (vm.questions[i].question.thirdKey == 'systolicPressure' && !vm.questions[i].question.content) {
  358. vm.questions[i].question.content = obj.systolicPressure
  359. vm.changeContent(vm.questions[i].question, obj.systolicPressure + '')
  360. }
  361. }
  362. }
  363. // var data = res.data
  364. // if (!vm.form.totalCholesterol) {
  365. // vm.form.totalCholesterol = data.totalCholesterol
  366. // }
  367. // if (!vm.form.hdlc) {
  368. // vm.form.hdlc = data.hdlc
  369. // }
  370. // if (!vm.form.ldlc) {
  371. // vm.form.ldlc = data.ldlc
  372. // }
  373. // if (!vm.form.systolicPressure) {
  374. // vm.form.systolicPressure = data.systolicPressure
  375. // }
  376. // if (!vm.diastolicPressure) {
  377. // vm.form.diastolicPressure = data.diastolicPressure
  378. // }
  379. vm.$forceUpdate()
  380. })
  381. })
  382. },
  383. getDoctorInfo: function () {
  384. var vm = this
  385. var data = {
  386. code: vm.doctorInfo.code
  387. }
  388. jbscAPI.doctorBaseinfo(data).then(function (res) {
  389. if (res.status == 200) {
  390. vm.doctorInfo = res.data
  391. } else {
  392. top.layer.msg(res.msg, { icon: 5 })
  393. }
  394. })
  395. },
  396. //计算选中个数,组装成后台接收格式
  397. selectItem: function (qst, select, num) {
  398. console.log('ssssssssssss99999999999999999999', qst, select)
  399. var vm = this
  400. var isFlag = 1
  401. if (qst.title == '抗栓药物其他名称' && vm.screeningTitle == '大肠癌筛查问卷(OB筛查)') {
  402. vm.selectArr.forEach(function (item, index) {
  403. if (item.thirdKey == 'ksDrugName1') {
  404. item.options.forEach(function (v, i) {
  405. if (v.comment == '其他') {
  406. isFlag = 0
  407. return false
  408. }
  409. })
  410. }
  411. })
  412. // 如果没有勾选“其他”选项,提示并返回
  413. if (isFlag) {
  414. qst.content = '' // 清空当前输入的内容
  415. this.$message.error('请先勾选抗栓药物名称的其他选项')
  416. return false
  417. }
  418. }
  419. if (vm.ascvdShow) {
  420. if (select.thirdKey == 'acs' || select.thirdKey == 'myocardialInfarct' || select.thirdKey == 'ischemicStroke' || select.thirdKey == 'seriousMedicalHistory') {
  421. return false
  422. }
  423. }
  424. var data = {
  425. qstCode: qst.code,
  426. type: qst.questionType,
  427. content: qst.content,
  428. thirdKey: qst.thirdKey
  429. }
  430. var options = []
  431. var ls = []
  432. var lsTo = []
  433. if (select) {
  434. if (qst.questionType == '1') {
  435. // 处理多选题
  436. if (!qst.selectedOptions) {
  437. qst.selectedOptions = []
  438. }
  439. var optionIndex = qst.selectedOptions.findIndex(item => item.optionCode == select.code)
  440. if (optionIndex > -1) {
  441. // 如果已经选中,则取消选择
  442. qst.selectedOptions.splice(optionIndex, 1)
  443. } else {
  444. // 如果未选中,则添加选项
  445. qst.selectedOptions.push({
  446. optionCode: select.code,
  447. comment: select.content,
  448. score: select.score,
  449. thirdKey: select.thirdKey,
  450. thirdValue: select.thirdValue
  451. })
  452. }
  453. options = qst.selectedOptions // 将选中的所有选项赋值给options
  454. } else {
  455. options = [
  456. {
  457. optionCode: select.code,
  458. comment: select.content,
  459. score: select.score,
  460. thirdKey: select.thirdKey,
  461. thirdValue: select.thirdValue
  462. }
  463. ]
  464. }
  465. if (select.thirdKey == 'ascvd' && select.thirdValue == 0) {
  466. console.log('333333333333333333333333')
  467. this.ascvdShow = '0'
  468. vm.spliceFunction()
  469. for (var i in this.questions) {
  470. if (
  471. this.questions[i].question.thirdKey == 'acs' ||
  472. this.questions[i].question.thirdKey == 'myocardialInfarct' ||
  473. this.questions[i].question.thirdKey == 'ischemicStroke' ||
  474. this.questions[i].question.thirdKey == 'seriousMedicalHistory'
  475. ) {
  476. var s = this.questions[i].option[1]
  477. var v = this.questions[i].question
  478. ls.push({
  479. qstCode: v.code,
  480. type: v.questionType,
  481. thirdKey: v.thirdKey,
  482. options: [
  483. {
  484. optionCode: s.code,
  485. comment: s.content,
  486. score: s.score,
  487. thirdKey: s.thirdKey,
  488. thirdValue: s.thirdValue
  489. }
  490. ]
  491. })
  492. }
  493. }
  494. document.getElementById('myInput1').disabled = true
  495. document.getElementById('myInput2').disabled = true
  496. document.getElementById('myInput3').disabled = true
  497. document.getElementById('myInput4').disabled = true
  498. } else if (select.thirdKey == 'ascvd' && select.thirdValue == 1) {
  499. this.ascvdShow = ''
  500. this.ascvdS1 = ''
  501. this.ascvdS2 = ''
  502. this.ascvdS3 = ''
  503. this.ascvdS4 = ''
  504. document.getElementById('myInput1').disabled = false
  505. document.getElementById('myInput2').disabled = false
  506. document.getElementById('myInput3').disabled = false
  507. document.getElementById('myInput4').disabled = false
  508. ls = []
  509. vm.spliceFunction()
  510. }
  511. if (select.thirdKey == 'acs') {
  512. vm.ascvdS1 = select.thirdValue
  513. }
  514. if (select.thirdKey == 'myocardialInfarct') {
  515. vm.ascvdS2 = select.thirdValue
  516. }
  517. if (select.thirdKey == 'ischemicStroke') {
  518. vm.ascvdS3 = select.thirdValue
  519. }
  520. if (select.thirdKey == 'seriousMedicalHistory') {
  521. vm.ascvdS4 = select.thirdValue
  522. }
  523. if (select.thirdKey == 'smoke') {
  524. vm.smoke = select.thirdValue
  525. }
  526. if (select.thirdKey == 'hypertension') {
  527. vm.hypertension = select.thirdValue
  528. }
  529. if (select.thirdKey == 'diabetes') {
  530. vm.diabetes = select.thirdValue
  531. }
  532. }
  533. if ((num && qst.thirdKey == 'weight') || qst.thirdKey == 'height') {
  534. var weight = ''
  535. var height = ''
  536. for (var i in vm.questions) {
  537. if (vm.questions[i].question.thirdKey == 'weight') {
  538. weight = vm.questions[i].question.content
  539. }
  540. if (vm.questions[i].question.thirdKey == 'height') {
  541. height = vm.questions[i].question.content
  542. }
  543. }
  544. var w = qst.thirdKey == 'weight' ? qst.content : weight
  545. var h = qst.thirdKey == 'height' ? qst.content : height / 100
  546. var s = (w / (h * h)).toFixed(2)
  547. vm.selectArr.forEach(function (v, i) {
  548. if (v.thirdKey == 'bmi') {
  549. vm.selectArr.splice(i, 1)
  550. }
  551. })
  552. for (var i in vm.questions) {
  553. if (vm.questions[i].question.thirdKey == 'bmi') {
  554. lsTo.push({
  555. qstCode: vm.questions[i].question.code,
  556. type: vm.questions[i].question.questionType,
  557. content: s,
  558. thirdKey: vm.questions[i].question.thirdKey,
  559. options: []
  560. })
  561. vm.shaowas = s
  562. // if(w && h) {
  563. // vm.shaowas = s
  564. // }
  565. // console.log(vm.questions[i].question.content,"0809")
  566. // vm.questions[i].question.content = ''
  567. // console.log(vm.questions[i].question.content,"00000---")
  568. }
  569. }
  570. }
  571. data.options = options
  572. console.log('111111111111xsssssssss')
  573. var oldLen = this.selectArr.length
  574. this.selectArr =
  575. _.filter(this.selectArr, function (o) {
  576. return o.qstCode != data.qstCode
  577. }) || []
  578. this.selectArr = this.selectArr.concat(lsTo)
  579. this.selectArr = this.selectArr.concat(ls)
  580. this.selectArr.push(data)
  581. console.log(this.selectArr, 'this.selectArr')
  582. var len = this.selectArr.length
  583. // var questions=Object.values(this.questions)
  584. var questions = _.toArray(this.questions)
  585. var allLen = questions.length
  586. console.log('22222222222222222', len, allLen)
  587. var progress = len === allLen ? 100 : (len / allLen) * 100
  588. if (select && select.thirdKey == 'ascvd') {
  589. this.$refs.progress.dataFunction(progress)
  590. } else {
  591. this.progress = progress
  592. }
  593. },
  594. spliceFunction: function () {
  595. var vm = this
  596. vm.selectArr.forEach(function (v, i) {
  597. if (v.thirdKey == 'acs') {
  598. vm.selectArr.splice(i, 1)
  599. }
  600. })
  601. vm.selectArr.forEach(function (v, i) {
  602. if (v.thirdKey == 'myocardialInfarct') {
  603. vm.selectArr.splice(i, 1)
  604. }
  605. })
  606. vm.selectArr.forEach(function (v, i) {
  607. if (v.thirdKey == 'ischemicStroke') {
  608. vm.selectArr.splice(i, 1)
  609. }
  610. })
  611. vm.selectArr.forEach(function (v, i) {
  612. if (v.thirdKey == 'seriousMedicalHistory') {
  613. vm.selectArr.splice(i, 1)
  614. }
  615. })
  616. },
  617. signOut: function () {
  618. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  619. var current = top.layer.confirm(
  620. '问卷还未提交,确定要关闭?',
  621. {
  622. btn: ['关闭', '取消'] //按钮
  623. },
  624. function () {
  625. top.layer.closeAll() //再执行关闭
  626. },
  627. function () {
  628. top.layer.close(current) //再执行关闭
  629. }
  630. )
  631. },
  632. changeContent: function (qst, content, num) {
  633. if (!content) return
  634. this.selectItem(qst, '', num)
  635. },
  636. getQuestion: function () {
  637. var vm = this
  638. var data = {
  639. surveyTemplateCode: vm.screeningType
  640. }
  641. jbscAPI.getAllQuestions(data).then(function (res) {
  642. if (res.status == 200) {
  643. // console.log(res.data,"res.data")
  644. for (var i in res.data) {
  645. if (res.data[i].isThird == 3) {
  646. if (res.data[i].question.questionType == '1') {
  647. res.data[i].question.selectedOptions = [] // 初始化多选项的数组
  648. }
  649. if (res.data[i].question.thirdKey == 'assessTime') {
  650. res.data[i].question.content = new Date()
  651. }
  652. if (res.data[i].option.length != 0) {
  653. res.data[i].question.thirdKey = res.data[i].option[0].thirdKey
  654. }
  655. if (res.data[i].question.thirdKey == 'assessDoctor') {
  656. res.data[i].question.content = docInfo.name
  657. }
  658. if (res.data[i].question.thirdKey == 'assessOrgId') {
  659. res.data[i].question.content = docInfo.hospitalName
  660. }
  661. if (res.data[i].question.thirdKey == 'name') {
  662. res.data[i].question.content = vm.screeningResidentsName
  663. }
  664. if (res.data[i].question.thirdKey == 'sex') {
  665. res.data[i].question.content = vm.sex
  666. }
  667. if (res.data[i].question.thirdKey == 'age') {
  668. res.data[i].question.content = vm.age
  669. }
  670. }
  671. if (res.data[i].question.thirdKey == 'belongCommunity') {
  672. res.data[i].question.content = docInfo.hospitalName
  673. }
  674. if (res.data[i].question.thirdKey == 'doctorName') {
  675. res.data[i].question.content = docInfo.name
  676. }
  677. if (res.data[i].question.thirdKey == 'doctorPhoneNo') {
  678. res.data[i].question.content = docInfo.mobile
  679. }
  680. if (res.data[i].question.thirdKey == 'userName') {
  681. res.data[i].question.content = decodeURI(httpData.resident_name)
  682. }
  683. if (res.data[i].question.thirdKey == 'idNo') {
  684. res.data[i].question.content = httpData.idcard
  685. }
  686. if (res.data[i].question.thirdKey == 'phoneNo') {
  687. res.data[i].question.content = httpData.mobile
  688. }
  689. if (res.data[i].question.thirdKey == 'assessDoctor') {
  690. res.data[i].question.content = docInfo.name
  691. }
  692. if (res.data[i].question.thirdKey == 'assessOrgId') {
  693. res.data[i].question.content = docInfo.hospitalName
  694. }
  695. if (res.data[i].question.thirdKey == 'age') {
  696. res.data[i].question.content = httpData.age
  697. }
  698. if (res.data[i].question.title == '性别') {
  699. var index = vm.sex == 1 ? '0' : '1'
  700. console.log('==================aaaaaaaaaa', res.data[i].question, res.data[i].option[index])
  701. vm.selectItem(res.data[i].question, res.data[i].option[index])
  702. }
  703. if (res.data[i].question.thirdKey == 'createDate') {
  704. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  705. }
  706. if (res.data[i].question.thirdKey == 'assessTime') {
  707. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  708. }
  709. if (res.data[i].question.thirdKey == 'sex' && (vm.screeningTitle == '大肠癌筛查问卷(OB筛查)' || vm.screeningTitle == '脑卒中风险评估(冠心病、脑卒中、肾病)')) {
  710. var index = vm.sex == 1 ? '0' : '1'
  711. vm.selectItem(res.data[i].question, res.data[i].option[index])
  712. }
  713. }
  714. console.log(res.data, 'ssssssssslllllllllll')
  715. vm.questions = res.data
  716. for (var i in res.data) {
  717. if (res.data[i].isThird == 3) {
  718. if (res.data[i].question.thirdKey == 'assessTime') {
  719. vm.changeContent(res.data[i].question, new Date().format('yyyy-MM-dd HH:mm'))
  720. }
  721. if (res.data[i].question.thirdKey == 'assessDoctor') {
  722. vm.changeContent(res.data[i].question, docInfo.name)
  723. }
  724. if (res.data[i].question.thirdKey == 'assessOrgId') {
  725. vm.changeContent(res.data[i].question, docInfo.hospitalName)
  726. }
  727. if (res.data[i].question.thirdKey == 'name') {
  728. vm.changeContent(res.data[i].question, vm.screeningResidentsName)
  729. }
  730. if (res.data[i].question.thirdKey == 'age') {
  731. vm.changeContent(res.data[i].question, vm.age)
  732. }
  733. if (res.data[i].question.thirdKey == 'sex') {
  734. var index = vm.sex == 1 ? '0' : '1'
  735. console.log('------111111000000000', res.data[i].question, res.data[i].option[index])
  736. vm.selectItem(res.data[i].question, res.data[i].option[index])
  737. }
  738. }
  739. }
  740. vm.$forceUpdate()
  741. if (vm.screeningType == '6bcd306aaafb4e4381071346d86fadbb1') {
  742. vm.getInitData()
  743. }
  744. }
  745. })
  746. },
  747. getHealth: function () {
  748. var vm = this
  749. jbscAPI
  750. .listMedical({
  751. patient: vm.screeningResidents,
  752. pageIndex: 1,
  753. pageSize: 1
  754. })
  755. .then(function (v) {
  756. if (v.status == 200) {
  757. if (v.list[0]) {
  758. jbscAPI
  759. .findMedicalDetail({
  760. medicalNo: v.list[0].medicalNo
  761. })
  762. .then(function (res) {
  763. if (res.status == 200) {
  764. var data = res.medical_detail
  765. for (var i in vm.questions) {
  766. if (vm.questions[i].question.thirdKey == 'height') {
  767. vm.questions[i].question.content = data.height
  768. vm.changeContent(vm.questions[i].question, data.height)
  769. }
  770. if (vm.questions[i].question.thirdKey == 'weight') {
  771. vm.questions[i].question.content = data.weight
  772. vm.changeContent(vm.questions[i].question, data.weight)
  773. }
  774. if (vm.questions[i].question.thirdKey == 'bmi') {
  775. if (data.height && data.weight) {
  776. var w = data.weight
  777. var h = data.height / 100
  778. var s = (w / (h * h)).toFixed(2)
  779. vm.questions[i].question.content = s
  780. vm.shaowas = s
  781. vm.changeContent(vm.questions[i].question, s)
  782. }
  783. }
  784. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  785. vm.questions[i].question.content = data.bloodPressureRigthU
  786. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthU)
  787. }
  788. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  789. vm.questions[i].question.content = data.bloodPressureRigthD
  790. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthD)
  791. }
  792. if (vm.questions[i].question.thirdKey == 'bpU') {
  793. vm.questions[i].question.content = data.bloodPressureLeftU || data.bloodPressureRigthU
  794. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftU || data.bloodPressureRigthU)
  795. }
  796. if (vm.questions[i].question.thirdKey == 'bpD') {
  797. vm.questions[i].question.content = data.bloodPressureLeftD || data.bloodPressureRigthD
  798. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftD || data.bloodPressureRigthD)
  799. }
  800. if (vm.questions[i].question.thirdKey == 'glycolatedHemoglobin') {
  801. vm.questions[i].question.content = data.glycolatedHemoglobin
  802. vm.changeContent(vm.questions[i].question, data.glycolatedHemoglobin)
  803. }
  804. if (vm.questions[i].question.thirdKey == 'fbg') {
  805. vm.questions[i].question.content = data.fastingPlasmaGlucoseL
  806. vm.changeContent(vm.questions[i].question, data.fastingPlasmaGlucoseL)
  807. }
  808. if (vm.questions[i].question.thirdKey == 'bloodPotassium') {
  809. vm.questions[i].question.content = data.renalFunctionBloodPotassium
  810. vm.changeContent(vm.questions[i].question, data.renalFunctionBloodPotassium)
  811. }
  812. if (vm.questions[i].question.thirdKey == 'renalFunctionCreatinine') {
  813. vm.questions[i].question.content = data.renalFunctionCreatinine
  814. vm.changeContent(vm.questions[i].question, data.renalFunctionCreatinine)
  815. }
  816. }
  817. }
  818. })
  819. vm.$forceUpdate()
  820. } else {
  821. var data = {
  822. patient: vm.screeningResidents
  823. }
  824. jbscAPI.getHealth(data).then(function (res) {
  825. if (res.status == 200) {
  826. vm.tizhongRecord =
  827. _.find(res.data, function (o) {
  828. return o.type == '3'
  829. }) || {}
  830. for (var i in vm.questions) {
  831. if (vm.questions[i].question.thirdKey == 'height') {
  832. vm.questions[i].question.content = vm.tizhongRecord.value2
  833. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value2)
  834. }
  835. if (vm.questions[i].question.thirdKey == 'weight') {
  836. vm.questions[i].question.content = vm.tizhongRecord.value1
  837. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value1)
  838. }
  839. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  840. vm.questions[i].question.content = res.data.xy.value1
  841. vm.changeContent(vm.questions[i].question, res.data.xy.value1)
  842. }
  843. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  844. vm.questions[i].question.content = res.data.xy.value2
  845. vm.changeContent(vm.questions[i].question, res.data.xy.value2)
  846. }
  847. if (vm.questions[i].question.thirdKey == 'bmi') {
  848. if (vm.tizhongRecord.value2 && vm.tizhongRecord.value1) {
  849. var w = vm.tizhongRecord.value1
  850. var h = vm.tizhongRecord.value2 / 100
  851. var s = (w / (h * h)).toFixed(2)
  852. vm.questions[i].question.content = s
  853. vm.shaowas = s
  854. vm.changeContent(vm.questions[i].question, s)
  855. }
  856. }
  857. }
  858. } else {
  859. top.layer.msg(res.msg, { icon: 5 })
  860. }
  861. vm.$forceUpdate()
  862. })
  863. }
  864. }
  865. })
  866. },
  867. save: function () {
  868. console.log('2222221sssssssssssssssss', this.selectArr)
  869. var vm = this
  870. if (vm.progress != 100) {
  871. top.layer.msg('问卷还未全部填写', { icon: 5 })
  872. return
  873. }
  874. var loadding = top.layer.load(0, { shade: false }) //0代表加载的风格,支持0-2
  875. vm.selectArr.forEach(function (v) {
  876. if (v.thirdKey == 'assessTime') {
  877. v.content = new Date(v.content).format('yyyy-MM-dd HH:mm')
  878. }
  879. })
  880. var data = {
  881. patientCode: vm.screeningResidents,
  882. labelType: vm.labelType,
  883. isAgain: vm.isAgain,
  884. source: 1,
  885. surveyStatus: vm.surveyStatus,
  886. jsonData: JSON.stringify({
  887. surveyCode: vm.screeningType,
  888. questions: vm.selectArr
  889. })
  890. }
  891. jbscAPI.saveAnswer(data).then(function (res) {
  892. top.layer.close(loadding)
  893. if (res.status == 200) {
  894. if (vm.questions[1].isThird == 3) {
  895. top.layer.open({
  896. type: 2,
  897. // offset: ['100px'], //右下角弹出
  898. area: ['568px', '100%'],
  899. shade: 0.5,
  900. title: '查看筛选结果',
  901. fixed: true, //不固定
  902. maxmin: true,
  903. closeBtn: 1,
  904. shift: 5,
  905. shadeClose: false, //点击遮罩关闭层
  906. content: '../../jbsc/html/view_screening_results.html?resultCode=' + res.data,
  907. end: function () {
  908. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  909. parent.eventBuss.$emit('guan_results', index)
  910. }
  911. })
  912. } else {
  913. top.layer.open({
  914. type: 2,
  915. area: ['820px', '648px'],
  916. shade: 0.5,
  917. title: '筛选统计',
  918. fixed: true, //不固定
  919. maxmin: true,
  920. closeBtn: 1,
  921. shift: 5,
  922. shadeClose: false, //点击遮罩关闭层
  923. content: '../../jbsc/html/filter_result.html?code=' + res.data + '&filter_type=' + vm.screeningType
  924. })
  925. }
  926. } else {
  927. top.layer.msg(res.msg, { icon: 5 })
  928. }
  929. })
  930. },
  931. // 返回选择居民或者问卷类型
  932. goBack: function (number) {
  933. if (this.noswitch) {
  934. return
  935. }
  936. var vm = this
  937. if (vm.isAgain) {
  938. var content
  939. if (number == 1) {
  940. content = '再次筛查无法选择居民'
  941. } else {
  942. content = '再次筛查无法选择问卷类型'
  943. }
  944. top.layer.msg(content, { icon: 5 })
  945. return
  946. }
  947. var content = '../../jbsc/html/filter_type.html?isReLoad=1'
  948. if (number === 1) {
  949. //选择居民
  950. content += '&goDenizen=1&fliter_code=' + vm.screeningType + '&fliter_title=' + vm.screeningTitle
  951. }
  952. layer.open({
  953. type: 2,
  954. offset: 'rb', //右下角弹出
  955. id: 'filter_type',
  956. background: 'transparent',
  957. area: ['280px', '100%'],
  958. shade: 0.5,
  959. title: false,
  960. fixed: true, //不固定
  961. maxmin: false,
  962. closeBtn: 0,
  963. shift: 5,
  964. shadeClose: true, //点击遮罩关闭层
  965. content: content
  966. })
  967. }
  968. },
  969. watch: {
  970. screeningType: function () {
  971. $('.daan-list input').attr('checked', false)
  972. }
  973. }
  974. })
  975. </script>
  976. </body>
  977. </html>