index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view class="createTherapy">
  3. <p class="tip-head">请先检索再创建</p>
  4. <view class="create-therapy-container">
  5. <view class="create-item-row">
  6. <view class="name">诊断时间</view>
  7. <view class="info date">
  8. <picker mode="date" v-model="createTherapyForm.time" @change="timeChange">
  9. <view class="time">
  10. <text>{{ createTherapyForm.time }}</text>
  11. <text class="zhcx-icon-youbianjiantoujiaoduxiao zhcx-iconfont"></text>
  12. </view>
  13. </picker>
  14. </view>
  15. </view>
  16. <view class="create-item-row ">
  17. <input class="inp-name" type="text" v-model="createTherapyForm.accountName" placeholder="请输入患者手机号码" />
  18. <button type="default" @click="verifyAccout" class="verifyAccoutBt">检测</button>
  19. </view>
  20. <view class="patient-info" v-if="patientInfoModal">
  21. <view class="patient-info-item-row">
  22. <view class="name">姓名</view>
  23. <input class="info" type="text" v-model="createTherapyForm.name" :disabled="userStatus" />
  24. </view>
  25. <view class="patient-info-item-row">
  26. <view class="name">身份证</view>
  27. <input class="info" type="text" v-model="createTherapyForm.patientIdCard" :disabled="userStatus"/>
  28. </view>
  29. <view class="patient-info-item-row" >
  30. <view class="name">性别</view>
  31. <radio-group @change="changeGender">
  32. <label>
  33. <radio value="0" :checked="createTherapyForm.gender==='0'" :disabled="userStatus"/><text>男</text>
  34. </label>
  35. <label class="gender-item-woman">
  36. <radio value="1" :checked="createTherapyForm.gender==='1'" :disabled="userStatus" /><text>女</text>
  37. </label>
  38. </radio-group>
  39. </view>
  40. <view class="patient-info-item-row">
  41. <view class="name">地址</view>
  42. <input class="info" type="text" v-model="createTherapyForm.patientAddress" :disabled="userStatus" />
  43. </view>
  44. <view class="patient-info-item-row" >
  45. <view class="name">邮箱</view>
  46. <input class="info" type="text" v-model="createTherapyForm.accountEmail" :disabled="userStatus" />
  47. </view>
  48. </view>
  49. <textarea class="textarea illness" v-model="createTherapyForm.illness" placeholder="病情描述" :disabled="illnessStatus" />
  50. <view class="addImage">
  51. <view class="title">添加医学影像</view>
  52. <view class="tip">支持各类图片,文件不大于10M</view>
  53. <view class="upload" @click="uploadBt">
  54. <view class="icon"></view>
  55. <view class="word">点击上传</view>
  56. </view>
  57. </view>
  58. <textarea class="textarea therapySchedule" v-model="createTherapyForm.therapySchedule" placeholder="治疗方案" :disabled="illnessStatus" />
  59. <view class="submit-BT" @click="createSubmit" >
  60. <text>提交</text>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {parseTime,validPhone} from '@/libs/index';
  67. import {upload} from '@/api';
  68. import {detectionAccount,creatPatient} from '@/api/doctor.js'
  69. export default{
  70. data(){
  71. return{
  72. createTherapyForm:{
  73. time:parseTime(new Date(),'{yyyy}-{mm}-{dd} {hh}:{mm}:{ss}'),
  74. accountName:"",
  75. name:"",
  76. illness:"",
  77. therapySchedule:'',
  78. patientIdCard:"",
  79. patientAddress:"",
  80. accountEmail:"",
  81. patientIdCard:"",
  82. image:null
  83. },
  84. patientInfoModal:true,
  85. userStatus:true,
  86. illnessStatus:true
  87. }
  88. },
  89. methods:{
  90. verifyAccout(){
  91. let accountName=this.createTherapyForm.accountName;
  92. accountName=accountName.trim();
  93. if(accountName.length<1){
  94. uni.showToast({
  95. icon:"none",
  96. title:"请输入患者手机号码"
  97. })
  98. return
  99. }else{
  100. if(!(validPhone(accountName))){
  101. uni.showToast({
  102. icon:"none",
  103. title:"手机号码有误"
  104. })
  105. return
  106. }
  107. }
  108. detectionAccount(accountName).then((res)=>{
  109. this.patientInfoModal=true;
  110. this.initUser();//清空数据
  111. if(res.data.length>0){
  112. let patientInfo=res.data[0];
  113. let time=parseTime(new Date(patientInfo.createTime),'{yyyy}-{mm}-{dd} {hh}:{mm}:{ss}');
  114. this.$set(this.createTherapyForm,'name',patientInfo.patientName);
  115. this.$set(this.createTherapyForm,'gender',patientInfo.patientSex);
  116. this.$set(this.createTherapyForm,'time',time||'');
  117. this.$set(this.createTherapyForm,'patientIdCard',patientInfo.patientIdCard) ;
  118. this.$set(this.createTherapyForm,'patientAddress',patientInfo.patientAddress);
  119. this.$set(this.createTherapyForm,'accountEmail',patientInfo.accountEmail) ;
  120. this.illnessStatus=false;
  121. }else{
  122. uni.showToast({
  123. icon:"none",
  124. title:"未检测到患者信息!"
  125. })
  126. this.userStatus=false;
  127. this.illnessStatus=false;
  128. }
  129. })
  130. },
  131. createSubmit(){
  132. let accountName=this.createTherapyForm.accountName;
  133. if(accountName.length<1){
  134. uni.showToast({
  135. icon:"none",
  136. title:"请输入患者手机号码"
  137. })
  138. return
  139. }else{
  140. accountName=accountName.trim();
  141. if(!(validPhone(accountName))){
  142. uni.showToast({
  143. icon:"none",
  144. title:"手机号码有误"
  145. })
  146. return
  147. }
  148. }
  149. let userInfo=uni.getStorageSync('userInfo');
  150. let form=this.createTherapyForm;
  151. let params={
  152. doctorId:userInfo.doctorId,
  153. accountTel:accountName,
  154. accountName:accountName,
  155. patientName: form['name'],
  156. patientSex: form['gender'],
  157. seekTime:form['time'],
  158. diseaseDesc:form['illness'],
  159. diseaseImgDesc:form["image"],
  160. doctorTreatment:form["therapySchedule"],
  161. patientIdCard:form['patientIdCard'],
  162. patientAddress:form['patientAddress'],
  163. accountEmail:form['accountEmail'],
  164. password:111111
  165. }
  166. /*检测账号信息,不存在就添加密码--防止用户检测后又更改账号但是不检测*/
  167. creatPatient(params).then(()=>{
  168. uni.showToast({
  169. title:"新建成功"
  170. })
  171. setTimeout(function(){
  172. uni.reLaunch({
  173. url:'/views/record/index?type=create'
  174. })
  175. },1500)
  176. })
  177. },
  178. timeChange({detail }){
  179. let time=parseTime(new Date(detail.value),'{yyyy}-{mm}-{dd} {hh}:{mm}:{ss}')
  180. this.createTherapyForm.time=time;
  181. },
  182. uploadBt(){
  183. uni.chooseImage({
  184. success: (chooseImageRes) => {
  185. const tempFilePaths = chooseImageRes.tempFilePaths;
  186. this.uploadSubmit(tempFilePaths[0])
  187. }
  188. });
  189. },
  190. uploadSubmit(filePath){
  191. upload({filePath}).then((res)=>{
  192. uni.showToast({
  193. title:"上传成功!"
  194. })
  195. let cont=JSON.parse(res);
  196. let image=[];
  197. image.push({
  198. path:cont.data.path
  199. })
  200. this.$set(this.createTherapyForm,'image',JSON.stringify(image));
  201. }).catch((msg)=>{
  202. uni.showToast({
  203. title:"上传失败!"
  204. })
  205. })
  206. },
  207. changeGender({detail}){
  208. this.createTherapyForm.gender=detail.value;
  209. },
  210. initUser(){
  211. this.$set(this.createTherapyForm,'name',"");
  212. this.$set(this.createTherapyForm,'gender',"");
  213. this.$set(this.createTherapyForm,'time',"");
  214. this.$set(this.createTherapyForm,'patientIdCard',"");
  215. this.$set(this.createTherapyForm,'patientAddress',"");
  216. this.$set(this.createTherapyForm,'accountEmail',"");
  217. }
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. .createTherapy{
  223. position: fixed;
  224. top: 0;
  225. left: 0;
  226. right: 0;
  227. bottom: 0;
  228. background-color: #fff;
  229. overflow-y: auto;
  230. z-index:999;
  231. .tip-head{
  232. background-color: orange;
  233. color: #fff;
  234. font-size: 12upx;
  235. padding: 4upx 0;
  236. text-align: center;
  237. }
  238. .create-therapy-container{
  239. padding: 40upx 24upx 200upx 44upx;
  240. .inp-name{
  241. height: 100upx;
  242. text-indent: 24upx;
  243. }
  244. .create-item-row{
  245. height: 100upx;
  246. display: flex;
  247. justify-content: space-between;
  248. align-items: center;
  249. .info{
  250. width: 400upx;
  251. height: 100upx;
  252. line-height: 100upx;
  253. text-align: right;
  254. &.date{
  255. width: 500upx;
  256. }
  257. .time{
  258. height: 100upx;
  259. line-height: 100upx;
  260. }
  261. }
  262. }
  263. .textarea{
  264. width: 100%;
  265. display: block;
  266. height: 240upx;
  267. border:1px solid #ccc;
  268. padding: 30upx 24upx;
  269. box-sizing: border-box;
  270. }
  271. .addImage{
  272. padding: 30upx 0;
  273. .title{
  274. color: #333;
  275. font-size:28upx;
  276. }
  277. .tip{
  278. padding: 8upx 0 16upx 0;
  279. color: #3584FF;
  280. font-size:24upx;
  281. }
  282. .upload{
  283. &{
  284. width: 150upx;
  285. height: 150upx;
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. flex-direction: column;
  290. background-color: #F1F1F1;
  291. }
  292. .icon{
  293. width: 50upx;
  294. height:50upx;
  295. position: relative;
  296. &::after{
  297. width: 50upx;
  298. height: 4upx;
  299. display: block;
  300. content: "";
  301. position: absolute;
  302. left: 50%;
  303. top: 50%;
  304. transform: translate(-50%,-50%);
  305. background-color: #ccc;
  306. }
  307. &::before{
  308. width: 4upx;
  309. height: 50upx;
  310. display: block;
  311. content: "";
  312. position: absolute;
  313. left: 50%;
  314. top: 50%;
  315. transform: translate(-50%,-50%);
  316. background-color: #ccc;
  317. }
  318. }
  319. .word{
  320. font-size: 24upx;
  321. padding-top: 4upx;
  322. }
  323. }
  324. }
  325. .submit-BT{
  326. width: 700rpx;
  327. height: 80upx;
  328. line-height: 80upx;
  329. text-align: center;
  330. background-color: #3384FF;
  331. position: fixed;
  332. bottom: 50upx;
  333. left: 50%;
  334. transform: translateX(-50%);
  335. color: #fff;
  336. border-radius: 8upx;
  337. }
  338. }
  339. .patient-info{
  340. border: 1px dashed #ccc;
  341. margin: 10upx 0;
  342. padding: 10upx;
  343. background-color: #f5f5f5;
  344. .patient-info-item-row{
  345. display: flex;
  346. justify-content: space-between;
  347. align-items: center;
  348. height: 70upx;
  349. line-height: 70upx;
  350. &:not(:first-child){
  351. border-top: 1px solid #eaeaea;
  352. }
  353. .info{
  354. color: #666;
  355. text-align: right;
  356. height: 100%;
  357. box-sizing: border-box;
  358. }
  359. .gender-item-woman{
  360. margin-left: 10upx;
  361. }
  362. }
  363. }
  364. .verifyAccoutBt{
  365. width: auto;
  366. height: 60upx;
  367. line-height: 60upx;
  368. text-align: center;
  369. background-color: #3384FF;
  370. color: #fff;
  371. border-radius: 8upx;
  372. display: inline-block;
  373. font-size: 28upx;
  374. margin: 0;
  375. }
  376. }
  377. </style>