addDoc.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view class="form-box">
  5. <text class="form-title">身体信息</text>
  6. <view class="form-item">
  7. <text class="label">身高</text>
  8. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入身高"
  9. placeholder-class="form-input" />
  10. <text class="unit">cm</text>
  11. </view>
  12. <view class="form-item">
  13. <text class="label">体重</text>
  14. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入体重"
  15. placeholder-class="form-input" />
  16. <text class="unit">kg</text>
  17. </view>
  18. <view class="form-item">
  19. <text class="label">腰围</text>
  20. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入腰围"
  21. placeholder-class="form-input" />
  22. <text class="unit">cm</text>
  23. </view>
  24. <view class="form-item">
  25. <text class="label">臀围</text>
  26. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入臀围"
  27. placeholder-class="form-input" />
  28. <text class="unit">cm</text>
  29. </view>
  30. </view>
  31. <view class="form-box">
  32. <text class="form-title">疾病史</text>
  33. <view class="form-item">
  34. <text class="label">高血糖</text>
  35. <radio-group style="display: flex;align-items: center;">
  36. <label style="margin-right: 50upx;">
  37. <radio @click="sexChange(1)" value="1" :checked="form.sex===1"
  38. style="margin-right: 16upx;" />
  39. <text class="sex-text">无</text>
  40. </label>
  41. <label style="margin-right: 50upx;">
  42. <radio @click="sexChange(2)" value="2" :checked="form.sex===2"
  43. style="margin-right: 16upx;" />
  44. <text class="sex-text">轻微</text>
  45. </label>
  46. <label>
  47. <radio @click="sexChange(3)" value="2" :checked="form.sex===2"
  48. style="margin-right: 16upx;" />
  49. <text class="sex-text">严重</text>
  50. </label>
  51. </radio-group>
  52. </view>
  53. <view class="form-item">
  54. <text class="label">测量值</text>
  55. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入测量值"
  56. placeholder-class="form-input" />
  57. <text class="unit">mmol/L</text>
  58. </view>
  59. <view class="form-item">
  60. <text class="label">高血压</text>
  61. <radio-group style="display: flex;align-items: center;">
  62. <label style="margin-right: 50upx;">
  63. <radio @click="sexChange(1)" value="1" :checked="form.sex===1"
  64. style="margin-right: 16upx;" />
  65. <text class="sex-text">无</text>
  66. </label>
  67. <label style="margin-right: 50upx;">
  68. <radio @click="sexChange(2)" value="2" :checked="form.sex===2"
  69. style="margin-right: 16upx;" />
  70. <text class="sex-text">轻微</text>
  71. </label>
  72. <label>
  73. <radio @click="sexChange(3)" value="2" :checked="form.sex===2"
  74. style="margin-right: 16upx;" />
  75. <text class="sex-text">严重</text>
  76. </label>
  77. </radio-group>
  78. </view>
  79. <view class="form-item">
  80. <text class="label">收缩压</text>
  81. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入测量值"
  82. placeholder-class="form-input" />
  83. <text class="unit">mmHg</text>
  84. </view>
  85. <view class="form-item">
  86. <text class="label">舒张压</text>
  87. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入测量值"
  88. placeholder-class="form-input" />
  89. <text class="unit">mmHg</text>
  90. </view>
  91. <view class="form-item">
  92. <text class="label">高血脂</text>
  93. <radio-group style="display: flex;align-items: center;">
  94. <label style="margin-right: 50upx;">
  95. <radio @click="sexChange(1)" value="1" :checked="form.sex===1"
  96. style="margin-right: 16upx;" />
  97. <text class="sex-text">无</text>
  98. </label>
  99. <label style="margin-right: 50upx;">
  100. <radio @click="sexChange(2)" value="2" :checked="form.sex===2"
  101. style="margin-right: 16upx;" />
  102. <text class="sex-text">轻微</text>
  103. </label>
  104. <label>
  105. <radio @click="sexChange(3)" value="2" :checked="form.sex===2"
  106. style="margin-right: 16upx;" />
  107. <text class="sex-text">严重</text>
  108. </label>
  109. </radio-group>
  110. </view>
  111. <view class="form-item">
  112. <text class="label">高尿酸</text>
  113. <radio-group style="display: flex;align-items: center;">
  114. <label style="margin-right: 50upx;">
  115. <radio @click="sexChange(1)" value="1" :checked="form.sex===1"
  116. style="margin-right: 16upx;" />
  117. <text class="sex-text">无</text>
  118. </label>
  119. <label style="margin-right: 50upx;">
  120. <radio @click="sexChange(2)" value="2" :checked="form.sex===2"
  121. style="margin-right: 16upx;" />
  122. <text class="sex-text">轻微</text>
  123. </label>
  124. <label>
  125. <radio @click="sexChange(3)" value="2" :checked="form.sex===2"
  126. style="margin-right: 16upx;" />
  127. <text class="sex-text">严重</text>
  128. </label>
  129. </radio-group>
  130. </view>
  131. <view class="form-item">
  132. <text class="label">测量值</text>
  133. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入测量值"
  134. placeholder-class="form-input" />
  135. <text class="unit">μmol/L</text>
  136. </view>
  137. <view class="form-item">
  138. <text class="label">高体重</text>
  139. <radio-group style="display: flex;align-items: center;">
  140. <label style="margin-right: 50upx;">
  141. <radio @click="sexChange(1)" value="1" :checked="form.sex===1"
  142. style="margin-right: 16upx;" />
  143. <text class="sex-text">正常</text>
  144. </label>
  145. <label style="margin-right: 50upx;">
  146. <radio @click="sexChange(2)" value="2" :checked="form.sex===2"
  147. style="margin-right: 16upx;" />
  148. <text class="sex-text">偏瘦</text>
  149. </label>
  150. <label>
  151. <radio @click="sexChange(3)" value="2" :checked="form.sex===2"
  152. style="margin-right: 16upx;" />
  153. <text class="sex-text">偏重</text>
  154. </label>
  155. </radio-group>
  156. </view>
  157. </view>
  158. <view class="form-box">
  159. <text class="form-title">其他病史</text>
  160. <view class="form-item wrap">
  161. <view class="form-item-tag" v-for="(item, index) in tags" :key="index" @click="radioClick(item)">
  162. <view :class="checked==item.id?'tag active':'tag'">
  163. {{item.name}}
  164. </view>
  165. </view>
  166. <view class="form-item-tag mt16">
  167. <view class="tag">
  168. + 其他
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. <view class="form-box">
  174. <text class="form-title">症状史</text>
  175. <view class="form-item wrap">
  176. <view class="form-item-tag" v-for="(item, index) in tags" :key="index" @click="radioClick(item)">
  177. <view :class="checked==item.id?'tag active':'tag'">
  178. {{item.name}}
  179. </view>
  180. </view>
  181. <view class="form-item-tag mt16">
  182. <view class="tag">
  183. + 其他
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <view class="btn-box">
  190. <view class="sub-btn" @click="submit()">保存</view>
  191. </view>
  192. </view>
  193. </template>
  194. <script>
  195. import {
  196. getDocDetails,
  197. addDoc,
  198. editDoc
  199. } from '@/api/doc.js'
  200. export default {
  201. data() {
  202. return {
  203. type: null,
  204. patientId: null,
  205. famaleurl:"/static/images/health/female_profile.png",
  206. maleurl:"/static/images/health/my_heads.png",
  207. checked:1,
  208. tags: [{
  209. name: '心脏病',
  210. checked:true,
  211. id: 1
  212. },
  213. {
  214. name: '脑梗死',
  215. checked:false,
  216. id: 2
  217. },{
  218. name: '肾病',
  219. checked:false,
  220. id: 3
  221. },{
  222. name: '脂肪肝',
  223. checked:false,
  224. id: 4
  225. }],
  226. form: {
  227. userName: null,
  228. idCard: null,
  229. sex: null,
  230. birthday: null,
  231. remark: null,
  232. }
  233. };
  234. },
  235. onLoad(option) {
  236. this.type = option.type;
  237. console.log(this.type)
  238. if (this.type == 'edit') {
  239. this.docId = option.docId;
  240. // this.getDocDetails();
  241. }
  242. },
  243. methods: {
  244. sexChange(type) {
  245. this.form.sex = type
  246. },
  247. radioClick(item) {
  248. this.checked=item.id
  249. },
  250. getDocDetails() {
  251. var data = {
  252. docId: this.docId
  253. };
  254. getDocDetails(data).then(
  255. res => {
  256. if (res.code == 200) {
  257. this.form = res.data;
  258. } else {
  259. uni.showToast({
  260. title: res.msg,
  261. });
  262. }
  263. },
  264. rej => {}
  265. );
  266. },
  267. submit() {
  268. if (this.form.userName == null) {
  269. uni.showToast({
  270. icon: 'none',
  271. title: "姓名不能为空",
  272. });
  273. return;
  274. }
  275. if (this.form.idCard == null) {
  276. uni.showToast({
  277. icon: 'none',
  278. title: "身份证号不能为空",
  279. });
  280. return;
  281. }
  282. if (this.form.sex == null) {
  283. uni.showToast({
  284. icon: 'none',
  285. title: "性别不能为空",
  286. });
  287. return;
  288. }
  289. if (this.form.birthday == null) {
  290. uni.showToast({
  291. icon: 'none',
  292. title: "出生年月不能为空",
  293. });
  294. return;
  295. }
  296. if (this.type == "add") {
  297. this.addDoc()
  298. } else if (this.type == "edit") {
  299. this.editDoc()
  300. }
  301. },
  302. editDoc() {
  303. editDoc(this.form).then(
  304. res => {
  305. if (res.code == 200) {
  306. uni.showToast({
  307. icon: 'success',
  308. title: "操作成功",
  309. });
  310. setTimeout(function() {
  311. uni.$emit('refreshDoc');
  312. uni.navigateBack({
  313. delta: 1
  314. })
  315. }, 500);
  316. } else {
  317. uni.showToast({
  318. icon: 'none',
  319. title: res.msg,
  320. });
  321. }
  322. },
  323. rej => {}
  324. );
  325. },
  326. addDoc() {
  327. addDoc(this.form).then(
  328. res => {
  329. if (res.code == 200) {
  330. uni.showToast({
  331. icon: 'success',
  332. title: "操作成功",
  333. });
  334. setTimeout(function() {
  335. uni.$emit('refreshDoc');
  336. uni.navigateBack({
  337. delta: 1
  338. })
  339. }, 500);
  340. } else {
  341. uni.showToast({
  342. icon: 'none',
  343. title: res.msg,
  344. });
  345. }
  346. },
  347. rej => {}
  348. );
  349. },
  350. // 出生日期选择
  351. bindDateChange: function(e) {
  352. this.form.birthday = e.target.value
  353. },
  354. }
  355. }
  356. </script>
  357. <style lang="scss">
  358. page {
  359. height: 100%;
  360. }
  361. .content {
  362. height: 100%;
  363. display: flex;
  364. flex-direction: column;
  365. justify-content: space-between;
  366. .inner {
  367. // height: calc(100% - 120upx);
  368. padding: 20upx;
  369. .form-box {
  370. padding: 0 30upx;
  371. background: #FFFFFF;
  372. border-radius: 16upx;
  373. margin-bottom: 20upx;
  374. .form-title {
  375. font-family: PingFang SC;
  376. font-weight: 600;
  377. font-size: 40rpx;
  378. color: #222426;
  379. text-align: left;
  380. padding: 30rpx 0;
  381. display: block;
  382. }
  383. .form-item {
  384. padding: 30upx 0;
  385. display: flex;
  386. align-items: flex-start;
  387. border-bottom: 1px solid #F1F1F1;
  388. &:last-child {
  389. border-bottom: none;
  390. }
  391. .label {
  392. width: 150upx;
  393. text-align: left;
  394. font-size: 32upx;
  395. line-height: 44upx;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. color: #222222;
  399. flex-shrink: 0;
  400. }
  401. input {
  402. text-align: left;
  403. }
  404. .unit {
  405. width: 150upx;
  406. text-align: right;
  407. font-size: 32upx;
  408. line-height: 44upx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #222222;
  412. flex-shrink: 0;
  413. }
  414. .form-input {
  415. font-size: 30upx;
  416. font-family: PingFang SC;
  417. font-weight: 500;
  418. color: #999999;
  419. text-align: left;
  420. }
  421. .form-item-tag{
  422. margin-right: 16rpx;
  423. .tag{
  424. border-radius: 8rpx 8rpx 8rpx 8rpx;
  425. border: 2rpx solid #ECECEC;
  426. display: flex;
  427. align-items: center;
  428. padding: 24rpx;
  429. font-family: PingFang SC;
  430. font-weight: 400;
  431. font-size: 24rpx;
  432. &.active{
  433. background: #F0FAFF;
  434. border: 2rpx solid #008FD3;
  435. color: #008FD3;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. .btn-box {
  443. height: 120upx;
  444. padding: 0 30upx;
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. // position: fixed;
  449. // width: 90%;
  450. // bottom: 0;
  451. // left: 50%;
  452. // transform: translate(-50%,-50%);
  453. // background: #FFFFFF;
  454. .sub-btn {
  455. width: 100%;
  456. height: 88upx;
  457. line-height: 88upx;
  458. text-align: center;
  459. font-size: 32upx;
  460. font-family: PingFang SC;
  461. font-weight: bold;
  462. color: #FFFFFF;
  463. background: #008FD3;
  464. border-radius: 44upx;
  465. margin-bottom: 40upx;
  466. }
  467. }
  468. }
  469. </style>