followup_newplan.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. var httpData=GetRequest();
  2. var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
  3. var loginDoctor = docInfo
  4. var clientHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
  5. new Vue({
  6. el:"#app",
  7. data:{
  8. clientHeight: clientHeight,
  9. planId: httpData['planId'],
  10. planDetaiId: httpData['planDetaiId'],
  11. patient: httpData['patient'],
  12. itemType:"1", //随访计划
  13. followUpItem:{
  14. patientName: '',
  15. planList:[{date:new Date().format("yyyy-MM-dd HH:mm")+":00",type:"2",doctor:loginDoctor.uid,followupClass:'',type1:'1'}], //计划列表
  16. },
  17. rules: {
  18. followupPlanDate: [
  19. { required: true, message: '请选择随访时间', trigger: 'change' },
  20. ],
  21. },
  22. item_1:{patientName: '',planList:[{date:"",type:"2",doctor:loginDoctor.uid,type1:'1'}]}, //随访计划列表
  23. planItem:{date:"",type:"2",doctor:loginDoctor.uid,type1:'1'}, //随访计划列表项
  24. item_2:{
  25. "patientName": '',
  26. "date":"",
  27. "followupType":"2",
  28. "followupClass":"",
  29. "followupManagerStatus":"",
  30. "plandate":"",
  31. "prescriptioncode":""
  32. },
  33. item_3:{
  34. "patientName": '',
  35. "followupDate":"",
  36. "followupPlanDate":"",
  37. "followupType":"2",
  38. "followupClass":"",
  39. },
  40. patientName: '',
  41. patientInfo:{},
  42. loginDoctor: loginDoctor,
  43. doctorList:[],
  44. sfPatientList:{},
  45. followupManagerStatusList:[], //临时随访状态
  46. toSelectsfpatient:false,
  47. followTypeList: [{code:'1',name:'高血压'},{code:'2',name:'糖尿病'},{code:'1,2',name:'高血压,糖尿病'},
  48. {code:'11',name:'冠心病'},{code:'16',name:'慢性阻塞性肺病'},{code:'17',name:'脑卒中'},{code:'13',name:'慢性前列腺'},{code:'19',name:'肺癌'},{code:'15',name:'慢性肾病'},
  49. {code:'14',name:'慢性乳腺'},{code:'20',name:'慢性胃肠病'},{code:'18',name:'脂肪肝'},{code:'12',name:'慢性妇科炎症'}
  50. ]
  51. },
  52. mounted: function() {
  53. this.doctorList.push(loginDoctor)
  54. this.getDictByDictName("FOLLOWUP_MANAGER_STATUS","followupManagerStatusList")
  55. if(this.patient){
  56. this.getPatientInfo()
  57. this.getDoctorList()
  58. }
  59. $("body").click(function () {
  60. $("#div_items").css('display', 'none');
  61. });
  62. $(".div_item").hover(function () {
  63. $(this).css('background-color', '#f8f8f8')
  64. }, function () {
  65. $(this).css('background-color', 'white')
  66. });
  67. },
  68. methods: {
  69. //计划类型改变
  70. changePlanType: function(){
  71. this.doctorList=[]
  72. if(this.itemType=="1"){
  73. this.doctorList.push(loginDoctor)
  74. }
  75. this.followUpItem=JSON.parse(JSON.stringify(this["item_"+this.itemType]))
  76. if(this.itemType=="1"){
  77. this.followUpItem.planList[0].date=new Date().format("yyyy-MM-dd HH:mm")+":00"
  78. }else if(this.itemType=="2"){
  79. this.followUpItem.date=new Date().format("yyyy-MM-dd HH:mm")+":00"
  80. this.followUpItem.type='2'
  81. }else if(this.itemType=="3"){
  82. this.followUpItem.followupDate=new Date().format("yyyy-MM-dd HH:mm")+":00"
  83. }
  84. // this.patientInfo = {}
  85. setTimeout(()=>{
  86. this.$refs.form.clearValidate()
  87. },100)
  88. },
  89. fsClassChange: function(){
  90. // this.patientInfo = {}
  91. this.followUpItem.patientName=""
  92. setTimeout(()=>{
  93. this.$refs.form.clearValidate()
  94. },100)
  95. },
  96. // 选择随访居民
  97. selectsfPatient: function(){
  98. var vm=this
  99. if(this.followUpItem.patientName.length>=15){
  100. $("#div_items").css('display', 'block');
  101. vm.getsfPatient()
  102. }else{
  103. $("#div_items").css('display', 'none');
  104. }
  105. },
  106. // 获取访视居民列表
  107. getsfPatient: function(){
  108. var vm=this
  109. var params={idcard:this.followUpItem.patientName}
  110. serviceVisitApi.getPatientJWInfo(params).then(res=>{
  111. if(res.status==200){
  112. if(!res.data.data){
  113. vm.sfPatientList={}
  114. }else{
  115. vm.sfPatientList=res.data.data
  116. }
  117. }else{
  118. this.$message.error(res.data.msg)
  119. }
  120. })
  121. },
  122. // 选择访视居民选中单个下拉框
  123. clicksingleItem: function(sitem){
  124. var vm=this
  125. if(!sitem.ssc&&!sitem.patient){
  126. const h = this.$createElement;
  127. this.$msgbox({
  128. title: '系统提示',
  129. message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '此居民暂无社保卡号,不支持为其创建入户访视计划。请居民注册厦门i健康账号后,医生方可创建入户访视计划'),
  130. showCancelButton: false,
  131. confirmButtonText: '确定',
  132. confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68",
  133. cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68"
  134. }).then(action => {
  135. })
  136. return
  137. }
  138. if(!sitem.patient){
  139. const h = this.$createElement;
  140. this.$msgbox({
  141. title: '系统提示',
  142. message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '此居民暂无厦门i健康,若要继续为此居民进行入户访视,系统将为此居民自动创建一个厦门i健康账号,请问您是否确认继续此操作?'),
  143. showCancelButton: true,
  144. confirmButtonText: '确定',
  145. cancelButtonText: '取消',
  146. confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68",
  147. cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68"
  148. }).then(action => {
  149. var obj={}
  150. obj.status=1
  151. obj.isCertified=0
  152. obj.address=sitem.homeAddress
  153. obj.name=sitem.sickName
  154. obj.sex=sitem.sickSex
  155. obj.idcard=sitem.idCard
  156. obj.birthday=sitem.birthday
  157. obj.ssc=sitem.ssc
  158. obj.age=sitem.age
  159. var data={
  160. jsonData:JSON.stringify(obj)
  161. }
  162. serviceVisitApi.create(data).then(res=>{
  163. if(res.status==200){
  164. $("#div_items").css('display', 'block');
  165. vm.getsfPatient()
  166. vm.toSelectsfpatient=false
  167. }else{
  168. this.$message.error(res.data.msg)
  169. }
  170. })
  171. }).catch(() => {
  172. });
  173. }else{
  174. vm.patientInfo={}
  175. vm.followUpItem.patientName=sitem.sickName
  176. vm.toSelectsfpatient=true
  177. vm.patientInfo.code=sitem.patient
  178. vm.patientInfo.name=sitem.sickName
  179. vm.patientInfo.idcard=sitem.idCard
  180. vm.patientInfo.age=sitem.age+"岁"
  181. vm.patientInfo.idcardEncrypt=sitem.idcardEncrypt
  182. vm.patientInfo.mobile=sitem.mobile
  183. vm.patientInfo.sex=sitem.sickSex
  184. }
  185. },
  186. // 获取居民对应医生列表--随访
  187. getDoctorList: function() {
  188. var params = {
  189. code: this.patient
  190. }
  191. followUpAPI.sign_doctors(params).then(function(msg){
  192. if (msg.status === 200) {
  193. var hasThisDoctor=_.find(msg.list,{code:loginDoctor.uid})
  194. if(hasThisDoctor>-1){ //列表里有当前医生
  195. this.doctorList=msg.list
  196. }else{
  197. this.doctorList.push(loginDoctor)
  198. }
  199. }
  200. })
  201. },
  202. addListItem: function(){
  203. var listItem=JSON.parse(JSON.stringify(this.planItem))
  204. listItem.date=new Date().format("yyyy-MM-dd HH:mm")+":00"
  205. this.followUpItem.planList.push(listItem)
  206. },
  207. removeListItem: function(index){
  208. const h = this.$createElement;
  209. this.$msgbox({
  210. title: '删除提示',
  211. message: h('p', { style: 'text-align: center;padding-top:20px;padding-bottom:40px;color:#333;' }, '请问您是否确认删除本次计划?'),
  212. showCancelButton: true,
  213. confirmButtonText: '确定',
  214. cancelButtonText: '取消',
  215. confirmButtonClass:"c-btn-plain c-btn-12b7f5-plain c-btn-w68",
  216. cancelButtonClass:"c-btn-plain c-btn-d7dce6-plain c-btn-w68"
  217. }).then(action => {
  218. this.followUpItem.planList.splice(index,1)
  219. }).catch(() => {
  220. });
  221. },
  222. //创建随访计划
  223. addFollowupPlan: function(){
  224. debugger
  225. var vm = this
  226. this.$refs["form"].validate((valid) => {
  227. if (valid) {
  228. var ispass=_.every(this.followUpItem.planList,(item,index)=>{
  229. var datepass=true
  230. var typepass=item.type!="3"||this.patientInfo.mobile
  231. if(typepass){
  232. datepass=index==0||(index>0 && this.followUpItem.planList[index-1].date<item.date)//前一次随访时间小于后一次随访时间
  233. if(!datepass){
  234. this.$message.warning("第"+index+"次随访时间小于第"+(index+1)+"次随访时间")
  235. }
  236. }else{
  237. this.$message.warning("该居民无联系方式,不可进行电话随访")
  238. }
  239. return typepass && datepass
  240. })
  241. if(!ispass){
  242. return false
  243. }
  244. var params={
  245. patient: this.patientInfo.code,data: JSON.stringify(this.followUpItem.planList)
  246. }
  247. // this.$loading('创建随访计划...')
  248. var loading = layer.load(0, {shade: false})
  249. followUpAPI.addFollowupPlan(params).then(res=>{
  250. // this.$loading.close()
  251. layer.close(loading)
  252. if(res.status == 200){
  253. layer.msg(res.msg, {
  254. icon: 1
  255. })
  256. if(res.data&&res.data.length>0){
  257. var relationCodeArr = []
  258. $.each(res.data, function(i, o){
  259. relationCodeArr.push(o.id)
  260. })
  261. var flag = 1 ;//标记(1随访2临时随访)
  262. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCodeArr, flag)
  263. }
  264. }else{
  265. layer.msg(res.msg, {
  266. icon: 5
  267. })
  268. }
  269. })
  270. } else {
  271. console.log('error submit!!');
  272. return false;
  273. }
  274. });
  275. },
  276. //创建临时随访
  277. addFollowup: function(){
  278. var vm = this
  279. this.$refs["form"].validate((valid) => {
  280. if (valid) {
  281. if(this.followUpItem.plandate){
  282. if(this.followUpItem.plandate<=this.followUpItem.date){
  283. this.$message.warning("下次随访时间不可早于随访时间")
  284. return false
  285. }
  286. }
  287. if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){
  288. this.$message.warning("该居民无联系方式,不可进行电话随访")
  289. return false
  290. }
  291. var params=JSON.parse(JSON.stringify(this.followUpItem))
  292. params.patient=this.patientInfo.code
  293. // this.$loading('创建临时随访...')
  294. var loading = layer.load(0, {shade: false})
  295. followUpAPI.addFollowup(params).then(res=>{
  296. // this.$loading.close()
  297. layer.close(loading)
  298. if(res.status == 200){
  299. layer.msg(res.msg, {
  300. icon: 1
  301. })
  302. if(res.data&&res.data.length>0){
  303. var relationCodeArr = []
  304. $.each(res.data, function(i, o){
  305. relationCodeArr.push(o.id)
  306. })
  307. var flag = 2 ;//标记(1随访2临时随访)
  308. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCodeArr, flag)
  309. }
  310. }else{
  311. layer.msg(res.msg, {
  312. icon: 5
  313. })
  314. }
  315. })
  316. } else {
  317. console.log('error submit!!');
  318. return false;
  319. }
  320. });
  321. },
  322. //创建入户访视
  323. saveFollowup: function(){
  324. var vm = this
  325. if(!this.patientInfo.code){ //未选中居民
  326. this.followUpItem.patientName=""
  327. }
  328. if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){
  329. this.$message.warning("该居民无联系方式,不可进行电话访视")
  330. return false
  331. }
  332. this.$refs["form"].validate((valid) => {
  333. if (valid) {
  334. var params={
  335. followupDate: this.followUpItem.followupDate,
  336. followupPlanDate: this.followUpItem.followupDate,
  337. followupType: this.followUpItem.followupType,
  338. followupClass: this.followUpItem.followupClass,
  339. doctorCode: loginDoctor.uid,
  340. doctorName: loginDoctor.name,
  341. orgCode: loginDoctor.hospital,
  342. orgName: loginDoctor.hospitalName,
  343. patientCode: this.patientInfo.code,
  344. patientName: this.patientInfo.name,
  345. idcard: this.patientInfo.idcard,
  346. age:this.patientInfo.age,
  347. idcardEncrypt:this.patientInfo.idcardEncrypt,
  348. mobile:this.patientInfo.mobile,
  349. sex:this.patientInfo.sex,
  350. dataFrom: "2",
  351. status: "2",
  352. createTime: new Date().format("yyyy-MM-dd HH:mm:ss"),
  353. creater: loginDoctor.uid,
  354. type:'3' //区分随访计划1、新增随访2、临时随访3、入户随访
  355. }
  356. // this.$loading('创建入户访视...')
  357. var loading = layer.load(0, {shade: false})
  358. followUpAPI.saveFollowup({jsonFollowup:JSON.stringify(params)}).then(res=>{
  359. // this.$loading.close()
  360. layer.close(loading)
  361. if(res.status == 200){
  362. layer.msg(res.msg, {
  363. icon: 1
  364. })
  365. if(res.data&&res.data.length>0){
  366. var relationCodeArr = []
  367. $.each(res.data, function(i, o){
  368. relationCodeArr.push(o.id)
  369. })
  370. var flag = 3 ;//标记(1随访2临时随访)
  371. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCodeArr, flag)
  372. }
  373. }else{
  374. layer.msg(res.msg, {
  375. icon: 5
  376. })
  377. }
  378. })
  379. } else {
  380. console.log('error submit!!');
  381. return false;
  382. }
  383. });
  384. },
  385. getDictByDictName: function(name,itemName) {
  386. var vm = this
  387. var params = {
  388. name: name
  389. }
  390. signAPI.getDictByDictName(params).then(function(res){
  391. var result = res.list
  392. if (res.status === 200) {
  393. vm[itemName] = result
  394. }
  395. })
  396. },
  397. // 选择居民信息或者获取居民信息
  398. // getPatientInfo(obj) {
  399. // this.patientInfo = obj
  400. // this.$set(this.followUpItem,"patientName",obj.name)
  401. // if(this.itemType=="1"){
  402. // this.getDoctorList()
  403. // }
  404. // },
  405. // 选择居民信息或者获取居民信息
  406. getPatientInfo: function() {
  407. var vm = this
  408. var params = {
  409. patient: vm.patient
  410. }
  411. followUpAPI.getPatientInfo(params).then(function(res){
  412. if(res.status == 200){
  413. vm.patientInfo = res.data?res.data:{}
  414. vm.followUpItem['patientName'] = vm.patientInfo.name
  415. vm.item_1['patientName'] = vm.patientInfo.name
  416. vm.item_2['patientName'] = vm.patientInfo.name
  417. vm.item_3['patientName'] = vm.patientInfo.name
  418. vm.patientName = vm.patientInfo.name
  419. }
  420. })
  421. },
  422. //打开居民列表弹框
  423. showPatientList: function(){
  424. if(this.itemType=="3"){
  425. var ispass=true
  426. this.$refs["form"].validateField(["followupClass","followupDate"],(valid)=>{
  427. if(valid){ //有值说明验证未通过
  428. ispass=false
  429. }
  430. })
  431. if(!ispass){
  432. return false
  433. }
  434. }
  435. this.$root.bus.$emit('selectPatientAddFUPlan',{type:this.itemType,patientInfo:this.patientInfo,followUpItem:this.followUpItem})
  436. },
  437. //关闭弹框
  438. closeMask: function(){
  439. this.$root.bus.$emit('closeMask')
  440. },
  441. back: function(){
  442. this.$emit("removeTab","newPlan")
  443. },
  444. }
  445. })