血透系统PC前端

PatientForm.vue 43KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. <template>
  2. <div class="main-contain">
  3. <div v-if="!isEdit" class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. <div class="" style="float:right;color: white">
  6. <el-button :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" type="primary" v-if="this.isEdit==false" @click="resetForm('form')" icon="el-icon-circle-plus-outline" size="small">新增</el-button>
  7. </div>
  8. </div>
  9. <div v-if="isEdit" class="" style="float:right;margin-right: 35px;margin-top: 10px">
  10. <!-- <el-button @click="$router.back(-1)" icon="el-icon-refresh" size="small">取消</el-button>
  11. <el-button :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" type="primary" v-if="this.isEdit==false" @click="resetForm('form')" icon="el-icon-circle-plus-outline" size="small">新增</el-button>
  12. <el-button :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" @click="onSubmit('form')" size="small" type="success" icon="el-icon-setting" >保存</el-button>
  13. <el-button v-if="isEdit==false" @click="onReSubmit('form')" :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" icon="el-icon-document-add" size="small" type="warning" >保存并继续新增</el-button> -->
  14. </div>
  15. <div class="app-container " v-loading="pageLoad">
  16. <el-form ref="form" :rules="rules" :model="form" label-width="124px" class="clearfix" popper-append-to-body="false" >
  17. <div class="dataTitle">一般资料</div>
  18. <el-row >
  19. <el-col :span="20" class="form-table" >
  20. <el-row :span="20">
  21. <el-col :span="8" :style="isEdit?'width:360px':''">
  22. <el-form-item label="姓名 : " class="is-required" prop="name" >
  23. <el-input v-model="form.name" ></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="8" :style="isEdit?'width:360px':''" style="height:59px;" >
  27. <el-form-item label="性别 : " class="is-required" prop="gender" >
  28. <el-radio-group v-model="form.gender" @change="changeGender">
  29. <el-radio v-for="item in sexOptions" :key="item.value" :label="item.value" :value="item.value" >{{item.label}}</el-radio>
  30. </el-radio-group>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="8" :style="isEdit?'width:360px':''">
  34. <el-form-item label="身份证号 : " class="is-required" prop="idCardNo" >
  35. <el-input v-model="form.idCardNo" @blur="checkIdCardNo" ></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <template v-if="isEdit">
  39. <!-- <el-col :span="8" :style="isEdit?'width:360px':''">
  40. <el-form-item label="患者类型 : " class="is-required" >
  41. <el-select v-model="form.patientType" placeholder="请选择患者类型" disabled >
  42. <el-option v-for="item in styleOptions" :key="item.id" :label="item.name" :value="item.id"/>
  43. </el-select>
  44. </el-form-item>
  45. </el-col> -->
  46. <el-col :span="8" :style="isEdit?'width:360px':''">
  47. <el-form-item label="透析号 : " class="is-required">
  48. <el-input disabled v-model="form.dialysisNo" placeholder="填写或自动生成" style="width:62%;float:left;margin-right: 2%;" ></el-input>
  49. <el-button style="width:36%;padding:10px 0;" disabled type="primary">自动生成</el-button>
  50. </el-form-item>
  51. </el-col>
  52. </template>
  53. <template v-else>
  54. <!-- <el-col :span="8" >
  55. <el-form-item label="患者类型 : " class="is-required" prop="patientType">
  56. <el-select v-model="form.patientType" placeholder="请选择患者类型" >
  57. <el-option v-for="item in styleOptions" :key="item.id" :label="item.name" :value="item.id"/>
  58. </el-select>
  59. </el-form-item>
  60. </el-col> -->
  61. <el-col :span="8" >
  62. <el-form-item label="透析号 : " class="is-required" prop="dialysisNo" >
  63. <el-input v-model="form.dialysisNo" placeholder="填写或自动生成" style="width:62%;float:left;margin-right: 2%;" ></el-input>
  64. <el-button style="width:36%;padding:10px 0;" :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" type="primary" @click="generatedialysisno">自动生成</el-button>
  65. </el-form-item>
  66. </el-col>
  67. </template>
  68. <el-col :span="8" :style="isEdit?'width:360px':''">
  69. <el-form-item label="出生日期 : " class="is-required" prop="birth" >
  70. <el-date-picker v-model="form.birth" type="date" placeholder="选择日期" :suffix-icon="'el-icon-menu'" @change="hadSelectBirth" format="yyyy-MM-dd" value-format="yyyy-MM-dd"></el-date-picker>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="8" :style="isEdit?'width:360px':''">
  74. <el-form-item label="本人电话 : " class="is-required" prop="phone">
  75. <el-input v-model="form.phone" maxlength="20"></el-input>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="8" :style="isEdit?'width:360px':''">
  79. <el-form-item label="家属电话 : " prop="homeTelephone">
  80. <el-input v-model="form.homeTelephone" maxlength="20"></el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="8" :style="isEdit?'width:360px':''" style="height:58px;" >
  84. <el-form-item label="患者来源 : " class="is-required" prop="source" >
  85. <el-radio-group v-model="form.source">
  86. <el-radio v-for="item in sourceOptions" :key="item.value" :label="item.value" :value="item.value" >{{item.label}}</el-radio>
  87. </el-radio-group>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="8" :style="isEdit?'width:360px':''" style="height:58px;">
  91. <el-form-item label="治疗状态(转归) : " class="is-required" prop="lapseto" >
  92. <el-radio-group v-model="form.lapseto">
  93. <el-radio v-for="item in lapsetoOptions" :key="item.value" :label="item.value" :value="item.value" >{{item.label}}</el-radio>
  94. </el-radio-group>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="8" :style="isEdit?'width:360px':''">
  98. <el-form-item label="民族 : " prop="nation">
  99. <el-input v-model="form.nation" maxlength="30"></el-input>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="8" :style="isEdit?'width:360px':''">
  103. <el-form-item label="籍贯 : " prop="native_place">
  104. <el-input v-model="form.native_place" maxlength="30"></el-input>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="8" >
  108. <el-form-item label="家庭住址 : " prop="homeAddress">
  109. <el-input v-model="form.homeAddress"></el-input>
  110. </el-form-item>
  111. </el-col>
  112. <div v-show="!generic_info_fold">
  113. <el-col :span="8" :style="isEdit?'width:360px':''">
  114. <el-form-item label="别名 : " prop="alias" >
  115. <el-input v-model="form.alias" ></el-input>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="8" :style="isEdit?'width:360px':''">
  119. <el-form-item label="身高(cm) : " prop="height">
  120. <el-input maxlength="5" v-model="form.height" @change="checkHeight"></el-input>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="8" :style="isEdit?'width:360px':''">
  124. <el-form-item label="婚姻状况 : " prop="maritalStatus">
  125. <el-select v-model="form.maritalStatus" placeholder="请选择婚姻状况">
  126. <el-option v-for="item in maritalOptions" :key="item.id" :label="item.name" :value="item.id"/>
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="8" style="clearfix" :style="isEdit?'width:360px':''">
  131. <el-form-item label="子女情况(个) : " prop="children">
  132. <el-input maxlength="5" v-model="form.children" ></el-input>
  133. </el-form-item>
  134. <!-- <el-form-item label=" " style="float:left;" label-width="30px">
  135. </el-form-item> -->
  136. </el-col>
  137. <el-col :span="8" :style="isEdit?'width:360px':''">
  138. <el-form-item label="住院(门诊)号 : " >
  139. <el-input v-model="form.admissionNumber"></el-input>
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="8" :style="isEdit?'width:360px':''">
  143. <el-form-item label="医保类型 : " prop="reimbursementWayID">
  144. <el-select v-model="form.reimbursementWayID" >
  145. <el-option v-for="item in wayOptions" :key="item.id" :label="item.name" :value="item.id"/>
  146. </el-select>
  147. </el-form-item>
  148. </el-col>
  149. <el-col :span="8" :style="isEdit?'width:360px':''">
  150. <el-form-item label="医保号 : " prop="healthCareNo">
  151. <el-input v-model="form.healthCareNo" ></el-input>
  152. </el-form-item>
  153. </el-col>
  154. <el-col :span="8" :style="isEdit?'width:360px':''">
  155. <el-form-item label="教育程度 : " prop="educationOptions">
  156. <el-select v-model="form.education" >
  157. <el-option v-for="item in educationOptions" :key="item.id" :label="item.name" :value="item.id"/>
  158. </el-select>
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="8" :style="isEdit?'width:360px':''">
  162. <el-form-item label="亲友电话 : " prop="relative_phone">
  163. <el-input v-model="form.relative_phone" maxlength="20"></el-input>
  164. </el-form-item>
  165. </el-col>
  166. <el-col :span="8" :style="isEdit?'width:360px':''">
  167. <el-form-item label="亲友关系 : " prop="relative_relations">
  168. <el-input v-model="form.relative_relations" maxlength="20"></el-input>
  169. </el-form-item>
  170. </el-col>
  171. <el-col :span="8" :style="isEdit?'width:360px':''">
  172. <el-form-item label="职业 : " prop="profession">
  173. <el-select v-model="form.profession" >
  174. <el-option v-for="item in professionOptions" :key="item.id" :label="item.name" :value="item.id"/>
  175. </el-select>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="8" >
  179. <el-form-item label="工作单位 : " prop="work">
  180. <el-input v-model="form.work"></el-input>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="8" >
  184. <el-form-item label="单位地址 : " prop="unit_address">
  185. <el-input v-model="form.unit_address"></el-input>
  186. </el-form-item>
  187. </el-col>
  188. </div>
  189. <el-col :span="24">
  190. <el-form-item>
  191. <el-button type="text" @click="generic_info_fold = !generic_info_fold">{{ generic_info_fold ? "更多资料" : "收起" }}<i class="el-icon--right" :class="generic_fold_icon"></i></el-button>
  192. </el-form-item>
  193. </el-col>
  194. </el-row>
  195. </el-col>
  196. <el-col :span="4" align="center">
  197. <el-upload style="width:100%;"
  198. :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false"
  199. :data="uploadData"
  200. class="uploadHead"
  201. :multiple="false"
  202. action="https://upload.qiniup.com"
  203. :show-file-list="false"
  204. :on-error="handleAvatarError"
  205. :on-success="handleAvatarSuccess"
  206. list-type="picture-card"
  207. :before-upload="beforeAvatarUpload">
  208. <img width="100%" height="100%" v-if="form.avatar" :src="form.avatar" class="avatar">
  209. <i class="el-icon-plus" v-else></i>
  210. </el-upload>
  211. <el-dialog :visible.sync="dialogVisible">
  212. <img width="100%" :src="dialogImageUrl" alt="">
  213. </el-dialog>
  214. <el-upload
  215. :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false"
  216. :data="uploadData"
  217. :multiple="false"
  218. action="https://upload.qiniup.com"
  219. :show-file-list="false"
  220. :on-error="handleAvatarError"
  221. :on-success="handleAvatarSuccess"
  222. :before-upload="beforeAvatarUpload">
  223. <el-button :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" class="uploadHeadBtn" type="primary" >上传头像</el-button>
  224. </el-upload>
  225. <el-form-item prop="avatar">
  226. <el-input v-model="form.avatar" type="hidden" placeholder=""></el-input>
  227. </el-form-item>
  228. </el-col>
  229. </el-row>
  230. <div class="dataTitle">治疗信息</div>
  231. <el-row :span="24">
  232. <el-col :span="8">
  233. <el-form-item label="主诉 : " prop="patient_complains">
  234. <el-input type="textarea" :rows="3" v-model="form.patient_complains" resize="none" placeholder=""></el-input>
  235. </el-form-item>
  236. </el-col>
  237. <el-col :span="8">
  238. <el-form-item label="现病史 : " prop="present_history">
  239. <el-input type="textarea" :rows="3" v-model="form.present_history" resize="none" placeholder=""></el-input>
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="8">
  243. <el-form-item label="既往史 : " prop="past_history">
  244. <el-input type="textarea" :rows="3" v-model="form.past_history" resize="none" placeholder=""></el-input>
  245. </el-form-item>
  246. </el-col>
  247. </el-row >
  248. <el-row :span="24">
  249. <el-col>
  250. <el-form-item label="体格检查">
  251. <el-input v-model="form.temperature" style="width: 200px;">
  252. <template slot="prepend">体温:</template>
  253. <template slot="append">℃</template>
  254. </el-input>
  255. <el-input v-model="form.pulse" style="width: 220px;">
  256. <template slot="prepend">脉搏: </template>
  257. <template slot="append">次/分</template>
  258. </el-input>
  259. <el-input v-model="form.respiratory" style="width: 220px;">
  260. <template slot="prepend">呼吸: </template>
  261. <template slot="append">次/分</template>
  262. </el-input>
  263. <!-- </el-form-item>
  264. <el-form-item> -->
  265. <el-input v-model="form.sbp" style="width: 240px;">
  266. <template slot="prepend">收缩压:</template>
  267. <template slot="append">mmHg</template>
  268. </el-input>
  269. <el-input v-model="form.dbp" style="width: 240px;">
  270. <template slot="prepend">舒张压:</template>
  271. <template slot="append">mmHg</template>
  272. </el-input>
  273. </el-form-item>
  274. </el-col>
  275. <el-col>
  276. </el-col>
  277. <el-col :span="24">
  278. <el-form-item label="" prop="remark">
  279. <el-input type="textarea" :rows="3" v-model="form.remark" resize="none" placeholder=""></el-input>
  280. </el-form-item>
  281. </el-col>
  282. <el-col :span="24" >
  283. <el-form-item label="传染病 : " prop="contagions">
  284. <el-checkbox-group v-model="form.contagions">
  285. <el-checkbox v-for="item in contagionList" v-if="item.type==2" :label="item.id" :key="item.id" :value="item.id">{{item.name}}</el-checkbox>
  286. </el-checkbox-group>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="24" >
  290. <el-form-item label="慢性病 : " prop="diseases">
  291. <el-checkbox-group v-model="form.diseases" >
  292. <el-checkbox v-for="item in checkDisease" :label="item.id" :key="item.id" :value="item.id" >{{item.name}}</el-checkbox>
  293. </el-checkbox-group>
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="24">
  297. <el-form-item label="诊断 : " prop="diagnose">
  298. <el-input type="textarea" :rows="3" v-model="form.diagnose" resize="none" placeholder=""></el-input>
  299. </el-form-item>
  300. </el-col>
  301. <div v-show="!treat_info_fold">
  302. <el-col :span="6" :style="isEdit?'width:360px':''">
  303. <el-form-item label="本院首次透析 : " prop="is_hospital_first_dialysis" >
  304. <el-radio-group v-model="form.is_hospital_first_dialysis">
  305. <el-radio v-for="item in isHospitalFirstDialysisOptions" :key="item.value" :label="item.value" :value="item.value" >{{item.label}}</el-radio>
  306. </el-radio-group>
  307. </el-form-item>
  308. </el-col>
  309. <el-col :span="6" :style="isEdit?'width:360px':''">
  310. <el-form-item label="首次透析日期 : " prop="firstDialysisDate">
  311. <el-date-picker v-model="form.firstDialysisDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="selectFirstDialysisDate"></el-date-picker>
  312. </el-form-item>
  313. </el-col>
  314. <el-col :span="6" :style="isEdit?'width:360px':''">
  315. <el-form-item label="首次透析医院 : " prop="first_dialysis_hospital">
  316. <el-input v-model="form.first_dialysis_hospital"></el-input>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="24" >
  320. <el-form-item label="透析之前情况 : " prop="predialysis_condition">
  321. <el-checkbox-group v-model="form.predialysis_condition">
  322. <el-checkbox v-for="item in predialysisConditionOptions" :label="item.label" :key="item.value" :value="item.label">{{item.label}}</el-checkbox>
  323. </el-checkbox-group>
  324. </el-form-item>
  325. </el-col>
  326. <el-col :span="6" :style="isEdit?'width:360px':''">
  327. <el-form-item label="本院前透析频率 : " prop="pre_hospital_dialysis_frequency">
  328. <el-input v-model="form.pre_hospital_dialysis_frequency"></el-input>
  329. </el-form-item>
  330. </el-col>
  331. <el-col :span="6" :style="isEdit?'width:360px':''">
  332. <el-form-item label="本院前透析次数 : " prop="pre_hospital_dialysis_times">
  333. <el-input v-model="form.pre_hospital_dialysis_times"></el-input>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="6" :style="isEdit?'width:360px':''">
  337. <el-form-item label="本院首次透析 : " prop="hospital_first_dialysis_date">
  338. <el-date-picker v-model="form.hospital_first_dialysis_date" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" ></el-date-picker>
  339. </el-form-item>
  340. </el-col>
  341. </div>
  342. <el-col :span="24">
  343. <el-form-item>
  344. <el-button type="text" @click="treat_info_fold = !treat_info_fold">{{ treat_info_fold ? "更多治疗信息" : "收起" }}<i class="el-icon--right" :class="treat_fold_icon"></i></el-button>
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="24">
  348. <el-form-item label="登记人员 : ">
  349. <span>{{adminusername}} </span>
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="24" align="right" >
  353. <el-form-item>
  354. <el-button @click="$router.back(-1)" icon="el-icon-refresh" size="small">取消</el-button>
  355. <el-button :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" @click="onSubmit('form')" size="small" type="primary" icon="el-icon-setting" >保存</el-button>
  356. <el-button v-if="isEdit==false" @click="onReSubmit('form')" :disabled="$store.getters.xt_user.subscibe.state==3||!subscibeFlag?true:false" icon="el-icon-document-add" size="small" type="success" >保存并继续新增</el-button>
  357. </el-form-item>
  358. </el-col>
  359. </el-row>
  360. </el-form>
  361. </div>
  362. </div>
  363. </template>
  364. <script>
  365. import { getToken } from '@/api/qiniu'
  366. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  367. import {
  368. getFileExtension,
  369. isCardNo,
  370. jsGetAge,
  371. isPositiveInteger,
  372. dialysisAge,
  373. uParseTime
  374. } from '@/utils/tools'
  375. import {
  376. generateDialysisNo,
  377. createPatient,
  378. editPatient,
  379. fetchPatient,
  380. GetPatientTotal
  381. } from '@/api/patient'
  382. // import { fetchAllDoctorAndNurse } from "@/api/doctor";
  383. import { getDataConfig } from '@/utils/data'
  384. const defaultForm = {
  385. avatar: 'https://images.shengws.com/201809182128111.png',
  386. name: '',
  387. alias: '',
  388. idCardNo: '',
  389. dialysisNo: '',
  390. gender: '',
  391. birth: '',
  392. nation: '',
  393. native_place: '',
  394. height: '',
  395. maritalStatus: '',
  396. children: '',
  397. admissionNumber: '',
  398. reimbursementWayID: '',
  399. healthCareNo: '',
  400. phone: '',
  401. homeTelephone: '',
  402. relative_phone: '',
  403. relative_relations: '',
  404. lapseto: '',
  405. homeAddress: '',
  406. work: '',
  407. unit_address: '',
  408. profession: '',
  409. education: '',
  410. source: '',
  411. is_hospital_first_dialysis: '',
  412. firstDialysisDate: '',
  413. first_dialysis_hospital: '',
  414. predialysis_condition: [],
  415. pre_hospital_dialysis_frequency: '',
  416. pre_hospital_dialysis_times: '',
  417. hospital_first_dialysis_date: '',
  418. contagions: [],
  419. diseases: [],
  420. remark: '',
  421. diagnose: '',
  422. // patientType: "",
  423. // partition: "",
  424. // bed: "",
  425. // age: "",
  426. // healthCareDueDate: "",
  427. // blood: "",
  428. // rh: "",
  429. // healthCareDueAlertDate: "",
  430. // receivingDate: "",
  431. // dialysisAge: "",
  432. // induction: "",
  433. // initial: "",
  434. // dialysisTotal: "",
  435. // doctor: "",
  436. // nurse: "",
  437. // assessment: "",
  438. patient_complains: '',
  439. present_history: '',
  440. past_history: '',
  441. temperature: '',
  442. pulse: '',
  443. respiratory: '',
  444. sbp: '',
  445. dbp: ''
  446. }
  447. export default {
  448. name: 'patientForm',
  449. props: {
  450. isEdit: {
  451. type: Boolean,
  452. default: false
  453. }
  454. },
  455. data() {
  456. var checkPhone = (rule, value, callback) => {
  457. if (value.length == 0) {
  458. return callback(new Error('本人电话不能为空'))
  459. }
  460. if (!value.match(/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/)) {
  461. return callback(new Error('请填写正确的电话(手机号码)'))
  462. }
  463. callback()
  464. }
  465. var checkFamilyPhone = (rule, value, callback) => {
  466. if (value.length == 0) {
  467. return callback(new Error('家属电话不能为空'))
  468. }
  469. if (!value.match(/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/)) {
  470. return callback(new Error('请填写正确的电话(手机号码)'))
  471. }
  472. callback()
  473. }
  474. return {
  475. crumbs:[
  476. {path:false, name:'病人管理'},
  477. {path:false, name:'新增病人'},
  478. ],
  479. generic_info_fold: true,
  480. treat_info_fold: true,
  481. patientTotal: 0,
  482. pageLoad: true,
  483. avatarFlag: false,
  484. subscibeFlag: false,
  485. orgname: '',
  486. adminusername: '',
  487. form: Object.assign({}, defaultForm),
  488. formSubmit: true,
  489. submitMethod: '',
  490. uploadData: { token: '', key: '' },
  491. dialogImageUrl: '',
  492. qiniuDomain: 'https://images.shengws.com/',
  493. dialogVisible: false,
  494. // typeOptions: null,
  495. // styleOptions: null,
  496. sourceOptions: [{ value: 1, label: '门诊' }, { value: 2, label: '住院' }],
  497. lapsetoOptions: [{ value: 1, label: '留治' }, { value: 2, label: '转出' }],
  498. // partitionOptions: null,
  499. sexOptions: [{ value: 1, label: '男' }, { value: 2, label: '女' }],
  500. isHospitalFirstDialysisOptions: [{ value: 1, label: '是' }, { value: 2, label: '否' }],
  501. predialysisConditionOptions: [{ value: 1, label: '腹膜透析' }, { value: 2, label: '肾移植' }],
  502. maritalOptions: null,
  503. wayOptions: null,
  504. educationOptions: null,
  505. professionOptions: null,
  506. // inductionOptions: null,
  507. // doctorOptions: null,
  508. // nurseOptions: null,
  509. // rhOptions: null,
  510. checkDisease: null,
  511. contagionList: null,
  512. loading: null,
  513. submitMsg: '',
  514. patientID: 0,
  515. subscibe: {},
  516. rules: {
  517. avatar: [{ required: true, message: '请上传头像', trigger: 'blur' }],
  518. patientType: [{ required: true, message: '请选择患者类型', trigger: 'blur' }],
  519. dialysisNo: [{ required: true, message: '请填写透析号', trigger: 'blur' }],
  520. phone: [{ validator: checkPhone, trigger: 'blur' }],
  521. source: [{ required: true, message: '请选择患者来源', trigger: 'blur' }],
  522. lapseto: [{ required: true, message: '请选择治疗状态', trigger: 'blur' }],
  523. name: [{ required: true, message: '请填写姓名', trigger: 'blur' }],
  524. gender: [{ required: true, message: '请选择性别', trigger: 'blur' }],
  525. idCardNo: [{ required: true, message: '请填写身份证号', trigger: 'blur' }],
  526. birth: [{ required: true, message: '请填写生日', trigger: 'blur' }]
  527. // homeTelephone: [{ validator: checkFamilyPhone, trigger: "blur" }],
  528. // homeAddress: [{ required: true, message: "请填写住址", trigger: "blur" }],
  529. }
  530. }
  531. },
  532. components: {
  533. BreadCrumb
  534. },
  535. computed: {
  536. generic_fold_icon: function() {
  537. return this.generic_info_fold ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
  538. },
  539. treat_fold_icon: function() {
  540. return this.treat_info_fold ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
  541. }
  542. },
  543. created() {
  544. // this.styleOptions = this.$store.getters.patient_types;
  545. // this.partitionOptions = this.$store.getters.partitions;
  546. this.maritalOptions = getDataConfig('patient', 'marital_options')
  547. this.wayOptions = getDataConfig('patient', 'reimbursement_ways')
  548. // this.typeOptions = this.$store.getters.blood_types;
  549. // this.rhOptions = this.$store.getters.rh;
  550. this.educationOptions = getDataConfig('patient', 'education_types')
  551. this.professionOptions = getDataConfig('patient', 'profession_options')
  552. // this.inductionOptions = this.$store.getters.induction_options;
  553. this.contagionList = this.$store.getters.contagions
  554. this.checkDisease = this.$store.getters.disease
  555. this.subscibe = this.$store.getters.xt_user.subscibe
  556. this.GetPatientTotal()
  557. // this.fetchAllDoctorAndNurse();
  558. this.pageLoad = false
  559. var xtuser = this.$store.getters.xt_user
  560. this.orgname = xtuser.org.org_name
  561. this.adminusername = xtuser.user.user_name
  562. if (this.isEdit) {
  563. this.submitMsg = '修改患者信息成功'
  564. const id = this.$route.params && this.$route.params.id
  565. this.patientID = parseInt(id)
  566. if (isNaN(this.patientID) || this.patientID <= 0) {
  567. this.$notify.error({
  568. title: '错误',
  569. message: '无效的id'
  570. })
  571. this.$router.back(-1)
  572. }
  573. this.fetchPatient(id)
  574. this.avatarFlag = true
  575. } else {
  576. this.submitMsg = '新增患者成功'
  577. this.form = Object.assign({}, defaultForm)
  578. }
  579. },
  580. methods: {
  581. GetPatientTotal() {
  582. GetPatientTotal().then(response => {
  583. if (response.data.state == 1) {
  584. this.patientTotal = response.data.data.total
  585. if ((this.subscibe.state == 2 && this.patientTotal >= 100) || (this.subscibe.state == 1 && this.patientTotal >= 200)) {
  586. this.$alert('患者数已达到当前服务版本病人数,需要升级到更高的版本', '提示', {
  587. confirmButtonText: '确定',
  588. showClose: false,
  589. callback: action => {
  590. this.$router.push('/service/buy')
  591. }
  592. })
  593. } else {
  594. this.subscibeFlag = true
  595. }
  596. } else {
  597. this.$message.error(response.data.msg)
  598. }
  599. }).catch(e => {
  600. })
  601. },
  602. changeGender(value) {
  603. if (this.avatarFlag) {
  604. return false
  605. }
  606. if (value == 1) {
  607. this.form.avatar = 'https://images.shengws.com/201809182128111.png'
  608. } else if (value == 2) {
  609. this.form.avatar = 'https://images.shengws.com/201809182128222.png'
  610. } else {
  611. }
  612. },
  613. resetForm(formName) {
  614. this.$refs[formName].resetFields()
  615. },
  616. onReSubmit(formName) {
  617. this.submitForm(formName, 'renew')
  618. },
  619. onSubmit(formName) {
  620. this.submitForm(formName, 'redict')
  621. },
  622. submitForm(formName, action) {
  623. if (!this.formSubmit) {
  624. return false
  625. }
  626. this.$refs[formName].validate(valid => {
  627. if (valid) {
  628. this.formSubmit = false
  629. if (this.isEdit) {
  630. editPatient(this.patientID, this.form)
  631. .then(response => {
  632. if (response.data.state == 0) {
  633. this.$message.error(response.data.msg)
  634. this.formSubmit = true
  635. return false
  636. } else {
  637. this.formSubmit = false
  638. this.$notify({
  639. title: '成功',
  640. message: this.submitMsg,
  641. type: 'success',
  642. duration: 2000
  643. })
  644. this.$refs[formName].resetFields()
  645. if (action !== 'renew') {
  646. this.$router.back(-1)
  647. }
  648. this.formSubmit = true
  649. return false
  650. }
  651. })
  652. .catch(err => {
  653. this.$message.error('网络异常')
  654. this.formSubmit = true
  655. return false
  656. })
  657. } else {
  658. createPatient(this.form)
  659. .then(response => {
  660. if (response.data.state == 0) {
  661. this.$message.error(response.data.msg)
  662. this.formSubmit = true
  663. return false
  664. } else {
  665. this.formSubmit = false
  666. this.$notify({
  667. title: '成功',
  668. message: this.submitMsg,
  669. type: 'success',
  670. duration: 2000
  671. })
  672. this.$refs[formName].resetFields()
  673. this.$store.dispatch('SetSubscibePatients')
  674. var sub = this.$store.getters.xt_user.subscibe
  675. console.log(sub)
  676. if (action !== 'renew') {
  677. this.$router.back(-1)
  678. }
  679. return false
  680. }
  681. })
  682. .catch(err => {
  683. this.$message.error('网络异常')
  684. this.formSubmit = true
  685. return false
  686. })
  687. }
  688. } else {
  689. this.formSubmit = true
  690. return false
  691. }
  692. })
  693. },
  694. handlePictureCardPreview(file) {
  695. this.dialogImageUrl = file.url
  696. this.dialogVisible = true
  697. },
  698. handleAvatarError(err, file, fileList) {
  699. this.$message.error(err)
  700. this.loading.close()
  701. return false
  702. },
  703. handleAvatarSuccess(res, file) {
  704. // this.imageUrl = URL.createObjectURL(file.raw);
  705. this.form.avatar = this.qiniuDomain + res.url
  706. this.avatarFlag = true
  707. this.loading.close()
  708. },
  709. beforeAvatarUpload(file) {
  710. // const isJPG = file.type === "image/jpeg";
  711. var fileType = file.type
  712. const isJPG = fileType.indexOf('image') > -1
  713. const isLt2M = file.size / 1024 / 1024 < 2
  714. if (!isJPG) {
  715. this.$message.error('只能上传图片')
  716. return false
  717. }
  718. if (!isLt2M) {
  719. this.$message.error('上传头像图片大小不能超过 2MB!')
  720. return false
  721. }
  722. var date = new Date()
  723. var ext = getFileExtension(file.name)
  724. var key =
  725. date.getFullYear() +
  726. '/' +
  727. (date.getMonth() + 1) +
  728. '/' +
  729. date.getDate() +
  730. '/' +
  731. date.getHours() +
  732. '/' +
  733. date.getMinutes() +
  734. '/' +
  735. date.getSeconds() +
  736. '/' +
  737. '_s_' +
  738. file.uid +
  739. '.' +
  740. ext
  741. this.loading = this.$loading({
  742. lock: true,
  743. text: '上传中...',
  744. spinner: 'el-icon-loading',
  745. background: 'rgba(0, 0, 0, 0.7)'
  746. })
  747. const _self = this
  748. return new Promise((resolve, reject) => {
  749. getToken()
  750. .then(response => {
  751. const token = response.data.data.uptoken
  752. _self._data.uploadData.token = token
  753. _self._data.uploadData.key = key
  754. resolve(true)
  755. })
  756. .catch(err => {
  757. console.log(err)
  758. reject(false)
  759. this.loading.close()
  760. })
  761. })
  762. },
  763. generatedialysisno() {
  764. generateDialysisNo().then(response => {
  765. this.form.dialysisNo = response.data.data.no + ''
  766. })
  767. },
  768. checkIdCardNo() {
  769. if (!isCardNo(this.form.idCardNo)) {
  770. this.$message.error('身份证号码信息有误!')
  771. this.form.birth = ''
  772. return false
  773. }
  774. var thisLen = this.form.idCardNo.length
  775. var birth = ''
  776. if (thisLen == 15) {
  777. birth = '19' + this.form.idCardNo.substr(6, 6)
  778. } else {
  779. birth = this.form.idCardNo.substr(6, 8)
  780. }
  781. this.form.birth =
  782. birth.substr(0, 4) +
  783. '-' +
  784. birth.substr(4, 2) +
  785. '-' +
  786. birth.substr(6, 2)
  787. this.form.age = jsGetAge(this.form.birth, '-')
  788. },
  789. hadSelectBirth() {
  790. this.form.age = jsGetAge(this.form.birth, '-')
  791. },
  792. checkHeight() {
  793. if (!isPositiveInteger(this.form.height)) {
  794. this.$message.error('身高请填写正整数!')
  795. return false
  796. }
  797. },
  798. selectFirstDialysisDate() {
  799. this.form.dialysisAge = dialysisAge(this.form.firstDialysisDate)
  800. },
  801. fetchPatient(id) {
  802. fetchPatient(id)
  803. .then(response => {
  804. if (response.data.state == 1) {
  805. this.$emit('tran-patient-info', response.data.data.patient)
  806. var patietInfo = response.data.data.patient
  807. this.form.avatar = patietInfo.avatar
  808. this.form.name = patietInfo.name
  809. this.form.alias = patietInfo.alias
  810. this.form.idCardNo = patietInfo.id_card_no
  811. this.form.dialysisNo = patietInfo.dialysis_no
  812. this.form.gender = patietInfo.gender
  813. if (patietInfo.gender == 1 || patietInfo.gender == 2) {
  814. this.form.gender = patietInfo.gender
  815. }
  816. this.form.birth = uParseTime(patietInfo.birthday, '{y}-{m}-{d}')
  817. this.form.nation = patietInfo.nation
  818. this.form.native_place = patietInfo.native_place
  819. this.form.height = patietInfo.height + ''
  820. // this.form.age = jsGetAge(this.form.birth, "-");
  821. if (patietInfo.marital_status > 0) {
  822. this.form.maritalStatus = patietInfo.marital_status
  823. }
  824. this.form.children = patietInfo.children
  825. this.form.admissionNumber = patietInfo.admission_number
  826. if (patietInfo.reimbursement_way_id > 0) {
  827. this.form.reimbursementWayID = patietInfo.reimbursement_way_id
  828. }
  829. this.form.healthCareNo = patietInfo.health_care_no
  830. this.form.phone = patietInfo.phone
  831. this.form.homeTelephone = patietInfo.home_telephone
  832. this.form.relative_phone = patietInfo.relative_phone
  833. this.form.relative_relations = patietInfo.relative_relations
  834. this.form.homeAddress = patietInfo.home_address
  835. this.form.work = patietInfo.work_unit
  836. this.form.unit_address = patietInfo.unit_address
  837. if (patietInfo.profession > 0) {
  838. this.form.profession = patietInfo.profession
  839. }
  840. if (patietInfo.education_level > 0) {
  841. this.form.education = patietInfo.education_level
  842. }
  843. if (patietInfo.source == 1 || patietInfo.source == 2) {
  844. this.form.source = patietInfo.source
  845. }
  846. if (patietInfo.lapseto == 1 || patietInfo.lapseto == 2) {
  847. this.form.lapseto = patietInfo.lapseto
  848. }
  849. if (patietInfo.is_hospital_first_dialysis == 1 || patietInfo.is_hospital_first_dialysis == 2) {
  850. this.form.is_hospital_first_dialysis = patietInfo.is_hospital_first_dialysis
  851. }
  852. if (patietInfo.first_dialysis_date != 0) {
  853. this.form.firstDialysisDate = uParseTime(
  854. patietInfo.first_dialysis_date,
  855. '{y}-{m}-{d}'
  856. )
  857. }
  858. this.form.first_dialysis_hospital = patietInfo.first_dialysis_hospital
  859. if (patietInfo.predialysis_condition.length > 0) {
  860. this.form.predialysis_condition = patietInfo.predialysis_condition.split(',')
  861. }
  862. this.form.pre_hospital_dialysis_frequency = patietInfo.pre_hospital_dialysis_frequency
  863. this.form.pre_hospital_dialysis_times = patietInfo.pre_hospital_dialysis_times
  864. if (patietInfo.hospital_first_dialysis_date != 0) {
  865. this.form.hospital_first_dialysis_date = uParseTime(
  866. patietInfo.hospital_first_dialysis_date,
  867. '{y}-{m}-{d}'
  868. )
  869. }
  870. this.form.contagions = response.data.data.contagions
  871. this.form.diseases = response.data.data.diseases
  872. this.form.remark = patietInfo.remark
  873. this.form.diagnose = patietInfo.diagnose
  874. this.form.patient_complains = patietInfo.patient_complains
  875. this.form.present_history = patietInfo.present_history
  876. this.form.past_history = patietInfo.past_history
  877. this.form.temperature = patietInfo.temperature
  878. this.form.pulse = patietInfo.pulse
  879. this.form.respiratory = patietInfo.respiratory
  880. this.form.sbp = patietInfo.sbp
  881. this.form.dbp = patietInfo.dbp
  882. // this.form.initial = patietInfo.initial_dialysis + "";
  883. // this.form.dialysisTotal = patietInfo.total_dialysis + "";
  884. // this.form.assessment = patietInfo.evaluate;
  885. // if (patietInfo.patient_type > 0) {
  886. // this.form.patientType = patietInfo.patient_type;
  887. // }
  888. // if (patietInfo.partition_id > 0) {
  889. // this.form.partition = patietInfo.partition_id;
  890. // }
  891. // if (patietInfo.bed_id > 0) {
  892. // this.form.bed = patietInfo.bed_id;
  893. // }
  894. // this.form.healthCareDueDate = uParseTime(
  895. // patietInfo.health_care_due_date,
  896. // "{y}-{m}-{d}"
  897. // );
  898. // if (patietInfo.blood_type > 0) {
  899. // this.form.blood = patietInfo.blood_type;
  900. // }
  901. // if (patietInfo.rh > 0) {
  902. // this.form.rh = patietInfo.rh;
  903. // }
  904. // this.form.healthCareDueAlertDate = uParseTime(
  905. // patietInfo.health_care_due_alert_date,
  906. // "{y}-{m}-{d}"
  907. // );
  908. // this.form.receivingDate = uParseTime(
  909. // patietInfo.receiving_date,
  910. // "{y}-{m}-{d}"
  911. // );
  912. // this.form.dialysisAge = dialysisAge(
  913. // this.form.firstDialysisDate,
  914. // "-"
  915. // );
  916. // if (patietInfo.induction_period > 0) {
  917. // this.form.induction = patietInfo.induction_period;
  918. // }
  919. // if (patietInfo.attending_doctor_id > 0) {
  920. // this.form.doctor = patietInfo.attending_doctor_id;
  921. // }
  922. // if (patietInfo.head_nurse_id > 0) {
  923. // this.form.nurse = patietInfo.head_nurse_id;
  924. // }
  925. // if (patietInfo.registrars_id > 0) {
  926. // this.form.registrars = patietInfo.registrars_id;
  927. // }
  928. } else {
  929. this.$notify.error({
  930. title: '错误',
  931. message: '网络异常'
  932. })
  933. this.$router.back(-1)
  934. }
  935. // this.postForm = response.data
  936. // // Just for test
  937. // this.postForm.title += ` Article Id:${this.postForm.id}`
  938. // this.postForm.content_short += ` Article Id:${this.postForm.id}`
  939. })
  940. .catch(err => {
  941. this.$notify.error({
  942. title: '错误',
  943. message: '网络异常'
  944. })
  945. this.$router.back(-1)
  946. })
  947. }
  948. // fetchAllDoctorAndNurse() {
  949. // fetchAllDoctorAndNurse().then(response => {
  950. // if (response.data.state == 1) {
  951. // this.doctorOptions = response.data.data.doctors;
  952. // this.nurseOptions = response.data.data.nursers;
  953. // }
  954. // });
  955. // }
  956. }
  957. }
  958. </script>
  959. <style rel="stylesheet/scss" lang="scss" scoped>
  960. .uploadHeadBtn {
  961. width: 148px;
  962. margin-top: 10px;
  963. }
  964. .el-form{
  965. .el-col-6,.el-col-8{
  966. width: 430px;
  967. }
  968. .el-form-item {
  969. .el-select {
  970. width: 100%;
  971. }
  972. .el-date-editor.el-input {
  973. width: 100%;
  974. }
  975. .textarea {
  976. width: 100%;
  977. height: 70px;
  978. border-color: #dcdfe6;
  979. padding: 5px;
  980. }
  981. }
  982. }
  983. .el-select-dropdown{
  984. z-index: 998!important;
  985. }
  986. </style>