yyghDoctorList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="container" :class="{ 'fixed': dialogIsShow }" :hidden="!showCon">
  3. <view class="content">
  4. <view class="userInfoTopFixe">
  5. <view class="date_list" v-if="serviceId != '009'">
  6. <view class="date_item date_item_hasList date_item_all" :class="{ 'backgroundCustom': timeActive === '' }"
  7. @click="timeClick" v-if="pageConfig.hasAllSchedules">
  8. 全部
  9. </view>
  10. <view class="date_item date_item_hasList" :class="{ 'backgroundCustom': timeActive === index, 'colorCustom_999': item.HasSchedule != 1 }"
  11. v-for="(item, index) in timeList" :key="index" @click="item.HasSchedule == 1 ? timeClick($event, item, index) : null">
  12. <text>{{ item.WeekName }}</text>
  13. <text class="month">{{ item.RegDateNotYear }}</text>
  14. </view>
  15. </view>
  16. <view class="nav">
  17. <view class="nav_inner">
  18. <view class="nav_tit_val">是否仅显示可约医生</view>
  19. <switch class="public_switch" :checked="reducibleOnly" color="var(--dominantColor)" @change="switchChange"></switch>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="doctor_list" :class="{ 'doctor_list100': serviceId == '009' }" v-if="!showNoData">
  24. <view class="doctor_item" v-for="(doctorItem, doctorIndex) in doctorList" :key="doctorIndex">
  25. <view class="doctor_item_nav" @click="doctorInfoClick(doctorItem)">
  26. <view class="doctor_item_nav_img">
  27. <image :src="doctorItem.PhotoUrl || iconUrl.icon_doctor" mode="widthFix"></image>
  28. </view>
  29. <view class="doctor_item_nav_tit">
  30. <view class="doctor_item_nav_subtit">
  31. <text class="doctor_item_nav_subtit_val">{{ doctorItem.DoctorName }}</text>
  32. <text v-if="doctorItem.DoctorTitle || doctorItem.Title" class="doctor_item_nav_subtit_txt">{{ doctorItem.DoctorTitle || doctorItem.Title }}</text>
  33. </view>
  34. <view v-if="doctorItem.Spec" class="doctor_item_nav_info">
  35. {{ doctorItem.Spec }}
  36. </view>
  37. </view>
  38. </view>
  39. <view class="scheduling_box" v-for="(schedulItem, schedulIndex) in doctorItem.Scheduling" :key="schedulIndex">
  40. <view class="scheduling_dept_box displayFlexBetween" @click="foldList(doctorIndex, schedulIndex)">
  41. <view class="scheduling_deptName_box displayFlexRow">
  42. <view class="backgroundCustom "></view>
  43. <text>{{ schedulItem.DeptName }}</text>
  44. </view>
  45. <image class="arrow" :class="{ 'transform_rotate_90': schedulItem.Check }" :src="iconUrl.icon_right"></image>
  46. </view>
  47. <view class="time_list" v-if="schedulItem.Check">
  48. <view class="time_item displayFlexCol" :class="{ 'time_item_stop': (item.IsHalt == 7 && item.WaitLeaveCount <= 0) || item.IsHalt == 2 }"
  49. v-for="(item, index) in (schedulItem.showAllSchedu ? schedulItem.Data_1 : schedulItem.Data_1_Diy)" :key="index"
  50. @click="toClinic(item, index, schedulItem)">
  51. <view>{{ item.RegDateDiy }}</view>
  52. <view style="margin-top: 12upx;">{{ item.WeekName }} {{ item.TimeSliceStr }}</view>
  53. <image v-if="item.IsHalt == 7" class="time_item_img" :src="iconUrl.full2"></image>
  54. <image v-if="item.IsHalt == 2" class="time_item_img" :src="iconUrl.stop"></image>
  55. <image v-if="item.IsHalt == 7 && item.WaitLeaveCount > 0" class="time_item_img" :src="iconUrl.yyghWait"></image>
  56. </view>
  57. <view class="time_item colorCustom" @click="showAll(doctorIndex, schedulIndex)" v-if="schedulItem.Data_1.length > 6">
  58. {{ schedulItem.showAllSchedu ? '收起' : '全部排班' }}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="other_dept_box" v-if="!doctorItem.ShowDeptSwitch">
  63. <view class="displayFlexRow border_top displayFlexBetween">
  64. <text>本院所有科室排班</text>
  65. <switch color="var(--dominantColor)" class="public_switch" @change="queryScheduleList($event, doctorIndex, doctorItem)" />
  66. </view>
  67. </view>
  68. <view class="other_dept_box displayFlexRow border_top" v-if="doctorItem.Scheduling.length == 1 && doctorItem.ShowDeptSwitch">
  69. <text class="non_schedul">暂无其他科室排班</text>
  70. </view>
  71. </view>
  72. </view>
  73. <view v-else class="noData">
  74. <noData :value="noDataTip"></noData>
  75. </view>
  76. </view>
  77. <doctorInfoComp :doctorInfoIsShow="doctorInfoIsShow" :doctorInfo="doctorInfo"></doctorInfoComp>
  78. </view>
  79. <!-- AI数智客服入口-->
  80. <aiCustomerEntry :currentUser="currentUser"></aiCustomerEntry>
  81. </template>
  82. <script setup lang="ts">
  83. import { ref, reactive, computed } from 'vue';
  84. import { onLoad } from '@dcloudio/uni-app';
  85. import { common, pagesPatientFn } from '@/utils';
  86. import icon from '@/utils/icon';
  87. import { REQUEST_CONFIG } from '@/config';
  88. import {
  89. queryClinicScheduleDate,
  90. queryClinicDoctorSchedule,
  91. queryClinicBaseDoctor,
  92. queryScheduleList as queryScheduleListApi
  93. } from '@/pagesPatient/service/yygh';
  94. import noData from '@/pages/st1/components/noData/noData.vue';
  95. import doctorInfoComp from '@/pagesPatient/st1/components/doctorInfo/doctorInfo.vue';
  96. import aiCustomerEntry from '@/pages/st1/components/pagesAICustomerService/st1/components/aiCustomerEntry/aiCustomerEntry.vue';
  97. // Define components locally if needed, but imported components are automatically available in <script setup>
  98. // We rename doctorInfo import to avoid conflict with doctorInfo ref
  99. const doctorInfo = ref({});
  100. const iconUrl = ref(icon);
  101. const dialogIsShow = ref(false);
  102. const showNoData = ref(false);
  103. const timeList = ref<any[]>([]);
  104. const timeActive = ref<string | number>('');
  105. const doctorList = ref<any[]>([]);
  106. const noDataTip = ref('暂无排班数据');
  107. const showCon = ref(false);
  108. const titleInfoList = ref([]);
  109. const titleSelect = ref<any>({});
  110. const titleClickVal = ref<any>({}); // Renamed from titleClick to avoid conflict with method
  111. const reducibleOnly = ref(false);
  112. const doctorInfoIsShow = ref(false);
  113. const pageConfig = ref<any>({});
  114. const serviceId = ref('');
  115. const queryBean = ref<any>({});
  116. const currentUser = ref({}); // Added for aiCustomerEntry
  117. const app = getApp();
  118. onLoad((options: any) => {
  119. if (options.DistrictId) {
  120. app.globalData.districtId = options.DistrictId;
  121. }
  122. // 当前页面配置信息
  123. let config = common.deepCopy(app.globalData.config?.pageConfiguration?.yyghDoctorList_config || {});
  124. let qBean = options.queryBean ? JSON.parse(options.queryBean) : app.globalData.queryBean ? app.globalData.queryBean : {};
  125. console.log(qBean, 'queryBean');
  126. if (options.deptName) qBean.DeptName = options.deptName;
  127. if (options.deptCode) qBean.DeptCode = options.deptCode;
  128. queryBean.value = qBean;
  129. serviceId.value = options.serviceId || '';
  130. pageConfig.value = config;
  131. timeActive.value = (config.hasAllSchedules && options.serviceId != '009') ? '' : 0;
  132. uni.setNavigationBarTitle({
  133. title: queryBean.value.DeptName || '排班',
  134. });
  135. main();
  136. });
  137. const main = async () => {
  138. let tList: any[] = [];
  139. // 获取排班日期列表
  140. let queryData = {
  141. HosId: app.globalData.districtId || app.globalData.hosId,
  142. DeptCode: queryBean.value.DeptCode
  143. };
  144. let timeListResp = await queryClinicScheduleDate(queryData);
  145. if (timeListResp && Array.isArray(timeListResp)) {
  146. timeListResp.map((item: any) => {
  147. if (item.RegDate == common.newDay()) item.WeekName = '今天';
  148. });
  149. tList = !common.isEmpty(timeListResp) ? timeListResp : tList;
  150. }
  151. // 获取排班医生列表
  152. await setterDoctorList(tList);
  153. timeList.value = tList;
  154. showCon.value = true;
  155. };
  156. // 医生筛选点击
  157. const titleClick = (item: any) => {
  158. titleClickVal.value = common.isEmpty(item) ? "" : item;
  159. };
  160. // 医生详情点击
  161. const doctorInfoClick = async (item: any) => {
  162. let queryData = {
  163. HosId: app.globalData.districtId || app.globalData.hosId,
  164. DeptCode: item.DeptCode || '',
  165. DoctorCode: item.DoctorCode || '',
  166. DoctorName: ''
  167. };
  168. let resp = await queryClinicBaseDoctor(queryData);
  169. if (!common.isEmpty(resp)) {
  170. doctorInfoIsShow.value = true;
  171. doctorInfo.value = resp[0];
  172. }
  173. };
  174. // 点击医生职称重置 确定按钮
  175. const titleBtnClick = async (type: string) => {
  176. if (type == 'reset') {
  177. titleClickVal.value = {};
  178. } else {
  179. titleSelect.value = titleClickVal.value;
  180. await setterDoctorList();
  181. dialogShowChange();
  182. }
  183. };
  184. // 点击查看全部排班
  185. const showAll = (doctorIndex: number, schedulIndex: number) => {
  186. const list = [...doctorList.value];
  187. list[doctorIndex].Scheduling[schedulIndex].showAllSchedu = !list[doctorIndex].Scheduling[schedulIndex].showAllSchedu;
  188. doctorList.value = list;
  189. };
  190. // 是否仅显示可约医生
  191. const switchChange = async (e: any) => {
  192. reducibleOnly.value = e.detail.value;
  193. await setterDoctorList();
  194. };
  195. // 点击排班时间
  196. const timeClick = async (e: any, item?: any, index?: number) => {
  197. // item and index are passed directly in Vue template
  198. // If called without item (click "All"), item is undefined
  199. if (!common.isEmpty(item)) {
  200. timeActive.value = index!;
  201. } else {
  202. timeActive.value = "";
  203. }
  204. await setterDoctorList();
  205. };
  206. // 医生dialog显隐
  207. const dialogShowChange = () => {
  208. dialogIsShow.value = !dialogIsShow.value;
  209. titleClickVal.value = titleSelect.value;
  210. };
  211. const doNothing = () => {};
  212. // 处理医生列表返回值
  213. const setterDoctorList = async (tList?: any[]) => {
  214. let list = tList || timeList.value;
  215. let time = typeof timeActive.value == 'number' ? list[timeActive.value].RegDate : "";
  216. let queryData = {
  217. HosId: app.globalData.districtId || app.globalData.hosId,
  218. ServiceId: serviceId.value,
  219. DeptCode: queryBean.value.DeptCode,
  220. DoctorCode: "",
  221. WorkDateStart: time || "",
  222. WorkDateEnd: time || "",
  223. TitleCode: titleSelect.value.DoctorTitleCode || "",
  224. OrderByDoc: '1',
  225. WaitRule: '1'
  226. };
  227. let resp = await queryClinicDoctorSchedule(queryData);
  228. let isReducibleOnly = reducibleOnly.value;
  229. if (!common.isEmpty(resp)) {
  230. for (let i of resp) {
  231. if (i.Data_1 && !common.isEmpty(i.Data_1)) {
  232. i.Data_1.map((item: any) => {
  233. item.RegDateDiy = item.RegDate.substring(5);
  234. item.WeekName = item.RegDate == common.newDay() ? '今天' : item.WeekName;
  235. });
  236. }
  237. /**如果医生头像没有域名 添加域名 */
  238. if (i.PhotoUrl && i.PhotoUrl.indexOf('http') == '-1') {
  239. i.PhotoUrl = REQUEST_CONFIG.BASE_URL + i.PhotoUrl;
  240. }
  241. if (i.PhotoUrl) {
  242. i.PhotoUrl = i.PhotoUrl.replace(/\\/g, '/');
  243. }
  244. if (i.Data_1 && i.Data_1.length > 6) {
  245. i.Data_1_Diy = i.Data_1.slice(0, 5);
  246. i.showAllSchedu = false;
  247. } else {
  248. i.Data_1_Diy = i.Data_1;
  249. i.showAllSchedu = true;
  250. }
  251. }
  252. }
  253. if (isReducibleOnly && !common.isEmpty(resp)) {
  254. resp = resp.filter((item: any) => item.Data_1.filter((cell: any) => cell.IsHalt != '7' && cell.IsHalt != '2').length > 0);
  255. }
  256. if (resp) {
  257. resp.map((item: any) => {
  258. let obj = [{
  259. Check: true,
  260. DeptName: item.DeptName,
  261. DeptCode: item.DeptCode,
  262. DoctorName: item.DoctorName,
  263. DoctorCode: item.DoctorCode,
  264. Data_1: item.Data_1,
  265. Data_1_Diy: item.Data_1_Diy,
  266. showAllSchedu: item.showAllSchedu,
  267. }];
  268. item.Scheduling = obj;
  269. });
  270. }
  271. doctorList.value = resp || [];
  272. showNoData.value = common.isEmpty(resp) ? true : false;
  273. };
  274. // 点击医生具体排班时间
  275. const toClinic = (item: any, index: number, schedulItem: any) => {
  276. // 判断(约满且无候补)或者停诊
  277. if ((item.IsHalt == 7 && item.WaitLeaveCount <= 0) || item.IsHalt == '2') {
  278. return;
  279. }
  280. // Construct event object to mimic typical event structure if needed by pagesPatientFn,
  281. // but handleRouter usually takes dataset from event.
  282. // Here we pass data manually or construct a mock event.
  283. // pagesPatientFn.handleRouter(e, 'yyghClinicMsg', this.data.serviceId, index)
  284. // Since pagesPatientFn.handleRouter expects an event object with currentTarget.dataset
  285. // We should reconstruct what it expects.
  286. // The original call was: pagesPatientFn.handleRouter(e, 'yyghClinicMsg',this.data.serviceId, index)
  287. // e.currentTarget.dataset.dataitem was 'item'
  288. const mockEvent = {
  289. currentTarget: {
  290. dataset: {
  291. dataitem: item,
  292. index: index
  293. }
  294. }
  295. };
  296. pagesPatientFn.handleRouter(mockEvent, 'yyghClinicMsg', serviceId.value, index);
  297. };
  298. // 查询其它科室排班
  299. const queryScheduleList = async (e: any, doctorIndex: number, doctorItem: any) => {
  300. // Switch change event
  301. // Note: switch binding in Vue passes value differently than bindchange in WXML
  302. // In Vue @change, value is boolean (e.detail.value)
  303. // If we want to use the same logic, we just need to proceed.
  304. let list = common.deepCopy(doctorList.value, []);
  305. let time = typeof timeActive.value == 'number' ? timeList.value[timeActive.value].RegDate : "";
  306. let queryData = {
  307. workDateEnd: time || "",
  308. workDateStart: time || "",
  309. doctorCode: doctorItem.DoctorCode,
  310. deptCode: doctorItem.DeptCode,
  311. hosId: app.globalData.districtId || app.globalData.hosId,
  312. WaitRule: '1'
  313. };
  314. let res = await queryScheduleListApi(queryData);
  315. if (common.isNotEmpty(res)) {
  316. let scheduleList: any[] = [];
  317. res.map((item: any) => {
  318. // 转换返回数据 小写转大写
  319. item.hisQueryClinicSchedules = common.changeObj(item.hisQueryClinicSchedules);
  320. item.hisQueryBaseDoctor = common.changeObj(item.hisQueryBaseDoctor);
  321. if (item.hisQueryClinicSchedules && item.hisQueryClinicSchedules.length > 0) {
  322. // 判断是否多数据处理 星期 时间 上下午
  323. item.hisQueryClinicSchedules.map((ele: any) => {
  324. ele.WeekName = ele.RegDate == common.newDay() ? '今天' : common.weekDay(ele.RegDate, 1);
  325. ele.RegDateDiy = ele.RegDate.substring(5);
  326. ele.TimeSliceStr = ele.TimeSlice == 1 ? '上午' : ele.TimeSlice == 2 ? '下午' : '全天';
  327. });
  328. // 判断如果超出6个隐藏
  329. if (item.hisQueryClinicSchedules.length > 6) {
  330. item.Data_1_Diy = item.hisQueryClinicSchedules.slice(0, 5);
  331. item.showAllSchedu = false;
  332. } else {
  333. item.Data_1_Diy = item.hisQueryClinicSchedules;
  334. item.showAllSchedu = true;
  335. }
  336. scheduleList.push({
  337. Check: item.hisQueryBaseDoctor.DeptCode == doctorItem.DeptCode ? true : false,
  338. DeptName: item.hisQueryBaseDoctor.DeptName,
  339. DeptCode: item.hisQueryBaseDoctor.DeptCode,
  340. DoctorName: doctorItem.DoctorName,
  341. DoctorCode: doctorItem.DoctorCode,
  342. Data_1: item.hisQueryClinicSchedules,
  343. Data_1_Diy: item.Data_1_Diy,
  344. showAllSchedu: item.showAllSchedu,
  345. });
  346. }
  347. });
  348. // 给当前查询的医生新加列表
  349. list[doctorIndex].Scheduling = scheduleList;
  350. }
  351. // 查询过的医生 不展示switch
  352. list[doctorIndex].ShowDeptSwitch = true;
  353. doctorList.value = list;
  354. };
  355. // 折叠列表
  356. const foldList = (doctorIndex: number, schedulIndex: number) => {
  357. let list = [...doctorList.value];
  358. list[doctorIndex].Scheduling[schedulIndex].Check = !list[doctorIndex].Scheduling[schedulIndex].Check;
  359. doctorList.value = list;
  360. };
  361. </script>
  362. <style scoped>
  363. @import "@/pagesPatient/st1/static/css/yyghDoctorList.css";
  364. </style>