AddBabyInfo.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <el-container>
  3. <el-header>
  4. <el-row :gutter="10">
  5. <el-col :span="6">
  6. <el-select filterable v-model="queryParam.wardCode" clearable style="width: 130px;" size="small" @change="selectPatList">
  7. <el-option v-for="item in ward" :key="item.code" :label="item.name" :value="item.code">
  8. <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
  9. <el-divider direction="vertical"></el-divider>
  10. <span>{{ item.name }}</span>
  11. </el-option>
  12. </el-select>
  13. </el-col>
  14. <el-col :span="8">
  15. 住院号:
  16. <el-popover :visible="visible" width="690" placement="right-end" trigger="click">
  17. <template #reference>
  18. <el-input v-model="queryParam.inpatientNo" @click="visible = true" style="width: 100px" clearable />
  19. </template>
  20. <div style="width: 670px;">
  21. <div style="text-align: right">
  22. <el-button icon="CloseBold" @click="visible = false"></el-button>
  23. </div>
  24. <el-table :data="patList" style="width: 100%" @row-click="fetchPatInfo" height="400">
  25. <el-table-column property="inpatientNo" label="住院号" />
  26. <el-table-column property="name" label="姓名" />
  27. <el-table-column property="sexName" label="性别" />
  28. <el-table-column property="bedNo" label="床号" />
  29. </el-table>
  30. </div>
  31. <div style="text-align: center">
  32. <el-button size="small" type="danger" @click="visible = false">关闭</el-button>
  33. </div>
  34. </el-popover>
  35. </el-col>
  36. <el-col :span="3">
  37. <el-button type="success" icon="Money" @click="addBaby">增加</el-button>
  38. </el-col>
  39. <el-col>
  40. <div style="color: red;"> 增加BB时,请补充相应的BB信息(如性别,出生日期,出生体重,出生身高)</div>
  41. </el-col>
  42. </el-row>
  43. </el-header>
  44. <el-main>
  45. <div>
  46. <PatientInfo :patientInfo="patientInfo"></PatientInfo>
  47. </div>
  48. <div>
  49. <div style="margin-top: 10px">
  50. <el-tag>婴儿补充信息</el-tag>
  51. </div>
  52. <div >
  53. <el-table :data="babyList" style="width: 100%" :height="windowHeight-170">
  54. <el-table-column property="inpatientNo" label="住院号" />
  55. <el-table-column property="name" label="姓名" />
  56. <el-table-column property="sexName" label="性别" />
  57. <!-- <el-table-column property="birthDate" label="出生日期" /> -->
  58. <el-table-column property="birthDateTime" label="出生时间" />
  59. <el-table-column property="babyBirthWeight" label="出生体重(克)" />
  60. <el-table-column property="babyBirthHeight" label="出生身高(厘米)" />
  61. <el-table-column property="birthOrder" label="出生顺序" />
  62. <el-table-column label="操作">
  63. <template #default="scope">
  64. <el-button icon="Edit" type="primary" @click="openEdit(scope.row)">编辑</el-button>
  65. <el-button icon="Delete" type="danger" @click="delBaBy(scope.$index,scope.row)">删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. </div>
  71. </el-main>
  72. </el-container>
  73. <el-dialog v-model="editBabyDialog" :title="dialogTitle" width="400">
  74. <el-form :model="editBaByInfo">
  75. <el-form-item label="性别" >
  76. <el-select v-model="editBaByInfo.sex">
  77. <el-option label="男" value="1" />
  78. <el-option label="女" value="2" />
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item label="出生日期" >
  82. <el-date-picker v-model="editBaByInfo.birthDate" type="datetime" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
  83. </el-form-item>
  84. <el-form-item label="出生体重(克)" >
  85. <el-input v-model="editBaByInfo.babyBirthWeight" type="number" placeholder="请输入出生体重" />
  86. </el-form-item>
  87. <el-form-item label="出生身高(厘米)" >
  88. <el-input v-model="editBaByInfo.babyBirthHeight" type="number" placeholder="请输入出生身高" />
  89. </el-form-item>
  90. </el-form>
  91. <template #footer>
  92. <span class="dialog-footer">
  93. <el-button type="danger" @click="editBabyDialog = false">取消</el-button>
  94. <el-button type="success" @click="onSubmit"> 保存</el-button>
  95. </span>
  96. </template>
  97. </el-dialog>
  98. </template>
  99. <script setup lang="ts" name = "addBabyInfo">
  100. import {onMounted, ref, defineAsyncComponent} from "vue";
  101. import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
  102. import {getPatientBaseInfo,queryPatientInfo} from "@/api/medical-advice/medical-advice-management";
  103. import {queryBabyInfo,deleteBaby,saveBabyInfo,editBabyInfo} from "@/api/medical-advice/patient-info";
  104. import {ElMessageBox} from "element-plus";
  105. // 异步导入PatientInfo组件
  106. const PatientInfo = defineAsyncComponent(() => import("@/components/medical-advice/PatientInfo.vue"));
  107. const windowHeight = window.innerHeight
  108. interface PatientInfoType {
  109. name?: string;
  110. [key: string]: any;
  111. }
  112. interface QueryParamType {
  113. wardCode?: string;
  114. inpatientNo?: string;
  115. admissTimes?: number | null;
  116. [key: string]: any;
  117. }
  118. interface EditBabyInfoType {
  119. name?: string;
  120. inpatientNo?: string;
  121. sex?: string;
  122. birthDate?: string;
  123. birthDateTime?: string;
  124. babyBirthWeight?: string | number;
  125. babyBirthHeight?: string | number;
  126. [key: string]: any;
  127. }
  128. const patientInfo = ref<PatientInfoType>({})
  129. const queryParam = ref<QueryParamType>({
  130. wardCode:'',
  131. inpatientNo:'',
  132. admissTimes:null,
  133. })
  134. const editBaByInfo = ref<EditBabyInfoType>({
  135. name:'',
  136. inpatientNo:'',
  137. sex:'',
  138. birthDate:'',
  139. birthDateTime:'',
  140. babyBirthWeight:'', // 新增:婴儿出生体重
  141. babyBirthHeight:'', // 新增:婴儿出生身高
  142. })
  143. const editBabyDialog = ref(false)
  144. const dialogTitle = ref('增加婴儿信息')
  145. const isEdit = ref(false)
  146. const saveData=()=>{
  147. editBaByInfo.value.name = patientInfo.value.name
  148. editBaByInfo.value.inpatientNo= queryParam.value.inpatientNo
  149. // 设置完整出生日期时间
  150. editBaByInfo.value.birthDateTime = editBaByInfo.value.birthDate
  151. saveBabyInfo(editBaByInfo.value).then((res)=>{
  152. editBabyDialog.value = false
  153. queryBaby()
  154. })
  155. }
  156. const onSubmit = ()=>{
  157. if(isEdit.value){
  158. // 方案A:提交前将控件值传到后端可解析字段
  159. editBaByInfo.value.birthDateTime = editBaByInfo.value.birthDate
  160. editBabyInfo(editBaByInfo.value).then(()=>{
  161. editBabyDialog.value = false
  162. queryBaby()
  163. })
  164. }else{
  165. saveData()
  166. }
  167. }
  168. const visible = ref<boolean>(false)
  169. const patList =ref([])
  170. const fetchPatInfo = (row)=>{
  171. queryParam.value.inpatientNo = row.inpatientNo
  172. queryParam.value.admissTimes = row.admissTimes
  173. visible.value = false
  174. queryInfo()
  175. queryBaby()
  176. }
  177. const queryBaby=()=>{
  178. queryBabyInfo(queryParam.value).then((res:any)=>{
  179. babyList.value = res
  180. })
  181. }
  182. const addBaby = ()=>{
  183. dialogTitle.value = '增加婴儿信息'
  184. isEdit.value = false
  185. Object.assign(editBaByInfo.value,{name:'',inpatientNo:'',sex:'',birthDate:'',birthDateTime:'',babyBirthWeight:'',babyBirthHeight:''})
  186. editBabyDialog.value = true
  187. }
  188. const openEdit = (row)=>{
  189. dialogTitle.value = '编辑婴儿信息'
  190. isEdit.value = true
  191. Object.assign(editBaByInfo.value,{
  192. name: patientInfo.value.name,
  193. inpatientNo: row.inpatientNo,
  194. sex: row.sex,
  195. birthDate: row.birthDateTime || row.birthDate,
  196. birthDateTime: row.birthDateTime,
  197. babyBirthWeight: row.babyBirthWeight,
  198. babyBirthHeight: row.babyBirthHeight,
  199. })
  200. editBabyDialog.value = true
  201. }
  202. const babyList = ref()
  203. const selectPatList = ()=>{
  204. queryPatientInfo('',queryParam.value.wardCode,'0').then((res:any) => {
  205. if(res.length > 0){
  206. patList.value = res.filter(item=>(!item.inpatientNo.includes('$')))
  207. }else {
  208. patList.value = []
  209. }
  210. })
  211. }
  212. const ward = ref<any>([])
  213. onMounted(()=>{
  214. getAllWards().then((res:any)=>{
  215. ward.value =res
  216. queryParam.value.wardCode = res[0].code
  217. })
  218. })
  219. const delBaBy = (index,row) =>{
  220. ElMessageBox.confirm('确认删除婴儿信息?', '提示', {
  221. confirmButtonText: '确认',
  222. cancelButtonText: '取消',
  223. distinguishCancelAndClose: true
  224. }).then(() => {
  225. deleteBaby(row).then((res)=>{
  226. queryBaby()
  227. })
  228. })
  229. }
  230. const queryInfo = ()=>{
  231. let params = {inpatientNo:queryParam.value.inpatientNo,
  232. admissTimes:queryParam.value.admissTimes,inOutStatusFlag:'0'}
  233. getPatientBaseInfo(params).then((res:any)=>{
  234. patientInfo.value =res
  235. })
  236. }
  237. </script>
  238. <style scoped lang="scss">
  239. </style>