%eG?d(h1DG)|1qvvXZJ(6-Mg54p^GQI|G?5Jyto!2C4e~J 4*6s7 z_QT)MLiw*AMWx` zBF@>`*v9E!KNi~RO4zDhzTLl{xmq6VERT9k?$NG#l);8ut0ZmQ_ge1Uq|oYSg~h2# z8SS%f`b>KCu(1tq{D9ez!S%^?_^q~$MT<2(##CFn9lwe-y$fut8z6R``~gefX}-O= zzVDN}zh URd_12{PJ3b#&?20{^KaE!i0x=I zpgtP!`M&q*KQA|L<#la2ig0@oYLz{Gi53t~W*dY(m6WI!kgs5iq8>#BN8PA=)Va{Y zp4kTJb)y3MWIk_=T$L;xrRra3V Pr^p@yo!lmLHe*`Au+3UdUt(hbLV3eY;! zWOd9fU`zXKCv$|&A`8$uP$ET|Ei<^>OE{*uiRI8^S|&qtTF{1c&&fi^@lCMDk+$2V zByVvO6B3wMNe1Ps3330NGfAM Ob5JNd&Pafh@FW0zAx%E5F_|0Lz4r`e9V)0r*dOQn^SVn zAcvac{ sM@*z7QXaXGXp5Lx=&U!BjkItPH-}}A( z-mZp#KmTIgzv5Oj-8qlnHEWu*G8MsuuFITlMZdexV%i}WE^4q_T_q~B!iGFTssY7d zTM2Z;+FSA1fE$WqQVA9EM;n_nY*ziv#nDpJQ8N|sOijzzlLe#QK#&ZF%i~rMz&CYZ z74fC^*lhV5%{G5<|2Kdw61E08VnUr1c>@`p*>aw~<8CoTVQrU=LA-ba$mYwHR`aV@ z_=du6AjbEV14-&!7f_?qBS?IVn4jXyMd5@h+7eO`YR})9R!|Q(M+{+8fDJ`y<-> zWT)m7yqpiz`(#z+!O+$jd~jrDioWVGkIq`j5XX*lehr-kNqw$BQjiv64p9E|N z+Ue0ppsqo$&dKukJJVOQ-iha);r%K-i0WK?0i1WDB274axTHB<9(ub44Yd_LYN~9Z z$NjtlytC?Is*c`?sdLWYcVd?*o5EW;3nt7|qVaO)tX&(}!(59Is!6R=2Y` zjGP&pD|*f7E0@P_J#qH${=9bD-S=UUUN7GF_BJo3E}p9?K1I>ev%n8G*XfRLCm3CO zH-A_hF~tP@kl(Ki(R<;@*;+tit!N4yPX~SBwfL$pr0z kJ+5v}SMqHerGu}XHRnfQBu2_&RIAc+0)pqF7e`wTEbnVt z*--OwjSS)Ug##2NFqV_OhScQc?~aFXHfEx*H6NZxVsE^ykKQ_`mBd-l*e2W}S~``E z!=K1l6*fLL0PXr06HG#=2<>6H!0ps=eR8z(N~(}Cf*5g9vby=++}`s=AFEU!7n?ek zmunSu ph23$AA(Y=d$)Ox 7Yc9iSD;LqmBh<9%0nmO<%~xC6{`P)8beDn)0NZHjz~y*x39JE`-jN zxT}&LUI8-#n}B8)s4Ysxpy-qx;=K!c7+RKVrpnuG8^t+hI@Qh`GYT4NZEpOz8pp_2 z6diqZT}YUHIejv{d_yZ0U0=!tmQl|oH8jSSo+iI^+7Ry`FvcWLy9SxA>%vmrC@bdM z$@U7Xq;us3Hg($Ky*{+BIj1+; wD)fz&@>NZ}=BpVqv<)Rr za@HXGl`zlVNSi1#b)bTO00x$rOVbkWR>E`H2JfEx`=*cI<|UK&CTwKPotc%S@^WDg zs81EFL4M}9t?ULbce*FkJ(yGMB#jC4Ge5-YBjbzzTmIrlPYLhSG<^m+pOPuBPU`zs z3pTnN1Lsq0wtH|UV{9cbc}*@PTU`mC)?c6BF2;yjnH)@49e`r-xBMH*`fio?j)$Qh zq(r~zYS@J?_N(6xQ0zuTw^)#hEUD4>AG5&-OvE$vo~?|?nrkAY2?4A(-T+$9LWIOQ zhNmqPuz@057fJhQLlR{=18@h0V5p;Ou&Nn9*vXyDGksm&T81hss!W+(S9XFghJ@bX zXgGkgq7d#O;^NC!BS}Ar4brDO!P3U-cmUEWR@}Sbz$cB-=tp2UX0GLonvYs<5J;B! zw+x<#aBt~DHDg$%(=V`=S-p(e!B=NIcWBs~goUR?O(aa}xu$oD_o%&%V`;bc3P^ZI zr{NEDblBOpPMZ;PoMZoj3!F9yoW}JECWZ9{wI?23VLf9rTMIHG7%#O6x5Vn`hhMJ@ zld`?c0+ b8{ zlw=`1_RwJ&Zo2m9PA!d!G@=YO(0X(T`+3TZjh?C%qi=%b;ivSl W|&*V%)Q zwZ+u$jRkWDT<|KbI_@nHuF#lEHIgi9)x#$8y!wvr=}pIL12obszT|d3?O-~R9tx-2 zn(X|L(#Dor8Br#zY!Ef=QCfI}P5dODR>$DF{ *OE4f&!w85TeHUD}O4ZHe$a;azZTiST}V|=EnB3_zV+aPwuN@ dsP-Kq#MEHn%fSHNgU%8vTvnMh?`rbd{ z(T9%uH=eYsYDJ9v@0900gK_ +WFtUWKGI)}{m4LvdpZMP z4D@=G_4VG{m0Tsa53^!=j9IJM#i1a`1EmfFSvojC;geceY6Hytzn;L*l^V`Yn~%Gf z#PG7-xsokh&VaQXPOVYiGz5X8dr1cjkGsi);?GVw01)Yr1KmVyDWq0uC2j^G^@}4k z>IB4Y!EM8#01M9 EOAun%2mzQNic+)^BHc*B2L1`H6KI9 z*GO7Dz4~mJDOuVzWowixnaTzsjdEKg8O3`%_cP`)2UhXv#-+)cfv1r+nQ%z605v(e znVrESw8t)CkMuFgm{7yDi`(;0CS$xm6&+-G7x*G>XbFm}k{Ie^k6+bK*Yn|^wiQP( z{4^IB(Y>$Rmi>O))$9QjvTi}iquSgVnHKpk-avpmmEMlii{te)6MYJMih!~f|BWOa zzld+VBx)9PPueKg6sL{xC)>^oNG}Pr^*UVF0SbKz&f_bw4WaD;Q#YK}cTp<|D-gVz zlo4*!*JGIxVamj)D|5ilK3wu4vrQSm+=Wd_(1vxq2z@B?0t-xc@&Z1D>kDZB!O?V^ z3^JjVI*Q2f6E7#O&*{cp0%rptJg%j^pDLH6G){9^OS1qI-CdEQ)}{hakN+kg zVS`H*v!wT;E& >AP9-A$qiPW{fetGz3lO4$?gQXGLT0OJ zt8S>76}vwn0zr|f{ntNluwZ$sh?|hIi0yn~(UROQo*}T;thE-!re-)EB-H)}%BFa- zez5rubaiW%hr|Hr@H`L#SiDYRjn>aG6gzk^6&G-!;*ZR4O%aW(2=YGMC7& &wvMEfA5p(Noh1Z5FF*wVH 6fGOu{#vX4}t}j#Oun za3(Af80a p1z~r0}iRT5LQmSyY-BD%a^30nxU$%ETf&X_k2y_?JSGdO%Bw29*Q*m zHqxZWIif=4j% mlvlYpxwRfjS;vJ`VjBj~lEb zAUl3L1X&b%4;&4P!@%qabCts&gHdNhh4ChGaInaT)DCasp0 51Wau_N-vPVg_~uc{%R+I z?eD&O @Ozl= zJQ;{7A>lwQ2uLI^?2dq(;x~Q#fbqZuNbZ3lefh t4`Pw?8SjATHL^h9X}U4kg2tBcTAnm zO F@o=+WA z=Ad)-r3YRn*zl->5hIL%Om%g@R-F4HnmZ&AiSzv&k~^Z6<(f )q=;^j_40yFTmo#4r#k`o{y;u)iqVf z&Twk|Te_>&UZfv1FV->qtuF4W7@pe!k&x4tU^cMfxoQT~!B9d9w4I6vNJWICQu%}= z92L|UhDoB`*sUR}pv!PHxiKNRC4q#g26eqc2f-m1d{4)|g?0@!#@w3j{sV>yh;6*M z)1jTf 777Vg3gqd#4Rw|LkoYszjDJvZE!e zDK4gG9$9A|IlC-9^x#lC?u}jbWec0D^Z=w))7_jGqRWT%`>Kk?#iW2UIO3EpW!7Nj z@~wdP1$r66z&Avk9*c76&J1euTV0iv@~--I;X_t$Vx%pAI8EoDEm5W-a!yd(q|a92 z7VgQBa4b#FuK-t^&9t1h*M1=JwaDK=f|WHR$N5*O!N&P2;=mHbKJ-5XFWb-Ri>bL; z^l5hlGPZanVi$H;!C^cba`QsI)H(dAzD*?+$3KPe*0D0&dj9Oj48|5XhzwL)Br}?v zGQKTQOB-6kN^*sx*$PzR+hbhBL15}0xQb~W$00D_w!R6Q?tWig5C#UEarPXEpzcu? zRHpn%E#1Mh0}4$#jlVP_-RHGTPLP=A7o3u&*Y3p7RxUyhN#oTzCQUHK6K}J7ZqZsI zF1gIQs%&NNc^6$(R>RX@)5jqIDT%3x@}hX|5aKm$X^ivAPDi>x 82i&M(j4*~MrSZW@b@*g*w8k+ zjf$NbRS6s6mx96|o(bWBCQf }=;XY5i zAU5bGDgcmKgu~Fb0T?!Z2_;9?=+bBC;50LUAlcHE8xb_v(5o9QEJ!(x)J;J($Xd4= z$(VE&?!iN~DP&EKhcn^Wi4%x$bX3dNKxZQlGu#d Pabw62SS)9W?>y*U3?`)mCpuB%Qy!cZd?SD6jhE#z#wZ zBER}>{0+8VL|Rdl1B?crw|5cveZ_VjMwNzNBmLJJL2QW6zXY~A!=I-@sTFTRT5t;= z-mCqV^~yD>!QLBQ4nv0KVGTa2>{#BMV@Nc)1>%224qWTy+G?iRQ+td`(hah1s9${f zFgX+!PXOo r;7K~O`NgSLH?(P~%c95J%ObpnzMDK;2f4L}J2aWOv zeM~Pz;{pn-+-31#k|!;wEVrYPE _L@kZ=7^ikvSe5WnnjmmDFYB~b+Wq-%HwWa`>ULgc-$oy=q=4R?sdXXWDTK_y z7>|`f65jk1|M)e;A)XH0=^UrSwq;XOEPL4OM;7Xz`I;gnW!0``yK<^_9~5mETQbm5 zN_Dowm@`AyYY|V)>z{^m&U}(3jz5)SXI8SxNh8RFaBiZa-~Td!b<=3xUM(ZB?rBD4 zXF>`_>f`*VOns(&rSxKTR!`Z1yM031+|L!>rT5ULL!%ig5a@c%Tr!=*>+c7R)tkfQ zcHwegZzTWaFK7`=Q{&Rn`g=g61G+-{lQW|OiLEvfrno_G4rZ_I UqfJw+*#kmVkY01*qA %M_OY*^T|_s4VsgChh`uMOo4$v zLU_v#w?oM=XUqV(y{L}&!F~8RGiB(WD{^eft@larGenB@d }ZWwioIplFqA#BZi`i-^mYiU#nm=xIrnQek`k z6==$y-*S}Hgx&&O@Y*5=Rf!y8uL>A`{DF65tWd~;jWQ%l=tX5ZNoiyc9IQ rLUu z;Ikuw_x#)`!e 3vtPbW-du2v5y*8LWk6QiHkym$k etOHU9h!)t`I-z8;@SEcJXlclOn^fFATx)}~k}p$i{#CJIE)@I?hhi#{cK6Aa zjU`+~!KsyrE~S9!*OsiZ6E-Oj!_m@=M5?O>Zfc-rWIr-Xh#U-HeIuqT^pk3n7E7jR z^Zv78>mqnU$ryYz@?OP}-o+>bmj1P(?c4F_o^rzVn%sOd8+xDX|85IkB8d z5g6PvNHTg7zbB` z9?adCK`>Tgaaf5z&*7+7}JsHd;6Doc>L}-yM|$II1FvGqm>!als7BX znMuL-b9;BzMNxad6R5z5y}+jk!^{20Xg)9TV<)jJhG0M98G(IwtXF93bdp)EWkcU^ z$gp9On_uCpoS5$sCsv(sUKPa=)lTCKkss9|%=p8MC#@n*(FT?BVrgq?0h9}kCK)*- zc+6e1kbAl=v#4g#@<`mE`Z3)8HvP1VHGxh0PC6J)zcCX+Cjtcq#VC8Rb;Qq5<6I}U z5vAihL^Jmhtn^s6z-D_RbJuzXt %S H(mErQ6XeG)D7ozidhUO z%{_%j$E+zmy-vg_e)#f&%dNclK92#N$!pXM$$y0{hoGs?5@b>VWpexvgmU_6FgyhX z4l6h(RvpUyG=~I3wN}|L%TFzy>yxvE()KeoR@K8NP5Rnzcu|DPiHcO)=<;Lmd-s~v ztZS-y&eL*PxD{YrGm$jn`Yu${A}-vSw<-R8`aIJ)Y@Q@@7(2Z?Byf$L{V~oQT;3&+ zn=IHJhZ0vmc k0?P4Zp+-B-8>zylX+{QGem}(>T((x_5Y#mc|z9mi0zU5$6 z^j|~9$HSb$2~=?jRK-e-^mUEfaQnN)oQ!W2Qm@os9wwYR!A?D-UTSTNge02jw&R`1 z^Ol;sSPl;3Z_mj7!fr1X=JpqoHx^Svb5hOoU^^)nrRz$X@p$DiZARU=qo>j_U=#q{ zaJ8pW(?Q~DQ+tfi)!<##0+ B|3H zyz)~}IsZez`@h?!iLH&3vc7@UziL}MRc3AG8Bn~%_V9_iZSCuvM$3$qRMA4w@$^DW z*_}1QSE4SQa @Pa`*R-#=tlBf5}oA4g9 zIIrooE00t;K~PS;FnKXeyNp#alA6@9j5Q-QxeAY5dLs!kFH$h$P|`wuA=nOM+xZ|} zF$Pc1b6D!&w&UA@sDLORsm9U|B9r#deOea*j-P6T(q(5} }~XJtTL^ zDWWW52NDi^97d~nOdbf42`v#J%OToKzX|T9=tb7XQmv*R4YMZ!kTaTkliap~8E`D$ zHt*-xYawt5z@Huf{+bSrzv5Bre+cR|+Fr2W3^iiZ)ouIq(m@+k83H8YQcu8OdUh%q zgkw-H!27v!@?tMDk42HQy~nfP&$J2F^BIbqlzj!w{sbG$8GhMca`L0Jv#26(DXw zZwTvv7>OX;0}vZ>bFhmVJ!`ND=>Yw1=58?)fEZv1k;ps4VFfd+hy(P2b>>CD#zAD* zwcB3a_wQY_GXT)!a-rYR`k|>U!TS}MCie8%THu9lAlfj-QVoe QF&3mBMKNT1|*)&I?}d2jh@t;>`O~#U?2h0ft!!7mCK1 zn1Qq&cfl^N?@lxQs?7-Az>RO_^`Xq|WONra!HqP;A?Ea$E&LYqtHnJFeiA(n$9v)k z_Wy0k|I6R~-^?jR^CJ25V@6tF005ky_FvTt|0Vc8Nm>8LzLOR||9cQ{9oXf+;z`T( znVT@unjly;=nXKa^DVE=v?f!!-4#wK3)I{BLbQUI_KI=o^1ROV=pWm*18XD!1?7!d zHpLFs6&4+=DnGEKx^xCQ7n$`0Tna=ah7a_){b -_ zY+zyNZ>5)nL g~7`! zbGk?8+yB4+9RHND$t-nKQ^T#Bb9gs1dLQswz9sg_o7!)a?rmmSyuoYAIj3`G4LL^p z_DP*JlQUR&Rjhbh&qe!!z9LSygl9GpQkpRaN|&-D3iO|}M= D@>o`rdR0#KuAouW%`*p=eyebn>XBEy zqI{pZ?Df4BvlfV|1PeY|ZLs9v)XA40*c1t!@>?!*vBY(uYJgkniYA^{y4nFNmwRvo zIzO+Oq#N7t`C+d6*H@c6McvZRrN7IKFf+7oso%BW)xPbqvA0U+x|w=AEP0%JYK^y< z)9r67WLEF}sPV$!+>t$hT;EsA%5;=m+$*%rsF-6({l|Wb2`?5^s|qBku>PrTH`^Jn znCJC_zfo
Glu&;dwl|m2zItXNeJ*>Pzw-mip0_lNRdIYWqoQLpP20D@i0zj650MY>^sGdYW zq6DNEVxKy)Ht2yR=&nUSN&}&LFEDAtErlJdfvz3>3ygYAAmfJJyJjg8U%o}ymCM(wa^`lUciAgLPAQ|5k(_Laffaa`pQ*=NiD$j ztYB9on}Mz!y^)8|KEnp89i_>Kt{=T`jnJQH4%Ls+(?-{izE2IIKNJ{@VCN(6T0_^4 ze*6SN`(9X_Ar7N}XeK81w1AsNz;?qnm!PI|^z9`GTZ2(GA~u@@c(a0YtswA}7y+Qu J9y^0H0RRi!yVd{z diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 4b04686c8..171f527da 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -97,6 +97,11 @@ + + PreserveNewest +true +PreserveNewest +diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index 3f1f494d5..dbb6e2d78 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -58,7 +58,7 @@ "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "CenterImageDev" + "ASPNETCORE_ENVIRONMENT": "Test_Study" }, "applicationUrl": "http://localhost:6100" } diff --git a/IRaCIS.Core.API/appsettings.Uat_Study.json b/IRaCIS.Core.API/appsettings.Uat_Study.json new file mode 100644 index 000000000..2f3ac31ff --- /dev/null +++ b/IRaCIS.Core.API/appsettings.Uat_Study.json @@ -0,0 +1,36 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + }, + "BasicSystemConfig": { + + "OpenUserComplexPassword": false, + + "OpenSignDocumentBeforeWork": false, + + "OpenTrialRelationDelete": true, + + "OpenLoginLimit": false, + "LoginMaxFailCount": 5, + + "LoginFailLockMinutes": 30 + + + }, + + "SystemEmailSendConfig": { + "Port": 465, + "Host": "smtp.qiye.aliyun.com", + "FromEmail": "test@extimaging.com", + "FromName": "Test_IRC", + "AuthorizationCode": "SHzyyl2021" + } + +} From 106cbfaccedda576b467555612d386182ba1479a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Aug 2023 11:35:44 +0800 Subject: [PATCH 08/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=8F=AF=E4=BC=A0=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingImageTaskViewModel.cs | 3 +-- .../ReadingImageTaskService.cs | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index b01c8e1ef..60cc90cc6 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1398,8 +1398,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid? SubjectId { get; set; } - [NotDefault] - public Guid TrialReadingCriterionId { get; set; } + public Guid? TrialReadingCriterionId { get; set; } public Guid? VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 8ed453112..69fafccdb 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2259,12 +2259,19 @@ namespace IRaCIS.Application.Services var trialReadingCriterionId = inDto.TrialReadingCriterionId; - var trialReadingCriterion= await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId); - //if (trialReadingCriterionId == null && inDto.VisitTaskId == null) - //{ - // throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); - //} + if (trialReadingCriterionId == null && inDto.VisitTaskId == null) + { + throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); + } + + if (inDto.VisitTaskId != null) + { + trialReadingCriterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(t => t.TrialReadingCriterionId).FirstOrDefaultAsync(); + } + + var trialReadingCriterion = await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId ?? Guid.Empty); + //看已阅的任务 if (inDto.VisitTaskId != null) @@ -2282,15 +2289,13 @@ namespace IRaCIS.Application.Services }).FirstOrDefaultAsync(); - trialReadingCriterionId = task.TrialReadingCriterionId; - } else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder) { var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto() { TrialId = inDto.TrialId, - TrialReadingCriterionId = trialReadingCriterionId, + TrialReadingCriterionId = trialReadingCriterionId.Value, Page = new PageInput() { PageIndex = 1, @@ -2357,11 +2362,11 @@ namespace IRaCIS.Application.Services // }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); #endregion - var taskQuery = await _visitTaskService.GetNotOrderReadingQueryableAsync(inDto.TrialId,(Guid) trialReadingCriterionId); + var taskQuery = await _visitTaskService.GetNotOrderReadingQueryableAsync(inDto.TrialId, (Guid)trialReadingCriterionId); var list = taskQuery.ToList(); - task = await taskQuery.OrderByDescending(t => t.TaskBlindName) + task = await taskQuery.OrderByDescending(t => t.TaskBlindName) .Select(x => new GetReadingTaskDto() { VisitTaskId = x.Id, @@ -2373,7 +2378,7 @@ namespace IRaCIS.Application.Services SubjectId = x.SubjectId, SubjectCode = x.Subject.Code, TrialReadingCriterionId = x.TrialReadingCriterionId, - }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); + }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); if (task != null) { From 7e518bf3ab25518c7cc065ac5c1f3d05956055a3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Aug 2023 14:53:07 +0800 Subject: [PATCH 09/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 18 +++++------------- .../Service/Common/ExcelExportService.cs | 1 - .../SiteSurvey/DTO/TrialSiteSurveyViewModel.cs | 1 - .../DTO/TrialSiteUserSurveyViewModel.cs | 4 +--- .../SiteSurvey/TrialSiteSurveyService.cs | 10 +++++----- .../SiteSurvey/TrialSiteUserSurveyService.cs | 1 - .../Service/SiteSurvey/_MapConfig.cs | 3 --- .../Service/TrialSiteUser/_MapConfig.cs | 1 - IRaCIS.Core.Domain/SQLFile/20220808.sql | 2 ++ .../SiteSurvey/TrialSiteUserSurvey.cs | 6 +++--- .../_IRaCIS/Output/ApiResponseCodeEnum.cs | 7 ------- 11 files changed, 16 insertions(+), 38 deletions(-) create mode 100644 IRaCIS.Core.Domain/SQLFile/20220808.sql diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5fd42050b..e666c4b8e 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9460,11 +9460,11 @@ Always - - 发送验证码 - - -+ + site 调研 发送验证码 + + +- @@ -9520,14 +9520,6 @@ - - 驳回 - - - -- - 提交 后台自动识别是谁提交 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 33cc8d6a6..ab17ac18a 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -155,7 +155,6 @@ namespace IRaCIS.Core.Application.Service.Common .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) - .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId) .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now) .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index c6cecba91..613550431 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -84,7 +84,6 @@ namespace IRaCIS.Core.Application.Contracts public bool? IsGenerateAccount { get; set; } - public Guid? TrialRoleNameId { get; set; } public TrialSiteUserStateEnum? State { get; set; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index f3e868457..949d7f0e7 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -48,9 +48,7 @@ namespace IRaCIS.Core.Application.Contracts } } - public string TrialRoleName { get; set; } - public string TrialRoleCode { get; set; } public UserTypeEnum? UserTypeEnum { get; set; } @@ -98,7 +96,7 @@ namespace IRaCIS.Core.Application.Contracts [DictionaryTranslateAttribute("YesOrNo")] public bool IsGenerateAccount { get; set; } - public Guid TrialRoleNameId { get; set; } + public int TrialRoleCode { get; set; } public string OrganizationName { get; set; } = string.Empty; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 9a9dbab04..da2aa69b1 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -263,7 +263,8 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); + var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true) + .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); if (currentLatest == null) { @@ -304,7 +305,7 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty); copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; }); - currentEntity = await _repository.AddAsync(copy); + currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); } @@ -448,7 +449,6 @@ namespace IRaCIS.Core.Application.Contracts .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) - .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId) .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) @@ -619,7 +619,7 @@ namespace IRaCIS.Core.Application.Contracts t.IsGenerateSuccess, t.UserTypeId, UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum, - t.TrialRoleName.Code, + t.TrialRoleCode, t.Email }).ToListAsync(); @@ -629,7 +629,7 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.Code == "1") || !currentUserList.Any(t => t.Code == "5")) + if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) { throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 248db3de0..5a375ecee 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -62,7 +62,6 @@ namespace IRaCIS.Core.Application.Contracts } } - } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 311a8fda6..51c756067 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -36,8 +36,6 @@ namespace IRaCIS.Core.Application.AutoMapper var isEn_Us = false; CreateMap () - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => isEn_Us? d.TrialRoleName.Value:d.TrialRoleName.ValueCN)) - .ForMember(t => t.TrialRoleCode, u => u.MapFrom(d => d.TrialRoleName.Code)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); @@ -70,7 +68,6 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap () .ForMember(t=>t.TrialSiteSurvey,u=>u.MapFrom(c=>c.TrialSiteSurvey)) - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 00a6a8be6..13bdab22a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -285,7 +285,6 @@ namespace IRaCIS.Core.Application.Service .ForMember(t => t.TrialSiteUserList, u => u.Ignore()); CreateMap () - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)) .ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode)) diff --git a/IRaCIS.Core.Domain/SQLFile/20220808.sql b/IRaCIS.Core.Domain/SQLFile/20220808.sql new file mode 100644 index 000000000..639ad02c0 --- /dev/null +++ b/IRaCIS.Core.Domain/SQLFile/20220808.sql @@ -0,0 +1,2 @@ + +update TrialSiteUserSurvey set TrialRoleCode= (select Code from Dictionary where Id=TrialSiteUserSurvey.TrialRoleNameId) \ No newline at end of file diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 9600b3c91..78ebde226 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs @@ -28,11 +28,11 @@ namespace IRaCIS.Core.Domain.Models public Guid? UserTypeId { get; set; } - public Guid TrialRoleNameId { get; set; } - - public Dictionary TrialRoleName { get; set; } + //public Guid TrialRoleNameId { get; set; } + //public Dictionary TrialRoleName { get; set; } + public int? TrialRoleCode { get; set; } /// diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs index 0fb88dff2..73b9597ae 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs @@ -23,17 +23,10 @@ namespace IRaCIS.Core.Infrastructure.Extention //程序异常 相当于之前的 IsSuccess = false ProgramException = 4, - - - //需要提示 ,需要提示 从Result 取数据 ( 0 可以继续处理提交 ,1 不能进行继续处理提交 ,2 刷新列表 ) NeedTips = 5, - - - - //在其他地方登陆,被迫下线 LoginInOtherPlace = -1, From ce3bfaeb5c263e3226e217a8d57404e3c906dbe9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 17:18:21 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_Study.json | 6 +- IRaCIS.Core.API/appsettings.Uat_Study.json | 6 +- .../DTO/TrialSiteSurveyViewModel.cs | 23 ++++++ .../SiteSurvey/TrialSiteSurveyService.cs | 26 +++++-- .../SiteSurvey/TrialSiteUserSurveyService.cs | 46 +++++++----- .../Service/SiteSurvey/_MapConfig.cs | 3 +- irc_api.drone.yml | 72 +++++++++++++++++++ 7 files changed, 152 insertions(+), 30 deletions(-) create mode 100644 irc_api.drone.yml diff --git a/IRaCIS.Core.API/appsettings.Test_Study.json b/IRaCIS.Core.API/appsettings.Test_Study.json index 8b87a0e23..6022d9a33 100644 --- a/IRaCIS.Core.API/appsettings.Test_Study.json +++ b/IRaCIS.Core.API/appsettings.Test_Study.json @@ -28,9 +28,9 @@ "SystemEmailSendConfig": { "Port": 465, "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" + "FromEmail": "test-study@extimaging.com", + "FromName": "Test_Study", + "AuthorizationCode": "zhanying123" } } diff --git a/IRaCIS.Core.API/appsettings.Uat_Study.json b/IRaCIS.Core.API/appsettings.Uat_Study.json index 2f3ac31ff..ba0d344bc 100644 --- a/IRaCIS.Core.API/appsettings.Uat_Study.json +++ b/IRaCIS.Core.API/appsettings.Uat_Study.json @@ -28,9 +28,9 @@ "SystemEmailSendConfig": { "Port": 465, "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" + "FromEmail": "uat-study@extimaging.com", + "FromName": "Uat_Study", + "AuthorizationCode": "zhanying123" } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index 613550431..bd658172b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -167,6 +167,29 @@ namespace IRaCIS.Core.Application.Contracts + } + + public class TrialSiteSurveySelectView + { + public Guid Id { get; set; } + public TrialSiteSurveyEnum State { get; set; } + public DateTime CreateTime { get; set; } + public bool IsDeleted { get; set; } + + public string Phone { get; set; } = string.Empty; + public string Email { get; set; } = string.Empty; + + public string UserName { get; set; } = string.Empty; + + } + + public class TrialSiteSurveySelectquery + { + public Guid TrialId { get; set; } + + public Guid SiteId { get; set; } + + public Guid TrialSiteSurveyId { get;set; } } /// TrialSiteSurveyQuery 列表查询参数模型 diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index da2aa69b1..dd8af2f8c 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -16,6 +16,7 @@ using MimeKit; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Infrastructure.Extention; +using Microsoft.VisualBasic; namespace IRaCIS.Core.Application.Contracts { @@ -293,6 +294,8 @@ namespace IRaCIS.Core.Application.Contracts copy.State = TrialSiteSurveyEnum.ToSubmit; copy.Email = userInfo.EmailOrPhone; + copy.Id = Guid.Empty; + copy.CreateTime = DateAndTime.Now; if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone) { @@ -301,19 +304,24 @@ namespace IRaCIS.Core.Application.Contracts } - copy.Id = Guid.Empty; - copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty); - copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; }); + + copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); + copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty;t.CreateTime = DateTime.Now; }); + + copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone(); + copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); + + } //删除验证码历史记录 await _repository.BatchDeleteAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); - await _repository.SaveChangesAsync(); + await _trialSiteSurveyRepository.SaveChangesAsync(); return ResponseOutput.Ok(new { @@ -428,6 +436,16 @@ namespace IRaCIS.Core.Application.Contracts return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc); } + [HttpPost] + public async Task > GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery) + { + var trialSiteSurveyQueryable = _trialSiteSurveyRepository + .Where(t=>t.Id!=inQuery.TrialSiteSurveyId) + .Where(t => t.TrialId == inQuery.TrialId && t.SiteId == inQuery.SiteId).IgnoreQueryFilters() + .ProjectTo
(_mapper.ConfigurationProvider); + + return await trialSiteSurveyQueryable.ToListAsync(); + } /// /// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 5a375ecee..0a98f5078 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -46,24 +46,7 @@ namespace IRaCIS.Core.Application.Contracts //---已锁定,不允许操作 return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]); } - - if (addOrEditTrialSiteUserSurvey.UserTypeId != null && ( _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)) - { - var existSysUser = await _repository.Where (t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d=>d.UserTypeRole).FirstOrDefaultAsync(); - - - if (existSysUser != null) - { - if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName) - { - //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存" - return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName,existSysUser.Phone], - new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone,existSysUser.IsTestUser,existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips); - } - - } - } - + if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { @@ -107,14 +90,39 @@ namespace IRaCIS.Core.Application.Contracts var verifyExp1 = new EntityVerifyExp () { - VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email, + VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email && u.TrialSiteSurveyId==addOrEditTrialSiteUserSurvey.TrialSiteSurveyId, VerifyMsg = "同一邮箱同一用户类型,生成账号的数据只允许存在一条!", IsVerify=addOrEditTrialSiteUserSurvey.IsGenerateAccount }; + if (addOrEditTrialSiteUserSurvey.UserTypeId != null) + { + var existSysUser = await _repository.Where (t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync(); + + + if (existSysUser != null) + { + if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName) + { + + + var optEntity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1); + + //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存" + return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone], + new { Id= optEntity.Id, existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsTestUser, existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips); + } + + } + } + + var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1); + + + return ResponseOutput.Ok(entity.Id.ToString()); } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 51c756067..974ecbfd3 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -33,7 +33,8 @@ namespace IRaCIS.Core.Application.AutoMapper .ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); - + CreateMap (); + var isEn_Us = false; CreateMap () .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) diff --git a/irc_api.drone.yml b/irc_api.drone.yml new file mode 100644 index 000000000..f90c72887 --- /dev/null +++ b/irc_api.drone.yml @@ -0,0 +1,72 @@ +kind: pipeline +type: docker +name: dotnet-core-app-test-study + +steps: + - name: docker-build + image: docker + pull: if-not-exists + volumes: + - name: dockersock + path: /var/run/docker.sock + - name: cached_nuget_packages + path: /drone/nuget_packages + commands: + - date +%H:%M:%S + - pwd + - docker build -t Test.Study . + - date +%H:%M:%S + + - name: docker-deploy + image: docker + pull: if-not-exists + depends_on: + - docker-build + volumes: + - name: dockersock + path: /var/run/docker.sock + commands: + - date +%H:%M:%S + - docker rm -f test-study-container + - docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test.Study + - date +%H:%M:%S + +volumes: + - name: cached_nuget_packages + host: + path: /mnt/f/docker_publish/nuget_packages + - name: dockersock + host: + path: /var/run/docker.sock + +trigger: + branch: + - Test.Study + +--- + + +kind: pipeline +type: ssh +name: default + +platform: + os: windows + arch: amd64 + +clone: + disable: true #禁用默认克隆 + +server: + host: 123.56.94.154 + user: Administrator + password: WHxckj2019 + +steps: +- name: test + commands: + - Start-Process -FilePath "C:\Users\Administrator\Desktop\win.bat" + +trigger: + branch: + - master \ No newline at end of file From 133120e8c0c147d06d29fae0e0c0b101abe58d30 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:05:48 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index f90c72887..04bc628f6 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -1,6 +1,6 @@ kind: pipeline type: docker -name: dotnet-core-app-test-study +name: irc-netcore-api steps: - name: docker-build @@ -41,14 +41,14 @@ volumes: trigger: branch: - - Test.Study + - master --- kind: pipeline type: ssh -name: default +name: ssh-windows-publish platform: os: windows @@ -65,8 +65,8 @@ server: steps: - name: test commands: - - Start-Process -FilePath "C:\Users\Administrator\Desktop\win.bat" + - Start-Process -FilePath "C:\CICD\Test.Study\netcore_Publish.bat" trigger: branch: - - master \ No newline at end of file + - Test.Study \ No newline at end of file From 08754b9a24f928e6a3f98d95587799b6b8ced986 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:15:25 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E5=B0=9D=E8=AF=95call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 04bc628f6..b6a3a310f 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -63,9 +63,9 @@ server: password: WHxckj2019 steps: -- name: test +- name: publish-test-study commands: - - Start-Process -FilePath "C:\CICD\Test.Study\netcore_Publish.bat" + - call "C:\CICD\Test.Study\netcore_Publish.bat" trigger: branch: From a7d41772f70b2d07858666fa9a12120541ea6c4e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:18:40 +0800 Subject: [PATCH 13/43] =?UTF-8?q?ps=20=E7=AD=89=E5=BE=85=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index b6a3a310f..4e449c79d 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -65,7 +65,7 @@ server: steps: - name: publish-test-study commands: - - call "C:\CICD\Test.Study\netcore_Publish.bat" + - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait trigger: branch: From 0a398bd712e20160ccd5c4207fbc4224102f7e95 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 10:56:39 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Test.IRC=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 4e449c79d..689c4c2bd 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -48,7 +48,7 @@ trigger: kind: pipeline type: ssh -name: ssh-windows-publish +name: ssh-windows-test-study-publish platform: os: windows @@ -69,4 +69,33 @@ steps: trigger: branch: - - Test.Study \ No newline at end of file + - Test.Study + + +--- + + +kind: pipeline +type: ssh +name: ssh-windows-test-irc-publish + +platform: + os: windows + arch: amd64 + +clone: + disable: true #禁用默认克隆 + +server: + host: 123.56.94.154 + user: Administrator + password: WHxckj2019 + +steps: +- name: publish-test-irc + commands: + - Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait + +trigger: + branch: + - Test.IRC \ No newline at end of file From d81fee17ba846ece752d2028f9b5cbe1834af02e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 11:36:28 +0800 Subject: [PATCH 15/43] =?UTF-8?q?bat=20=E6=89=A7=E8=A1=8C=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E5=88=86=20=E6=B5=8B=E8=AF=95=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 689c4c2bd..a8284defb 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -65,7 +65,11 @@ server: steps: - name: publish-test-study commands: + #拉取代码 并停止服务 - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait + - cd C:\CICD\Test.Study\netcore_repo + - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API + - Start-Service -Name "Test_Study_API" trigger: branch: From bf230924d74fdbca0a1fcd63095446240d190ed4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 11:52:33 +0800 Subject: [PATCH 16/43] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=8F=91=E5=B8=83=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index a8284defb..5a9d7c9e7 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -68,7 +68,8 @@ steps: #拉取代码 并停止服务 - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait - cd C:\CICD\Test.Study\netcore_repo - - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API + - dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages + - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API - Start-Service -Name "Test_Study_API" trigger: From 775927c484401e7c38371716e34373e337958377 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 13:54:36 +0800 Subject: [PATCH 17/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Test.Study?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_Study.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.API/appsettings.Test_Study.json b/IRaCIS.Core.API/appsettings.Test_Study.json index 6022d9a33..9e82384b7 100644 --- a/IRaCIS.Core.API/appsettings.Test_Study.json +++ b/IRaCIS.Core.API/appsettings.Test_Study.json @@ -7,7 +7,7 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=CenterImage_Test;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, "BasicSystemConfig": { From dcdf03ca8e0ec034d98f5d4358403e7576dcee3b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 16:40:01 +0800 Subject: [PATCH 18/43] x --- IRaCIS.Core.API/Test.cs | 99 ----------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 IRaCIS.Core.API/Test.cs diff --git a/IRaCIS.Core.API/Test.cs b/IRaCIS.Core.API/Test.cs deleted file mode 100644 index f7567c3ca..000000000 --- a/IRaCIS.Core.API/Test.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.EntityFrameworkCore; - -namespace EFSaving.Concurrency -{ - public class Sample - { - public static void Run() - { - // Ensure database is created and has a person in it - using (var setupContext = new PersonContext()) - { - setupContext.Database.EnsureDeleted(); - setupContext.Database.EnsureCreated(); - - setupContext.People.Add(new Person { FirstName = "John", LastName = "Doe" }); - setupContext.SaveChanges(); - } - - #region ConcurrencyHandlingCode - using var context = new PersonContext(); - // Fetch a person from database and change phone number - var person = context.People.Single(p => p.PersonId == 1); - person.PhoneNumber = "555-555-5555"; - - // Change the person's name in the database to simulate a concurrency conflict - context.Database.ExecuteSqlRaw( - "UPDATE dbo.People SET FirstName = 'Jane' WHERE PersonId = 1"); - - var saved = false; - while (!saved) - { - try - { - // Attempt to save changes to the database - context.SaveChanges(); - saved = true; - } - catch (DbUpdateConcurrencyException ex) - { - foreach (var entry in ex.Entries) - { - if (entry.Entity is Person) - { - var proposedValues = entry.CurrentValues; - var databaseValues = entry.GetDatabaseValues(); - - foreach (var property in proposedValues.Properties) - { - var proposedValue = proposedValues[property]; - var databaseValue = databaseValues[property]; - - // TODO: decide which value should be written to database - // proposedValues[property] = ; - } - - // Refresh original values to bypass next concurrency check - entry.OriginalValues.SetValues(databaseValues); - } - else - { - throw new NotSupportedException( - "Don't know how to handle concurrency conflicts for " - + entry.Metadata.Name); - } - } - } - } - #endregion - } - - public class PersonContext : DbContext - { - public DbSet People { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - // Requires NuGet package Microsoft.EntityFrameworkCore.SqlServer - optionsBuilder.UseSqlServer( - @"Server=(localdb)\mssqllocaldb;Database=EFSaving.Concurrency;Trusted_Connection=True"); - } - } - - public class Person - { - public int PersonId { get; set; } - - [ConcurrencyCheck] - public string FirstName { get; set; } - - [ConcurrencyCheck] - public string LastName { get; set; } - - public string PhoneNumber { get; set; } - } - } -} \ No newline at end of file From 5ae02e0d1f28616ae41affe47fa123ddc1f68478 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 16:56:22 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2trialId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/launchSettings.json | 24 ++++--------------- .../SiteSurvey/TrialSiteUserSurveyService.cs | 6 +++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index dbb6e2d78..a8d648f0a 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -30,31 +30,15 @@ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", "publishAllPorts": true }, - "IRaCIS.Staging": { + "Uat_Study": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Staging" + "ASPNETCORE_ENVIRONMENT": "Uat_Study" }, - "applicationUrl": "http://localhost:6200" + "applicationUrl": "http://localhost:6100" }, - "IRaCIS.Production": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" - }, - "applicationUrl": "http://localhost:6300" - }, - "IRaCIS.CertificateApply": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "CertificateApply" - }, - "applicationUrl": "http://localhost:6400" - }, - "IRaCIS.CenterImageDev": { + "Test_Study": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 0a98f5078..9d4bce551 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -18,10 +18,12 @@ namespace IRaCIS.Core.Application.Contracts public class TrialSiteUserSurveyService : BaseService, ITrialSiteUserSurveyService { private readonly IRepository _trialSiteUserSurveyRepository; + private readonly IRepository _trialSiteSurveyRepository; - public TrialSiteUserSurveyService(IRepository trialSiteUserSurveyRepository) + public TrialSiteUserSurveyService(IRepository trialSiteUserSurveyRepository, IRepository trialSiteSurveyRepository) { _trialSiteUserSurveyRepository = trialSiteUserSurveyRepository; + _trialSiteSurveyRepository = trialSiteSurveyRepository; } [HttpGet("{trialSiteSurveyId:guid}")] @@ -50,7 +52,7 @@ namespace IRaCIS.Core.Application.Contracts if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { - var trialId= _trialSiteUserSurveyRepository.Where(t=>t.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialSiteSurvey.TrialId).FirstOrDefault(); + var trialId= _trialSiteSurveyRepository.Where(t=>t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialId).FirstOrDefault(); var trialType = _repository.Where (t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); From f9274c8fda489cb1852fbcb9e240fca9b11862a4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 17:21:32 +0800 Subject: [PATCH 20/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E5=BA=9F=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index dd8af2f8c..fb75b1e3b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Contracts await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needGenerateList); //将历史锁定的调研表废弃 - await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock, z => new TrialSiteSurvey() { IsDeleted = true }); + await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id!= trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true }); } await _trialSiteSurveyRepository.SaveChangesAsync(); From c77cf1bf1eb93e2268b1280bb23989be433c180d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 17:44:10 +0800 Subject: [PATCH 21/43] =?UTF-8?q?=E5=BA=9F=E9=99=A4=E7=9A=84=E4=B9=9F?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0=E8=B0=83=E7=A0=94=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index fb75b1e3b..2273d8add 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -351,7 +351,7 @@ namespace IRaCIS.Core.Application.Contracts [HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")] public async Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId) { - var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId) + var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() .ProjectTo (_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); return result; From 33ef76ad9809a4ee780f35cfd52b0ba3a62d53b6 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 14 Aug 2023 17:48:44 +0800 Subject: [PATCH 22/43] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=95=8C=E9=9D=A2tab=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 2 +- .../Service/Management/UserTypeService.cs | 10 +++++++++- .../TrialSiteUser/DTO/TrialConfigDTO.cs | 19 +++++++++++++++++++ .../Service/TrialSiteUser/_MapConfig.cs | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 9defbfcbb..64556463d 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Services .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); - var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo (_mapper.ConfigurationProvider).FirstOrDefault(); + var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo (_mapper.ConfigurationProvider).FirstOrDefault(); //var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository diff --git a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs index c6aa10fd2..c6b5a168e 100644 --- a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs @@ -113,7 +113,15 @@ namespace IRaCIS.Core.Application.Contracts if (userTypeSelectEnum == UserTypeSelectEnum.ExternalUser) { - userTypeEnums = new List () { UserTypeEnum.PI, UserTypeEnum.MIM }; + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.TA) + { + userTypeEnums = new List () { UserTypeEnum.ProjectManager }; + } + else + { + userTypeEnums = new List () { UserTypeEnum.PI, UserTypeEnum.MIM }; + } + } if (userTypeSelectEnum == UserTypeSelectEnum.SiteSurvey) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs index 9da0f6e88..ba9cedd59 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs @@ -214,6 +214,25 @@ namespace IRaCIS.Core.Application.Contracts } + public class TrialConfigTabDto + { + public TrialQCProcess QCProcessEnum { get; set; } = TrialQCProcess.DoubleAudit; + + public bool IsImageConsistencyVerification { get; set; } = true; + + public bool IsMedicalReview { get; set; } + + + public bool IsEnrollementQualificationConfirm { get; set; } = false; + + + public bool IsPDProgressView { get; set; } + + public UserTypeEnum? EnrollConfirmDefaultUserType { get; set; } + + public UserTypeEnum? PDProgressDefaultUserType { get; set; } + } + public class TrialProcessConfigDTO { /// diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 13bdab22a..27f03fa41 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -22,8 +22,8 @@ namespace IRaCIS.Core.Application.Service CreateMap (); + CreateMap (); - CreateMap () .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.IsImageConsistencyVerification, u => u.MapFrom(s => s.Trial.IsImageConsistencyVerification)) From c04d3a3fe478b20e128d92b10062b4cbe7359b8c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 14 Aug 2023 18:24:45 +0800 Subject: [PATCH 23/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9PI=20=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 9bbeef1b5..80167909a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -255,6 +255,8 @@ namespace IRaCIS.Core.Application.Service.Allocation visitTask.LatestReplyUserId = _userInfo.Id; visitTask.LatestReplyTime = DateTime.Now; + visitTask.IsEnrollment = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsEnrollment; + visitTask.IsPDConfirm = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsPDConfirm; if (isFirstAudit) { From 5d2acf44c10b4e340868908cf1f94c0fc9b50f6f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 15 Aug 2023 15:25:18 +0800 Subject: [PATCH 24/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=20isJoin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/VisitTaskHelpeService.cs | 2 +- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 10 ++++++---- IRaCIS.Core.Application/TestService.cs | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index d5498f96f..548987b2b 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.Service public VisitTaskHelpeService(IRepository visitTaskRepository, IRepository trialRepository, IEasyCachingProvider provider, IRepository subjectVisitRepository, IRepository readModuleRepository, - IRepository readingTaskQuestionAnswerRepository, + IRepository readingTaskQuestionAnswerRepository, IRepository readingTableAnswerRowInfoRepository, IRepository readingTableQuestionAnswerRepository, IRepository readingTableQuestionTrialRepository, diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 2273d8add..784239717 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -729,17 +729,18 @@ namespace IRaCIS.Core.Application.Contracts sysUserInfo = newUser; + } + await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id }); + } + // //发送邮件的时候需要用到该字段 item.SystemUserId = sysUserInfo.Id; - await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id }); - - } await _trialSiteUserSurveyRepository.SaveChangesAsync(); @@ -784,10 +785,11 @@ namespace IRaCIS.Core.Application.Contracts await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); - + await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true }); } await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now }); + await _userRepository.SaveChangesAsync(); return ResponseOutput.Ok(); diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 54a486acc..a2b12a4da 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -2,6 +2,7 @@ using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; +using MassTransit; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; @@ -171,9 +172,19 @@ namespace IRaCIS.Application.Services [AllowAnonymous] - public async Task testwwwww([FromServices] IWebHostEnvironment env) + public async Task > testwwwww([FromServices] IWebHostEnvironment env) { - await Task.CompletedTask; + int count = 200; + + var list=new List
(); + + for (int i = 0; i < count; i++) + { + Guid guid = NewId.NextGuid(); + list.Add(guid); + } + + return list; } From 008f5203c0a63a545eef8065fa5d434e4903c5e4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 15 Aug 2023 16:40:36 +0800 Subject: [PATCH 25/43] =?UTF-8?q?=E5=A4=96=E9=83=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs | 2 +- IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs | 3 ++- IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 784239717..8a6ec6d21 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -669,7 +669,7 @@ namespace IRaCIS.Core.Application.Contracts //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 - var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsGenerateSuccess != true).ProjectTo (_mapper.ConfigurationProvider).ToList(); + var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true ).ProjectTo (_mapper.ConfigurationProvider).ToList(); await GenerateAccountAsync(needGenerateList, trialId); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs index ca5d4e631..69e0d5b83 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs @@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.ViewModel - + public UserTypeEnum? UserTypeEnum { get; set; } public DateTime? ExpireTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 27f03fa41..c8e56eebb 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -206,7 +206,8 @@ namespace IRaCIS.Core.Application.Service CreateMap ().ReverseMap(); CreateMap (); - CreateMap (); + CreateMap () + .ForMember(t=>t.UserTypeEnum,u=>u.MapFrom(c=>c.SystemUser.UserTypeEnum)); CreateMap ().ReverseMap(); diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs index 297b37279..148c6e53c 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs @@ -92,7 +92,8 @@ namespace IRaCIS.Core.Domain.Models public Guid SystemUserId { get; set; } - + [JsonIgnore] + public User SystemUser { get; set; } public bool IsJoin { get; set; } From 4bc2c3107a77becf76b3cd31531ceb66d4e26297 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 16 Aug 2023 13:10:51 +0800 Subject: [PATCH 26/43] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=85=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/SystemDocumentService.cs | 25 ++++++++++++++++--- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 4 +-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index fc4b1efa1..4d3003ad9 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Contracts; using User = IRaCIS.Core.Domain.Models.User; +using DocumentFormat.OpenXml.Office2010.Word; namespace IRaCIS.Core.Application.Services { @@ -19,14 +20,16 @@ namespace IRaCIS.Core.Application.Services private readonly IRepository _systemDocumentRepository; private readonly IRepository _systemDocNeedConfirmedUserTypeRepository; + private readonly IRepository _systemDocConfirmedUserRepository; public SystemDocumentService( IRepository systemDocumentRepository, - IRepository systemDocNeedConfirmedUserTypeRepository - ) + IRepository systemDocNeedConfirmedUserTypeRepository, + IRepository systemDocConfirmedUserRepository) { _systemDocumentRepository = systemDocumentRepository; this._systemDocNeedConfirmedUserTypeRepository = systemDocNeedConfirmedUserTypeRepository; - } + _systemDocConfirmedUserRepository = systemDocConfirmedUserRepository; + } @@ -109,6 +112,22 @@ namespace IRaCIS.Core.Application.Services } + [HttpDelete("{systemDocumentId:guid}")] + public async Task AbandonSystemDocumentAsync(Guid systemDocumentId) + { + + await _systemDocumentRepository.UpdatePartialFromQueryAsync(systemDocumentId, u => new SystemDocument() { IsDeleted = true }); + + await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedUser() + { + IsDeleted = true + }); + + await _systemDocConfirmedUserRepository.SaveChangesAsync(); + return ResponseOutput.Result(true); + } + + [HttpDelete("{systemDocumentId:guid}")] public async Task DeleteSystemDocumentAsync(Guid systemDocumentId) diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 1135e0088..263ac8f46 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -489,11 +489,11 @@ namespace IRaCIS.Core.Domain.Models /// /// PI不认同 /// - PIAgree = 1, + PINotAgree = 1, ////// PI认同 /// - PINotAgree = 2 + PIAgree = 2 } } From b9ccf4bb12f91646ca730b099ccc729bd73fca9a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 11:18:01 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E4=B8=AD=E5=BF=83=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 96 +++- .../Helper/FileStoreHelper.cs | 22 + .../IRaCIS.Core.Application.xml | 36 -- .../Service/Common/ExcelExportService.cs | 1 - .../DTO/TrialSiteUserSurveyViewModel.cs | 55 ++ .../Interface/ITrialSiteSurveyService.cs | 2 + .../Interface/ITrialSiteUserSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteSurveyService.cs | 256 ++++++++- .../SiteSurvey/TrialSiteUserSurveyService.cs | 12 +- .../Service/SiteSurvey/_MapConfig.cs | 21 + .../Interface/ITrialExternalUserService.cs | 1 - .../TrialSiteUser/TrialExternalUserService.cs | 530 ------------------ .../SiteSurvey/TrialSiteUserSurvey.cs | 14 +- IRaCIS.Core.Domain/_Config/_StaticData.cs | 2 + 14 files changed, 439 insertions(+), 611 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 9d2cb6003..7e2bd5d35 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -37,6 +37,7 @@ using Microsoft.Net.Http.Headers; using MiniExcelLibs; using Newtonsoft.Json; using SharpCompress.Archives; +using SharpCompress.Common; using System; using System.Collections.Generic; using System.Data; @@ -704,8 +705,8 @@ namespace IRaCIS.Core.API.Controllers { var subjectVisitId = incommand.SubjectVisitId; - var studyMonitorId=incommand.StudyMonitorId; - var noneDicomStudyId=incommand.NoneDicomStudyId; + var studyMonitorId = incommand.StudyMonitorId; + var noneDicomStudyId = incommand.NoneDicomStudyId; await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); @@ -936,6 +937,97 @@ namespace IRaCIS.Core.API.Controllers return ResponseOutput.Ok(); } + + + [HttpPost] + [UnitOfWork] + public async TaskUploadTrialSiteSurveyUser(Guid trialId, + [FromServices] IRepository _trialSiteRepository, + [FromServices] IRepository _usertypeRepository, + [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) + { + var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); + await FileUploadAsync(async (realFileName) => + { + fileName = realFileName; + + if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) + { + throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); + } + + (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); + + return serverFilePath; + }); + + //去掉空白行 + var excelList = MiniExcel.Query (serverFilePath).ToList() + .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName)) && string.IsNullOrWhiteSpace(t.Email) + && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName)); + + if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) + { + throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); + } + + var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim()).Distinct().ToList(); + + if (_trialSiteRepository.Where(t => siteCodeList.Contains(t.TrialSiteCode)).Count() != siteCodeList.Count) + { + throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); + } + + if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) + { + throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); + } + + if (excelList.Any(t => t.Email.Contains("@"))) + { + throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); + } + var generateUserTypeList = new List () { "CRC", "SR", "CRA" }; + + if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) + { + throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); + } + + //处理好 用户类型 和用户类型枚举 + var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); + var siteList= _trialSiteRepository.Where(t=>t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t=>new {t.TrialSiteCode,t.SiteId}).ToList(); + + foreach (var item in excelList) + { + switch (item.UserTypeStr.ToUpper()) + { + case "CRC": + + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; + item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; + break; + + case "CRA": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; + item.UserTypeEnum = UserTypeEnum.CRA; + break; + + case "SR": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; + item.UserTypeEnum = UserTypeEnum.SR; + break; + + } + + item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; + } + + await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, excelList.ToList()); + + return ResponseOutput.Ok(); + + } } diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index dbdd13cd4..cd9090ffb 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -292,6 +292,28 @@ public static class FileStoreHelper return (serverFilePath, relativePath); } + //获取 中心调研用户路径 + + public static (string PhysicalPath, string RelativePath) GetTrialSiteSurveyFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId) + { + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); + + //上传根路径 + string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), StaticData.Folder.UploadSiteSurveyData); + + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + + var (trustedFileNameForFileStorage, realFileName) = FileStoreHelper.GetStoreFileName(fileName); + + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{StaticData.Folder.UploadSiteSurveyData}/{trustedFileNameForFileStorage}"; + + var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + return (serverFilePath, relativePath); + } + public static (string PhysicalPath, string RelativePath, string FileRealName) GetClinicalTemplatePath(IWebHostEnvironment _hostEnvironment, string fileName,Guid trialId) { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index e666c4b8e..3ec98cf7f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -7741,42 +7741,6 @@ - -- 勾选用户 批量发送邮件 - -- - -- 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件 - - -- - -- 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId - - -- - -- 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId - - - -- - - 加入项目 - - - -- diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index ab17ac18a..abdba14f3 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -156,7 +156,6 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) - .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now) .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) .ProjectTo TaskAllocationRuleView 列表视图模型 (_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index 949d7f0e7..d2959bb4f 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -5,7 +5,9 @@ //-------------------------------------------------------------------- using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Domain.Share; +using MiniExcelLibs.Attributes; using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations; namespace IRaCIS.Core.Application.Contracts { @@ -54,6 +56,12 @@ namespace IRaCIS.Core.Application.Contracts public Guid? SystemUserId { get; set; } + + + + public bool? IsHistoryUserOriginDeleted { get; set; } + + } @@ -99,8 +107,17 @@ namespace IRaCIS.Core.Application.Contracts public int TrialRoleCode { get; set; } public string OrganizationName { get; set; } = string.Empty; + + public bool IsHistoryUser { get; set; } + public bool? IsHistoryUserDeleted { get; set; } } + public class TrialSiteUserSurverQuery + { + public Guid TrialSiteSurveyId { get; set; } + + public bool? IsHistoryUser { get; set; } + } public class TrialSiteUserSurveyVerfyResult { @@ -109,6 +126,44 @@ namespace IRaCIS.Core.Application.Contracts public List ErroMsgList { get; set; } = new List (); } + public class SiteSurveyUserImportUploadDto + { + [NotDefault] + public Guid TrialId { get; set; } + + public string BaseUrl { get; set; } + public string RouteUrl { get; set; } + } + + public class SiteSurveyUserImportDto + { + public string TrialSiteCode { get;set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Phone { get; set; } + public string OrganizationName { get; set; } + + [ExcelColumnName("UserType")] + public string UserTypeStr { get; set; } + + [JsonIgnore] + public Guid SiteId { get; set; } + + [JsonIgnore] + public UserTypeEnum UserTypeEnum { get; set; } = UserTypeEnum.Undefined; + + + [JsonIgnore] + public Guid UserTypeId{ get; set; } + + + [JsonIgnore] + public bool IsGeneratedAccount { get; set; } + [JsonIgnore] + public bool IsJoinedTrial { get; set; } + } + } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs index 6bc2fc3ec..61ee8a14e 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs @@ -20,5 +20,7 @@ namespace IRaCIS.Core.Application.Contracts //Task TrialSurveyLock(Guid trialSiteSurveyId, bool isLock); //IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId); Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService); + + Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs index 32942f1ac..10de23ac1 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs @@ -10,6 +10,6 @@ namespace IRaCIS.Core.Application.Contracts { Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey); Task DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId); - Task > GetTrialSiteUserSurveyList(Guid trialSiteSurveyId); + Task
> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 8a6ec6d21..ac7241796 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -17,6 +17,9 @@ using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Infrastructure.Extention; using Microsoft.VisualBasic; +using DocumentFormat.OpenXml.Spreadsheet; +using IRaCIS.Core.Domain.Models; +using IRaCIS.Core.Application.ViewModel; namespace IRaCIS.Core.Application.Contracts { @@ -31,13 +34,14 @@ namespace IRaCIS.Core.Application.Contracts private readonly IRepository
_userRepository; private readonly IRepository _trialSiteRepository; private readonly IRepository _trialUserRepository; + private readonly IRepository _trialSiteUserRepository; private readonly ITokenService _tokenService; private readonly IMailVerificationService _mailVerificationService; public TrialSiteSurveyService(IRepository trialSiteSurveyRepository, IRepository trialUserRepository, IRepository trialSiteUserSurveyRepository, IRepository userRepository, IRepository trialSiteRepository, ITokenService tokenService, - IMailVerificationService mailVerificationService) + IMailVerificationService mailVerificationService, IRepository trialSiteUserRepository) { _trialSiteSurveyRepository = trialSiteSurveyRepository; _trialSiteUserSurveyRepository = trialSiteUserSurveyRepository; @@ -46,6 +50,7 @@ namespace IRaCIS.Core.Application.Contracts _trialSiteRepository = trialSiteRepository; _tokenService = tokenService; _mailVerificationService = mailVerificationService; + _trialSiteUserRepository = trialSiteUserRepository; } private object lockObj { get; set; } = new object(); @@ -225,6 +230,9 @@ namespace IRaCIS.Core.Application.Contracts TrialSiteSurvey? currentEntity = null; + + var userList = await _trialSiteUserRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, false, true).ProjectTo (_mapper.ConfigurationProvider).ToListAsync(); + //普通登录 if (userInfo.IsUpdate == false) { @@ -235,8 +243,13 @@ namespace IRaCIS.Core.Application.Contracts //没有记录 new一份 if (dbEntityList.Count == 0) { + var addSurvey = _mapper.Map (userInfo); - currentEntity = await _repository.AddAsync(_mapper.Map (userInfo)); + + //从项目site 中找到已存在的 加到历史人员中 + addSurvey.TrialSiteUserSurveyList = userList; + + currentEntity = await _repository.AddAsync(addSurvey); } else @@ -254,6 +267,16 @@ namespace IRaCIS.Core.Application.Contracts currentEntity = currentLatest; + + if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock) + { + + + await UnlockSyncSiteUserAsync(userInfo.TrialId, userInfo.SiteId, currentEntity.Id, userList); + + } + + } @@ -306,14 +329,19 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); - copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty;t.CreateTime = DateTime.Now; }); + copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); - copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone(); + copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList(); copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); + //从项目site 中找到已存在的 加到历史人员中 + + + copy.TrialSiteUserSurveyList.AddRange(userList); + currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); - + } @@ -343,6 +371,29 @@ namespace IRaCIS.Core.Application.Contracts #endregion } + private async Task UnlockSyncSiteUserAsync(Guid trialId, Guid siteId, Guid trialSiteSurveyId, List userList) + { + var existList = await _trialSiteUserSurveyRepository.Where(t => t.IsHistoryUser && t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == siteId, true).ToListAsync(); + + foreach (var item in userList) + { + var find = existList.FirstOrDefault(t => t.SystemUserId == item.SystemUserId); + //不存在就加入 + if (find == null) + { + item.TrialSiteSurveyId = trialSiteSurveyId; + await _trialSiteUserSurveyRepository.AddAsync(item); + } + else + { + item.IsHistoryUserOriginDeleted = find.IsHistoryUserOriginDeleted; + + } + } + + await _trialSiteUserSurveyRepository.SaveChangesAsync(); + } + /// /// 直接查询相关所有数据 @@ -351,9 +402,22 @@ namespace IRaCIS.Core.Application.Contracts [HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")] public async Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId) { + + //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) + var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId); + + if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true) + { + var userList = await _trialSiteUserRepository.Where(t => t.TrialId == find.TrialId && t.SiteId == find.SiteId, false, true).ProjectTo (_mapper.ConfigurationProvider).ToListAsync(); + + + await UnlockSyncSiteUserAsync(find.TrialId, find.SiteId, find.Id, userList); + } + + + var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() .ProjectTo (_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); - return result; } @@ -440,7 +504,7 @@ namespace IRaCIS.Core.Application.Contracts public async Task > GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery) { var trialSiteSurveyQueryable = _trialSiteSurveyRepository - .Where(t=>t.Id!=inQuery.TrialSiteSurveyId) + .Where(t => t.Id != inQuery.TrialSiteSurveyId) .Where(t => t.TrialId == inQuery.TrialId && t.SiteId == inQuery.SiteId).IgnoreQueryFilters() .ProjectTo
(_mapper.ConfigurationProvider); @@ -667,18 +731,25 @@ namespace IRaCIS.Core.Application.Contracts else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { + var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo (_mapper.ConfigurationProvider).ToList(); //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 - var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true ).ProjectTo (_mapper.ConfigurationProvider).ToList(); - + var needGenerateList = allUserList.Where(t => t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true).ToList(); await GenerateAccountAsync(needGenerateList, trialId); - await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList }); - await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needGenerateList); + //新加入的 或者历史人员退出改为加入的 + var needSendEmailList = allUserList.Where(t => (t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true) || (t.IsHistoryUser == true && t.IsHistoryUserOriginDeleted == true && t.IsHistoryUserDeleted == false)).ToList(); + + await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needSendEmailList }); + + + var needQuitUserList = allUserList.Where(t => t.IsHistoryUser && t.IsHistoryUserOriginDeleted == false && t.IsHistoryUserDeleted == true).ToList(); + + await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needQuitUserList); //将历史锁定的调研表废弃 - await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id!= trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true }); + await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true }); } await _trialSiteSurveyRepository.SaveChangesAsync(); @@ -689,13 +760,14 @@ namespace IRaCIS.Core.Application.Contracts private async Task GenerateAccountAsync(List needGenerateList, Guid trialId) { + var trialType = _repository.Where (t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); + foreach (var item in needGenerateList) { //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - var trialType = _repository.Where (t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); if (sysUserInfo == null) { @@ -720,7 +792,6 @@ namespace IRaCIS.Core.Application.Contracts saveItem.UserTypeEnum = _repository.Where (t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - //saveItem.Password = MD5Helper.Md5(verificationCode.ToString()); var newUser = _userRepository.AddAsync(saveItem).Result; @@ -736,7 +807,6 @@ namespace IRaCIS.Core.Application.Contracts } - // //发送邮件的时候需要用到该字段 item.SystemUserId = sysUserInfo.Id; @@ -775,12 +845,30 @@ namespace IRaCIS.Core.Application.Contracts await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } + else + { + await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() + { + IsDeleted = false, + DeletedTime = null, + JoinTime = DateTime.Now, + }); + } + if (!await _repository.AnyAsync (t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } + else + { + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() + { + IsDeleted = false, + DeletedTime = null, + }); + } await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); @@ -789,7 +877,7 @@ namespace IRaCIS.Core.Application.Contracts } await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now }); - + await _userRepository.SaveChangesAsync(); return ResponseOutput.Ok(); @@ -800,23 +888,139 @@ namespace IRaCIS.Core.Application.Contracts private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List list) { - //跟踪查询该site下的所有的用户 - var siteUserList = await _repository.Where (t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync(); - foreach (var siteUser in siteUserList) + var userIdList = list.Select(t => t.SystemUserId).ToList(); + + + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), c => new TrialSiteUser() { - //当前中心用户 不在调研表存在,就将该人退出 - if (!list.Any(t => t.SystemUserId == siteUser.UserId)) - { - siteUser.IsDeleted = true; - siteUser.DeletedTime = DateTime.Now; - } + IsDeleted = true, + DeletedTime = DateTime.Now, + }); + + //var siteUserList = await _repository.Where (t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), true,true).ToListAsync(); + + + //foreach (var siteUser in siteUserList) + //{ + + // var find= list.FirstOrDefault(t => t.SystemUserId == siteUser.UserId); + // if(find != null) + // { + // siteUser.IsDeleted =(bool) find.IsHistoryUserDeleted; + // siteUser.DeletedTime = find.IsHistoryUserDeleted==true? DateTime.Now:null; + // } + //} + + + #region MyRegion + ////跟踪查询该site下的所有的用户 + //var siteUserList = await _repository.Where (t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync(); + + //foreach (var siteUser in siteUserList) + //{ + // //当前中心用户 不在调研表存在,就将该人退出 + // if (!list.Any(t => t.SystemUserId == siteUser.UserId)) + // { + // siteUser.IsDeleted = true; + // siteUser.DeletedTime = DateTime.Now; + // } + + //} + #endregion - } await _repository.SaveChangesAsync(); } + + public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list) + { + + + var trialType = _repository.Where (t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); + + //判断是否有系统账号 + foreach (var item in list) + { + //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 + var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); + + if (sysUserInfo == null) + { + + lock (lockObj) + { + var saveItem = _mapper.Map (item); + + + if (trialType == TrialType.NoneOfficial) + { + saveItem.IsTestUser = true; + } + + // 中心调研生成账号 都是外部的 + saveItem.IsZhiZhun = false; + saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; + + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); + + saveItem.UserName = saveItem.UserCode; + + var newUser = _userRepository.AddAsync(saveItem).Result; + + _ = _userRepository.SaveChangesAsync().Result; + + sysUserInfo = newUser; + + } + + item.IsGeneratedAccount = true; + + + } + + var userId = sysUserInfo.Id; + + + if (!await _trialUserRepository.AnyAsync(t=>t.TrialId==trialId && t.UserId== userId, true)) + { + await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); + } + else + { + await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() + { + IsDeleted = false, + DeletedTime = null, + JoinTime = DateTime.Now, + }); + } + + + if (!await _repository.AnyAsync (t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) + { + await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); + } + else + { + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() + { + IsDeleted = false, + DeletedTime = null, + }); + } + + } + + //判断是否加入到项目 + + + } + + } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 9d4bce551..326be7ed0 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -26,19 +26,19 @@ namespace IRaCIS.Core.Application.Contracts _trialSiteSurveyRepository = trialSiteSurveyRepository; } - [HttpGet("{trialSiteSurveyId:guid}")] - public async Task > GetTrialSiteUserSurveyList(Guid trialSiteSurveyId) + [HttpPost] + public async Task
> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery) { - var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) - //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.CRCSubmitted) - //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.SPMApproved) + var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == inquery.TrialSiteSurveyId) + .WhereIf(inquery.IsHistoryUser !=null, t => t.IsHistoryUser==inquery.IsHistoryUser) .ProjectTo
(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); return await trialSiteUserSurveyQueryable.ToListAsync(); } - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + + [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] [HttpPost("{trialId:guid}")] public async Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey) { diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 974ecbfd3..ea2453623 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -21,6 +21,23 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap ().ForMember(d => d.Email, t => t.MapFrom(t => t.EmailOrPhone)); + CreateMap () + .ForMember(d => d.Id, u => u.Ignore()) + .ForMember(d => d.Phone, u => u.MapFrom(c => c.User.Phone)) + .ForMember(d => d.Email, u => u.MapFrom(c => c.User.EMail)) + .ForMember(d => d.OrganizationName, u => u.MapFrom(c => c.User.OrganizationName)) + .ForMember(d => d.UserTypeId, u => u.MapFrom(c => c.User.UserTypeId)) + .ForMember(d => d.IsHistoryUser, u => u.MapFrom(c => true)) + .ForMember(d => d.IsHistoryUserOriginDeleted, u => u.MapFrom(c => c.IsDeleted)) + .ForMember(d => d.IsHistoryUserDeleted, u => u.MapFrom(c => c.IsDeleted)) + .ForMember(d => d.FirstName, u => u.MapFrom(c => c.User.FirstName)) + .ForMember(d => d.LastName, u => u.MapFrom(c => c.User.LastName)) + .ForMember(d => d.IsGenerateAccount, u => u.MapFrom(c => true)) + .ForMember(d => d.IsGenerateSuccess, u => u.MapFrom(c => true)) + .ForMember(d => d.SystemUserId, u => u.MapFrom(c => c.UserId)) + .ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted)); + + //列表 CreateMap () @@ -60,6 +77,10 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap (); + CreateMap () + .ForMember(d => d.EMail, u => u.MapFrom(s => s.Email)); + + CreateMap (); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs index 065aeea98..b3e671035 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs @@ -21,7 +21,6 @@ namespace IRaCIS.Core.Application.Interfaces Task DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId); - Task UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId); } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 94bb318c3..6bf00a16e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -281,535 +281,5 @@ namespace IRaCIS.Core.Application.Service - - - - #region 老版本流程 现在废弃 - - /// - /// 勾选用户 批量发送邮件 - /// - ///- [HttpPost] - public async Task SendInviteEmail(TrialExternalUserSendEmail sendEmail) - { - - var trialInfo = await _repository.FirstOrDefaultAsync (t => t.Id == sendEmail.TrialId); - - foreach (var userInfo in sendEmail.SendUsers) - { - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, userInfo.Email)); - //主题 - messageToSend.Subject = $"[{trialInfo.ResearchProgramNo}] 邀请"; - - //var baseApiUrl = sendEmail.BaseUrl.Remove(sendEmail.BaseUrl.IndexOf("#")) + "api"; - - var builder = new BodyBuilder(); - - var sysUserInfo = (await _userRepository.Where(t => t.Id == userInfo.SystemUserId).FirstOrDefaultAsync()).IfNullThrowException(); - - - builder.HtmlBody = @$" - -- "; - - - //< form action = '#' method = 'post' > - - // < button type = 'submit' style = 'margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;border:none;margin-bottom: 100px;cursor: pointer' > 查看并确认 button > - - // form > - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - smtp.MessageSent += (sender, args) => - { - - _ = _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.HasSend, ConfirmTime = null, RejectReason = String.Empty, ExpireTime = DateTime.Now.AddDays(7) }).Result; - - }; - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - - - } - - return ResponseOutput.Ok(); - - } - - - - - ///-櫭 -- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: --- { - //您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢! - _localizer["TrialExternalUser_IRCInvitation", trialInfo.ResearchProgramNo] - } - -- - - - - 查看并确认 - -- /// 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件 - /// - /// - ///- [AllowAnonymous] - public async Task TrialExternalUserJoinTrial(TrialExternalUserConfirm editTrialUserPreparation) - { - - var needUpdate = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == editTrialUserPreparation.Id); - - if (DateTime.Now > needUpdate.ExpireTime) - { - //---邀请加入时间已过期,重新被邀请后才可以进行确认操作 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]); - } - - _mapper.Map(editTrialUserPreparation, needUpdate); - - needUpdate.InviteState = editTrialUserPreparation.IsJoin == true ? TrialExternalUserStateEnum.UserConfirmed : TrialExternalUserStateEnum.UserReject; - - - var trialId = needUpdate.TrialId; - var userId = needUpdate.SystemUserId; - - //判断TrialUser中是否存在 不存在就插入 - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId)) - { - - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - } - - var success = await _trialExternalUseRepository.SaveChangesAsync(); - - - if (editTrialUserPreparation.IsJoin == true) - { - var trialInfo = await _repository.FirstOrDefaultAsync (t => t.Id == needUpdate.TrialId); - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email)); - //主题 - //$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息"; - messageToSend.Subject = _localizer["TrialExternalUser_AccountInfo", trialInfo.ResearchProgramNo]; - - var builder = new BodyBuilder(); - - - var sysUserInfo = (await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); - - int verificationCode = new Random().Next(100000, 1000000); - - if (sysUserInfo.IsFirstAdd) - { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, - u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) }); - } - - builder.HtmlBody = @$" - -- "; - - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); - - - } - return ResponseOutput.Ok(); - - //else - //{ - // builder.HtmlBody = @$" - //--- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: ---{ - // 您好,欢迎您参加项目 实验方案号:{trialInfo.ResearchProgramNo}IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下: - _localizer["TrialExternalUser_Welcome", trialInfo.ResearchProgramNo] - } - ---- -- -{ - // 项目编号: {trialInfo.TrialCode} - _localizer["TrialExternalUser_ProjectNumber", trialInfo.TrialCode] - } --- -{ - // 试验方案号: {trialInfo.ResearchProgramNo} - _localizer["TrialExternalUser_ExperimentPlanNumber", trialInfo.ResearchProgramNo] - } --- -{ - // 试验名称: {trialInfo.ExperimentName} - _localizer["TrialExternalUser_ExperimentName", trialInfo.ExperimentName] - } --- -{ - // 用户名: {sysUserInfo.UserName} - _localizer["TrialExternalUser_Username", sysUserInfo.UserName] - } --- - -{ - // 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")} - _localizer["TrialExternalUser_Password", verificationCode.ToString()] - } --- -{ - // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - _localizer["TrialExternalUser_Role", sysUserInfo.UserTypeRole.UserTypeShortName] - } --- 系统登录地址: {editTrialUserPreparation.BaseUrl} -{ - // 系统登录地址: {editTrialUserPreparation.BaseUrl} - _localizer["TrialExternalUser_LoginUrl", editTrialUserPreparation.BaseUrl] - } --- //- // "; - //} - - - - - - - } - - ///- //- //- // {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: - //- //- // 您好,您拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下: - //- //- //- //- // 项目编号: {trialInfo.TrialCode} - //- //- // 试验方案号: {trialInfo.ResearchProgramNo} - //- //- // 试验名称: {trialInfo.ExperimentName} - //- //- // 用户名: {sysUserInfo.UserName} - //- //- // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - //- //- /// 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId - /// - /// - ///- [AllowAnonymous] - public async Task TrialSiteSurveyUserJoinTrial(TrialExternalUserConfirm editInfo) - { - - var needUpdate = (await _trialSiteSurveyUserRepository.Where(t => t.Id == editInfo.Id, true).Include(t => t.TrialSiteSurvey).FirstOrDefaultAsync()).IfNullThrowException(); - - var revieweUser = await _userRepository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialSiteSurvey.ReviewerUserId); - - - if (DateTime.Now > needUpdate.ExpireTime) - { - //---邀请加入时间已过期,重新被邀请后才可以进行确认操作 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]); - } - - _mapper.Map(editInfo, needUpdate); - - needUpdate.InviteState = editInfo.IsJoin == true ? TrialSiteUserStateEnum.UserConfirmed : TrialSiteUserStateEnum.UserReject; - - - if (needUpdate.SystemUserId == null) - { - //---调研表系统用户Id 存储有问题 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_UserIdStorageProblem"]); - } - - var trialId = needUpdate.TrialSiteSurvey.TrialId; - var siteId = needUpdate.TrialSiteSurvey.SiteId; - var userId = (Guid)needUpdate.SystemUserId; - - - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId)) - { - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable }); - - - } - - var success = await _trialExternalUseRepository.SaveChangesAsync(); - - var trialInfo = await _repository.FirstOrDefaultAsync (t => t.Id == needUpdate.TrialSiteSurvey.TrialId); - - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, editInfo.IsJoin == true ? needUpdate.Email : revieweUser.EMail)); - //主题 - // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息"; - messageToSend.Subject = _localizer["TrialExternalUser_IRCAccountInfo", trialInfo.ResearchProgramNo]; - - - var builder = new BodyBuilder(); - - - var sysUserInfo = await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - int verificationCode = new Random().Next(100000, 1000000); - - if (sysUserInfo.IsFirstAdd) - { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, - u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) }); - } - - if (editInfo.IsJoin == true) - { - builder.HtmlBody = @$" - -- "; - - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - } - //else - //{ - - // builder.HtmlBody = @$" - //--- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: --- 您好,欢迎您参加项目 实验方案号: {trialInfo.ResearchProgramNo} IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下: ---- -- 项目编号: {trialInfo.TrialCode} --- 试验方案号: {trialInfo.ResearchProgramNo} --- 试验名称: {trialInfo.ExperimentName} --- 用户名: {sysUserInfo.UserName} --- 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")} --- 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} --- 系统登录地址: {editInfo.BaseUrl} --- //- // "; - - //} - - - - - - return ResponseOutput.Ok(); - - } - - - ///- //- //- // {revieweUser.LastName + "/" + revieweUser.FirstName}: - //- //- // 您好,{sysUserInfo.LastName + "/" + sysUserInfo.FirstName} 拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下: - //- //- //- //- // 项目编号: {trialInfo.TrialCode} - //- //- // 试验方案号: {trialInfo.ResearchProgramNo} - //- //- // 试验名称: {trialInfo.ExperimentName} - //- //- // 用户名: {sysUserInfo.UserName} - //- //- // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - //- //- // 拒绝原因: {editInfo.RejectReason} - //- //- /// 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId - /// - /// - /// - ///- [AllowAnonymous] - public async Task JoinBasicInfo(Guid id, bool isExternalUser) - { - if (isExternalUser) - { - return (await _trialExternalUseRepository.Where(t => t.Id == id) - .ProjectTo (_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - } - else - { - return (await _trialSiteSurveyUserRepository.Where(t => t.Id == id) - .ProjectTo (_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - } - - } - - - - - - /// - /// 加入项目 - /// - /// - /// - ///- [HttpGet("{trialId:guid}/{trialExternalUserId:guid}")] - [NonDynamicMethod] - public async Task UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId) - { - - var externalUser = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == trialExternalUserId); - - - //判断TrialUser中是否存在 不存在就插入 - if (!await _repository.AnyAsync (t => t.TrialId == trialId && t.UserId == externalUser.SystemUserId)) - { - await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = (Guid)externalUser.SystemUserId, JoinTime = DateTime.Now }); - - await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialExternalUserId, - u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed }); - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == externalUser.SystemUserId, u => new User() { Status = UserStateEnum.Enable }); - - await _userRepository.SaveChangesAsync(); - } - - - - return ResponseOutput.Ok(); - - - } - - #endregion - - - - - } } diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 78ebde226..b82f4f698 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs @@ -59,7 +59,6 @@ namespace IRaCIS.Core.Domain.Models [Required] public Guid UpdateUserId { get; set; } - public string UserName { get; set; } = string.Empty; /// /// Phone @@ -97,16 +96,15 @@ namespace IRaCIS.Core.Domain.Models public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent; - - #region 废弃 - public DateTime? ExpireTime { get; set; } - public bool IsJoin { get; set; } - public DateTime? ConfirmTime { get; set; } - public string RejectReason { get; set; } = string.Empty; - #endregion + public bool IsHistoryUser { get; set; } + + public bool? IsHistoryUserDeleted { get; set; } + + public bool? IsHistoryUserOriginDeleted { get; set; } + diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs index daf810d2b..68298ec64 100644 --- a/IRaCIS.Core.Domain/_Config/_StaticData.cs +++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs @@ -104,6 +104,8 @@ public static class StaticData public static readonly string UploadEDCData = "UploadEDCData"; + + public static readonly string UploadSiteSurveyData = "SiteSurveyData"; public static readonly string UploadFileFolder = "UploadFile"; } From 5e743b162de911f9743956a559f99b56a969df1e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 14:54:44 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 184 +++++++++--------- .../DTO/TrialSiteUserSurveyViewModel.cs | 12 +- .../Interface/ITrialSiteSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteSurveyService.cs | 33 ++-- .../Service/TrialSiteUser/TrialService.cs | 84 +------- 5 files changed, 124 insertions(+), 191 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 7e2bd5d35..6117602a2 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -938,96 +938,6 @@ namespace IRaCIS.Core.API.Controllers } - - [HttpPost] - [UnitOfWork] - public async Task UploadTrialSiteSurveyUser(Guid trialId, - [FromServices] IRepository _trialSiteRepository, - [FromServices] IRepository _usertypeRepository, - [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) - { - var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); - await FileUploadAsync(async (realFileName) => - { - fileName = realFileName; - - if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) - { - throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); - } - - (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); - - return serverFilePath; - }); - - //去掉空白行 - var excelList = MiniExcel.Query (serverFilePath).ToList() - .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName)) && string.IsNullOrWhiteSpace(t.Email) - && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName)); - - if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) - { - throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); - } - - var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim()).Distinct().ToList(); - - if (_trialSiteRepository.Where(t => siteCodeList.Contains(t.TrialSiteCode)).Count() != siteCodeList.Count) - { - throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); - } - - if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) - { - throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); - } - - if (excelList.Any(t => t.Email.Contains("@"))) - { - throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); - } - var generateUserTypeList = new List () { "CRC", "SR", "CRA" }; - - if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) - { - throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); - } - - //处理好 用户类型 和用户类型枚举 - var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); - var siteList= _trialSiteRepository.Where(t=>t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t=>new {t.TrialSiteCode,t.SiteId}).ToList(); - - foreach (var item in excelList) - { - switch (item.UserTypeStr.ToUpper()) - { - case "CRC": - - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; - item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; - break; - - case "CRA": - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; - item.UserTypeEnum = UserTypeEnum.CRA; - break; - - case "SR": - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; - item.UserTypeEnum = UserTypeEnum.SR; - break; - - } - - item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; - } - - await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, excelList.ToList()); - - return ResponseOutput.Ok(); - - } } @@ -1123,6 +1033,100 @@ namespace IRaCIS.Core.API.Controllers _userInfo = userInfo; } + + [HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")] + [DisableFormValueModelBinding] + [UnitOfWork] + public async Task UploadTrialSiteSurveyUser(Guid trialId, string baseUrl, string routeUrl, + [FromServices] IRepository _trialSiteRepository, + [FromServices] IRepository _usertypeRepository, + [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) + { + var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); + await FileUploadAsync(async (realFileName) => + { + fileName = realFileName; + + if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) + { + throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); + } + + (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); + + return serverFilePath; + }); + + //去掉空白行 + var excelList = MiniExcel.Query (serverFilePath).ToList() + .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName) && string.IsNullOrWhiteSpace(t.Email) + && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName))).ToList(); + + if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) + { + throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); + } + + var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim().ToUpper()).Distinct().ToList(); + + if (_trialSiteRepository.Where(t => t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode.ToUpper())).Count() != siteCodeList.Count) + { + throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); + } + + if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) + { + throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); + } + + if (excelList.Any(t => !t.Email.Contains("@"))) + { + throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); + } + var generateUserTypeList = new List () { "CRC", "SR", "CRA" }; + + if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) + { + throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); + } + + //处理好 用户类型 和用户类型枚举 + var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); + var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, t.SiteId }).ToList(); + + foreach (var item in excelList) + { + switch (item.UserTypeStr.ToUpper()) + { + case "CRC": + + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; + item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; + break; + + case "CRA": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; + item.UserTypeEnum = UserTypeEnum.CRA; + break; + + case "SR": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; + item.UserTypeEnum = UserTypeEnum.SR; + break; + + } + + item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; + } + + await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, excelList.ToList()); + + return ResponseOutput.Ok(); + + } + + + /// 缩略图 [AllowAnonymous] [HttpGet("Common/LocalFilePreview")] diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index d2959bb4f..d272c3cba 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -137,12 +137,12 @@ namespace IRaCIS.Core.Application.Contracts public class SiteSurveyUserImportDto { - public string TrialSiteCode { get;set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string Email { get; set; } - public string Phone { get; set; } - public string OrganizationName { get; set; } + public string TrialSiteCode { get;set; }=string.Empty; + public string FirstName { get; set; } = string.Empty; + public string LastName { get; set; } = string.Empty; + public string Email { get; set; } = string.Empty; + public string Phone { get; set; } = string.Empty; + public string OrganizationName { get; set; } = string.Empty; [ExcelColumnName("UserType")] public string UserTypeStr { get; set; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs index 61ee8a14e..52a6ba09a 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs @@ -21,6 +21,6 @@ namespace IRaCIS.Core.Application.Contracts //IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId); TaskVerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService); - Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list); + Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl,string rootUrl, List list); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index ac7241796..3e680e5a2 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -838,14 +838,16 @@ namespace IRaCIS.Core.Application.Contracts //判断TrialUser中是否存在 不存在就插入 - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) + + var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true); + if (findTrialUser==null) { await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } - else + else if(findTrialUser.IsDeleted==true) { await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() { @@ -853,13 +855,14 @@ namespace IRaCIS.Core.Application.Contracts DeletedTime = null, JoinTime = DateTime.Now, }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } if (!await _repository.AnyAsync (t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } else { @@ -935,7 +938,7 @@ namespace IRaCIS.Core.Application.Contracts - public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list) + public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List list) { @@ -977,18 +980,22 @@ namespace IRaCIS.Core.Application.Contracts } item.IsGeneratedAccount = true; - - + } var userId = sysUserInfo.Id; + var siteId = item.SiteId; - - if (!await _trialUserRepository.AnyAsync(t=>t.TrialId==trialId && t.UserId== userId, true)) + //判断是否加入到项目 + var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true); + if (findTrialUser == null) { await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); + } - else + else if (findTrialUser.IsDeleted == true) { await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() { @@ -996,6 +1003,8 @@ namespace IRaCIS.Core.Application.Contracts DeletedTime = null, JoinTime = DateTime.Now, }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); } @@ -1003,7 +1012,6 @@ namespace IRaCIS.Core.Application.Contracts { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } else { @@ -1014,9 +1022,12 @@ namespace IRaCIS.Core.Application.Contracts }); } + await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); + + await _trialSiteUserRepository.SaveChangesAsync(); + } - //判断是否加入到项目 } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 493e04861..0806cb981 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -280,52 +280,9 @@ namespace IRaCIS.Application.Services public async Task DeleteTrial(Guid trialId) { - - var trial = (await _trialRepository.FirstOrDefaultAsync(u => u.Id == trialId, true)).IfNullThrowException(); - - if (_verifyConfig.CurrentValue.OpenTrialRelationDelete) { - - #region 项目真删除废弃 - - //if (trial.VisitPlanConfirmed) - //{ - // return ResponseOutput.NotOk("Trial访视计划已经确认,无法删除"); - //} - - //if (await _repository.AnyAsync (u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial有医生入组或在入组流程中,无法删除"); - //} - - //if (await _repository.AnyAsync (u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial下面有Site,无法删除"); - //} - - ////PM 可以删除项目 仅仅在没有site 参与者只有他自己的时候 - //if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - //{ - // //参与者仅有他自己时,可以删除 - // if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1) - // { - - // var success1 = await _repository.BatchDeleteAsync (o => o.Id == trialId) || - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - - // return ResponseOutput.Result(success1); - // } - //} - - //if (await _repository.AnyAsync (u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial下面有参与者,无法删除"); - //} - #endregion - - + await _repository.BatchDeleteAsync (o => o.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync (o => o.TrialId == trialId); @@ -344,9 +301,6 @@ namespace IRaCIS.Application.Services - - - await _repository.BatchDeleteAsync (t => t.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync (t => t.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync (t => t.SubjectVisit.TrialId == trialId); @@ -438,7 +392,6 @@ namespace IRaCIS.Application.Services await _repository.BatchDeleteAsync (t => t.OriginalReReadingTask.TrialId == trialId); await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - await _repository.BatchDeleteAsync (t => t.TrialId == trialId); await _repository.BatchDeleteAsync (t => t.TrialId == trialId) ; return ResponseOutput.Ok(); @@ -454,41 +407,6 @@ namespace IRaCIS.Application.Services } - [AllowAnonymous] - [HttpDelete, Route("{trialId:guid}")] - public async Task DeleteTrialTaskData(Guid trialId) - { - - //await _repository.BatchDeleteAsync (t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId) || - - - - - //await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - - - // await _repository.BatchDeleteAsync (t => t.TaskMedicalReview.TrialId == trialId); - // await _repository.BatchDeleteAsync (t => t.TaskMedicalReview.TrialId == trialId); - - - // await _repository.BatchDeleteAsync (t => t.VisitTask.TrialId == trialId); - - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId) ; - - // await _repository.BatchDeleteAsync (t => t.VisitTask.TrialId == trialId); - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - - // await _repository.BatchDeleteAsync (t => t.OriginalReReadingTask.TrialId == trialId); - // await _repository.BatchDeleteAsync (t => t.TrialId == trialId); - - return ResponseOutput.Ok(); - } From 8ffe69d38e636301bb9c0914fab7d46c2497741c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:03:40 +0800 Subject: [PATCH 29/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=97=B6=E9=97=B4=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/TestService.cs | 84 +------------------------- 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index a2b12a4da..f0ccc199f 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -65,90 +65,12 @@ namespace IRaCIS.Application.Services return ResponseOutput.Ok(); } - + [AllowAnonymous] [UnitOfWork] public async Task Get() { - - //Expression > visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty; - - //var visitTaskIdQueryable = _visitTaskRepositoryy.Where(visitTaskLambda).Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id); - - //await _visitTaskRepositoryy.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() - //{ - // IsFrontTaskNeedSignButNotSign = true - //}); - - - //var a = ((Decimal)1.00).ToString().TrimEnd(new char[] { '.', '0' }); - //var b = ((Decimal)1.01).ToString().TrimEnd(new char[] { '.', '0' }); - //var c = ((Decimal)100).ToString().TrimEnd(new char[] { '.', '0' }); - //var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693"); - //var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694"); - - // var subjectList = new List () { Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693") , - // Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694") , - // Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391695") - // }; - - //string[] citys = new string[] { "广州", "深圳", "上海", "北京" }; - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][N:[CN:{item}]/0000000]")); - //} - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[N:[CN:{item}]/0000000]")); - //} - - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]")); - //} - - //var needAddVisitList = await _repository.Where (t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync(); - - - //await _repository.BatchUpdateAsync (t => t.Id == Guid.Empty, u => new VisitTask() - //{ - // SuggesteFinishedTime = u.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7), - - // Code = u.Code + 1 - //}); - - //var query = from item1 in _repository.Where () - // join item2 in _repository.Where () on item1.ValueType equals item2.ValueType - // select new - // { - // item1.ValueType, - // dd = item2.ValueType - // }; - - //var list2 = query.ToList(); - - //await Task.CompletedTask; - - //var list = await _repository.Where (t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")).ToListAsync(); - - ////await _repository.BatchDeleteAsync (t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")); - - //await _repository.AddRangeAsync(list, true); - - //await _repository.SaveChangesAsync(); - - //await _repository.BatchUpdateAsync (t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74") && t.EntityName== "ClinicalDataTrialSet", t => new DataInspection() { CreateTime= DateTime.Now.AddMonths(-2) } ); - - //await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now }); - - //await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now.AddMinutes(1) }); - - //var a = _userInfo.IsTestUser; - - //var list1 = await _repository.Where ().Select(t => t.TranslateValue(t.Value, t.ValueCN, true)).ToListAsync(); - //var list2 = await _repository.Where ().Select(t => t.TranslateValue(t.Value, t.ValueCN, false)).ToListAsync(); - - await _repository.SaveChangesAsync(); - return _userInfo.LocalIp; + + return "修改服务器时间自动发布测试"; } From 585b665b535bed31c2476f42ad39b531e7f54f0a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:17:06 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E7=BB=A7=E7=BB=ADtest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/TestService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index f0ccc199f..fb175609a 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -70,7 +70,7 @@ namespace IRaCIS.Application.Services public async Task Get() { - return "修改服务器时间自动发布测试"; + return "修改服务器时间自动发布测试--我又修改了"; } From d575d8ac7365a1477afbad289852e3973ee31436 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:59:11 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E6=8B=B7=E8=B4=9D=E6=95=B0=E6=8D=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 3e680e5a2..ffa1e5876 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -331,9 +331,13 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); - copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList(); - copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); - + //锁定了的话,就不拷贝 + if(currentLatest.State!= TrialSiteSurveyEnum.PMCreatedAndLock) + { + copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList(); + copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); + } + //从项目site 中找到已存在的 加到历史人员中 From c85bb7f22bcbfe11faa9f1597e8a5c8022c0335a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:21:34 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index ffa1e5876..0cb4dc7af 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -715,10 +715,10 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) - { - throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); - } + //if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) + //{ + // throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); + //} if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) || From d200f12fa85a03b4478761f959299214f7e0d805 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:42:05 +0800 Subject: [PATCH 33/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 0cb4dc7af..3931be3c6 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -390,8 +390,7 @@ namespace IRaCIS.Core.Application.Contracts } else { - item.IsHistoryUserOriginDeleted = find.IsHistoryUserOriginDeleted; - + find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; } } From 536e9ef262d1cd887f10e13c6ebf9c3db5b59fc0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:44:55 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 3931be3c6..dc8e1846c 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -391,6 +391,7 @@ namespace IRaCIS.Core.Application.Contracts else { find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; + find.IsHistoryUserDeleted = item.IsHistoryUserOriginDeleted; } } From aa343ade2ec92e53ce8d84cd18e1e3c512e4ff10 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 17:11:02 +0800 Subject: [PATCH 35/43] xx --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index dc8e1846c..f03880787 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -287,7 +287,7 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true) + var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId,true) .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); if (currentLatest == null) @@ -408,7 +408,7 @@ namespace IRaCIS.Core.Application.Contracts { //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) - var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId); + var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId,true); if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true) { From ea157cdb711e6239bb230818009d545e310ac75f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 18:07:34 +0800 Subject: [PATCH 36/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=92=8C=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 11 ++++++++++- .../Service/SiteSurvey/TrialSiteUserSurveyService.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index f03880787..a42337612 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -20,6 +20,7 @@ using Microsoft.VisualBasic; using DocumentFormat.OpenXml.Spreadsheet; using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.ViewModel; +using Dicom; namespace IRaCIS.Core.Application.Contracts { @@ -410,6 +411,7 @@ namespace IRaCIS.Core.Application.Contracts //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId,true); + if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true) { var userList = await _trialSiteUserRepository.Where(t => t.TrialId == find.TrialId && t.SiteId == find.SiteId, false, true).ProjectTo