index.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. var template = ''
  2. $.ajax('../../../component/statistics/LascModifyPatient/index.html', {
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function (res) {},
  9. success: function (res) {
  10. template = res
  11. }
  12. })
  13. Vue.component('lasc-modify-patient', {
  14. template: template,
  15. name: 'lasc-modify-patient',
  16. props: {
  17. currentInfo: {},
  18. readonly: {
  19. type: Boolean,
  20. default: false
  21. }
  22. },
  23. data: function () {
  24. return {
  25. form: {
  26. baseinfo: {
  27. sickName: '',
  28. age: '',
  29. nation: '',
  30. nationName: '',
  31. birthday: '',
  32. sex: '',
  33. phone: '',
  34. address: '',
  35. womenCategory: '',
  36. accountFeeType: '',
  37. unitName: '',
  38. height: '',
  39. weight: '',
  40. edu: '',
  41. monthlyIncome: '',
  42. vaccinationHpv: ''
  43. },
  44. disease: {
  45. menophagia: '',
  46. menophagiaAge: '',
  47. hysterectomy: '',
  48. hysterectomyAge: '',
  49. menopause: '',
  50. menopauseAge: '',
  51. copd: '',
  52. copdAge: ''
  53. },
  54. fertility: {
  55. menophaniaAge: '',
  56. menopause: '',
  57. lmp: '',
  58. miscarriage: '',
  59. reproductiveHistory: '',
  60. breastCancerFir: '',
  61. breastCancerSec: '',
  62. partusMaturus: '',
  63. prematureDelivery: '',
  64. firstDeliveryAge: '',
  65. breastCancerSecNum: '',
  66. oophoromaNum: '',
  67. cervicalCancerFir: '',
  68. brcaGeneticTesting: '',
  69. chestRadiotherapy: '',
  70. chestRadiotherapy: '',
  71. hormoneUseMonth: '',
  72. breastBiopsySurgery: '',
  73. oophoromaSec: '',
  74. breastSurgeryNum: '',
  75. breastSurgeryResult: '',
  76. accessoryExcision: '',
  77. hysterectomy: '',
  78. hysterectomyAge: '',
  79. contraceptiveOtherMethod: '',
  80. contraceptiveMethod: '',
  81. accessoryExcision: '',
  82. contactBleeding: '',
  83. irregularVaginalBleeding: ''
  84. }
  85. },
  86. menophaniaAgeList: [],
  87. selAddress: '', // 默认值
  88. selectedStreet: '',
  89. areaList: areaDataArr,
  90. areaOptions: [], // 地区数据
  91. rules: {},
  92. streetList: [],
  93. cascaderProps: {
  94. value: 'value',
  95. label: 'label',
  96. children: 'children',
  97. expandTrigger: 'hover',
  98. checkStrictly: true, // 可以只选父级
  99. emitPath: true // 只返回最后一级的值
  100. },
  101. currentStreet: []
  102. }
  103. },
  104. methods: {
  105. getTableInfo() {
  106. var vm = this
  107. vm.selectedStreet = ''
  108. vm.selAddress = ''
  109. vm.form = {
  110. baseinfo: {
  111. sickName: '',
  112. age: '',
  113. nation: '',
  114. nationName: '',
  115. birthday: '',
  116. sex: '',
  117. phone: '',
  118. address: '',
  119. womenCategory: '',
  120. accountFeeType: '',
  121. unitName: '',
  122. height: '',
  123. weight: '',
  124. edu: '',
  125. monthlyIncome: '',
  126. vaccinationHpv: ''
  127. },
  128. disease: {
  129. menophagia: '',
  130. menophagiaAge: '',
  131. hysterectomy: '',
  132. hysterectomyAge: '',
  133. menopause: '',
  134. menopauseAge: '',
  135. copd: '',
  136. copdAge: ''
  137. },
  138. fertility: {
  139. menophaniaAge: '',
  140. menopause: '',
  141. lmp: '',
  142. miscarriage: '',
  143. reproductiveHistory: '',
  144. breastCancerFir: '',
  145. breastCancerSec: '',
  146. partusMaturus: '',
  147. prematureDelivery: '',
  148. firstDeliveryAge: '',
  149. breastCancerSecNum: '',
  150. oophoromaNum: '',
  151. cervicalCancerFir: '',
  152. brcaGeneticTesting: '',
  153. chestRadiotherapy: '',
  154. chestRadiotherapy: '',
  155. hormoneUseMonth: '',
  156. breastBiopsySurgery: '',
  157. oophoromaSec: '',
  158. breastSurgeryNum: '',
  159. breastSurgeryResult: '',
  160. accessoryExcision: '',
  161. hysterectomy: '',
  162. hysterectomyAge: '',
  163. contraceptiveOtherMethod: '',
  164. contraceptiveMethod: '',
  165. accessoryExcision: '',
  166. contactBleeding: '',
  167. irregularVaginalBleeding: ''
  168. }
  169. }
  170. var params = {
  171. id: '', // 表单id
  172. screenId: this.currentInfo.id, // 筛查id
  173. type: '1' //表单类型
  174. }
  175. httpRequest.get('doctor/twoCancers/count/tableDetail', { data: params }).then(function (res) {
  176. if (res.status == 200) {
  177. if (res.obj.baseinfo) {
  178. vm.form.baseinfo = res.obj.baseinfo
  179. _.filter(vm.areaList.city_list, function (v, k) {
  180. if (v.indexOf(vm.form.baseinfo.sickCity) === 0) {
  181. vm.selAddress = k
  182. }
  183. })
  184. vm.getStreetData(vm.selAddress, vm.form.baseinfo.sickStreet)
  185. }
  186. if (res.obj.disease) {
  187. vm.form.disease = res.obj.disease
  188. }
  189. if (res.obj.fertility) {
  190. vm.form.fertility = res.obj.fertility
  191. }
  192. // vm.form = res.obj;
  193. }
  194. })
  195. },
  196. // 编辑
  197. updJkCopdPatient() {
  198. var vm = this
  199. var params = {
  200. baseInfoJson: JSON.stringify(this.form.baseinfo),
  201. fertilityJson: JSON.stringify(this.form.fertility),
  202. cervicalDiseaseHistoryJson: JSON.stringify(this.form.disease)
  203. }
  204. httpRequest.post('doctor/twoCancers/updBaseInfoSave', { data: params }).then(function (res) {
  205. console.log('333333333333333', res)
  206. if (res.status == 200) {
  207. toastr.error('保存成功')
  208. vm.getTableInfo()
  209. } else {
  210. toastr.error(res.msg)
  211. }
  212. })
  213. },
  214. getStreetData(cityCode, streetName) {
  215. console.log('1111111111111111', cityCode, streetName)
  216. var cityCode = cityCode.substring(0, 4)
  217. var streetList = []
  218. _.filter(this.areaList.county_list, function (v, k) {
  219. if (k.indexOf(cityCode) === 0) {
  220. streetList.push({
  221. value: k,
  222. label: v,
  223. children: []
  224. })
  225. }
  226. })
  227. this.streetList = streetList
  228. console.log(this.streetList, ';;;;;;;;;;;;;;;;;;;;;;;')
  229. this.streetList.map(item => {
  230. this.fetchStreetList(item)
  231. })
  232. var currentStreet = this.currentStreet
  233. setTimeout(() => {
  234. currentStreet.forEach(item1 => {
  235. if (item1.name == streetName) {
  236. this.selectedStreet = item1.code
  237. }
  238. })
  239. }, 1000)
  240. },
  241. handleItemChange(item) {
  242. var sickProvince = ''
  243. var sickCity = ''
  244. _.filter(this.areaList.province_list, function (v, k) {
  245. if (k.indexOf(item[0]) === 0) {
  246. sickProvince = v || ''
  247. }
  248. })
  249. _.filter(this.areaList.city_list, function (v, k) {
  250. if (k.indexOf(item[1]) === 0) {
  251. sickCity = v || ''
  252. }
  253. })
  254. this.form.baseinfo.sickProvince = sickProvince
  255. this.form.baseinfo.sickCity = sickCity
  256. this.form.baseinfo.sickCounty = ''
  257. this.form.baseinfo.sickStreet = ''
  258. this.selSickStreet = ''
  259. var cityCode = (item[1] || '').substring(0, 4)
  260. var streetList = []
  261. _.filter(this.areaList.county_list, function (v, k) {
  262. if (k.indexOf(cityCode) === 0) {
  263. streetList.push({
  264. value: k,
  265. label: v,
  266. children: []
  267. })
  268. }
  269. })
  270. this.streetList = streetList
  271. console.log(this.streetList, ';;;;;;;;;;;;;;;;;;;;;;;')
  272. this.streetList.map(item => {
  273. this.fetchStreetList(item)
  274. })
  275. console.log('111111111111111112222222222222222', this.currentStreet)
  276. },
  277. loadAreaData() {
  278. this.areaOptions = Object.keys(this.areaList.province_list).map(provinceCode => ({
  279. value: provinceCode,
  280. label: this.areaList.province_list[provinceCode],
  281. children: this.getCityChildren(provinceCode)
  282. }))
  283. },
  284. // 获取城市子节点
  285. getCityChildren(provinceCode) {
  286. const prefix = provinceCode.substring(0, 2)
  287. return Object.keys(this.areaList.city_list)
  288. .filter(cityCode => cityCode.startsWith(prefix))
  289. .map(cityCode => ({
  290. value: cityCode,
  291. label: this.areaList.city_list[cityCode]
  292. }))
  293. },
  294. fetchStreetList(item) {
  295. var vm = this
  296. var params = {
  297. town: item.value
  298. }
  299. httpRequest.get('doctor/sign/getStreetListByTown', { data: params }).then(function (res) {
  300. if (res.status == 200) {
  301. res.data.forEach(element => {
  302. vm.currentStreet.push(element)
  303. })
  304. var children =
  305. !res.data || !res.data.length
  306. ? []
  307. : _.map(res.data, function (v) {
  308. return {
  309. label: v.name,
  310. value: v.code
  311. }
  312. })
  313. }
  314. item.children = children
  315. })
  316. },
  317. handleStreetChange(item) {
  318. this.form.baseinfo.sickCounty = this.areaList.county_list[item[0]]
  319. this.currentStreet.forEach(element => {
  320. if (element.code == item[1]) {
  321. this.form.baseinfo.sickStreet = element.name
  322. }
  323. })
  324. }
  325. },
  326. watch: {
  327. currentInfo: {
  328. handler(newVal, oldVal) {
  329. if (newVal) {
  330. this.getTableInfo()
  331. }
  332. },
  333. deep: true
  334. }
  335. },
  336. mounted() {
  337. console.log('currentInfocurrentInfo: ', this.currentInfo)
  338. // this.form = this.currentInfo
  339. for (var i = 8; i < 21; i++) {
  340. this.menophaniaAgeList.push(i)
  341. }
  342. this.loadAreaData()
  343. this.getTableInfo()
  344. console.log('3333333333333333333333333', this)
  345. }
  346. })