selecteCardOrHos.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <!--pages2/st1/merge/business/patientManagement/choosePatient/choosePatient.wxml-->
  3. <view class="container" v-if="showCon">
  4. <view class="content">
  5. <view class="patientBox">
  6. <view v-if="patientInfoList.length == 0" class="noData">
  7. <noData :value="noDataValue"></noData>
  8. </view>
  9. <template v-if="patientInfoList.length > 0">
  10. <view class="patient_list" v-for="(item, index) in patientInfoList" :key="index">
  11. <view class="patientInfoBox displayFlexLeft" @click="optionClick(item, index, 'member')">
  12. <view class="patient_info displayFlexCol">
  13. <view class="name_tel">
  14. <text>{{item.memberName}}</text>
  15. <text>{{item.mobile}}</text>
  16. </view>
  17. <text class="idCard" v-if="item.isChildren == 0">{{item.certTypeName}}:{{item.certNum}}</text>
  18. <text class="idCard" v-if="item.isChildren == 1">监护人身份证:{{item.guardianCertNum}}</text>
  19. </view>
  20. <text class="defaultText" v-if="item.userMemberList && item.userMemberList[0] && item.userMemberList[0].isDefaultMember == 1">默认</text>
  21. <image class="public_right_img public_right_img30" :class="{ 'transform90': patientInfoIndex === index }" :src="iconUrl.icon_right"></image>
  22. </view>
  23. <!-- 等于人本时展示授权与信用管理 -->
  24. <template v-if="item.memberType == 1">
  25. <view class="personallyBox" :class="{ 'noPersonallyBox': !(type != 'member' && item.data_1 && patientInfoIndex == index) }">
  26. <view class="moduleBox displayFlexBetween" @click.stop="forWard('authorizeIndex', item)">
  27. <view class="bg backgroundCustom_F08"></view>
  28. <view class="moduleInfo">
  29. <view class="moduleInfo_txt">已授权他人使用</view>
  30. <view class="colorCustom_F08">授权{{item.authQuantity || 0}}人</view>
  31. </view>
  32. <view class="moduleBox_btn backgroundCustom_F08">去管理</view>
  33. </view>
  34. <view class="moduleBox displayFlexBetween" @click.stop="forWard('creditIndex', item)">
  35. <view class="bg backgroundCustom"></view>
  36. <view class="moduleInfo">
  37. <view class="moduleInfo_txt">信用权益</view>
  38. <view class="colorCustom">您的诊疗信用良好,可享受先诊后付费权益</view>
  39. </view>
  40. <view class="moduleBox_btn backgroundCustom">去管理</view>
  41. </view>
  42. </view>
  43. </template>
  44. <image :src="iconUrl.icon_memDivision" class="icon_memDivision" mode="widthFix" v-if="item.memberType == 1 && type != 'member' && item.data_1 && patientInfoIndex == index"></image>
  45. <view class="patientCardBox" v-if="type != 'member' && item.data_1 && patientInfoIndex == index">
  46. <template v-for="(childItem, childIndex) in item.data_1" :key="childIndex">
  47. <view class="patientCardBox_list displayFlexBetween" :class="{ 'colorCustom': childItem.isDefault == 1 }"
  48. @click.stop="optionClick(item, index, 'card', childItem)" v-if="cardTypeName == childItem.cardTypeName">
  49. <view>{{childItem.cardTypeName}}:{{childItem.cardNo}}</view>
  50. <image class="public_right_img" :src="iconUrl.icon_right"></image>
  51. </view>
  52. </template>
  53. </view>
  54. </view>
  55. <view class="relativesBox displayFlexLeft" v-if="patientInfoList.some(i => i.memberType == 1)">
  56. <image :src="iconUrl.icon_relatives" class="icon_relatives"></image>
  57. <view>亲友成员({{patientInfoList.length - 1}}人)</view>
  58. </view>
  59. </template>
  60. </view>
  61. </view>
  62. <view class="public_btn backgroundCustom_F08" @click="jumpAddPatient">添加就诊人</view>
  63. </view>
  64. </template>
  65. <script lang="ts" setup>
  66. import { queryMemberHeaderInfo } from '@/pages/st1/service/base';
  67. import { setDefaultMemberV3, setDefaultClinicCard_V3 } from '@/pagesPersonal/service/patientManagement';
  68. import { common } from '@/utils';
  69. import icon from '@/utils/icon';
  70. import { usePreserMember, queryMemberCardList_V3 } from '@/hook';
  71. import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
  72. import { ref } from 'vue';
  73. import noData from "@/pages/st1/components/noData/noData.vue";
  74. const app = getApp();
  75. const iconUrl = ref(icon);
  76. const noDataValue = ref("暂无就诊人");
  77. const patientInfoList = ref<any[]>([]);
  78. const patientInfoIndex = ref<any>('');
  79. const pageType = ref('');
  80. const type = ref("member");
  81. const cardType = ref("1");
  82. const cardTypeName = ref('就诊卡');
  83. const fromComponent = ref(false);
  84. const showCon = ref(false);
  85. const currentUser = ref<any>({});
  86. onLoad((options: any) => {
  87. pageType.value = options.pageType || '';
  88. type.value = options.type || 'member';
  89. cardType.value = options.type == 'hospital' ? '14' : '1';
  90. cardTypeName.value = options.type == 'hospital' ? '住院号' : '就诊卡';
  91. fromComponent.value = options.fromComponent || false;
  92. currentUser.value = app.globalData.currentUser || {};
  93. uni.setNavigationBarTitle({
  94. title: options.type == 'hospital' ? '选择住院号' : options.type == 'card' ? '选择就诊卡' : '选择就诊人'
  95. });
  96. });
  97. onShow(() => {
  98. if (app.globalData.logSuccess) {
  99. main();
  100. } else {
  101. app.loginReadyCallBack = () => main();
  102. }
  103. });
  104. onUnload(() => {
  105. if (app.globalData.cardDeleted) {
  106. let pages = getCurrentPages();
  107. if (pages.length >= 2) {
  108. let goPage = pages[pages.length - 2];
  109. // Try to call refresh if available on the page instance
  110. // @ts-ignore
  111. if (typeof goPage.$vm?.refresh == 'function') {
  112. // @ts-ignore
  113. goPage.$vm.refresh();
  114. } else if (typeof (goPage as any).refresh == 'function') {
  115. (goPage as any).refresh();
  116. }
  117. }
  118. }
  119. });
  120. const main = async () => {
  121. let _patientInfoIndex = '';
  122. let _type = type.value;
  123. // Use usePreserMember hook instead of publicFn.getMember
  124. // Assuming usePreserMember returns the member list directly
  125. let resp: any = await usePreserMember();
  126. if (!common.isEmpty(resp)) {
  127. if (_type != 'member') {
  128. resp.forEach((item: any, index: number) => {
  129. if (item.userMemberList && item.userMemberList[0] && item.userMemberList[0].isDefaultMember == 1) {
  130. _patientInfoIndex = index as any;
  131. }
  132. if (!common.isEmpty(item.data_1)) {
  133. item.data_1.forEach((childItem: any) => {
  134. //健康卡位数太长转换下
  135. if (childItem.cardType == 16 && childItem.cardNo.length > 9) {
  136. childItem.cardNo = childItem.cardNo.replace(/\*{3,}/g, '***');
  137. }
  138. });
  139. }
  140. });
  141. }
  142. }
  143. // 就诊人排序
  144. resp = resp.sort(function (a: any, b: any) {
  145. if (a.memberType !== b.memberType) {
  146. return a.memberType < b.memberType ? -1 : 1; // 如果类型不同,则按照字母顺序返回
  147. } else {
  148. return a.memberType == 1 ? -1 : b.userMemberList[0].isDefaultMember - a.userMemberList[0].isDefaultMember; // 如果类型相同,则比较名称
  149. }
  150. });
  151. const asyncRequests = resp.map(async (item: any) => getQueryMemberHeaderInfoFunc(item));
  152. await Promise.all(asyncRequests);
  153. patientInfoIndex.value = _patientInfoIndex;
  154. patientInfoList.value = resp || [];
  155. showCon.value = true;
  156. };
  157. // 获取信用授权数据
  158. const getQueryMemberHeaderInfoFunc = async (item: any) => {
  159. if (item.memberType == 1) {
  160. let { resData } = await queryMemberHeaderInfo({
  161. memberId: item.memberId,
  162. accountSn: item.accountSn
  163. });
  164. item.authQuantity = resData.RespCode == 10000 && resData.Data && resData.Data[0] ? resData.Data[0].userCount : 0;
  165. }
  166. return item;
  167. };
  168. /**
  169. * 列表点击
  170. */
  171. const optionClick = async (item: any, index: number, tag: string, childItem?: any) => {
  172. let _type = type.value;
  173. if (tag == 'member') {
  174. if (_type == 'member') {
  175. app.globalData.currentUser = item;
  176. } else {
  177. let resp = item.data_1 || [];
  178. if (common.isEmpty(item.data_1)) {
  179. // Fetch cards
  180. let { resData } = await queryMemberCardList_V3({ memberId: item.memberId });
  181. if (resData.RespCode == 10000) {
  182. resp = resData.Data || [];
  183. }
  184. }
  185. if (common.isEmpty(resp) || (common.isNotEmpty(resp) && resp.filter((ele: any) => ele.cardType == cardType.value).length == 0)) {
  186. // 首页进入切换就诊人,设置最好操作人
  187. if (pageType.value == 'home') {
  188. await setDefaultMember(item);
  189. common.navigateBack(1, 'currentUser', item);
  190. } else {
  191. common.showModal(`查无${cardType.value == '14' ? '住院号' : '就诊卡'}`);
  192. }
  193. return;
  194. }
  195. resp.forEach((cItem: any) => {
  196. //健康卡位数太长转换下
  197. if (cItem.cardType == 16 && cItem.cardNo.length > 9) {
  198. cItem.cardNo = cItem.cardNo.replace(/\*{3,}/g, '***');
  199. }
  200. });
  201. patientInfoList.value[index].data_1 = resp;
  202. patientInfoIndex.value = index;
  203. // Force update if needed, but Vue 3 proxy should handle it
  204. return;
  205. }
  206. }
  207. // 卡点击
  208. if (tag == 'card' && childItem) {
  209. item = common.mergeObject(item, childItem);
  210. app.globalData.currentUser = item;
  211. if (pageType.value == 'home') {
  212. await setDefaultMember(item);
  213. }
  214. // 跳转CRM
  215. else if (pageType.value == 'crm') {
  216. await setDefaultMember(item);
  217. common.goToUrl("/pagesCrm/st1/business/myFollowUp/home/home", {
  218. skipWay: "redirectTo"
  219. });
  220. return;
  221. }
  222. }
  223. if (fromComponent.value) {
  224. /**如果从组件进入页面 重新选择就诊人后直接返回 */
  225. common.navigateBack(1, 'currentUser', item);
  226. } else {
  227. if (app.globalData.toUrl) {
  228. common.goToUrl(app.globalData.toUrl, {
  229. skipWay: "redirectTo"
  230. });
  231. return;
  232. }
  233. if (pageType.value == "pennant") {
  234. item.Check = true;
  235. }
  236. common.navigateBack(1, 'currentUser', item);
  237. }
  238. };
  239. // 设置默认就诊人 默认就诊卡
  240. const setDefaultMember = async (item: any) => {
  241. let querData = {
  242. accountSn: item.accountSn,
  243. memberId: item.memberId
  244. };
  245. // 设置默认就诊人
  246. let { resData } = await setDefaultMemberV3(querData);
  247. if (resData.RespCode == "10000") {
  248. if (item.cardNo) {
  249. let data = {
  250. memberId: item.memberId,
  251. cardNo: item.cardNo,
  252. cardType: item.cardType,
  253. encryptionStore: item.encryptionStore,
  254. };
  255. await setDefaultClinicCard_V3(data);
  256. }
  257. // 设置完默认就诊人 重新查询并保存全局就诊人数据信息
  258. await usePreserMember();
  259. app.globalData.currentUser = item;
  260. }
  261. };
  262. const jumpAddPatient = () => {
  263. app.globalData.isSelectAdd = true;
  264. common.goToUrl(`/pagesPersonal/st1/business/patientManagement/selecteBindCardMode/selecteBindCardMode`);
  265. };
  266. /**
  267. * 点击本人 去管理
  268. */
  269. const forWard = (router: string, memberInfo: any) => {
  270. // 存储本人数据
  271. app.globalData.myInfo = memberInfo;
  272. let url: string | null = null;
  273. if (router == 'creditIndex') {
  274. url = `/pagesPersonal/st1/business/creditManagement/${router}/${router}`;
  275. } else if (router == 'authorizeIndex') {
  276. url = `/pagesPersonal/st1/business/authorizeMangement/${router}/${router}`;
  277. }
  278. if (url) common.goToUrl(url);
  279. };
  280. </script>
  281. <style lang="scss" scoped>
  282. .noData {
  283. margin-top: -180upx;
  284. }
  285. .container {
  286. width: 100%;
  287. height: auto;
  288. min-height: 100%;
  289. background: #f1f1f6;
  290. position: relative;
  291. }
  292. .patient_list {
  293. border-radius: 24upx;
  294. overflow: hidden;
  295. position: relative;
  296. margin: 30upx;
  297. z-index: 100;
  298. }
  299. .patient_list:last-child {
  300. border-bottom: none;
  301. }
  302. .patient_info {
  303. height: 88upx;
  304. justify-content: space-between;
  305. align-items: flex-start;
  306. }
  307. .border-bottom:last-child::after {
  308. border-top: 0px !important;
  309. }
  310. .public_card_img {
  311. width: 88upx;
  312. height: 88upx;
  313. margin-right: 24upx;
  314. flex-shrink: 0;
  315. }
  316. .name_tel text:nth-child(1) {
  317. font-size: 32upx;
  318. font-weight: bold;
  319. color: #222326;
  320. margin-right: 30upx;
  321. }
  322. .name_tel text:nth-child(2) {
  323. font-size: 32upx;
  324. color: #222326;
  325. }
  326. .idCard {
  327. font-size: 30upx;
  328. color: #62626D;
  329. margin-top: 10upx;
  330. display: inline-block;
  331. }
  332. .public_btn {
  333. margin: 60upx 30upx;
  334. }
  335. .defaultText{
  336. width: 72upx;
  337. height: 36upx;
  338. line-height: 36upx;
  339. text-align: center;
  340. background: #F4FAED;
  341. border-radius: 4upx;
  342. position: absolute;
  343. right: 36upx;
  344. font-size: 26upx;
  345. font-family: PingFang SC;
  346. font-weight: 500;
  347. color: var(--dominantColor);
  348. }
  349. .patientInfoBox{
  350. position: relative;
  351. background:#fff;
  352. padding: 50upx 30upx;
  353. }
  354. .patientCardBox{
  355. background:#fff;
  356. padding: 1upx 30upx;
  357. }
  358. .patientCardBox_list{
  359. padding: 0upx 30upx;
  360. box-sizing: border-box;
  361. margin-bottom: 30upx;
  362. background: #F8F8FA;
  363. border-radius: 10upx;
  364. height: 110upx;
  365. line-height: 110upx;
  366. position: relative;
  367. }
  368. .patientCardBox_list .public_right_img{
  369. right: 30upx;
  370. }
  371. .transform90{
  372. transform: rotateZ(90deg);
  373. }
  374. .icon_roundHook{
  375. width: 30upx;
  376. height: 30upx;
  377. position: absolute;
  378. right: 30upx;
  379. top: 0;
  380. bottom: 0;
  381. margin: auto 0;
  382. }
  383. .relativesBox{
  384. margin: 30upx;
  385. font-size: 30upx;
  386. font-weight: 600;
  387. }
  388. .relativesBox .icon_relatives{
  389. width: 42upx;
  390. height: 39upx;
  391. margin-right: 18upx;
  392. }
  393. .personallyBox{
  394. background-color: #fff;
  395. padding: 1upx 30upx;
  396. }
  397. .noPersonallyBox{
  398. border-radius: 0 0 24upx 24upx;
  399. padding-bottom: 20upx;
  400. }
  401. .personallyBox .moduleBox{
  402. height: 120upx;
  403. position: relative;
  404. border-radius: 24upx;
  405. overflow: hidden;
  406. padding: 0 24upx;
  407. }
  408. .personallyBox .bg{
  409. position: absolute;
  410. width: 100%;
  411. height: 100%;
  412. opacity: .2;
  413. left: 0;
  414. top: 0;
  415. }
  416. .personallyBox .moduleBox{
  417. font-size: 24upx;
  418. margin-bottom: 30upx;
  419. }
  420. .personallyBox .moduleInfo_txt{
  421. font-size: 28upx;
  422. font-weight: 600;
  423. margin-bottom: 8upx;
  424. }
  425. .personallyBox .moduleBox_btn{
  426. padding: 12upx 18upx;
  427. border-radius: 20upx;
  428. }
  429. </style>