followup_newplan.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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:"22",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:"22",doctor:loginDoctor.uid,type1:'1'}]}, //随访计划列表
  23. planItem:{date:"",type:"22",doctor:loginDoctor.uid,type1:'1'}, //随访计划列表项
  24. item_2:{
  25. "patientName": '',
  26. "date":"",
  27. "followupType":"22",
  28. "followupClass":"",
  29. "followupManagerStatus":"",
  30. "plandate":"",
  31. "prescriptioncode":""
  32. },
  33. item_3:{
  34. "patientName": '',
  35. "followupDate":"",
  36. "followupPlanDate":"",
  37. "followupType":"22",
  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. var vm = this
  225. this.$refs["form"].validate((valid) => {
  226. if (valid) {
  227. var ispass=_.every(this.followUpItem.planList,(item,index)=>{
  228. var datepass=true
  229. var typepass=item.type!="3"||this.patientInfo.mobile
  230. if(typepass){
  231. datepass=index==0||(index>0 && this.followUpItem.planList[index-1].date<item.date)//前一次随访时间小于后一次随访时间
  232. if(!datepass){
  233. this.$message.warning("第"+index+"次随访时间小于第"+(index+1)+"次随访时间")
  234. }
  235. }else{
  236. this.$message.warning("该居民无联系方式,不可进行电话随访")
  237. }
  238. return typepass && datepass
  239. })
  240. if(!ispass){
  241. return false
  242. }
  243. var params={
  244. patient: this.patientInfo.code,data: JSON.stringify(this.followUpItem.planList)
  245. }
  246. // this.$loading('创建随访计划...')
  247. var loading = layer.load(0, {shade: false})
  248. followUpAPI.addFollowupPlan(params).then(res=>{
  249. // this.$loading.close()
  250. layer.close(loading)
  251. if(res.status == 200){
  252. layer.msg(res.msg, {
  253. icon: 1
  254. })
  255. if(res.data&&res.data.length>0){
  256. var relationCode = res.data[0].id
  257. var flag = 1 ;//标记(1随访2临时随访)
  258. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode, flag)
  259. }
  260. }else{
  261. layer.msg(res.msg, {
  262. icon: 5
  263. })
  264. }
  265. })
  266. } else {
  267. console.log('error submit!!');
  268. return false;
  269. }
  270. });
  271. },
  272. //创建临时随访
  273. addFollowup: function(){
  274. var vm = this
  275. this.$refs["form"].validate((valid) => {
  276. if (valid) {
  277. if(this.followUpItem.plandate){
  278. if(this.followUpItem.plandate<=this.followUpItem.date){
  279. this.$message.warning("下次随访时间不可早于随访时间")
  280. return false
  281. }
  282. }
  283. if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){
  284. this.$message.warning("该居民无联系方式,不可进行电话随访")
  285. return false
  286. }
  287. var params=JSON.parse(JSON.stringify(this.followUpItem))
  288. params.patient=this.patientInfo.code
  289. // this.$loading('创建临时随访...')
  290. var loading = layer.load(0, {shade: false})
  291. followUpAPI.addFollowup(params).then(res=>{
  292. // this.$loading.close()
  293. layer.close(loading)
  294. if(res.status == 200){
  295. layer.msg(res.msg, {
  296. icon: 1
  297. })
  298. if(res.data&&res.data.length>0){
  299. var relationCode = res.data
  300. var flag = 2 ;//标记(1随访2临时随访)
  301. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode, flag)
  302. }
  303. }else{
  304. layer.msg(res.msg, {
  305. icon: 5
  306. })
  307. }
  308. })
  309. } else {
  310. console.log('error submit!!');
  311. return false;
  312. }
  313. });
  314. },
  315. //创建入户访视
  316. saveFollowup: function(){
  317. var vm = this
  318. if(!this.patientInfo.code){ //未选中居民
  319. this.followUpItem.patientName=""
  320. }
  321. if(this.followUpItem.followupType=="3"&&!this.patientInfo.mobile){
  322. this.$message.warning("该居民无联系方式,不可进行电话访视")
  323. return false
  324. }
  325. this.$refs["form"].validate((valid) => {
  326. if (valid) {
  327. var params={
  328. followupDate: this.followUpItem.followupDate,
  329. followupPlanDate: this.followUpItem.followupDate,
  330. followupType: this.followUpItem.followupType,
  331. followupClass: this.followUpItem.followupClass,
  332. doctorCode: loginDoctor.uid,
  333. doctorName: loginDoctor.name,
  334. orgCode: loginDoctor.hospital,
  335. orgName: loginDoctor.hospitalName,
  336. patientCode: this.patientInfo.code,
  337. patientName: this.patientInfo.name,
  338. idcard: this.patientInfo.idcard,
  339. age:this.patientInfo.age,
  340. idcardEncrypt:this.patientInfo.idcardEncrypt,
  341. mobile:this.patientInfo.mobile,
  342. sex:this.patientInfo.sex,
  343. dataFrom: "2",
  344. status: "2",
  345. createTime: new Date().format("yyyy-MM-dd HH:mm:ss"),
  346. creater: loginDoctor.uid,
  347. type:'3' //区分随访计划1、新增随访2、临时随访3、入户随访
  348. }
  349. // this.$loading('创建入户访视...')
  350. var loading = layer.load(0, {shade: false})
  351. followUpAPI.saveFollowup({jsonFollowup:JSON.stringify(params)}).then(res=>{
  352. // this.$loading.close()
  353. layer.close(loading)
  354. if(res.status == 200){
  355. layer.msg(res.msg, {
  356. icon: 1
  357. })
  358. if(res.data&&res.data.length>0){
  359. var relationCode = res.data[0].id
  360. window.parent.closeFollowUpLayer(vm.planDetaiId, relationCode)
  361. }
  362. }else{
  363. layer.msg(res.msg, {
  364. icon: 5
  365. })
  366. }
  367. })
  368. } else {
  369. console.log('error submit!!');
  370. return false;
  371. }
  372. });
  373. },
  374. getDictByDictName: function(name,itemName) {
  375. var vm = this
  376. var params = {
  377. name: name
  378. }
  379. signAPI.getDictByDictName(params).then(function(res){
  380. var result = res.list
  381. if (res.status === 200) {
  382. vm[itemName] = result
  383. }
  384. })
  385. },
  386. // 选择居民信息或者获取居民信息
  387. // getPatientInfo(obj) {
  388. // this.patientInfo = obj
  389. // this.$set(this.followUpItem,"patientName",obj.name)
  390. // if(this.itemType=="1"){
  391. // this.getDoctorList()
  392. // }
  393. // },
  394. // 选择居民信息或者获取居民信息
  395. getPatientInfo: function() {
  396. var vm = this
  397. var params = {
  398. patient: vm.patient
  399. }
  400. followUpAPI.getPatientInfo(params).then(function(res){
  401. if(res.status == 200){
  402. vm.patientInfo = res.data?res.data:{}
  403. vm.followUpItem['patientName'] = vm.patientInfo.name
  404. vm.item_1['patientName'] = vm.patientInfo.name
  405. vm.item_2['patientName'] = vm.patientInfo.name
  406. vm.item_3['patientName'] = vm.patientInfo.name
  407. vm.patientName = vm.patientInfo.name
  408. }
  409. })
  410. },
  411. //打开居民列表弹框
  412. showPatientList: function(){
  413. if(this.itemType=="3"){
  414. var ispass=true
  415. this.$refs["form"].validateField(["followupClass","followupDate"],(valid)=>{
  416. if(valid){ //有值说明验证未通过
  417. ispass=false
  418. }
  419. })
  420. if(!ispass){
  421. return false
  422. }
  423. }
  424. this.$root.bus.$emit('selectPatientAddFUPlan',{type:this.itemType,patientInfo:this.patientInfo,followUpItem:this.followUpItem})
  425. },
  426. //关闭弹框
  427. closeMask: function(){
  428. this.$root.bus.$emit('closeMask')
  429. },
  430. back: function(){
  431. this.$emit("removeTab","newPlan")
  432. },
  433. }
  434. })