questionnaire.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  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 :type="qst.questionType==1?'checkbox':'radio'" :checked="opt.thirdValue == sex" :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  35. </template>
  36. <template v-if="qst.isThird==3&&qst.question.thirdKey=='acs'">
  37. <input :type="qst.questionType==1?'checkbox':'radio'" :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS1)" id='myInput1' :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  38. </template>
  39. <template v-if="qst.isThird==3&&qst.question.thirdKey=='myocardialInfarct'">
  40. <input :type="qst.questionType==1?'checkbox':'radio'" :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS2)" id='myInput2' :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  41. </template>
  42. <template v-if="qst.isThird==3&&qst.question.thirdKey=='ischemicStroke'">
  43. <input :type="qst.questionType==1?'checkbox':'radio'" :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS3)" id='myInput3' :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  44. </template>
  45. <template v-if="qst.isThird==3&&qst.question.thirdKey=='seriousMedicalHistory'">
  46. <input :type="qst.questionType==1?'checkbox':'radio'" :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS4)" id='myInput4' :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  47. </template>
  48. <template v-if="qst.question.thirdKey!='sex'&&qst.question.thirdKey!='acs'&&qst.question.thirdKey!='myocardialInfarct'&&qst.question.thirdKey!='ischemicStroke'&&qst.question.thirdKey!='seriousMedicalHistory'">
  49. <input :type="qst.questionType==1||qst.question.questionType?'checkbox':'radio'" v-if="qst.question.thirdKey!='sex'" :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  50. </template>
  51. </lable>
  52. </div>
  53. <div v-else>
  54. <template v-if="(qst.isThird=='3' && qst.question.thirdKey == 'assessTime')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='大肠癌筛查问卷(OB筛查)')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='脑卒中风险评估(冠心病、脑卒中、肾病)')">
  55. <div style="padding-left: 20px;">
  56. <el-date-picker
  57. v-model="qst.question.content"
  58. type="datetime"
  59. format="yyyy-MM-dd HH:mm"
  60. value-format="yyyy-MM-dd HH:mm"
  61. placeholder="选择日期时间"
  62. @change='changeContent(qst.question,qst.question.content)'>
  63. </el-date-picker>
  64. </div>
  65. </template>
  66. <template v-else>
  67. <div class="daan-list" v-if="qst.isThird==3 && (qst.question.thirdKey == 'assessDoctor' || qst.question.thirdKey == 'assessOrgId'||(!shaowas&&qst.question.thirdKey == 'bmi'))">
  68. <textarea class="wenjuan-textarea" disabled rows="2" v-model="qst.question.content"></textarea>
  69. </div>
  70. <div class="daan-list" v-else-if="qst.question.thirdKey != 'bmi'">
  71. <textarea class="wenjuan-textarea" @keyup="changeContent(qst.question,qst.question.content,1)" rows="2" v-model="qst.question.content"></textarea>
  72. </div>
  73. <div class="daan-list" v-if="(shaowas&&qst.question.thirdKey == 'bmi')">
  74. <textarea class="wenjuan-textarea" disabled rows="2" v-model="shaowas"></textarea>
  75. </div>
  76. </template>
  77. </div>
  78. </li>
  79. </ul>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="w-250">
  84. <div class="base-info">
  85. <p class="f-16 mb0">基本信息</p>
  86. <div class="flex-box right-triangle">
  87. <span class="w-70">
  88. 类型
  89. </span>
  90. <a class="flex-box-item" :alt="screeningTitle" v-text="screeningTitle" @click="goBack">
  91. --
  92. </a>
  93. </div>
  94. <div class="flex-box right-triangle">
  95. <span class="w-70">
  96. 对象
  97. </span>
  98. <a class="flex-box-item" :alt="screeningResidentsName" v-text="screeningResidentsName" @click="goBack(1)">
  99. --
  100. </a>
  101. </div>
  102. <div class="flex-box">
  103. <span class="w-70">
  104. 筛查人员
  105. </span>
  106. <div class="flex-box-item c-999" v-text="doctorInfo.name"></div>
  107. </div>
  108. <div class="flex-box" style="align-items: flex-start;">
  109. <span class="w-70">
  110. 体征记录
  111. </span>
  112. <div class="flex-box-item" v-if="tizhongRecord.value1 || tizhongRecord.value2">
  113. <p v-if="tizhongRecord.value1">体重<input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value1" />kg</p>
  114. <p class="mb0" v-if="tizhongRecord.value2">身高<input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value2" />cm</p>
  115. </div>
  116. <div class="flex-box-item" v-else>
  117. 暂无体征
  118. </div>
  119. </div>
  120. </div>
  121. <div class="completion-of-progress">
  122. <p class="f16 mb0">完成情况</p>
  123. <div class="canvas-box">
  124. <canvas-progress :progress="progress" ref="progress"></canvas-progress>
  125. <p class="progress-number">
  126. <span>已完成</span>
  127. </p>
  128. </div>
  129. </div>
  130. <div class="btn-group-bottom">
  131. <button class="btn submit-btn" @click="save">提交</button>
  132. <button class="btn btn-exit" @click="signOut">退出</button>
  133. </div>
  134. </div>
  135. </div>
  136. <script type="text/javascript" src="../../../plugins/echarts/3.8.5/echarts.min.js" ></script>
  137. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  138. <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
  139. <script src="../../../component/common/event-bus.js"></script>
  140. <script src="../../../js/element-ui.js" type="text/javascript" charset="utf-8"></script>
  141. <!-- <script src="https://unpkg.com/element-ui/lib/index.js" type="text/javascript" charset="utf-8"></script> -->
  142. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  143. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  144. <script src="../../../plugins/toastr/toastr.min.js"></script>
  145. <script type="text/javascript" src="../../../plugins/layer/layer.min.js" ></script>
  146. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  147. <script src="../../../api/http-request.js" type="text/javascript" charset="utf-8"></script>
  148. <script type="text/javascript" src="../../../api/jbsc-api.js" ></script>
  149. <script type="text/javascript" src="../component/canvas-progress.js" ></script>
  150. <script type="text/javascript">
  151. var httpData=GetRequest();
  152. var docInfo = JSON.parse(window.localStorage.getItem('docInfo'));
  153. var question=new Vue({
  154. el: "#app",
  155. data: {
  156. //数据结果
  157. progress:0,
  158. selectArr:[],
  159. screeningTitle:decodeURI(httpData['fliter_title']),
  160. screeningType:httpData['fliter_code'],
  161. screeningResidents:httpData['resident_code'],
  162. screeningResidentsName:decodeURI(httpData['resident_name']),
  163. sex:decodeURI(httpData['sex']),
  164. age:decodeURI(httpData['age']),
  165. doctorInfo:{code:docInfo.code},
  166. questions:[],
  167. tizhongRecord:{},
  168. labelType:5,//问卷筛查labelType=5
  169. isAgain:(httpData['isAgain'] || 0),
  170. ascvdShow:'',
  171. ascvdS1:'',
  172. ascvdS2:'',
  173. ascvdS3:'',
  174. ascvdS4:'',
  175. shaowas:'',
  176. },
  177. mounted: function(){
  178. console.log('screeningTitle',this.screeningTitle)
  179. this.getHealth();
  180. this.getQuestion();
  181. this.getDoctorInfo()
  182. },
  183. methods: {
  184. getDoctorInfo:function(){
  185. var vm=this;
  186. var data={
  187. code:vm.doctorInfo.code
  188. }
  189. jbscAPI.doctorBaseinfo(data).then(function(res){
  190. if(res.status==200){
  191. vm.doctorInfo=res.data
  192. }else{
  193. top.layer.msg(res.msg, {icon: 5});
  194. }
  195. })
  196. },
  197. //计算选中个数,组装成后台接收格式
  198. selectItem:function(qst,select,num){
  199. var vm = this
  200. var isFlag=1
  201. if (qst.title == '抗栓药物其他名称' && vm.screeningTitle == '大肠癌筛查问卷(OB筛查)') {
  202. vm.selectArr.forEach(function(item, index) {
  203. if (item.thirdKey == 'ksDrugName1') {
  204. item.options.forEach(function(v, i) {
  205. if (v.comment == '其他') {
  206. isFlag = 0;
  207. return false;
  208. }
  209. });
  210. }
  211. });
  212. // 如果没有勾选“其他”选项,提示并返回
  213. if (isFlag) {
  214. qst.content = ''; // 清空当前输入的内容
  215. this.$message.error('请先勾选抗栓药物名称的其他选项');
  216. return false;
  217. }
  218. }
  219. if(vm.ascvdShow) {
  220. if(select.thirdKey == 'acs' || select.thirdKey == 'myocardialInfarct' || select.thirdKey == 'ischemicStroke' || select.thirdKey == 'seriousMedicalHistory') {
  221. return false
  222. }
  223. }
  224. var data={
  225. qstCode:qst.code,
  226. type:qst.questionType,
  227. content:qst.content,
  228. thirdKey:qst.thirdKey
  229. }
  230. var options=[];
  231. var ls = []
  232. var lsTo = []
  233. if(select){
  234. if(qst.questionType == '1') {
  235. // 处理多选题
  236. if (!qst.selectedOptions) {
  237. qst.selectedOptions = [];
  238. }
  239. var optionIndex = qst.selectedOptions.findIndex(item => item.optionCode == select.code);
  240. if (optionIndex > -1) {
  241. // 如果已经选中,则取消选择
  242. qst.selectedOptions.splice(optionIndex, 1);
  243. } else {
  244. // 如果未选中,则添加选项
  245. qst.selectedOptions.push({
  246. optionCode:select.code,
  247. comment:select.content,
  248. score:select.score,
  249. thirdKey:select.thirdKey,
  250. thirdValue:select.thirdValue
  251. });
  252. }
  253. options = qst.selectedOptions; // 将选中的所有选项赋值给options
  254. }else{
  255. options=[{
  256. optionCode:select.code,
  257. comment:select.content,
  258. score:select.score,
  259. thirdKey:select.thirdKey,
  260. thirdValue:select.thirdValue
  261. }]
  262. }
  263. if(select.thirdKey=="ascvd"&&select.thirdValue==0) {
  264. this.ascvdShow = '0'
  265. vm.spliceFunction()
  266. for(var i in this.questions) {
  267. if(this.questions[i].question.thirdKey == 'acs' || this.questions[i].question.thirdKey == 'myocardialInfarct' || this.questions[i].question.thirdKey == 'ischemicStroke' || this.questions[i].question.thirdKey == 'seriousMedicalHistory') {
  268. var s = this.questions[i].option[1]
  269. var v = this.questions[i].question
  270. ls.push({
  271. qstCode:v.code,
  272. type:v.questionType,
  273. thirdKey:v.thirdKey,
  274. options:[{
  275. optionCode:s.code,
  276. comment:s.content,
  277. score:s.score,
  278. thirdKey:s.thirdKey,
  279. thirdValue:s.thirdValue
  280. }],
  281. })
  282. }
  283. }
  284. document.getElementById("myInput1").disabled = true;
  285. document.getElementById("myInput2").disabled = true;
  286. document.getElementById("myInput3").disabled = true;
  287. document.getElementById("myInput4").disabled = true;
  288. }else if(select.thirdKey=="ascvd"&&select.thirdValue==1){
  289. this.ascvdShow = ''
  290. this.ascvdS1 = ''
  291. this.ascvdS2 = ''
  292. this.ascvdS3 = ''
  293. this.ascvdS4 = ''
  294. document.getElementById("myInput1").disabled = false;
  295. document.getElementById("myInput2").disabled = false;
  296. document.getElementById("myInput3").disabled = false;
  297. document.getElementById("myInput4").disabled = false;
  298. ls = []
  299. vm.spliceFunction()
  300. }
  301. if(select.thirdKey == 'acs') {vm.ascvdS1 = select.thirdValue}
  302. if(select.thirdKey == 'myocardialInfarct') {vm.ascvdS2 = select.thirdValue}
  303. if(select.thirdKey == 'ischemicStroke') {vm.ascvdS3 = select.thirdValue}
  304. if(select.thirdKey == 'seriousMedicalHistory') {vm.ascvdS4 = select.thirdValue}
  305. }
  306. if(num && qst.thirdKey == 'weight' || qst.thirdKey == 'height') {
  307. var weight = ''
  308. var height = ''
  309. for(var i in vm.questions){
  310. if(vm.questions[i].question.thirdKey == "weight") {
  311. weight = vm.questions[i].question.content
  312. }
  313. if(vm.questions[i].question.thirdKey == "height") {
  314. height = vm.questions[i].question.content
  315. }
  316. }
  317. var w = qst.thirdKey == 'weight'?qst.content:weight
  318. var h = qst.thirdKey == 'height'?qst.content:height / 100
  319. var s = (w / (h * h)).toFixed(2)
  320. vm.selectArr.forEach(function(v,i){
  321. if(v.thirdKey == 'bmi') {
  322. vm.selectArr.splice(i,1)
  323. }
  324. })
  325. for(var i in vm.questions) {
  326. if(vm.questions[i].question.thirdKey == "bmi") {
  327. lsTo.push({
  328. qstCode:vm.questions[i].question.code,
  329. type:vm.questions[i].question.questionType,
  330. content:s,
  331. thirdKey:vm.questions[i].question.thirdKey,
  332. options:[]
  333. })
  334. vm.shaowas = s
  335. // if(w && h) {
  336. // vm.shaowas = s
  337. // }
  338. // console.log(vm.questions[i].question.content,"0809")
  339. // vm.questions[i].question.content = ''
  340. // console.log(vm.questions[i].question.content,"00000---")
  341. }
  342. }
  343. }
  344. data.options=options;
  345. console.log('111111111111xsssssssss')
  346. var oldLen = this.selectArr.length;
  347. this.selectArr = _.filter(this.selectArr,function(o) {
  348. return o.qstCode !=data.qstCode;
  349. }) || [];
  350. this.selectArr = this.selectArr.concat(lsTo)
  351. this.selectArr = this.selectArr.concat(ls)
  352. this.selectArr.push(data);
  353. console.log(this.selectArr,'this.selectArr')
  354. var len=this.selectArr.length;
  355. // var questions=Object.values(this.questions)
  356. var questions = _.toArray(this.questions)
  357. var allLen=questions.length;
  358. var progress=len===allLen?100:((len/allLen)*100);
  359. if(select&&select.thirdKey=="ascvd") {
  360. this.$refs.progress.dataFunction(progress)
  361. }else{
  362. this.progress=progress;
  363. }
  364. },
  365. spliceFunction:function() {
  366. var vm = this
  367. vm.selectArr.forEach(function(v,i){
  368. if(v.thirdKey == 'acs') {
  369. vm.selectArr.splice(i,1)
  370. }
  371. })
  372. vm.selectArr.forEach(function(v,i){
  373. if(v.thirdKey == 'myocardialInfarct') {
  374. vm.selectArr.splice(i,1)
  375. }
  376. })
  377. vm.selectArr.forEach(function(v,i){
  378. if(v.thirdKey == 'ischemicStroke') {
  379. vm.selectArr.splice(i,1)
  380. }
  381. })
  382. vm.selectArr.forEach(function(v,i){
  383. if(v.thirdKey == 'seriousMedicalHistory') {
  384. vm.selectArr.splice(i,1)
  385. }
  386. })
  387. },
  388. signOut:function(){
  389. var index = top.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  390. var current=top.layer.confirm('问卷还未提交,确定要关闭?', {
  391. btn: ['关闭','取消'] //按钮
  392. }, function(){
  393. top.layer.closeAll(); //再执行关闭
  394. }, function(){
  395. top.layer.close(current); //再执行关闭
  396. });
  397. },
  398. changeContent:function(qst,content,num){
  399. if(!content) return ;
  400. this.selectItem(qst,'',num)
  401. },
  402. getQuestion:function(){
  403. var vm=this
  404. var data={
  405. surveyTemplateCode: vm.screeningType
  406. }
  407. jbscAPI.getAllQuestions(data).then(function(res){
  408. if(res.status==200){
  409. // console.log(res.data,"res.data")
  410. for(var i in res.data) {
  411. if(res.data[i].isThird == 3){
  412. if (res.data[i].question.questionType == '1') {
  413. res.data[i].question.selectedOptions = []; // 初始化多选项的数组
  414. }
  415. if(res.data[i].question.thirdKey == 'assessTime') {
  416. res.data[i].question.content = new Date()
  417. }
  418. if(res.data[i].option.length!=0){
  419. res.data[i].question.thirdKey = res.data[i].option[0].thirdKey
  420. }
  421. if(res.data[i].question.thirdKey == 'assessDoctor') {
  422. res.data[i].question.content = docInfo.name
  423. }
  424. if(res.data[i].question.thirdKey == 'assessOrgId') {
  425. res.data[i].question.content = docInfo.hospitalName
  426. }
  427. if(res.data[i].question.thirdKey == 'name') {
  428. res.data[i].question.content = vm.screeningResidentsName
  429. }
  430. if(res.data[i].question.thirdKey == 'sex') {
  431. res.data[i].question.content = vm.sex
  432. }
  433. if(res.data[i].question.thirdKey == 'age') {
  434. res.data[i].question.content = vm.age
  435. }
  436. }
  437. if(res.data[i].question.thirdKey == 'belongCommunity') {
  438. res.data[i].question.content = docInfo.hospitalName
  439. }
  440. if(res.data[i].question.thirdKey == 'doctorName') {
  441. res.data[i].question.content = docInfo.name
  442. }
  443. if(res.data[i].question.thirdKey == 'doctorPhoneNo') {
  444. res.data[i].question.content = docInfo.mobile
  445. }
  446. if(res.data[i].question.thirdKey == 'userName') {
  447. res.data[i].question.content =decodeURI(httpData.resident_name)
  448. }
  449. if(res.data[i].question.thirdKey == 'idNo') {
  450. res.data[i].question.content =httpData.idcard
  451. }
  452. if(res.data[i].question.thirdKey == 'phoneNo') {
  453. res.data[i].question.content =httpData.mobile
  454. }
  455. if(res.data[i].question.thirdKey == 'assessDoctor') {
  456. res.data[i].question.content=docInfo.name
  457. }
  458. if(res.data[i].question.thirdKey == 'assessOrgId') {
  459. res.data[i].question.content=docInfo.hospitalName
  460. }
  461. if(res.data[i].question.thirdKey == 'age') {
  462. res.data[i].question.content =httpData.age
  463. }
  464. if(res.data[i].question.title == "性别") {
  465. var index = vm.sex==1?"0":'1'
  466. console.log(
  467. '==================aaaaaaaaaa',res.data[i].question,res.data[i].option[index]
  468. )
  469. vm.selectItem(res.data[i].question,res.data[i].option[index])
  470. }
  471. if(res.data[i].question.thirdKey == "createDate") {
  472. res.data[i].question.content =new Date().format('yyyy-MM-dd hh:mm:ss')
  473. }
  474. if(res.data[i].question.thirdKey == "assessTime") {
  475. res.data[i].question.content =new Date().format('yyyy-MM-dd hh:mm:ss')
  476. }
  477. if(res.data[i].question.thirdKey == 'sex'&&(vm.screeningTitle=='大肠癌筛查问卷(OB筛查)'||vm.screeningTitle=='脑卒中风险评估(冠心病、脑卒中、肾病)')) {
  478. var index = vm.sex==1?"0":'1'
  479. vm.selectItem(res.data[i].question,res.data[i].option[index])
  480. }
  481. }
  482. console.log(res.data,'ssssssssslllllllllll')
  483. vm.questions = res.data;
  484. for(var i in res.data) {
  485. if(res.data[i].isThird == 3){
  486. if(res.data[i].question.thirdKey == 'assessTime') {
  487. vm.changeContent(res.data[i].question,new Date().format('yyyy-MM-dd HH:mm'))
  488. }
  489. if(res.data[i].question.thirdKey == 'assessDoctor') {
  490. vm.changeContent(res.data[i].question,docInfo.name)
  491. }
  492. if(res.data[i].question.thirdKey == 'assessOrgId') {
  493. vm.changeContent(res.data[i].question,docInfo.hospitalName)
  494. }
  495. if(res.data[i].question.thirdKey == 'name') {
  496. vm.changeContent(res.data[i].question,vm.screeningResidentsName)
  497. }
  498. if(res.data[i].question.thirdKey == 'age') {
  499. vm.changeContent(res.data[i].question,vm.age)
  500. }
  501. if(res.data[i].question.thirdKey == 'sex') {
  502. var index = vm.sex==1?"0":'1'
  503. console.log('------111111000000000',res.data[i].question,res.data[i].option[index])
  504. vm.selectItem(res.data[i].question,res.data[i].option[index])
  505. }
  506. }
  507. }
  508. }
  509. })
  510. },
  511. getHealth:function(){
  512. var vm=this;
  513. jbscAPI.listMedical({
  514. patient: vm.screeningResidents,
  515. pageIndex: 1,
  516. pageSize: 1
  517. }).then(function(v){
  518. if(v.status == 200) {
  519. if(v.list[0]) {
  520. jbscAPI.findMedicalDetail({
  521. medicalNo: v.list[0].medicalNo
  522. }).then(function(res){
  523. if(res.status == 200) {
  524. var data = res.medical_detail
  525. for(var i in vm.questions) {
  526. if(vm.questions[i].question.thirdKey == "height") {
  527. vm.questions[i].question.content = data.height
  528. vm.changeContent(vm.questions[i].question,data.height)
  529. }
  530. if(vm.questions[i].question.thirdKey == "weight") {
  531. vm.questions[i].question.content = data.weight
  532. vm.changeContent(vm.questions[i].question,data.weight)
  533. }
  534. if(vm.questions[i].question.thirdKey == "bmi") {
  535. if(data.height && data.weight) {
  536. var w = data.weight
  537. var h = data.height / 100
  538. var s = (w / (h * h)).toFixed(2)
  539. vm.questions[i].question.content = s
  540. vm.shaowas = s
  541. vm.changeContent(vm.questions[i].question,s)
  542. }
  543. }
  544. if(vm.questions[i].question.thirdKey == "systolicPressure") {
  545. vm.questions[i].question.content = data.bloodPressureRigthU
  546. vm.changeContent(vm.questions[i].question,data.bloodPressureRigthU)
  547. }
  548. if(vm.questions[i].question.thirdKey == "diastolicPressure") {
  549. vm.questions[i].question.content = data.bloodPressureRigthD
  550. vm.changeContent(vm.questions[i].question,data.bloodPressureRigthD)
  551. }
  552. if(vm.questions[i].question.thirdKey == "bpU") {
  553. vm.questions[i].question.content = data.bloodPressureLeftU || data.bloodPressureRigthU
  554. vm.changeContent(vm.questions[i].question,data.bloodPressureLeftU || data.bloodPressureRigthU)
  555. }
  556. if(vm.questions[i].question.thirdKey == "bpD") {
  557. vm.questions[i].question.content = data.bloodPressureLeftD || data.bloodPressureRigthD
  558. vm.changeContent(vm.questions[i].question,data.bloodPressureLeftD || data.bloodPressureRigthD)
  559. }
  560. if(vm.questions[i].question.thirdKey == "glycolatedHemoglobin") {
  561. vm.questions[i].question.content = data.glycolatedHemoglobin
  562. vm.changeContent(vm.questions[i].question,data.glycolatedHemoglobin)
  563. }
  564. if(vm.questions[i].question.thirdKey == "fbg") {
  565. vm.questions[i].question.content = data.fastingPlasmaGlucoseL
  566. vm.changeContent(vm.questions[i].question,data.fastingPlasmaGlucoseL)
  567. }
  568. if(vm.questions[i].question.thirdKey == "bloodPotassium") {
  569. vm.questions[i].question.content = data.renalFunctionBloodPotassium
  570. vm.changeContent(vm.questions[i].question,data.renalFunctionBloodPotassium)
  571. }
  572. if(vm.questions[i].question.thirdKey == "renalFunctionCreatinine") {
  573. vm.questions[i].question.content = data.renalFunctionCreatinine
  574. vm.changeContent(vm.questions[i].question,data.renalFunctionCreatinine)
  575. }
  576. }
  577. }
  578. })
  579. }else{
  580. var data={
  581. patient: vm.screeningResidents
  582. }
  583. jbscAPI.getHealth(data).then(function(res){
  584. if(res.status == 200) {
  585. vm.tizhongRecord = _.find(res.data,function(o) {
  586. return o.type =="3";
  587. }) || {};
  588. for(var i in vm.questions) {
  589. if(vm.questions[i].question.thirdKey == "height") {
  590. vm.questions[i].question.content = vm.tizhongRecord.value2
  591. vm.changeContent(vm.questions[i].question,vm.tizhongRecord.value2)
  592. }
  593. if(vm.questions[i].question.thirdKey == "weight") {
  594. vm.questions[i].question.content = vm.tizhongRecord.value1
  595. vm.changeContent(vm.questions[i].question,vm.tizhongRecord.value1)
  596. }
  597. if(vm.questions[i].question.thirdKey == "systolicPressure") {
  598. vm.questions[i].question.content = res.data.xy.value1
  599. vm.changeContent(vm.questions[i].question,res.data.xy.value1)
  600. }
  601. if(vm.questions[i].question.thirdKey == "diastolicPressure") {
  602. vm.questions[i].question.content = res.data.xy.value2
  603. vm.changeContent(vm.questions[i].question,res.data.xy.value2)
  604. }
  605. if(vm.questions[i].question.thirdKey == "bmi") {
  606. if(vm.tizhongRecord.value2 && vm.tizhongRecord.value1) {
  607. var w = vm.tizhongRecord.value1
  608. var h = vm.tizhongRecord.value2 / 100
  609. var s = (w / (h * h)).toFixed(2)
  610. vm.questions[i].question.content = s
  611. vm.shaowas = s
  612. vm.changeContent(vm.questions[i].question,s)
  613. }
  614. }
  615. }
  616. } else {
  617. top.layer.msg(res.msg, {icon: 5});
  618. }
  619. })
  620. }
  621. }
  622. })
  623. },
  624. save:function(){
  625. console.log('2222221sssssssssssssssss',this.selectArr)
  626. var vm=this;
  627. if(vm.progress!=100){
  628. top.layer.msg('问卷还未全部填写', {icon: 5});
  629. return ;
  630. }
  631. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  632. vm.selectArr.forEach(function(v){
  633. if(v.thirdKey == "assessTime") {
  634. v.content = v.content.format('yyyy-MM-dd HH:mm')
  635. }
  636. })
  637. var data={
  638. patientCode:vm.screeningResidents,
  639. labelType:vm.labelType,
  640. isAgain:vm.isAgain,
  641. source:1,
  642. jsonData:JSON.stringify({
  643. surveyCode:vm.screeningType,
  644. questions:vm.selectArr
  645. })
  646. }
  647. jbscAPI.saveAnswer(data).then(function(res){
  648. top.layer.close(loadding);
  649. if(res.status == 200) {
  650. if(vm.questions[1].isThird == 3) {
  651. top.layer.open({
  652. type: 2,
  653. // offset: ['100px'], //右下角弹出
  654. area: ['568px', '100%'],
  655. shade: 0.5,
  656. title: '查看筛选结果',
  657. fixed: true, //不固定
  658. maxmin: true,
  659. closeBtn:1,
  660. shift: 5,
  661. shadeClose: false, //点击遮罩关闭层
  662. content: '../../jbsc/html/view_screening_results.html?resultCode='+res.data,
  663. end:function() {
  664. var index = top.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  665. parent.eventBuss.$emit('guan_results',index)
  666. },
  667. });
  668. }else{
  669. top.layer.open({
  670. type: 2,
  671. area: ['820px', '648px'],
  672. shade: 0.5,
  673. title: '筛选统计',
  674. fixed: true, //不固定
  675. maxmin: true,
  676. closeBtn:1,
  677. shift: 5,
  678. shadeClose: false, //点击遮罩关闭层
  679. content: '../../jbsc/html/filter_result.html?code='+res.data+'&filter_type='+vm.screeningType
  680. });
  681. }
  682. } else {
  683. top.layer.msg(res.msg, {icon: 5});
  684. }
  685. })
  686. },
  687. // 返回选择居民或者问卷类型
  688. goBack:function(number){
  689. var vm=this
  690. if(vm.isAgain){
  691. var content;
  692. if(number==1){
  693. content='再次筛查无法选择居民'
  694. }else{
  695. content='再次筛查无法选择问卷类型'
  696. }
  697. top.layer.msg(content, {icon: 5});
  698. return ;
  699. }
  700. var content='../../jbsc/html/filter_type.html?isReLoad=1';
  701. if(number===1){//选择居民
  702. content+='&goDenizen=1&fliter_code='+vm.screeningType+'&fliter_title='+vm.screeningTitle;
  703. }
  704. layer.open({
  705. type: 2,
  706. offset: 'rb', //右下角弹出
  707. id:"filter_type",
  708. background:"transparent",
  709. area: ['280px', '100%'],
  710. shade: 0.5,
  711. title: false,
  712. fixed: true, //不固定
  713. maxmin: false,
  714. closeBtn:0,
  715. shift: 5,
  716. shadeClose: true, //点击遮罩关闭层
  717. content: content
  718. });
  719. }
  720. },watch:{
  721. screeningType:function(){
  722. $('.daan-list input').attr('checked',false)
  723. },
  724. }
  725. })
  726. </script>
  727. </body>
  728. </html>