InternalNetIntetface.cpp 171 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947
  1. #include "InternalNetIntetface.h"
  2. #include "Poco/Random.h"
  3. #include "Poco/Buffer.h"
  4. #include "Poco/Exception.h"
  5. #include "Poco/MD5Engine.h"
  6. #include "Poco/Util/IniFileConfiguration.h"
  7. #include "Poco/Timer.h"
  8. #include "Poco/AutoPtr.h"
  9. #include "Poco/Thread.h"
  10. #include "Poco/ThreadPool.h"
  11. #include "Poco/File.h"
  12. #include "Poco/StreamCopier.h"
  13. #include "Poco/UUIDGenerator.h"
  14. #include "Poco/Buffer.h"
  15. #include "Poco/HMACEngine.h"
  16. #include "Poco/SHA1Engine.h"
  17. #include "Poco/Crypto/Cipher.h"
  18. #include "Poco/Crypto/CipherFactory.h"
  19. #include "Poco/Crypto/CipherKey.h"
  20. #include <fstream>
  21. #include <sstream>
  22. #include "ErrorCode.h"
  23. #include "PhmsLogger.h"
  24. #include "Util.h"
  25. #include "UploadTimerCallback.h"
  26. #include "DownloadTimerCallback.h"
  27. #include "DownloadThreadCallback.h"
  28. #include "SessionIdManager.h"
  29. #include <vector>
  30. #include <map>
  31. using Poco::Random;
  32. using Poco::MD5Engine;
  33. using Poco::Exception;
  34. using Poco::DigestEngine;
  35. using Poco::Util::IniFileConfiguration;
  36. using Poco::Timer;
  37. using Poco::TimerCallback;
  38. using Poco::AutoPtr;
  39. using Poco::Thread;
  40. using Poco::ThreadPool;
  41. using Poco::File;
  42. using Poco::StreamCopier;
  43. using Poco::UUIDGenerator;
  44. using Poco::Buffer;
  45. using Poco::HMACEngine;
  46. using Poco::DigestEngine;
  47. using Poco::SHA1Engine;
  48. using Poco::Crypto::Cipher;
  49. using Poco::Crypto::CipherFactory;
  50. using Poco::Crypto::CipherKey;
  51. using namespace std;
  52. CInternalNetIntetface::CInternalNetIntetface(void):m_nSaveType(0)
  53. {
  54. m_pPhmsSession = new CPhmsSession;
  55. m_eventSocketAbort.reset();
  56. }
  57. CInternalNetIntetface::~CInternalNetIntetface(void)
  58. {
  59. delete m_pPhmsSession;
  60. }
  61. //Setter
  62. void CInternalNetIntetface::SetSaveType(int nSaveType)
  63. {
  64. this->m_nSaveType = nSaveType;
  65. }
  66. void CInternalNetIntetface::SetFilePath(string stringFilePath)
  67. {
  68. this->m_stringFilePath = stringFilePath;
  69. }
  70. void CInternalNetIntetface::SetSessionId(string stringSessionId)
  71. {
  72. m_pPhmsSession->SetSessionId(stringSessionId);
  73. }
  74. void CInternalNetIntetface::SetCommandType(EnumPhmsCommandType enumCommandType)
  75. {
  76. m_pPhmsSession->SetCommandType(enumCommandType);
  77. }
  78. void CInternalNetIntetface::SetGWSessionId(string stringSessionId)
  79. {
  80. m_pPhmsSession->SetGWSessionId(stringSessionId);
  81. }
  82. //Getter
  83. int CInternalNetIntetface::GetSaveType()
  84. {
  85. return m_nSaveType;
  86. }
  87. string CInternalNetIntetface::GetContent()
  88. {
  89. return m_stringContent;
  90. }
  91. string CInternalNetIntetface::GetSessionId()
  92. {
  93. return m_pPhmsSession->GetSessionId();
  94. }
  95. EnumPhmsCommandType CInternalNetIntetface::GetCommandType()
  96. {
  97. return m_pPhmsSession->GetCommandType();
  98. }
  99. string CInternalNetIntetface::GetIp()
  100. {
  101. return m_stringIp;
  102. }
  103. string CInternalNetIntetface::GetGWSessionId()
  104. {
  105. return m_pPhmsSession->GetGWSessionId();
  106. }
  107. int CInternalNetIntetface::LoadServerPathAndAlreadyUploadSize(string stringLocalIniPath, string& stringServerPath, string& stringAlreadyUploadSize)
  108. {
  109. int nRet = PHMS_SUCCESSFUL_RESULT;
  110. File fileUploadIniConfig(stringLocalIniPath, "gbk");
  111. if(!fileUploadIniConfig.exists())
  112. {
  113. try
  114. {
  115. fileUploadIniConfig.createFile();
  116. }
  117. catch(Exception& e)
  118. {
  119. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  120. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  121. return COMMON_FILE_OPEN_FAIL;
  122. }
  123. }
  124. AutoPtr<IniFileConfiguration> iniFile = new IniFileConfiguration(stringLocalIniPath, "gbk");
  125. //unsigned nAlreadyUploadSize = 0;
  126. stringServerPath = iniFile->getString("URI", "");
  127. if(stringServerPath.size() != 0)
  128. {
  129. this->SetSaveType(1);
  130. nRet = this->GetAlreadyUploadFileSize(stringServerPath);
  131. if(nRet != PHMS_SUCCESSFUL_RESULT)
  132. {
  133. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  134. return nRet;
  135. }
  136. stringAlreadyUploadSize = this->GetContent();
  137. return StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  138. }
  139. return PHMS_SUCCESSFUL_RESULT;
  140. }
  141. int CInternalNetIntetface::StoreServerPathAndAlreadyUploadSize(string stringLocalIniPath, string stringServerPath, string stringAlreadyUploadSize)
  142. {
  143. //IniFileConfiguration类只实现了load,未实现store,所以setXXXX函数只修改内存,不能保存到具体流(文件),所以不能用IniFileConfiguration.setString
  144. //iniFile->setString("URI", stringServerPath);
  145. //iniFile->setString("ALREADY_UPLOAD_SIZE", stringAlreadyUploadSize);
  146. ofstream oFstream;
  147. oFstream.exceptions(ios_base::failbit|ios_base::badbit);
  148. try
  149. {
  150. oFstream.open(stringLocalIniPath.c_str(), ios_base::binary|ios_base::trunc);
  151. oFstream.write("URI=", 4);
  152. oFstream.write(stringServerPath.c_str(), (std::streamsize)stringServerPath.size());
  153. oFstream.write("\n", 1);
  154. oFstream.write("ALREADY_UPLOAD_SIZE=", 20);
  155. oFstream.write(stringAlreadyUploadSize.c_str(), (std::streamsize)stringAlreadyUploadSize.size());
  156. oFstream.write("\n", 1);
  157. oFstream.close();
  158. }
  159. catch(ios::failure& e)
  160. {
  161. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  162. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  163. return COMMON_FILE_WRITE_FAIL;
  164. }
  165. return PHMS_SUCCESSFUL_RESULT;
  166. }
  167. int CInternalNetIntetface::GetOrder(unsigned long nTotalSize, unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string& stringOrder)
  168. {
  169. //获得stringOrder参数
  170. if(nAlreadyUploadSize==0 && nTotalSize==nThisTimeUploadSize)
  171. {
  172. stringOrder = "0";
  173. }
  174. if(nAlreadyUploadSize==0 && nTotalSize>nThisTimeUploadSize)
  175. {
  176. stringOrder = "1";
  177. }
  178. if(nAlreadyUploadSize>0 && nTotalSize>nAlreadyUploadSize+nThisTimeUploadSize)
  179. {
  180. stringOrder = "2";
  181. }
  182. if(nAlreadyUploadSize>0 && nTotalSize==nAlreadyUploadSize+nThisTimeUploadSize)
  183. {
  184. stringOrder = "3";
  185. }
  186. return PHMS_SUCCESSFUL_RESULT;
  187. }
  188. int CInternalNetIntetface::GetUploadSegmentInfo(int nSegmentCount, unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string stringLocalPath, vSegmentInfo& vSI)
  189. {
  190. //获得stringStart、stringEnd、stringMd5系列参数
  191. //****
  192. //注意:是取nAlreadyUploadSize+nThisTimeUploadSize部分中的三段,不是nThisTimeUploadSize中的三段,取nThisTimeUploadSize中三段的代码没删,注释了
  193. //****
  194. unsigned long nPerPartSize = 0;
  195. unsigned long nModeSize;
  196. // nPerPartSize = nThisTimeUploadSize/3;;//--------用于取nThisTimeUploadSize的三段
  197. // nModeSize = nThisTimeUploadSize%3;;//--------用于取nThisTimeUploadSize的三段
  198. nPerPartSize = (nAlreadyUploadSize+nThisTimeUploadSize)/3;
  199. nModeSize = (nAlreadyUploadSize+nThisTimeUploadSize)%3;
  200. string stringStartX;
  201. string stringEndX;
  202. string stringMd5X;
  203. //unsigned long nPartXEnd = nAlreadyUploadSize-1;//用于取nThisTimeUploadSize的三段
  204. unsigned long nPartXEnd = 0-1;
  205. unsigned long nPartXStart, nPartXSize, nRandomX, nStartX, nEndX;
  206. for(int i=0; i<nSegmentCount; i++)
  207. {
  208. //三段长度的分法:nPerPartSize, nPerPartSize, nPerPartSize+nModeSize
  209. nPartXStart = nPartXEnd+1;
  210. if(i == nSegmentCount-1)
  211. {
  212. //最后一段加模数
  213. nPartXEnd = nPartXStart+nPerPartSize+nModeSize-1;
  214. }
  215. else
  216. {
  217. nPartXEnd = nPartXStart+nPerPartSize-1;
  218. }
  219. nPartXSize = nPartXEnd-nPartXStart+1;
  220. //如果段长度大于1024,则随机取nStartX和nEndX;否则取段的全部
  221. if(nPartXSize > 1024)
  222. {
  223. Random random;
  224. random.seed();
  225. nRandomX = random.next(nPartXSize-1024+1);
  226. nStartX = nPartXStart+nRandomX;
  227. nEndX = nStartX+1024-1;
  228. }
  229. else
  230. {
  231. nStartX = nPartXStart;
  232. nEndX = nPartXEnd;
  233. }
  234. //计算md5
  235. char* bufSrcX = NULL;
  236. unsigned long nLengthX = nEndX-nStartX+1;
  237. bufSrcX = new char[nLengthX+1];
  238. memset(bufSrcX, 0, nLengthX+1);
  239. ifstream iFStreamX;
  240. iFStreamX.exceptions(ios::failbit|ios::badbit);
  241. try
  242. {
  243. //open函数默认文本打开,如果文本打开的话读到0就相当于eof了,所以指定ios_base::binary
  244. iFStreamX.open(stringLocalPath.c_str(), ios_base::binary|ios_base::in);
  245. iFStreamX.seekg(nStartX, std::ios_base::beg);
  246. //int nTempLengthX = 0;
  247. iFStreamX.read(bufSrcX, nLengthX);
  248. iFStreamX.close();
  249. }
  250. catch (ios::failure& e)
  251. {
  252. //写日志
  253. //int nReadCount = iFStreamX.gcount();
  254. delete bufSrcX;
  255. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  256. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_READ_FAIL), __FUNCTION__, __FILE__, __LINE__);
  257. return COMMON_FILE_READ_FAIL;
  258. }
  259. stringMd5X = CUtil::GetMd5(bufSrcX, nLengthX);
  260. delete bufSrcX;
  261. stringStartX = CUtil::ULongToString(nStartX);
  262. stringEndX = CUtil::ULongToString(nEndX);
  263. SEGMENT_INFO si;
  264. si.m_stringStart = stringStartX;
  265. si.m_stringEnd = stringEndX;
  266. si.m_stringMd5 = stringMd5X;
  267. vSI.insert(vSI.end(), si);
  268. }
  269. return PHMS_SUCCESSFUL_RESULT;
  270. }
  271. int CInternalNetIntetface::GenerateTempUploadFile(int nAlreadyUploadSize, int nThisTimeUploadSize, string stringLocalFilePath, string& stringTempUploadFilePath)
  272. {
  273. string stringUuid = UUIDGenerator::defaultGenerator().createOne().toString();
  274. stringTempUploadFilePath = stringLocalFilePath+"."+stringUuid;
  275. File fileTempUploadFile(stringTempUploadFilePath, "gbk");
  276. try
  277. {
  278. fileTempUploadFile.createFile();
  279. }
  280. catch(Exception& e)
  281. {
  282. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  283. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  284. return COMMON_FILE_OPEN_FAIL;
  285. }
  286. ifstream iFstream;
  287. ofstream oFstream;
  288. iFstream.exceptions(ios_base::eofbit|ios_base::failbit|ios_base::badbit);
  289. oFstream.exceptions(ios_base::failbit|ios_base::badbit);
  290. try
  291. {
  292. iFstream.open(stringLocalFilePath.c_str(), ios_base::binary);
  293. oFstream.open(stringTempUploadFilePath.c_str(), ios_base::binary|ios_base::trunc);
  294. iFstream.seekg(nAlreadyUploadSize, ios_base::beg);
  295. Buffer<char> bufFileContent(nThisTimeUploadSize);
  296. iFstream.read(bufFileContent.begin(), nThisTimeUploadSize);
  297. oFstream.write(bufFileContent.begin(), nThisTimeUploadSize);
  298. iFstream.close();
  299. oFstream.close();
  300. }
  301. catch(ios_base::failure& e)
  302. {
  303. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  304. if(iFstream.eof() || iFstream.fail() || iFstream.bad())
  305. {
  306. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_READ_FAIL), __FUNCTION__, __FILE__, __LINE__);
  307. return COMMON_FILE_READ_FAIL;
  308. }
  309. else
  310. {
  311. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  312. return COMMON_FILE_WRITE_FAIL;
  313. }
  314. }
  315. return PHMS_SUCCESSFUL_RESULT;
  316. }
  317. int CInternalNetIntetface::GetDownloadTempFileSize(string stringTempDirectory, int nThreadCount, unsigned long* pTempFileSize)
  318. {
  319. //创建目录,并扫描临时文件,获得每个临时文件的大小,以方便继续下载
  320. File fileDir(stringTempDirectory, "gbk");
  321. try
  322. {
  323. fileDir.createDirectory();
  324. }
  325. catch(const Exception& e)
  326. {
  327. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  328. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_CREATE_DIR_FAIL), __FUNCTION__, __FILE__, __LINE__);
  329. return COMMON_CREATE_DIR_FAIL;
  330. }
  331. vector<File> vTempFile;
  332. vector<File>::const_iterator iter;
  333. fileDir.list(vTempFile);
  334. unsigned int nThreadNum = 0;
  335. for(nThreadNum=0; nThreadNum<nThreadCount; nThreadNum++)
  336. {
  337. for(iter=vTempFile.begin(); iter!=vTempFile.end(); iter++)
  338. {
  339. if(iter->path().find("PHMS_TEMP_"+CUtil::UIntToString(nThreadNum)) != string::npos)
  340. {
  341. pTempFileSize[nThreadNum] = (unsigned long)iter->getSize();
  342. break;
  343. }
  344. }
  345. if(iter == vTempFile.end())
  346. {
  347. pTempFileSize[nThreadNum] = 0;
  348. }
  349. }
  350. return PHMS_SUCCESSFUL_RESULT;
  351. }
  352. int CInternalNetIntetface::DivideSegment(unsigned long nRemainFileSize, unsigned long nSegmentMaxSize, int& nThreadCount, unsigned long* pSegmentFileSize)
  353. {
  354. if(nRemainFileSize/(nSegmentMaxSize*nThreadCount) > 0)
  355. {
  356. for(int i=0; i<nThreadCount; i++)
  357. {
  358. pSegmentFileSize[i] = nSegmentMaxSize;
  359. }
  360. }
  361. else
  362. {
  363. //缺点:没有智能的判断文件过小不需要nThreadCount个线程
  364. //比如剩余2 bytes,要求3 Threads,程序也会创建两个线程(两个请求),去分别要一个字节。这种情况还是非常少见的,以后有时间再优化
  365. if(nRemainFileSize < nThreadCount)
  366. {
  367. //特殊情况,剩余文件size小于线程数
  368. for(int i=0; i<nRemainFileSize; i++)
  369. {
  370. pSegmentFileSize[i] = 1;
  371. }
  372. nThreadCount = nRemainFileSize;
  373. }
  374. else
  375. {
  376. //剩余文件size大于线程数,但小于nSegmentMaxSize*nThreadCount
  377. for(int i=0; i<nThreadCount-1; i++)
  378. {
  379. pSegmentFileSize[i] = nRemainFileSize/nThreadCount;
  380. }
  381. pSegmentFileSize[nThreadCount-1] = nRemainFileSize/nThreadCount + nRemainFileSize%nThreadCount;
  382. }
  383. }
  384. return PHMS_SUCCESSFUL_RESULT;
  385. }
  386. int CInternalNetIntetface::CombineSegmentFile(string stringLocalFile, string stringTempDirectory, int nThreadCount)
  387. {
  388. ifstream iFstream;
  389. ofstream oFstream;
  390. iFstream.exceptions(ios_base::goodbit);
  391. oFstream.exceptions(ios_base::eofbit|ios_base::failbit);
  392. File fileDir(stringTempDirectory, "gbk");
  393. try
  394. {
  395. oFstream.open(stringLocalFile.c_str(), ios_base::out|ios_base::app|ios_base::binary);
  396. for(int i=0; i<nThreadCount; i++)
  397. {
  398. string stringTempFile;
  399. stringTempFile = stringTempDirectory+"/"+"PHMS_TEMP_"+CUtil::UIntToString(i);
  400. iFstream.open(stringTempFile.c_str(), ios_base::in|ios_base::binary);
  401. StreamCopier::copyStream(iFstream, oFstream);
  402. iFstream.clear();//必须清状态,否则下次打开失败
  403. iFstream.close();
  404. File fileTempFile(stringTempFile, "gbk");
  405. fileTempFile.remove();
  406. }
  407. }
  408. catch(ios_base::failure& e)
  409. {
  410. //写日志
  411. //iFstream.close();
  412. //oFstream.close();
  413. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  414. CPhmsLogger::GetPhmsLogger()->WriteLog(stringLocalFile, __FUNCTION__, __FILE__, __LINE__);
  415. fileDir.remove(true);
  416. if(oFstream.bad())
  417. {
  418. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_COMBILE_FILE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  419. return COMMON_COMBILE_FILE_FAIL;
  420. }
  421. else
  422. {
  423. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_COMBILE_FILE_FAIL_BUT_CAN_RETRY), __FUNCTION__, __FILE__, __LINE__);
  424. return COMMON_COMBILE_FILE_FAIL_BUT_CAN_RETRY;
  425. }
  426. }
  427. oFstream.close();
  428. try
  429. {
  430. fileDir.remove(true);
  431. }
  432. catch(const Exception&)
  433. {
  434. //防止发生和下载定时器回调遍历文件夹冲突的情况下抛出异常,发生冲突即使删不掉也无所谓。
  435. //几率非常小,产生的后果影响也非常小(多一个空文件夹),所以就暂时不用互斥量控制了
  436. }
  437. return PHMS_SUCCESSFUL_RESULT;
  438. }
  439. int CInternalNetIntetface::Login(string stringRole, string stringUsername, string stringPassword, string stringLanguage, string stringToken, bool bMustSsl)
  440. {
  441. int nRet = PHMS_SUCCESSFUL_RESULT;
  442. m_pPhmsSession->SetSaveType(m_nSaveType);
  443. m_pPhmsSession->SetFilePath(m_stringFilePath);
  444. nRet = m_pPhmsSession->Login(stringRole, stringUsername, stringPassword, stringLanguage, stringToken, bMustSsl);
  445. if(nRet != PHMS_SUCCESSFUL_RESULT)
  446. {
  447. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  448. if(!m_eventSocketAbort.tryWait(500))
  449. {
  450. if(nRet==COMMON_SEND_FAIL || nRet==COMMON_SEND_TIMEOUT || nRet==COMMON_RECV_FAIL || nRet==COMMON_RECV_TIMEOUT)
  451. {
  452. m_pPhmsSession->SetUseIp(true);
  453. nRet = m_pPhmsSession->Login(stringRole, stringUsername, stringPassword, stringLanguage, stringToken, bMustSsl);
  454. m_pPhmsSession->SetUseIp(false);
  455. if(nRet != PHMS_SUCCESSFUL_RESULT)
  456. {
  457. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  458. return nRet;
  459. }
  460. else
  461. {
  462. if(m_nSaveType == 1)
  463. {
  464. m_stringContent = m_pPhmsSession->GetContent();
  465. }
  466. m_stringIp = m_pPhmsSession->GetIp();
  467. return PHMS_SUCCESSFUL_RESULT;
  468. }
  469. }
  470. }
  471. return nRet;
  472. }
  473. if(m_nSaveType == 1)
  474. {
  475. m_stringContent = m_pPhmsSession->GetContent();
  476. }
  477. m_stringIp = m_pPhmsSession->GetIp();
  478. return PHMS_SUCCESSFUL_RESULT;
  479. }
  480. int CInternalNetIntetface::MechineRegister(string stringCountry, string stringAreaId, string stringArea, string stringDevice, string stringSignature, string stringSerialnum)
  481. {
  482. int nRet = PHMS_SUCCESSFUL_RESULT;
  483. m_pPhmsSession->SetSaveType(m_nSaveType);
  484. m_pPhmsSession->SetFilePath(m_stringFilePath);
  485. nRet = m_pPhmsSession->MechineRegister(stringCountry, stringAreaId, stringArea, stringDevice, stringSignature, stringSerialnum);
  486. if(nRet != PHMS_SUCCESSFUL_RESULT)
  487. {
  488. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  489. return nRet;
  490. }
  491. if(m_nSaveType == 1)
  492. {
  493. m_stringContent = m_pPhmsSession->GetContent();
  494. }
  495. return PHMS_SUCCESSFUL_RESULT;
  496. }
  497. int CInternalNetIntetface::Logout()
  498. {
  499. int nRet = PHMS_SUCCESSFUL_RESULT;
  500. m_pPhmsSession->SetSaveType(m_nSaveType);
  501. m_pPhmsSession->SetFilePath(m_stringFilePath);
  502. nRet = m_pPhmsSession->Logout();
  503. if(nRet != PHMS_SUCCESSFUL_RESULT)
  504. {
  505. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  506. return nRet;
  507. }
  508. if(m_nSaveType == 1)
  509. {
  510. m_stringContent = m_pPhmsSession->GetContent();
  511. }
  512. return PHMS_SUCCESSFUL_RESULT;
  513. }
  514. int CInternalNetIntetface::SetDoctorSign(string stringFilePath)
  515. {
  516. int nRet = PHMS_SUCCESSFUL_RESULT;
  517. m_pPhmsSession->SetSaveType(m_nSaveType);
  518. m_pPhmsSession->SetFilePath(m_stringFilePath);
  519. string stringMd5;
  520. nRet = CUtil::GetMd5(stringFilePath, stringMd5);
  521. if(nRet != PHMS_SUCCESSFUL_RESULT)
  522. {
  523. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  524. return nRet;
  525. }
  526. nRet = m_pPhmsSession->SetDoctorSign(stringMd5, stringFilePath);
  527. if(nRet != PHMS_SUCCESSFUL_RESULT)
  528. {
  529. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  530. return nRet;
  531. }
  532. if(m_nSaveType == 1)
  533. {
  534. m_stringContent = m_pPhmsSession->GetContent();
  535. }
  536. return PHMS_SUCCESSFUL_RESULT;
  537. }
  538. int CInternalNetIntetface::SetDoctorPhoto(string stringFilePath)
  539. {
  540. int nRet = PHMS_SUCCESSFUL_RESULT;
  541. m_pPhmsSession->SetSaveType(m_nSaveType);
  542. m_pPhmsSession->SetFilePath(m_stringFilePath);
  543. string stringMd5;
  544. nRet = CUtil::GetMd5(stringFilePath, stringMd5);
  545. if(nRet != PHMS_SUCCESSFUL_RESULT)
  546. {
  547. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  548. return nRet;
  549. }
  550. nRet = m_pPhmsSession->SetDoctorPhoto(stringMd5, stringFilePath);
  551. if(nRet != PHMS_SUCCESSFUL_RESULT)
  552. {
  553. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  554. return nRet;
  555. }
  556. if(m_nSaveType == 1)
  557. {
  558. m_stringContent = m_pPhmsSession->GetContent();
  559. }
  560. return PHMS_SUCCESSFUL_RESULT;
  561. }
  562. int CInternalNetIntetface::ApplyNewCase(string stringName, string stringThirdId, string stringDataType, string stringDataTypeName, string stringNotes, string stringHospitalId,
  563. string stringHospitalName, string stringDoctorId, string stringDoctorName, string stringCheckTime, string stringOtherParam, string stringDeviceId, string stringDeviceName,
  564. string stringMd5, string stringCaseOrigin, string stringYzlb, string stringSex, string stringApplicationNo, string stringAutoMatic)
  565. {
  566. int nRet = PHMS_SUCCESSFUL_RESULT;
  567. m_pPhmsSession->SetSaveType(m_nSaveType);
  568. m_pPhmsSession->SetFilePath(m_stringFilePath);
  569. nRet = m_pPhmsSession->ApplyNewCase(stringName, stringThirdId, stringDataType, stringDataTypeName, stringNotes, stringHospitalId, stringHospitalName,
  570. stringDoctorId, stringDoctorName, stringCheckTime, stringOtherParam, stringDeviceId, stringDeviceName, stringMd5, stringCaseOrigin, stringYzlb, stringSex, stringApplicationNo, stringAutoMatic);
  571. if(nRet != PHMS_SUCCESSFUL_RESULT)
  572. {
  573. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  574. return nRet;
  575. }
  576. if(m_nSaveType == 1)
  577. {
  578. m_stringContent = m_pPhmsSession->GetContent();
  579. }
  580. return PHMS_SUCCESSFUL_RESULT;
  581. }
  582. int CInternalNetIntetface::UploadCaseSegment(string stringCaseId, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
  583. unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath)
  584. {
  585. //验证参数
  586. if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
  587. {
  588. //写日志
  589. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  590. return COMMON_PARAM_VALIDATE_FAIL;
  591. }
  592. int nRet = PHMS_SUCCESSFUL_RESULT;
  593. m_pPhmsSession->SetSaveType(m_nSaveType);
  594. m_pPhmsSession->SetFilePath(m_stringFilePath);
  595. //获得stringTotalSize参数
  596. string stringTotalSize;
  597. stringTotalSize = CUtil::ULongToString(nTotalSize);
  598. //获得stringOrder
  599. string stringOrder;
  600. this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
  601. //获得Start\End\Md5信息
  602. vSegmentInfo vSi;
  603. nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
  604. if(nRet != PHMS_SUCCESSFUL_RESULT)
  605. {
  606. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  607. return nRet;
  608. }
  609. string stringTempUploadFilePath;
  610. nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
  611. if(nRet != PHMS_SUCCESSFUL_RESULT)
  612. {
  613. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  614. return nRet;
  615. }
  616. nRet = m_pPhmsSession->UploadCaseSegment(stringCaseId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
  617. vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
  618. vSi[2].m_stringMd5, stringTempUploadFilePath);
  619. try
  620. {
  621. File fileTempUploadFile(stringTempUploadFilePath, "gbk");
  622. fileTempUploadFile.remove(false);
  623. }
  624. catch(const Exception&)
  625. {
  626. }
  627. if(nRet != PHMS_SUCCESSFUL_RESULT)
  628. {
  629. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  630. return nRet;
  631. }
  632. if(m_nSaveType == 1)
  633. {
  634. m_stringContent = m_pPhmsSession->GetContent();
  635. }
  636. return PHMS_SUCCESSFUL_RESULT;
  637. }
  638. int CInternalNetIntetface::CaseHoldPlace(string stringCaseId, string stringReceiverId)
  639. {
  640. int nRet = PHMS_SUCCESSFUL_RESULT;
  641. m_pPhmsSession->SetSaveType(m_nSaveType);
  642. m_pPhmsSession->SetFilePath(m_stringFilePath);
  643. nRet = m_pPhmsSession->CaseHoldPlace(stringCaseId, stringReceiverId);
  644. if(nRet != PHMS_SUCCESSFUL_RESULT)
  645. {
  646. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  647. return nRet;
  648. }
  649. if(m_nSaveType == 1)
  650. {
  651. m_stringContent = m_pPhmsSession->GetContent();
  652. }
  653. return PHMS_SUCCESSFUL_RESULT;
  654. }
  655. int CInternalNetIntetface::GetAutoDownloadCase(string stringCaseType,string stringSenderId,string stringCaseOrigin)
  656. {
  657. int nRet = PHMS_SUCCESSFUL_RESULT;
  658. m_pPhmsSession->SetSaveType(m_nSaveType);
  659. m_pPhmsSession->SetFilePath(m_stringFilePath);
  660. nRet = m_pPhmsSession->GetAutoDownloadCase( stringCaseType, stringSenderId, stringCaseOrigin);
  661. if(nRet != PHMS_SUCCESSFUL_RESULT)
  662. {
  663. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  664. return nRet;
  665. }
  666. if(m_nSaveType == 1)
  667. {
  668. m_stringContent = m_pPhmsSession->GetContent();
  669. }
  670. return PHMS_SUCCESSFUL_RESULT;
  671. }
  672. int CInternalNetIntetface::DownloadCaseBegin(string stringCaseId, string stringReceiverId)
  673. {
  674. int nRet = PHMS_SUCCESSFUL_RESULT;
  675. m_pPhmsSession->SetSaveType(m_nSaveType);
  676. m_pPhmsSession->SetFilePath(m_stringFilePath);
  677. nRet = m_pPhmsSession->DownloadCaseBegin(stringCaseId, stringReceiverId);
  678. if(nRet != PHMS_SUCCESSFUL_RESULT)
  679. {
  680. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  681. return nRet;
  682. }
  683. if(m_nSaveType == 1)
  684. {
  685. m_stringContent = m_pPhmsSession->GetContent();
  686. }
  687. return PHMS_SUCCESSFUL_RESULT;
  688. }
  689. int CInternalNetIntetface::DownloadFileSegment(string stringUri, unsigned long nBeginPos, unsigned long nEndPos)
  690. {
  691. int nRet = PHMS_SUCCESSFUL_RESULT;
  692. m_pPhmsSession->SetSaveType(m_nSaveType);
  693. m_pPhmsSession->SetFilePath(m_stringFilePath);
  694. string stringStart = CUtil::ULongToString(nBeginPos);
  695. string stringEnd = CUtil::ULongToString(nEndPos);
  696. nRet = m_pPhmsSession->DownloadFileSegment(stringUri, stringStart, stringEnd);
  697. if(nRet != PHMS_SUCCESSFUL_RESULT)
  698. {
  699. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  700. return nRet;
  701. }
  702. if(m_nSaveType == 1)
  703. {
  704. m_stringContent = m_pPhmsSession->GetContent();
  705. }
  706. return PHMS_SUCCESSFUL_RESULT;
  707. }
  708. int CInternalNetIntetface::DownloadCaseComplete(string stringCaseId, string stringReceiverId)
  709. {
  710. int nRet = PHMS_SUCCESSFUL_RESULT;
  711. m_pPhmsSession->SetSaveType(m_nSaveType);
  712. m_pPhmsSession->SetFilePath(m_stringFilePath);
  713. nRet = m_pPhmsSession->DownloadCaseComplete(stringCaseId, stringReceiverId);
  714. if(nRet != PHMS_SUCCESSFUL_RESULT)
  715. {
  716. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  717. return nRet;
  718. }
  719. if(m_nSaveType == 1)
  720. {
  721. m_stringContent = m_pPhmsSession->GetContent();
  722. }
  723. return PHMS_SUCCESSFUL_RESULT;
  724. }
  725. int CInternalNetIntetface::InvalidCase(string stringCaseId, string stringReceiverId, string stringReason)
  726. {
  727. int nRet = PHMS_SUCCESSFUL_RESULT;
  728. m_pPhmsSession->SetSaveType(m_nSaveType);
  729. m_pPhmsSession->SetFilePath(m_stringFilePath);
  730. nRet = m_pPhmsSession->InvalidCase(stringCaseId, stringReceiverId, stringReason);
  731. if(nRet != PHMS_SUCCESSFUL_RESULT)
  732. {
  733. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  734. return nRet;
  735. }
  736. if(m_nSaveType == 1)
  737. {
  738. m_stringContent = m_pPhmsSession->GetContent();
  739. }
  740. return PHMS_SUCCESSFUL_RESULT;
  741. }
  742. int CInternalNetIntetface::TransmitCase(string stringCaseId, string stringReceiverId, string stringForwardToH, string stringForwardToHospitalName,
  743. string stringForwardToD, string stringForwardToDoctorName)
  744. {
  745. int nRet = PHMS_SUCCESSFUL_RESULT;
  746. m_pPhmsSession->SetSaveType(m_nSaveType);
  747. m_pPhmsSession->SetFilePath(m_stringFilePath);
  748. nRet = m_pPhmsSession->TransmitCase(stringCaseId, stringReceiverId, stringForwardToH, stringForwardToHospitalName, stringForwardToD, stringForwardToDoctorName);
  749. if(nRet != PHMS_SUCCESSFUL_RESULT)
  750. {
  751. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  752. return nRet;
  753. }
  754. if(m_nSaveType == 1)
  755. {
  756. m_stringContent = m_pPhmsSession->GetContent();
  757. }
  758. return PHMS_SUCCESSFUL_RESULT;
  759. }
  760. int CInternalNetIntetface::RollbackCase(string stringCaseId, string stringReceiverId, string stringBackTo)
  761. {
  762. int nRet = PHMS_SUCCESSFUL_RESULT;
  763. m_pPhmsSession->SetSaveType(m_nSaveType);
  764. m_pPhmsSession->SetFilePath(m_stringFilePath);
  765. nRet = m_pPhmsSession->Rollback(stringCaseId, stringReceiverId, stringBackTo);
  766. if(nRet != PHMS_SUCCESSFUL_RESULT)
  767. {
  768. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  769. return nRet;
  770. }
  771. if(m_nSaveType == 1)
  772. {
  773. m_stringContent = m_pPhmsSession->GetContent();
  774. }
  775. return PHMS_SUCCESSFUL_RESULT;
  776. }
  777. int CInternalNetIntetface::GetHospitalListOfGroup(string stringHGroupId, string stringType, string stringCaseType, unsigned int nPageTo, unsigned int nPageSize)
  778. {
  779. int nRet = PHMS_SUCCESSFUL_RESULT;
  780. m_pPhmsSession->SetSaveType(m_nSaveType);
  781. m_pPhmsSession->SetFilePath(m_stringFilePath);
  782. string stringPageTo = CUtil::UIntToString(nPageTo);
  783. string stringPageSize = CUtil::UIntToString(nPageSize);
  784. nRet = m_pPhmsSession->GetHospitalListOfGroup(stringHGroupId, stringType, stringCaseType, stringPageTo, stringPageSize);
  785. if(nRet != PHMS_SUCCESSFUL_RESULT)
  786. {
  787. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  788. return nRet;
  789. }
  790. if(m_nSaveType == 1)
  791. {
  792. m_stringContent = m_pPhmsSession->GetContent();
  793. }
  794. return PHMS_SUCCESSFUL_RESULT;
  795. }
  796. int CInternalNetIntetface::GetDoctorListOfHospital(string stringHospitalId, string stringDoctorId, string stringCaseType, string stringDoctorType, unsigned int nPageTo, unsigned int nPageSize)
  797. {
  798. int nRet = PHMS_SUCCESSFUL_RESULT;
  799. m_pPhmsSession->SetSaveType(m_nSaveType);
  800. m_pPhmsSession->SetFilePath(m_stringFilePath);
  801. string stringPageTo = CUtil::UIntToString(nPageTo);
  802. string stringPageSize = CUtil::UIntToString(nPageSize);
  803. nRet = m_pPhmsSession->GetDoctorListOfHospital(stringHospitalId, stringDoctorId, stringCaseType, stringDoctorType, stringPageTo, stringPageSize);
  804. if(nRet != PHMS_SUCCESSFUL_RESULT)
  805. {
  806. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  807. return nRet;
  808. }
  809. if(m_nSaveType == 1)
  810. {
  811. m_stringContent = m_pPhmsSession->GetContent();
  812. }
  813. return PHMS_SUCCESSFUL_RESULT;
  814. }
  815. int CInternalNetIntetface::AnalyzeBegin(string stringCaseId, string stringReceiverId, string stringCaseType)
  816. {
  817. int nRet = PHMS_SUCCESSFUL_RESULT;
  818. m_pPhmsSession->SetSaveType(m_nSaveType);
  819. m_pPhmsSession->SetFilePath(m_stringFilePath);
  820. nRet = m_pPhmsSession->AnalyzeBegin(stringCaseId, stringReceiverId, stringCaseType);
  821. if(nRet != PHMS_SUCCESSFUL_RESULT)
  822. {
  823. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  824. return nRet;
  825. }
  826. if(m_nSaveType == 1)
  827. {
  828. m_stringContent = m_pPhmsSession->GetContent();
  829. }
  830. return PHMS_SUCCESSFUL_RESULT;
  831. }
  832. int CInternalNetIntetface::AnalyzeComplete(string stringCaseId, string stringReceiverId, string stringCaseType)
  833. {
  834. int nRet = PHMS_SUCCESSFUL_RESULT;
  835. m_pPhmsSession->SetSaveType(m_nSaveType);
  836. m_pPhmsSession->SetFilePath(m_stringFilePath);
  837. nRet = m_pPhmsSession->AnalyzeComplete(stringCaseId, stringReceiverId, stringCaseType);
  838. if(nRet != PHMS_SUCCESSFUL_RESULT)
  839. {
  840. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  841. return nRet;
  842. }
  843. if(m_nSaveType == 1)
  844. {
  845. m_stringContent = m_pPhmsSession->GetContent();
  846. }
  847. return PHMS_SUCCESSFUL_RESULT;
  848. }
  849. int CInternalNetIntetface::ApplyNewReport(string stringCaseId, string stringReceiverId, string stringDiagnosis, string stringMd5, string stringDigitalSign, string stringTimestampSign, string stringCaseType)
  850. {
  851. int nRet = PHMS_SUCCESSFUL_RESULT;
  852. m_pPhmsSession->SetSaveType(m_nSaveType);
  853. m_pPhmsSession->SetFilePath(m_stringFilePath);
  854. nRet = m_pPhmsSession->ApplyNewReport(stringCaseId, stringReceiverId, stringDiagnosis, stringMd5, stringDigitalSign, stringTimestampSign, stringCaseType);
  855. if(nRet != PHMS_SUCCESSFUL_RESULT)
  856. {
  857. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  858. return nRet;
  859. }
  860. if(m_nSaveType == 1)
  861. {
  862. m_stringContent = m_pPhmsSession->GetContent();
  863. }
  864. return PHMS_SUCCESSFUL_RESULT;
  865. }
  866. int CInternalNetIntetface::UploadReportSegment(string stringCaseId, string stringReceiverId, string stringCaseType, string stringReportId, unsigned long nTotalSize,
  867. unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath, string stringFileType)
  868. {
  869. //验证参数
  870. if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
  871. {
  872. //写日志
  873. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  874. return COMMON_PARAM_VALIDATE_FAIL;
  875. }
  876. int nRet = PHMS_SUCCESSFUL_RESULT;
  877. m_pPhmsSession->SetSaveType(m_nSaveType);
  878. m_pPhmsSession->SetFilePath(m_stringFilePath);
  879. //获得stringTotalSize参数
  880. string stringTotalSize;
  881. stringTotalSize = CUtil::ULongToString(nTotalSize);
  882. //获得stringOrder
  883. string stringOrder;
  884. this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
  885. //获得Start\End\Md5信息
  886. vSegmentInfo vSi;
  887. nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
  888. if(nRet != PHMS_SUCCESSFUL_RESULT)
  889. {
  890. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  891. return nRet;
  892. }
  893. string stringTempUploadFilePath;
  894. nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
  895. if(nRet != PHMS_SUCCESSFUL_RESULT)
  896. {
  897. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  898. return nRet;
  899. }
  900. nRet = m_pPhmsSession->UploadReportSegment(stringCaseId, stringReceiverId, stringCaseType, stringReportId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
  901. vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
  902. vSi[2].m_stringMd5, stringTempUploadFilePath, stringFileType);
  903. try
  904. {
  905. File fileTempUploadFile(stringTempUploadFilePath, "gbk");
  906. fileTempUploadFile.remove(false);
  907. }
  908. catch(const Exception&)
  909. {
  910. }
  911. if(nRet != PHMS_SUCCESSFUL_RESULT)
  912. {
  913. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  914. return nRet;
  915. }
  916. if(m_nSaveType == 1)
  917. {
  918. m_stringContent = m_pPhmsSession->GetContent();
  919. }
  920. return PHMS_SUCCESSFUL_RESULT;
  921. }
  922. int CInternalNetIntetface::DownloadReportBegin(string stringCaseId, string stringReportId)
  923. {
  924. int nRet = PHMS_SUCCESSFUL_RESULT;
  925. m_pPhmsSession->SetSaveType(m_nSaveType);
  926. m_pPhmsSession->SetFilePath(m_stringFilePath);
  927. nRet = m_pPhmsSession->DownloadReportBegin(stringCaseId, stringReportId);
  928. if(nRet != PHMS_SUCCESSFUL_RESULT)
  929. {
  930. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  931. return nRet;
  932. }
  933. if(m_nSaveType == 1)
  934. {
  935. m_stringContent = m_pPhmsSession->GetContent();
  936. }
  937. return PHMS_SUCCESSFUL_RESULT;
  938. }
  939. int CInternalNetIntetface::DownloadReportComplete(string stringCaseId, string stringReportId)
  940. {
  941. int nRet = PHMS_SUCCESSFUL_RESULT;
  942. m_pPhmsSession->SetSaveType(m_nSaveType);
  943. m_pPhmsSession->SetFilePath(m_stringFilePath);
  944. nRet = m_pPhmsSession->DownloadReportComplete(stringCaseId, stringReportId);
  945. if(nRet != PHMS_SUCCESSFUL_RESULT)
  946. {
  947. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  948. return nRet;
  949. }
  950. if(m_nSaveType == 1)
  951. {
  952. m_stringContent = m_pPhmsSession->GetContent();
  953. }
  954. return PHMS_SUCCESSFUL_RESULT;
  955. }
  956. int CInternalNetIntetface::GetAlreadyUploadFileSize(string stringUri)
  957. {
  958. int nRet = PHMS_SUCCESSFUL_RESULT;
  959. m_pPhmsSession->SetSaveType(m_nSaveType);
  960. m_pPhmsSession->SetFilePath(m_stringFilePath);
  961. nRet = m_pPhmsSession->GetAlreadyUploadFileSize(stringUri);
  962. if(nRet != PHMS_SUCCESSFUL_RESULT)
  963. {
  964. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  965. return nRet;
  966. }
  967. if(m_nSaveType == 1)
  968. {
  969. m_stringContent = m_pPhmsSession->GetContent();
  970. }
  971. return PHMS_SUCCESSFUL_RESULT;
  972. }
  973. int CInternalNetIntetface::GetReviewReportList(string stringReportStartDate, string stringReportEndDate,string stringReviewStartDate,
  974. string stringReviewEndDate, string stringReviewState, string stringCaseType, string stringPtName, string stringSenderId, string stringYzlb, string stringAId,
  975. string stringReviewerId, string stringReceiverId, string stringCaseId, unsigned int nPageTo, unsigned int nPageSize)
  976. {
  977. int nRet = PHMS_SUCCESSFUL_RESULT;
  978. m_pPhmsSession->SetSaveType(m_nSaveType);
  979. m_pPhmsSession->SetFilePath(m_stringFilePath);
  980. string stringPageTo = CUtil::UIntToString(nPageTo);
  981. string stringPageSize = CUtil::UIntToString(nPageSize);
  982. nRet = m_pPhmsSession->GetReviewReportList(stringReportStartDate, stringReportEndDate, stringReviewStartDate, stringReviewEndDate,
  983. stringReviewState, stringCaseType, stringPtName, stringSenderId, stringYzlb, stringAId, stringReviewerId, stringReceiverId, stringCaseId, stringPageTo, stringPageSize);
  984. if(nRet != PHMS_SUCCESSFUL_RESULT)
  985. {
  986. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  987. return nRet;
  988. }
  989. if(m_nSaveType == 1)
  990. {
  991. m_stringContent = m_pPhmsSession->GetContent();
  992. }
  993. return PHMS_SUCCESSFUL_RESULT;
  994. }
  995. int CInternalNetIntetface::ReviewReport(string stringReportKeyId, string stringReviewState, string stringPath, string stringDiagnostic,
  996. string stringDigitalSign, string stringTimeStampSign)
  997. {
  998. int nRet = PHMS_SUCCESSFUL_RESULT;
  999. m_pPhmsSession->SetSaveType(m_nSaveType);
  1000. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1001. nRet = m_pPhmsSession->ReviewReport(stringReportKeyId, stringReviewState, stringPath, stringDiagnostic, stringDigitalSign, stringTimeStampSign);
  1002. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1003. {
  1004. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1005. return nRet;
  1006. }
  1007. if(m_nSaveType == 1)
  1008. {
  1009. m_stringContent = m_pPhmsSession->GetContent();
  1010. }
  1011. return PHMS_SUCCESSFUL_RESULT;
  1012. }
  1013. int CInternalNetIntetface::GetReportStateOfCase(string stringCaseId)
  1014. {
  1015. int nRet = PHMS_SUCCESSFUL_RESULT;
  1016. m_pPhmsSession->SetSaveType(m_nSaveType);
  1017. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1018. nRet = m_pPhmsSession->GetReportStateOfCase(stringCaseId);
  1019. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1020. {
  1021. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1022. return nRet;
  1023. }
  1024. if(m_nSaveType == 1)
  1025. {
  1026. m_stringContent = m_pPhmsSession->GetContent();
  1027. }
  1028. return PHMS_SUCCESSFUL_RESULT;
  1029. }
  1030. int CInternalNetIntetface::GetCaseListOfDoctor(string stringCaseId, string stringCaseType, string stringCaseSource, string stringCaseState,
  1031. string stringPatientName, string stringSenderId, string stringReceiverId, string stringStartDate, string stringEndDate, string stringCheckStartDate,
  1032. string stringCheckEndDate, string stringSenderName, string stringDiagnostic, string stringCaseOrigin, string stringYzlb, string stringAId, string stringSex, string stringOrderBy,
  1033. string stringThirdId, string stringLang, string stringIsFullName, unsigned int nPageTo, unsigned int nPageSize)
  1034. {
  1035. int nRet = PHMS_SUCCESSFUL_RESULT;
  1036. m_pPhmsSession->SetSaveType(m_nSaveType);
  1037. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1038. string stringPageTo = CUtil::UIntToString(nPageTo);
  1039. string stringPageSize = CUtil::UIntToString(nPageSize);
  1040. nRet = m_pPhmsSession->GetCaseListOfDoctor(stringCaseId, stringCaseType, stringCaseSource, stringCaseState, stringPatientName,
  1041. stringSenderId, stringReceiverId, stringStartDate, stringEndDate, stringCheckStartDate, stringCheckEndDate, stringSenderName,
  1042. stringDiagnostic, stringCaseOrigin, stringYzlb, stringAId, stringSex, stringOrderBy, stringThirdId, stringLang, stringIsFullName, stringPageTo, stringPageSize);
  1043. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1044. {
  1045. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1046. return nRet;
  1047. }
  1048. if(m_nSaveType == 1)
  1049. {
  1050. m_stringContent = m_pPhmsSession->GetContent();
  1051. }
  1052. return PHMS_SUCCESSFUL_RESULT;
  1053. }
  1054. int CInternalNetIntetface::GetHospitalInfo(string stringHospitalId)
  1055. {
  1056. int nRet = PHMS_SUCCESSFUL_RESULT;
  1057. m_pPhmsSession->SetSaveType(m_nSaveType);
  1058. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1059. nRet = m_pPhmsSession->GetHospitalInfo(stringHospitalId);
  1060. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1061. {
  1062. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1063. return nRet;
  1064. }
  1065. if(m_nSaveType == 1)
  1066. {
  1067. m_stringContent = m_pPhmsSession->GetContent();
  1068. }
  1069. return PHMS_SUCCESSFUL_RESULT;
  1070. }
  1071. int CInternalNetIntetface::UploadIm(string stringSenderId, string stringSenderName, string stringReceiverId, string stringMsgDirection,
  1072. string stringMsgType, string stringMsgContent, string stringCaseId, string stringCaseType)
  1073. {
  1074. int nRet = PHMS_SUCCESSFUL_RESULT;
  1075. m_pPhmsSession->SetSaveType(m_nSaveType);
  1076. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1077. nRet = m_pPhmsSession->UploadIm(stringSenderId, stringSenderName, stringReceiverId, stringMsgDirection, stringMsgType, stringMsgContent,
  1078. stringCaseId, stringCaseType);
  1079. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1080. {
  1081. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1082. return nRet;
  1083. }
  1084. if(m_nSaveType == 1)
  1085. {
  1086. m_stringContent = m_pPhmsSession->GetContent();
  1087. }
  1088. return PHMS_SUCCESSFUL_RESULT;
  1089. }
  1090. int CInternalNetIntetface::GetImList(string stringSenderId, string stringCaseId, string stringCaseType, string stringMsgDirection,
  1091. string stringMsgType)
  1092. {
  1093. int nRet = PHMS_SUCCESSFUL_RESULT;
  1094. m_pPhmsSession->SetSaveType(m_nSaveType);
  1095. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1096. nRet = m_pPhmsSession->GetImList(stringSenderId, stringCaseId, stringCaseType, stringMsgDirection, stringMsgType);
  1097. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1098. {
  1099. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1100. return nRet;
  1101. }
  1102. if(m_nSaveType == 1)
  1103. {
  1104. m_stringContent = m_pPhmsSession->GetContent();
  1105. }
  1106. return PHMS_SUCCESSFUL_RESULT;
  1107. }
  1108. int CInternalNetIntetface::GetImList2(string stringNextId)
  1109. {
  1110. int nRet = PHMS_SUCCESSFUL_RESULT;
  1111. m_pPhmsSession->SetSaveType(m_nSaveType);
  1112. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1113. nRet = m_pPhmsSession->GetImList2(stringNextId);
  1114. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1115. {
  1116. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1117. return nRet;
  1118. }
  1119. if(m_nSaveType == 1)
  1120. {
  1121. m_stringContent = m_pPhmsSession->GetContent();
  1122. }
  1123. return PHMS_SUCCESSFUL_RESULT;
  1124. }
  1125. int CInternalNetIntetface::DownloadImComplete(string stringMsgId)
  1126. {
  1127. int nRet = PHMS_SUCCESSFUL_RESULT;
  1128. m_pPhmsSession->SetSaveType(m_nSaveType);
  1129. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1130. nRet = m_pPhmsSession->ImDownloadComplete(stringMsgId);
  1131. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1132. {
  1133. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1134. return nRet;
  1135. }
  1136. if(m_nSaveType == 1)
  1137. {
  1138. m_stringContent = m_pPhmsSession->GetContent();
  1139. }
  1140. return PHMS_SUCCESSFUL_RESULT;
  1141. }
  1142. int CInternalNetIntetface::SendPhoneMsg (string stringCardId, string stringPhoneNum, string stringMsg)
  1143. {
  1144. int nRet = PHMS_SUCCESSFUL_RESULT;
  1145. m_pPhmsSession->SetSaveType(m_nSaveType);
  1146. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1147. nRet = m_pPhmsSession->SendPhoneMsg(stringCardId, stringPhoneNum, stringMsg);
  1148. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1149. {
  1150. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1151. return nRet;
  1152. }
  1153. if(m_nSaveType == 1)
  1154. {
  1155. m_stringContent = m_pPhmsSession->GetContent();
  1156. }
  1157. return PHMS_SUCCESSFUL_RESULT;
  1158. }
  1159. int CInternalNetIntetface::UploadTrendData(string stringCardId, string stringDeviceId, string stringDeviceName, string stringCaseId, vector<RECORD_DATA> vRecordData)
  1160. {
  1161. int nRet = PHMS_SUCCESSFUL_RESULT;
  1162. m_pPhmsSession->SetSaveType(m_nSaveType);
  1163. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1164. nRet = m_pPhmsSession->UploadTrendData(stringCardId, stringDeviceId, stringDeviceName, stringCaseId, vRecordData);
  1165. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1166. {
  1167. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1168. return nRet;
  1169. }
  1170. if(m_nSaveType == 1)
  1171. {
  1172. m_stringContent = m_pPhmsSession->GetContent();
  1173. }
  1174. return PHMS_SUCCESSFUL_RESULT;
  1175. }
  1176. int CInternalNetIntetface::UploadTrendDataString(string stringCardId, string stringDeviceId, string stringDeviceName, string stringCaseId, vector<RECORD_DATA_STRING> vRecordData)
  1177. {
  1178. int nRet = PHMS_SUCCESSFUL_RESULT;
  1179. m_pPhmsSession->SetSaveType(m_nSaveType);
  1180. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1181. nRet = m_pPhmsSession->UploadTrendDataString(stringCardId, stringDeviceId, stringDeviceName, stringCaseId, vRecordData);
  1182. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1183. {
  1184. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1185. return nRet;
  1186. }
  1187. if(m_nSaveType == 1)
  1188. {
  1189. m_stringContent = m_pPhmsSession->GetContent();
  1190. }
  1191. return PHMS_SUCCESSFUL_RESULT;
  1192. }
  1193. int CInternalNetIntetface::UploadTrendDataFile(string stringFilePath)
  1194. {
  1195. int nRet = PHMS_SUCCESSFUL_RESULT;
  1196. m_pPhmsSession->SetSaveType(m_nSaveType);
  1197. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1198. nRet = m_pPhmsSession->UploadTrendDataFile(stringFilePath);
  1199. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1200. {
  1201. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1202. return nRet;
  1203. }
  1204. if(m_nSaveType == 1)
  1205. {
  1206. m_stringContent = m_pPhmsSession->GetContent();
  1207. }
  1208. return PHMS_SUCCESSFUL_RESULT;
  1209. }
  1210. int CInternalNetIntetface::UploadAudioSegment (string stringMsgId, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
  1211. unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath)
  1212. {
  1213. //验证参数
  1214. if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
  1215. {
  1216. //写日志
  1217. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  1218. return COMMON_PARAM_VALIDATE_FAIL;
  1219. }
  1220. int nRet = PHMS_SUCCESSFUL_RESULT;
  1221. m_pPhmsSession->SetSaveType(m_nSaveType);
  1222. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1223. //获得stringTotalSize参数
  1224. string stringTotalSize;
  1225. stringTotalSize = CUtil::ULongToString(nTotalSize);
  1226. //获得stringOrder
  1227. string stringOrder;
  1228. this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
  1229. //获得Start\End\Md5信息
  1230. vSegmentInfo vSi;
  1231. nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
  1232. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1233. {
  1234. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1235. return nRet;
  1236. }
  1237. //生成临时文件
  1238. string stringTempUploadFilePath;
  1239. nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
  1240. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1241. {
  1242. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1243. return nRet;
  1244. }
  1245. nRet = m_pPhmsSession->UploadAudioSegment(stringMsgId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
  1246. vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
  1247. vSi[2].m_stringMd5, stringTempUploadFilePath);
  1248. try
  1249. {
  1250. File fileTempUploadFile(stringTempUploadFilePath, "gbk");
  1251. fileTempUploadFile.remove(false);
  1252. }
  1253. catch(const Exception&)
  1254. {
  1255. }
  1256. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1257. {
  1258. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1259. return nRet;
  1260. }
  1261. if(m_nSaveType == 1)
  1262. {
  1263. m_stringContent = m_pPhmsSession->GetContent();
  1264. }
  1265. return PHMS_SUCCESSFUL_RESULT;
  1266. }
  1267. int CInternalNetIntetface::UploadAdvice (string stringUserId, string stringUsername, string stringMsg, string stringType, string stringIsSendMsg)
  1268. {
  1269. int nRet = PHMS_SUCCESSFUL_RESULT;
  1270. m_pPhmsSession->SetSaveType(m_nSaveType);
  1271. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1272. nRet = m_pPhmsSession->UploadAdvice(stringUserId, stringUsername, stringMsg, stringType, stringIsSendMsg);
  1273. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1274. {
  1275. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1276. return nRet;
  1277. }
  1278. if(m_nSaveType == 1)
  1279. {
  1280. m_stringContent = m_pPhmsSession->GetContent();
  1281. }
  1282. return PHMS_SUCCESSFUL_RESULT;
  1283. }
  1284. int CInternalNetIntetface::GetAdvice (string stringSgId, string stringUserId, string stringDoctorId, string stringDownloadState, string stringType,
  1285. string stringStartDate, string stringEndDate, unsigned int nPageTo, unsigned int nPageSize)
  1286. {
  1287. int nRet = PHMS_SUCCESSFUL_RESULT;
  1288. m_pPhmsSession->SetSaveType(m_nSaveType);
  1289. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1290. string stringPageTo = CUtil::UIntToString(nPageTo);
  1291. string stringPageSize = CUtil::UIntToString(nPageSize);
  1292. nRet = m_pPhmsSession->GetAdvice(stringSgId, stringUserId, stringDoctorId, stringDownloadState, stringType, stringStartDate, stringEndDate, stringPageTo, stringPageSize);
  1293. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1294. {
  1295. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1296. return nRet;
  1297. }
  1298. if(m_nSaveType == 1)
  1299. {
  1300. m_stringContent = m_pPhmsSession->GetContent();
  1301. }
  1302. return PHMS_SUCCESSFUL_RESULT;
  1303. }
  1304. int CInternalNetIntetface::DownloadAdviceComplete (string stringAdviceId)
  1305. {
  1306. int nRet = PHMS_SUCCESSFUL_RESULT;
  1307. m_pPhmsSession->SetSaveType(m_nSaveType);
  1308. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1309. nRet = m_pPhmsSession->DownloadAdviceComplete(stringAdviceId);
  1310. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1311. {
  1312. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1313. return nRet;
  1314. }
  1315. if(m_nSaveType == 1)
  1316. {
  1317. m_stringContent = m_pPhmsSession->GetContent();
  1318. }
  1319. return PHMS_SUCCESSFUL_RESULT;
  1320. }
  1321. int CInternalNetIntetface::GetReportListOfCase (string stringCaseId)
  1322. {
  1323. int nRet = PHMS_SUCCESSFUL_RESULT;
  1324. m_pPhmsSession->SetSaveType(m_nSaveType);
  1325. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1326. nRet = m_pPhmsSession->GetReportListOfCase(stringCaseId);
  1327. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1328. {
  1329. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1330. return nRet;
  1331. }
  1332. if(m_nSaveType == 1)
  1333. {
  1334. m_stringContent = m_pPhmsSession->GetContent();
  1335. }
  1336. return PHMS_SUCCESSFUL_RESULT;
  1337. }
  1338. //接口有变动,加了一个参数senderid,表示要查找信息的人,如为空表示自己
  1339. int CInternalNetIntetface::GetSelfInfo (string stringSenderId)
  1340. {
  1341. int nRet = PHMS_SUCCESSFUL_RESULT;
  1342. m_pPhmsSession->SetSaveType(m_nSaveType);
  1343. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1344. nRet = m_pPhmsSession->GetSelfInfo(stringSenderId);
  1345. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1346. {
  1347. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1348. return nRet;
  1349. }
  1350. if(m_nSaveType == 1)
  1351. {
  1352. m_stringContent = m_pPhmsSession->GetContent();
  1353. }
  1354. return PHMS_SUCCESSFUL_RESULT;
  1355. }
  1356. int CInternalNetIntetface::ChangePwd (string stringOldPwd, string stringNewPwd)
  1357. {
  1358. int nRet = PHMS_SUCCESSFUL_RESULT;
  1359. m_pPhmsSession->SetSaveType(m_nSaveType);
  1360. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1361. nRet = m_pPhmsSession->ChangePwd(stringOldPwd, stringNewPwd);
  1362. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1363. {
  1364. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1365. return nRet;
  1366. }
  1367. if(m_nSaveType == 1)
  1368. {
  1369. m_stringContent = m_pPhmsSession->GetContent();
  1370. }
  1371. return PHMS_SUCCESSFUL_RESULT;
  1372. }
  1373. int CInternalNetIntetface::DoctorChangeInfo (string stringName, string stringSex, string stringTel, string stringBirthdear,
  1374. string stringPosition, string stringNotes)
  1375. {
  1376. int nRet = PHMS_SUCCESSFUL_RESULT;
  1377. m_pPhmsSession->SetSaveType(m_nSaveType);
  1378. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1379. nRet = m_pPhmsSession->DoctorChangeSelfInfo(stringName, stringSex, stringTel, stringBirthdear, stringPosition, stringNotes, "");
  1380. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1381. {
  1382. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1383. return nRet;
  1384. }
  1385. if(m_nSaveType == 1)
  1386. {
  1387. m_stringContent = m_pPhmsSession->GetContent();
  1388. }
  1389. return PHMS_SUCCESSFUL_RESULT;
  1390. }
  1391. int CInternalNetIntetface::CliniqueChangeInfo (string stringPid, string stringName, string stringTel, string stringNotes)
  1392. {
  1393. int nRet = PHMS_SUCCESSFUL_RESULT;
  1394. m_pPhmsSession->SetSaveType(m_nSaveType);
  1395. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1396. nRet = m_pPhmsSession->CliniqueChangeSelfInfo(stringPid, stringName, stringTel, stringNotes);
  1397. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1398. {
  1399. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1400. return nRet;
  1401. }
  1402. if(m_nSaveType == 1)
  1403. {
  1404. m_stringContent = m_pPhmsSession->GetContent();
  1405. }
  1406. return PHMS_SUCCESSFUL_RESULT;
  1407. }
  1408. int CInternalNetIntetface::UserChangeInfo (string stringPid, string stringName, string stringSex, string stringTel, string stringBirthday,
  1409. string stringAddress, string stringLmp, string stringToken, string stringHeight, string stringWeight, string stringPhoto, string stringVCodeBeFollowed, string stringHospitalId, string stringOtherInfo)
  1410. {
  1411. int nRet = PHMS_SUCCESSFUL_RESULT;
  1412. m_pPhmsSession->SetSaveType(m_nSaveType);
  1413. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1414. nRet = m_pPhmsSession->CardUserChangeSelfInfo(stringPid, stringName, stringSex, stringTel, stringBirthday, stringAddress, stringLmp, stringToken, stringHeight, stringWeight, stringPhoto, stringVCodeBeFollowed, stringHospitalId, stringOtherInfo);
  1415. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1416. {
  1417. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1418. return nRet;
  1419. }
  1420. if(m_nSaveType == 1)
  1421. {
  1422. m_stringContent = m_pPhmsSession->GetContent();
  1423. }
  1424. return PHMS_SUCCESSFUL_RESULT;
  1425. }
  1426. int CInternalNetIntetface::GetCaseListOfUser (string stringCaseId, string stringCaseType, string stringCaseState, string stringThirdId, string stringName,
  1427. string stringStartDate, string stringEndDate, string stringCheckStartDate, string stringCheckEndDate, string stringCaseOrigin,
  1428. string stringYzlb, string stringSex, string stringIsRead, string stringOrderBy, unsigned int nPageTo, unsigned int nPageSize)
  1429. {
  1430. int nRet = PHMS_SUCCESSFUL_RESULT;
  1431. m_pPhmsSession->SetSaveType(m_nSaveType);
  1432. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1433. string stringPageTo = CUtil::UIntToString(nPageTo);
  1434. string stringPageSize = CUtil::UIntToString(nPageSize);
  1435. nRet = m_pPhmsSession->GetCaseListOfUser(stringCaseId, stringCaseType, stringCaseState, stringThirdId, stringName, stringStartDate, stringEndDate,
  1436. stringCheckStartDate, stringCheckEndDate, stringCaseOrigin, stringYzlb, stringSex, stringIsRead, stringOrderBy, stringPageTo, stringPageSize);
  1437. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1438. {
  1439. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1440. return nRet;
  1441. }
  1442. if(m_nSaveType == 1)
  1443. {
  1444. m_stringContent = m_pPhmsSession->GetContent();
  1445. }
  1446. return PHMS_SUCCESSFUL_RESULT;
  1447. }
  1448. int CInternalNetIntetface::GetReportListOfUser (string stringReportId, string stringReportStartDate, string stringReportEndDate,
  1449. string stringCaseType, string stringReportState, string stringOrderBy, unsigned int nPageTo, unsigned int nPageSize)
  1450. {
  1451. int nRet = PHMS_SUCCESSFUL_RESULT;
  1452. m_pPhmsSession->SetSaveType(m_nSaveType);
  1453. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1454. string stringPageTo = CUtil::UIntToString(nPageTo);
  1455. string stringPageSize = CUtil::UIntToString(nPageSize);
  1456. nRet = m_pPhmsSession->GetReportListOfUser(stringReportId, stringReportStartDate, stringReportEndDate, stringCaseType, stringReportState, stringOrderBy, stringPageTo, stringPageSize);
  1457. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1458. {
  1459. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1460. return nRet;
  1461. }
  1462. if(m_nSaveType == 1)
  1463. {
  1464. m_stringContent = m_pPhmsSession->GetContent();
  1465. }
  1466. return PHMS_SUCCESSFUL_RESULT;
  1467. }
  1468. int CInternalNetIntetface::GetCardUserList (string stringCardId, string stringSenderId, string stringPersonId, string stringTel, string stringName,
  1469. string stringType, unsigned int nPageTo, unsigned int nPageSize)
  1470. {
  1471. int nRet = PHMS_SUCCESSFUL_RESULT;
  1472. m_pPhmsSession->SetSaveType(m_nSaveType);
  1473. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1474. string stringPageTo = CUtil::UIntToString(nPageTo);
  1475. string stringPageSize = CUtil::UIntToString(nPageSize);
  1476. nRet = m_pPhmsSession->GetCardUserList(stringCardId, stringSenderId, stringPersonId, stringTel, stringName, stringType, stringPageTo, stringPageSize);
  1477. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1478. {
  1479. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1480. return nRet;
  1481. }
  1482. if(m_nSaveType == 1)
  1483. {
  1484. m_stringContent = m_pPhmsSession->GetContent();
  1485. }
  1486. return PHMS_SUCCESSFUL_RESULT;
  1487. }
  1488. int CInternalNetIntetface::KeepSession()
  1489. {
  1490. int nRet = PHMS_SUCCESSFUL_RESULT;
  1491. m_pPhmsSession->SetSaveType(m_nSaveType);
  1492. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1493. nRet = m_pPhmsSession->KeepSession();
  1494. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1495. {
  1496. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1497. return nRet;
  1498. }
  1499. if(m_nSaveType == 1)
  1500. {
  1501. m_stringContent = m_pPhmsSession->GetContent();
  1502. }
  1503. return PHMS_SUCCESSFUL_RESULT;
  1504. }
  1505. int CInternalNetIntetface::MarkCaseException(string stringCaseId, string stringReceiverId , int nResultFlag)
  1506. {
  1507. int nRet = PHMS_SUCCESSFUL_RESULT;
  1508. m_pPhmsSession->SetSaveType(m_nSaveType);
  1509. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1510. nRet = m_pPhmsSession->MarkCaseException(stringCaseId, stringReceiverId, nResultFlag);
  1511. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1512. {
  1513. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1514. return nRet;
  1515. }
  1516. if(m_nSaveType == 1)
  1517. {
  1518. m_stringContent = m_pPhmsSession->GetContent();
  1519. }
  1520. return PHMS_SUCCESSFUL_RESULT;
  1521. }
  1522. int CInternalNetIntetface::MarkReportRead(string stringReportId)
  1523. {
  1524. int nRet = PHMS_SUCCESSFUL_RESULT;
  1525. m_pPhmsSession->SetSaveType(m_nSaveType);
  1526. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1527. nRet = m_pPhmsSession->MarkReportRead(stringReportId);
  1528. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1529. {
  1530. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1531. return nRet;
  1532. }
  1533. if(m_nSaveType == 1)
  1534. {
  1535. m_stringContent = m_pPhmsSession->GetContent();
  1536. }
  1537. return PHMS_SUCCESSFUL_RESULT;
  1538. }
  1539. int CInternalNetIntetface::Feedback(string stringTitle, string stringNotes, string stringPhone, string stringFilePath)
  1540. {
  1541. int nRet = PHMS_SUCCESSFUL_RESULT;
  1542. m_pPhmsSession->SetSaveType(m_nSaveType);
  1543. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1544. nRet = m_pPhmsSession->Feedback(stringTitle, stringNotes, stringPhone, stringFilePath);
  1545. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1546. {
  1547. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1548. return nRet;
  1549. }
  1550. if(m_nSaveType == 1)
  1551. {
  1552. m_stringContent = m_pPhmsSession->GetContent();
  1553. }
  1554. return PHMS_SUCCESSFUL_RESULT;
  1555. }
  1556. int CInternalNetIntetface::UploadTrendData2(string stringTargetPath)
  1557. {
  1558. int nRet = PHMS_SUCCESSFUL_RESULT;
  1559. m_pPhmsSession->SetSaveType(m_nSaveType);
  1560. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1561. nRet = m_pPhmsSession->UploadTrendData2(stringTargetPath);
  1562. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1563. {
  1564. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1565. return nRet;
  1566. }
  1567. if(m_nSaveType == 1)
  1568. {
  1569. m_stringContent = m_pPhmsSession->GetContent();
  1570. }
  1571. return PHMS_SUCCESSFUL_RESULT;
  1572. }
  1573. int CInternalNetIntetface::GetAllTeamList()
  1574. {
  1575. int nRet = PHMS_SUCCESSFUL_RESULT;
  1576. m_pPhmsSession->SetSaveType(m_nSaveType);
  1577. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1578. nRet = m_pPhmsSession->GetAllTeamList();
  1579. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1580. {
  1581. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1582. return nRet;
  1583. }
  1584. if(m_nSaveType == 1)
  1585. {
  1586. m_stringContent = m_pPhmsSession->GetContent();
  1587. }
  1588. return PHMS_SUCCESSFUL_RESULT;
  1589. }
  1590. int CInternalNetIntetface::GetDoctorListOfTeam(string stringTeamId)
  1591. {
  1592. int nRet = PHMS_SUCCESSFUL_RESULT;
  1593. m_pPhmsSession->SetSaveType(m_nSaveType);
  1594. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1595. nRet = m_pPhmsSession->GetDoctorListOfTeam(stringTeamId);
  1596. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1597. {
  1598. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1599. return nRet;
  1600. }
  1601. if(m_nSaveType == 1)
  1602. {
  1603. m_stringContent = m_pPhmsSession->GetContent();
  1604. }
  1605. return PHMS_SUCCESSFUL_RESULT;
  1606. }
  1607. int CInternalNetIntetface::GetEventStream(string stringCaseId, string stringOriginalHospital)
  1608. {
  1609. int nRet = PHMS_SUCCESSFUL_RESULT;
  1610. m_pPhmsSession->SetSaveType(m_nSaveType);
  1611. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1612. nRet = m_pPhmsSession->GetEventStream(stringCaseId, stringOriginalHospital);
  1613. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1614. {
  1615. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1616. return nRet;
  1617. }
  1618. if(m_nSaveType == 1)
  1619. {
  1620. m_stringContent = m_pPhmsSession->GetContent();
  1621. }
  1622. return PHMS_SUCCESSFUL_RESULT;
  1623. }
  1624. int CInternalNetIntetface::GetCaseTypeList(string stringLanguage)
  1625. {
  1626. int nRet = PHMS_SUCCESSFUL_RESULT;
  1627. m_pPhmsSession->SetSaveType(m_nSaveType);
  1628. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1629. nRet = m_pPhmsSession->GetCaseTypeList(stringLanguage);
  1630. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1631. {
  1632. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1633. return nRet;
  1634. }
  1635. if(m_nSaveType == 1)
  1636. {
  1637. m_stringContent = m_pPhmsSession->GetContent();
  1638. }
  1639. return PHMS_SUCCESSFUL_RESULT;
  1640. }
  1641. int CInternalNetIntetface::DoctorHandledCaseStatistics(string stringCaseType, string stringStartTime, string stringEndTime)
  1642. {
  1643. int nRet = PHMS_SUCCESSFUL_RESULT;
  1644. m_pPhmsSession->SetSaveType(m_nSaveType);
  1645. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1646. nRet = m_pPhmsSession->DoctorHandledCaseStatistics(stringCaseType, stringStartTime, stringEndTime);
  1647. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1648. {
  1649. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1650. return nRet;
  1651. }
  1652. if(m_nSaveType == 1)
  1653. {
  1654. m_stringContent = m_pPhmsSession->GetContent();
  1655. }
  1656. return PHMS_SUCCESSFUL_RESULT;
  1657. }
  1658. int CInternalNetIntetface::UserRegister(string stringPhone, string stringName, string stringHeigth)
  1659. {
  1660. int nRet = PHMS_SUCCESSFUL_RESULT;
  1661. m_pPhmsSession->SetSaveType(m_nSaveType);
  1662. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1663. nRet = m_pPhmsSession->UserRegister(stringPhone, stringName, stringHeigth);
  1664. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1665. {
  1666. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1667. return nRet;
  1668. }
  1669. if(m_nSaveType == 1)
  1670. {
  1671. m_stringContent = m_pPhmsSession->GetContent();
  1672. }
  1673. return PHMS_SUCCESSFUL_RESULT;
  1674. }
  1675. int CInternalNetIntetface::GetTrendData(string stringUId, string stringInterUId, string stringTrendType, string stringStartDate, string stringEndDate, string stringNextId)
  1676. {
  1677. int nRet = PHMS_SUCCESSFUL_RESULT;
  1678. m_pPhmsSession->SetSaveType(m_nSaveType);
  1679. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1680. nRet = m_pPhmsSession->GetTrendData(stringUId, stringInterUId, stringTrendType, stringStartDate, stringEndDate, stringNextId);
  1681. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1682. {
  1683. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1684. return nRet;
  1685. }
  1686. //目前该接口只支持保存到文件
  1687. return PHMS_SUCCESSFUL_RESULT;
  1688. }
  1689. int CInternalNetIntetface::GetLastPhysiologicalData()
  1690. {
  1691. int nRet = PHMS_SUCCESSFUL_RESULT;
  1692. m_pPhmsSession->SetSaveType(m_nSaveType);
  1693. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1694. nRet = m_pPhmsSession->GetLastPhysiologicalData();
  1695. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1696. {
  1697. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1698. return nRet;
  1699. }
  1700. if(m_nSaveType == 1)
  1701. {
  1702. m_stringContent = m_pPhmsSession->GetContent();
  1703. }
  1704. return PHMS_SUCCESSFUL_RESULT;
  1705. }
  1706. int CInternalNetIntetface::GetHealthDegree(string stringUId, string stringInterUId, string stringDate)
  1707. {
  1708. int nRet = PHMS_SUCCESSFUL_RESULT;
  1709. m_pPhmsSession->SetSaveType(m_nSaveType);
  1710. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1711. nRet = m_pPhmsSession->GetHealthDegree(stringUId, stringInterUId, stringDate);
  1712. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1713. {
  1714. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1715. return nRet;
  1716. }
  1717. if(m_nSaveType == 1)
  1718. {
  1719. m_stringContent = m_pPhmsSession->GetContent();
  1720. }
  1721. return PHMS_SUCCESSFUL_RESULT;
  1722. }
  1723. int CInternalNetIntetface::GetUserOfNoAdviceAndMostData(string stringDays)
  1724. {
  1725. int nRet = PHMS_SUCCESSFUL_RESULT;
  1726. m_pPhmsSession->SetSaveType(m_nSaveType);
  1727. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1728. nRet = m_pPhmsSession->GetUserOfNoAdviceAndMostData(stringDays);
  1729. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1730. {
  1731. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1732. return nRet;
  1733. }
  1734. if(m_nSaveType == 1)
  1735. {
  1736. m_stringContent = m_pPhmsSession->GetContent();
  1737. }
  1738. return PHMS_SUCCESSFUL_RESULT;
  1739. }
  1740. int CInternalNetIntetface::AdviceDelay(string stringUId, string stringMinutes)
  1741. {
  1742. int nRet = PHMS_SUCCESSFUL_RESULT;
  1743. m_pPhmsSession->SetSaveType(m_nSaveType);
  1744. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1745. nRet = m_pPhmsSession->AdviceDelay(stringUId, stringMinutes);
  1746. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1747. {
  1748. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1749. return nRet;
  1750. }
  1751. if(m_nSaveType == 1)
  1752. {
  1753. m_stringContent = m_pPhmsSession->GetContent();
  1754. }
  1755. return PHMS_SUCCESSFUL_RESULT;
  1756. }
  1757. int CInternalNetIntetface::AdviceComplete(string stringUId, string stringOptionType, string stringAdvice)
  1758. {
  1759. int nRet = PHMS_SUCCESSFUL_RESULT;
  1760. m_pPhmsSession->SetSaveType(m_nSaveType);
  1761. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1762. nRet = m_pPhmsSession->AdviceComplete(stringUId, stringOptionType, stringAdvice);
  1763. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1764. {
  1765. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1766. return nRet;
  1767. }
  1768. if(m_nSaveType == 1)
  1769. {
  1770. m_stringContent = m_pPhmsSession->GetContent();
  1771. }
  1772. return PHMS_SUCCESSFUL_RESULT;
  1773. }
  1774. int CInternalNetIntetface::GetUserListOfNoAdvice(string stringDays, unsigned int nPageTo, unsigned int nPageSize)
  1775. {
  1776. int nRet = PHMS_SUCCESSFUL_RESULT;
  1777. m_pPhmsSession->SetSaveType(m_nSaveType);
  1778. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1779. string stringPageTo = CUtil::UIntToString(nPageTo);
  1780. string stringPageSize = CUtil::UIntToString(nPageSize);
  1781. nRet = m_pPhmsSession->GetUserListOfNoAdvice(stringDays, stringPageTo, stringPageSize);
  1782. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1783. {
  1784. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1785. return nRet;
  1786. }
  1787. if(m_nSaveType == 1)
  1788. {
  1789. m_stringContent = m_pPhmsSession->GetContent();
  1790. }
  1791. return PHMS_SUCCESSFUL_RESULT;
  1792. }
  1793. int CInternalNetIntetface::AdviceBegin(string stringUId)
  1794. {
  1795. int nRet = PHMS_SUCCESSFUL_RESULT;
  1796. m_pPhmsSession->SetSaveType(m_nSaveType);
  1797. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1798. nRet = m_pPhmsSession->AdviceBegin(stringUId);
  1799. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1800. {
  1801. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1802. return nRet;
  1803. }
  1804. if(m_nSaveType == 1)
  1805. {
  1806. m_stringContent = m_pPhmsSession->GetContent();
  1807. }
  1808. return PHMS_SUCCESSFUL_RESULT;
  1809. }
  1810. int CInternalNetIntetface::GetUserListOfAdvicing(unsigned int nPageTo, unsigned int nPageSize)
  1811. {
  1812. int nRet = PHMS_SUCCESSFUL_RESULT;
  1813. m_pPhmsSession->SetSaveType(m_nSaveType);
  1814. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1815. string stringPageTo = CUtil::UIntToString(nPageTo);
  1816. string stringPageSize = CUtil::UIntToString(nPageSize);
  1817. nRet = m_pPhmsSession->GetUserListOfAdvicing(stringPageTo, stringPageSize);
  1818. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1819. {
  1820. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1821. return nRet;
  1822. }
  1823. if(m_nSaveType == 1)
  1824. {
  1825. m_stringContent = m_pPhmsSession->GetContent();
  1826. }
  1827. return PHMS_SUCCESSFUL_RESULT;
  1828. }
  1829. int CInternalNetIntetface::VerifyThirdId(string stringUId, string stringType)
  1830. {
  1831. int nRet = PHMS_SUCCESSFUL_RESULT;
  1832. m_pPhmsSession->SetSaveType(m_nSaveType);
  1833. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1834. nRet = m_pPhmsSession->VerifyThirdId(stringUId, stringType);
  1835. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1836. {
  1837. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1838. return nRet;
  1839. }
  1840. if(m_nSaveType == 1)
  1841. {
  1842. m_stringContent = m_pPhmsSession->GetContent();
  1843. }
  1844. return PHMS_SUCCESSFUL_RESULT;
  1845. }
  1846. int CInternalNetIntetface::PersonIdRegister(string stringType, string stringRegFrom, string stringPersonId, string stringName, string stringSex, string stringBirthday, string stringAddress,
  1847. string stringPhone, string stringHeigth, string stringUploadUnitId, string stringHospitalId, string stringHGroupId, string stringScode, string stringWxUId, string stringLmp, string stringWeight, string stringPassword,
  1848. string stringThirdCode, string stringIsRegister)
  1849. {
  1850. int nRet = PHMS_SUCCESSFUL_RESULT;
  1851. m_pPhmsSession->SetSaveType(m_nSaveType);
  1852. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1853. nRet = m_pPhmsSession->PersonIdRegister(stringType, stringRegFrom, stringPersonId, stringName, stringSex, stringBirthday, stringAddress, stringPhone, stringHeigth, stringUploadUnitId,
  1854. stringHospitalId, stringHGroupId, stringScode, stringWxUId, stringLmp, stringWeight, stringPassword, stringThirdCode, stringIsRegister);
  1855. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1856. {
  1857. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1858. return nRet;
  1859. }
  1860. if(m_nSaveType == 1)
  1861. {
  1862. m_stringContent = m_pPhmsSession->GetContent();
  1863. }
  1864. return PHMS_SUCCESSFUL_RESULT;
  1865. }
  1866. int CInternalNetIntetface::GetVerificationCode(string stringType, string stringPhone)
  1867. {
  1868. int nRet = PHMS_SUCCESSFUL_RESULT;
  1869. m_pPhmsSession->SetSaveType(m_nSaveType);
  1870. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1871. nRet = m_pPhmsSession->GetVerificationCode(stringType, stringPhone);
  1872. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1873. {
  1874. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1875. return nRet;
  1876. }
  1877. if(m_nSaveType == 1)
  1878. {
  1879. m_stringContent = m_pPhmsSession->GetContent();
  1880. }
  1881. return PHMS_SUCCESSFUL_RESULT;
  1882. }
  1883. int CInternalNetIntetface::GetAskList(string stringAskType, string stringAskEnd, string stringDoctorId, string stringIsAsk, string stringUserId, string stringStartTime, string stringEndTime, unsigned int nPageTo, unsigned int nPageSize)
  1884. {
  1885. int nRet = PHMS_SUCCESSFUL_RESULT;
  1886. m_pPhmsSession->SetSaveType(m_nSaveType);
  1887. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1888. string stringPageTo = CUtil::UIntToString(nPageTo);
  1889. string stringPageSize = CUtil::UIntToString(nPageSize);
  1890. nRet = m_pPhmsSession->GetAskList(stringAskType, stringAskEnd, stringDoctorId, stringIsAsk, stringUserId, stringStartTime, stringEndTime, stringPageTo, stringPageSize);
  1891. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1892. {
  1893. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1894. return nRet;
  1895. }
  1896. if(m_nSaveType == 1)
  1897. {
  1898. m_stringContent = m_pPhmsSession->GetContent();
  1899. }
  1900. return PHMS_SUCCESSFUL_RESULT;
  1901. }
  1902. int CInternalNetIntetface::GetAskDetail(string stringAskId)
  1903. {
  1904. int nRet = PHMS_SUCCESSFUL_RESULT;
  1905. m_pPhmsSession->SetSaveType(m_nSaveType);
  1906. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1907. nRet = m_pPhmsSession->GetAskDetail(stringAskId);
  1908. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1909. {
  1910. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1911. return nRet;
  1912. }
  1913. if(m_nSaveType == 1)
  1914. {
  1915. m_stringContent = m_pPhmsSession->GetContent();
  1916. }
  1917. return PHMS_SUCCESSFUL_RESULT;
  1918. }
  1919. int CInternalNetIntetface::GetQuestionList(string stringDoctorId, string stringReportType, string stringAskId)
  1920. {
  1921. int nRet = PHMS_SUCCESSFUL_RESULT;
  1922. m_pPhmsSession->SetSaveType(m_nSaveType);
  1923. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1924. nRet = m_pPhmsSession->GetQuestionList(stringDoctorId, stringReportType, stringAskId);
  1925. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1926. {
  1927. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1928. return nRet;
  1929. }
  1930. if(m_nSaveType == 1)
  1931. {
  1932. m_stringContent = m_pPhmsSession->GetContent();
  1933. }
  1934. return PHMS_SUCCESSFUL_RESULT;
  1935. }
  1936. int CInternalNetIntetface::SubmitQuestion(string stringUserId, string stringAdvise, string stringReportType, string stringAskId, string stringAskedId, string stringDoctorPhotoPath)
  1937. {
  1938. int nRet = PHMS_SUCCESSFUL_RESULT;
  1939. m_pPhmsSession->SetSaveType(m_nSaveType);
  1940. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1941. nRet = m_pPhmsSession->SubmitQuestion(stringUserId, stringAdvise, stringReportType, stringAskId, stringAskedId, stringDoctorPhotoPath);
  1942. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1943. {
  1944. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1945. return nRet;
  1946. }
  1947. if(m_nSaveType == 1)
  1948. {
  1949. m_stringContent = m_pPhmsSession->GetContent();
  1950. }
  1951. return PHMS_SUCCESSFUL_RESULT;
  1952. }
  1953. int CInternalNetIntetface::GetDataDictionary()
  1954. {
  1955. int nRet = PHMS_SUCCESSFUL_RESULT;
  1956. m_pPhmsSession->SetSaveType(m_nSaveType);
  1957. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1958. nRet = m_pPhmsSession->GetDataDictionary();
  1959. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1960. {
  1961. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1962. return nRet;
  1963. }
  1964. if(m_nSaveType == 1)
  1965. {
  1966. m_stringContent = m_pPhmsSession->GetContent();
  1967. }
  1968. return PHMS_SUCCESSFUL_RESULT;
  1969. }
  1970. int CInternalNetIntetface::LoggingHealthBaseInfo(string stringUserId, string stringWeblock, string stringNation, string stringProfression, string stringCrowd, string stringBloodType,
  1971. string stringJwsJiBing, string stringJwsShouShu, string stringJwsWaiShang, string stringJwsShuXue, string stringJwsBaoLuShi, string stringJwsBaoLuShiBz,
  1972. string stringJwsYiChuanJiBing, string stringGmsGuoMinShi, string stringGmsGuoMinShiBz, string stringJzsFuQin, string stringJzsFuQinBz, string stringJzsMuQin,
  1973. string stringJzsMuQinBz, string stringJzsXdjm, string stringJzsXdjmBz, string stringJzsZiNv, string stringJzsZiNvBz, string stringJzsQiTa)
  1974. {
  1975. int nRet = PHMS_SUCCESSFUL_RESULT;
  1976. m_pPhmsSession->SetSaveType(m_nSaveType);
  1977. m_pPhmsSession->SetFilePath(m_stringFilePath);
  1978. nRet = m_pPhmsSession->LoggingHealthBaseInfo(stringUserId, stringWeblock, stringNation, stringProfression, stringCrowd, stringBloodType, stringJwsJiBing, stringJwsShouShu, stringJwsWaiShang,
  1979. stringJwsShuXue, stringJwsBaoLuShi, stringJwsBaoLuShiBz, stringJwsYiChuanJiBing, stringGmsGuoMinShi, stringGmsGuoMinShiBz, stringJzsFuQin, stringJzsFuQinBz, stringJzsMuQin, stringJzsMuQinBz,
  1980. stringJzsXdjm, stringJzsXdjmBz, stringJzsZiNv, stringJzsZiNvBz, stringJzsQiTa);
  1981. if(nRet != PHMS_SUCCESSFUL_RESULT)
  1982. {
  1983. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  1984. return nRet;
  1985. }
  1986. if(m_nSaveType == 1)
  1987. {
  1988. m_stringContent = m_pPhmsSession->GetContent();
  1989. }
  1990. return PHMS_SUCCESSFUL_RESULT;
  1991. }
  1992. int CInternalNetIntetface::LoggingHealthCurrentInfo(string stringUserId, string stringShfsYinShi, string stringShfsXlzk, string stringShfsXlzkBz, string stringShfsXltz, string stringShfsXiYan,
  1993. string stringShfsYinJiu, string stringShfsSyqk, string stringShfsYunDong, string stringShfsYunDongShiJian, string stringSysjcDanGuChun, string stringSysjcXueChangGui,
  1994. string stringSysjcXueChangGuiBz, string stringSysjcNiaoChangGui, string stringSysjcNiaoChangGuiBz, string stringSysjcQiTa, string stringYongYao, string stringZhuYuan,
  1995. string stringJkwtNaoXueGuan, string stringJkwtNaoXueGuanBz, string stringJkwtShenZang, string stringJkwtShenZangBz, string stringJkwtXinZang, string stringJkwtXinZangBz,
  1996. string stringJkwtXueGuan, string stringJkwtXueGuanBz, string stringJkwtYanBu, string stringJkwtYanBuBz, string stringJkwtShenJing, string stringJkwtQiTa, string stringDate)
  1997. {
  1998. int nRet = PHMS_SUCCESSFUL_RESULT;
  1999. m_pPhmsSession->SetSaveType(m_nSaveType);
  2000. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2001. nRet = m_pPhmsSession->LoggingHealthCurrentInfo(stringUserId, stringShfsYinShi, stringShfsXlzk, stringShfsXlzkBz, stringShfsXltz, stringShfsXiYan, stringShfsYinJiu, stringShfsSyqk, stringShfsYunDong,
  2002. stringShfsYunDongShiJian, stringSysjcDanGuChun, stringSysjcXueChangGui, stringSysjcXueChangGuiBz, stringSysjcNiaoChangGui, stringSysjcNiaoChangGuiBz, stringSysjcQiTa, stringYongYao, stringZhuYuan,
  2003. stringJkwtNaoXueGuan, stringJkwtNaoXueGuanBz, stringJkwtShenZang, stringJkwtShenZangBz, stringJkwtXinZang, stringJkwtXinZangBz, stringJkwtXueGuan, stringJkwtXueGuanBz, stringJkwtYanBu, stringJkwtYanBuBz,
  2004. stringJkwtShenJing, stringJkwtQiTa, stringDate);
  2005. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2006. {
  2007. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2008. return nRet;
  2009. }
  2010. if(m_nSaveType == 1)
  2011. {
  2012. m_stringContent = m_pPhmsSession->GetContent();
  2013. }
  2014. return PHMS_SUCCESSFUL_RESULT;
  2015. }
  2016. int CInternalNetIntetface::GetCliniqueListOfHospital(string stringHospitalId)
  2017. {
  2018. int nRet = PHMS_SUCCESSFUL_RESULT;
  2019. m_pPhmsSession->SetSaveType(m_nSaveType);
  2020. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2021. nRet = m_pPhmsSession->GetCliniqueListOfHospital(stringHospitalId);
  2022. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2023. {
  2024. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2025. return nRet;
  2026. }
  2027. if(m_nSaveType == 1)
  2028. {
  2029. m_stringContent = m_pPhmsSession->GetContent();
  2030. }
  2031. return PHMS_SUCCESSFUL_RESULT;
  2032. }
  2033. int CInternalNetIntetface::GetStatisticsInfo(string stringTypeId, string stringMonth, string stringMonthDay, unsigned int nPageTo, unsigned int nPageSize)
  2034. {
  2035. int nRet = PHMS_SUCCESSFUL_RESULT;
  2036. m_pPhmsSession->SetSaveType(m_nSaveType);
  2037. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2038. string stringPageTo = CUtil::UIntToString(nPageTo);
  2039. string stringPageSize = CUtil::UIntToString(nPageSize);
  2040. nRet = m_pPhmsSession->GetStatisticsInfo(stringTypeId, stringMonth, stringMonthDay, stringPageTo, stringPageSize);
  2041. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2042. {
  2043. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2044. return nRet;
  2045. }
  2046. if(m_nSaveType == 1)
  2047. {
  2048. m_stringContent = m_pPhmsSession->GetContent();
  2049. }
  2050. return PHMS_SUCCESSFUL_RESULT;
  2051. }
  2052. int CInternalNetIntetface::UpdateCaseInfo(string stringHospitalId, string stringCaseId, string stringOtherParam, string stringFlag, string stringNotes, string stringReceiverId)
  2053. {
  2054. int nRet = PHMS_SUCCESSFUL_RESULT;
  2055. m_pPhmsSession->SetSaveType(m_nSaveType);
  2056. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2057. nRet = m_pPhmsSession->UpdateCaseInfo(stringHospitalId, stringCaseId, stringOtherParam, stringFlag, stringNotes, stringReceiverId);
  2058. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2059. {
  2060. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2061. return nRet;
  2062. }
  2063. if(m_nSaveType == 1)
  2064. {
  2065. m_stringContent = m_pPhmsSession->GetContent();
  2066. }
  2067. return PHMS_SUCCESSFUL_RESULT;
  2068. }
  2069. int CInternalNetIntetface::GetUserHealthList(string stringNextId, string stringTypeId, string stringSecondTypeId, string stringName, string stringSex, string stringThirdIdType,
  2070. string stringThirdId, string stringHospitalId, string stringUnitSenderId, string stringIsData, string stringIntervalTime, string stringPopulations, string stringContractDoctor, string stringIsContract, string stringPageSize)
  2071. {
  2072. int nRet = PHMS_SUCCESSFUL_RESULT;
  2073. m_pPhmsSession->SetSaveType(m_nSaveType);
  2074. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2075. nRet = m_pPhmsSession->GetUserHealthList(stringNextId, stringTypeId, stringSecondTypeId, stringName, stringSex, stringThirdIdType, stringThirdId, stringHospitalId,
  2076. stringUnitSenderId, stringIsData, stringIntervalTime, stringPopulations, stringContractDoctor, stringIsContract, stringPageSize);
  2077. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2078. {
  2079. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2080. return nRet;
  2081. }
  2082. if(m_nSaveType == 1)
  2083. {
  2084. m_stringContent = m_pPhmsSession->GetContent();
  2085. }
  2086. return PHMS_SUCCESSFUL_RESULT;
  2087. }
  2088. int CInternalNetIntetface::GetAdviceImplemention(string stringThirdId, string stringHospitalId)
  2089. {
  2090. int nRet = PHMS_SUCCESSFUL_RESULT;
  2091. m_pPhmsSession->SetSaveType(m_nSaveType);
  2092. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2093. nRet = m_pPhmsSession->GetAdviceImplemention(stringThirdId, stringHospitalId);
  2094. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2095. {
  2096. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2097. return nRet;
  2098. }
  2099. if(m_nSaveType == 1)
  2100. {
  2101. m_stringContent = m_pPhmsSession->GetContent();
  2102. }
  2103. return PHMS_SUCCESSFUL_RESULT;
  2104. }
  2105. int CInternalNetIntetface::ChangePersonType(string stringThirdId, string stringPeopleType, string stringHospitalId)
  2106. {
  2107. int nRet = PHMS_SUCCESSFUL_RESULT;
  2108. m_pPhmsSession->SetSaveType(m_nSaveType);
  2109. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2110. nRet = m_pPhmsSession->ChangePersonType(stringThirdId, stringPeopleType, stringHospitalId);
  2111. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2112. {
  2113. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2114. return nRet;
  2115. }
  2116. if(m_nSaveType == 1)
  2117. {
  2118. m_stringContent = m_pPhmsSession->GetContent();
  2119. }
  2120. return PHMS_SUCCESSFUL_RESULT;
  2121. }
  2122. int CInternalNetIntetface::SetNextVisitTime(string stringThirdId, string stringInterViewTime, string stringHospitalId)
  2123. {
  2124. int nRet = PHMS_SUCCESSFUL_RESULT;
  2125. m_pPhmsSession->SetSaveType(m_nSaveType);
  2126. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2127. nRet = m_pPhmsSession->SetNextVisitTime(stringThirdId, stringInterViewTime, stringHospitalId);
  2128. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2129. {
  2130. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2131. return nRet;
  2132. }
  2133. if(m_nSaveType == 1)
  2134. {
  2135. m_stringContent = m_pPhmsSession->GetContent();
  2136. }
  2137. return PHMS_SUCCESSFUL_RESULT;
  2138. }
  2139. int CInternalNetIntetface::GetPersonTypeList(string stringLanguage)
  2140. {
  2141. int nRet = PHMS_SUCCESSFUL_RESULT;
  2142. m_pPhmsSession->SetSaveType(m_nSaveType);
  2143. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2144. nRet = m_pPhmsSession->GetPersonTypeList(stringLanguage);
  2145. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2146. {
  2147. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2148. return nRet;
  2149. }
  2150. if(m_nSaveType == 1)
  2151. {
  2152. m_stringContent = m_pPhmsSession->GetContent();
  2153. }
  2154. return PHMS_SUCCESSFUL_RESULT;
  2155. }
  2156. int CInternalNetIntetface::PersonIdRegisterAndLogin(string stringRole, string stringPId, string stringName, string stringSex, string stringBirthday, string stringAddress, string stringDeviceId, string stringMd5,
  2157. string stringLang, string stringRegFrom)
  2158. {
  2159. int nRet = PHMS_SUCCESSFUL_RESULT;
  2160. m_pPhmsSession->SetSaveType(m_nSaveType);
  2161. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2162. nRet = m_pPhmsSession->PersonIdRegisterAndLogin(stringRole, stringPId, stringName, stringSex, stringBirthday, stringAddress, stringDeviceId, stringMd5, stringLang, stringRegFrom);
  2163. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2164. {
  2165. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2166. return nRet;
  2167. }
  2168. if(m_nSaveType == 1)
  2169. {
  2170. m_stringContent = m_pPhmsSession->GetContent();
  2171. }
  2172. return PHMS_SUCCESSFUL_RESULT;
  2173. }
  2174. int CInternalNetIntetface::CardBindPhone(string stringPhone, string stringScode)
  2175. {
  2176. int nRet = PHMS_SUCCESSFUL_RESULT;
  2177. m_pPhmsSession->SetSaveType(m_nSaveType);
  2178. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2179. nRet = m_pPhmsSession->CardBindPhone(stringPhone, stringScode);
  2180. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2181. {
  2182. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2183. return nRet;
  2184. }
  2185. if(m_nSaveType == 1)
  2186. {
  2187. m_stringContent = m_pPhmsSession->GetContent();
  2188. }
  2189. return PHMS_SUCCESSFUL_RESULT;
  2190. }
  2191. int CInternalNetIntetface::ResetPassword(string stringPhone, string stringScode, string stringNewPwd)
  2192. {
  2193. int nRet = PHMS_SUCCESSFUL_RESULT;
  2194. m_pPhmsSession->SetSaveType(m_nSaveType);
  2195. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2196. nRet = m_pPhmsSession->ResetPassword(stringPhone, stringScode, stringNewPwd);
  2197. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2198. {
  2199. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2200. return nRet;
  2201. }
  2202. if(m_nSaveType == 1)
  2203. {
  2204. m_stringContent = m_pPhmsSession->GetContent();
  2205. }
  2206. return PHMS_SUCCESSFUL_RESULT;
  2207. }
  2208. int CInternalNetIntetface::UploadDaily(string stringType, string stringCreateTime, string stringFiles)
  2209. {
  2210. int nRet = PHMS_SUCCESSFUL_RESULT;
  2211. m_pPhmsSession->SetSaveType(m_nSaveType);
  2212. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2213. nRet = m_pPhmsSession->UploadDaily(stringType, stringCreateTime, stringFiles);
  2214. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2215. {
  2216. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2217. return nRet;
  2218. }
  2219. if(m_nSaveType == 1)
  2220. {
  2221. m_stringContent = m_pPhmsSession->GetContent();
  2222. }
  2223. return PHMS_SUCCESSFUL_RESULT;
  2224. }
  2225. int CInternalNetIntetface::GetDateListOfDaily(string stringYear, string stringMonth)
  2226. {
  2227. int nRet = PHMS_SUCCESSFUL_RESULT;
  2228. m_pPhmsSession->SetSaveType(m_nSaveType);
  2229. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2230. nRet = m_pPhmsSession->GetDateListOfDaily(stringYear, stringMonth);
  2231. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2232. {
  2233. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2234. return nRet;
  2235. }
  2236. if(m_nSaveType == 1)
  2237. {
  2238. m_stringContent = m_pPhmsSession->GetContent();
  2239. }
  2240. return PHMS_SUCCESSFUL_RESULT;
  2241. }
  2242. int CInternalNetIntetface::GetDailyOfDate(string stringDate, string stringType)
  2243. {
  2244. int nRet = PHMS_SUCCESSFUL_RESULT;
  2245. m_pPhmsSession->SetSaveType(m_nSaveType);
  2246. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2247. nRet = m_pPhmsSession->GetDailyOfDate(stringDate, stringType);
  2248. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2249. {
  2250. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2251. return nRet;
  2252. }
  2253. if(m_nSaveType == 1)
  2254. {
  2255. m_stringContent = m_pPhmsSession->GetContent();
  2256. }
  2257. return PHMS_SUCCESSFUL_RESULT;
  2258. }
  2259. int CInternalNetIntetface::ShareDaily(string stringType, string stringCreateTime)
  2260. {
  2261. int nRet = PHMS_SUCCESSFUL_RESULT;
  2262. m_pPhmsSession->SetSaveType(m_nSaveType);
  2263. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2264. nRet = m_pPhmsSession->ShareDaily(stringType, stringCreateTime);
  2265. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2266. {
  2267. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2268. return nRet;
  2269. }
  2270. if(m_nSaveType == 1)
  2271. {
  2272. m_stringContent = m_pPhmsSession->GetContent();
  2273. }
  2274. return PHMS_SUCCESSFUL_RESULT;
  2275. }
  2276. int CInternalNetIntetface::DeleteDaily(string stringType, string stringDate)
  2277. {
  2278. int nRet = PHMS_SUCCESSFUL_RESULT;
  2279. m_pPhmsSession->SetSaveType(m_nSaveType);
  2280. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2281. nRet = m_pPhmsSession->DeleteDaily(stringType, stringDate);
  2282. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2283. {
  2284. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2285. return nRet;
  2286. }
  2287. if(m_nSaveType == 1)
  2288. {
  2289. m_stringContent = m_pPhmsSession->GetContent();
  2290. }
  2291. return PHMS_SUCCESSFUL_RESULT;
  2292. }
  2293. int CInternalNetIntetface::PhoneScanQR(string stringQRCode)
  2294. {
  2295. int nRet = PHMS_SUCCESSFUL_RESULT;
  2296. m_pPhmsSession->SetSaveType(m_nSaveType);
  2297. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2298. nRet = m_pPhmsSession->PhoneScanQR(stringQRCode);
  2299. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2300. {
  2301. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2302. return nRet;
  2303. }
  2304. if(m_nSaveType == 1)
  2305. {
  2306. m_stringContent = m_pPhmsSession->GetContent();
  2307. }
  2308. return PHMS_SUCCESSFUL_RESULT;
  2309. }
  2310. int CInternalNetIntetface::PhoneScanQRVerify(string stringQRCode)
  2311. {
  2312. int nRet = PHMS_SUCCESSFUL_RESULT;
  2313. m_pPhmsSession->SetSaveType(m_nSaveType);
  2314. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2315. nRet = m_pPhmsSession->PhoneScanQRVerify(stringQRCode);
  2316. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2317. {
  2318. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2319. return nRet;
  2320. }
  2321. if(m_nSaveType == 1)
  2322. {
  2323. m_stringContent = m_pPhmsSession->GetContent();
  2324. }
  2325. return PHMS_SUCCESSFUL_RESULT;
  2326. }
  2327. int CInternalNetIntetface::ApplyQRCode(string stringType, string stringScene)
  2328. {
  2329. int nRet = PHMS_SUCCESSFUL_RESULT;
  2330. m_pPhmsSession->SetSaveType(m_nSaveType);
  2331. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2332. nRet = m_pPhmsSession->ApplyQRCode(stringType, stringScene);
  2333. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2334. {
  2335. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2336. return nRet;
  2337. }
  2338. if(m_nSaveType == 1)
  2339. {
  2340. m_stringContent = m_pPhmsSession->GetContent();
  2341. }
  2342. return PHMS_SUCCESSFUL_RESULT;
  2343. }
  2344. int CInternalNetIntetface::ValidateUserAccount(string stringLoginId, string stringPassword, string stringRole)
  2345. {
  2346. int nRet = PHMS_SUCCESSFUL_RESULT;
  2347. m_pPhmsSession->SetSaveType(m_nSaveType);
  2348. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2349. nRet = m_pPhmsSession->ValidateUserAccount(stringLoginId, stringPassword, stringRole);
  2350. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2351. {
  2352. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2353. return nRet;
  2354. }
  2355. if(m_nSaveType == 1)
  2356. {
  2357. m_stringContent = m_pPhmsSession->GetContent();
  2358. }
  2359. return PHMS_SUCCESSFUL_RESULT;
  2360. }
  2361. int CInternalNetIntetface::RegisterBluetoothDevice(string stringUniqueSN, string stringSerial, string stringBluetoothAddress, string stringBluetoothName, string stringDeviceType)
  2362. {
  2363. int nRet = PHMS_SUCCESSFUL_RESULT;
  2364. m_pPhmsSession->SetSaveType(m_nSaveType);
  2365. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2366. nRet = m_pPhmsSession->RegisterBluetoothDevice(stringUniqueSN, stringSerial, stringBluetoothAddress, stringBluetoothName, stringDeviceType);
  2367. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2368. {
  2369. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2370. return nRet;
  2371. }
  2372. if(m_nSaveType == 1)
  2373. {
  2374. m_stringContent = m_pPhmsSession->GetContent();
  2375. }
  2376. return PHMS_SUCCESSFUL_RESULT;
  2377. }
  2378. int CInternalNetIntetface::GetBluetoothInfoOfDevice(string stringUniqueSN)
  2379. {
  2380. int nRet = PHMS_SUCCESSFUL_RESULT;
  2381. m_pPhmsSession->SetSaveType(m_nSaveType);
  2382. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2383. nRet = m_pPhmsSession->GetBluetoothInfoOfDevice(stringUniqueSN);
  2384. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2385. {
  2386. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2387. return nRet;
  2388. }
  2389. if(m_nSaveType == 1)
  2390. {
  2391. m_stringContent = m_pPhmsSession->GetContent();
  2392. }
  2393. return PHMS_SUCCESSFUL_RESULT;
  2394. }
  2395. int CInternalNetIntetface::ChangeDeviceType(string stringUniqueSN, string stringDeviceType)
  2396. {
  2397. int nRet = PHMS_SUCCESSFUL_RESULT;
  2398. m_pPhmsSession->SetSaveType(m_nSaveType);
  2399. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2400. nRet = m_pPhmsSession->ChangeDeviceType(stringUniqueSN, stringDeviceType);
  2401. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2402. {
  2403. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2404. return nRet;
  2405. }
  2406. if(m_nSaveType == 1)
  2407. {
  2408. m_stringContent = m_pPhmsSession->GetContent();
  2409. }
  2410. return PHMS_SUCCESSFUL_RESULT;
  2411. }
  2412. int CInternalNetIntetface::UnregisterBluetoothDevice(string stringUniqueSN)
  2413. {
  2414. int nRet = PHMS_SUCCESSFUL_RESULT;
  2415. m_pPhmsSession->SetSaveType(m_nSaveType);
  2416. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2417. nRet = m_pPhmsSession->UnregisterBluetoothDevice(stringUniqueSN);
  2418. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2419. {
  2420. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2421. return nRet;
  2422. }
  2423. if(m_nSaveType == 1)
  2424. {
  2425. m_stringContent = m_pPhmsSession->GetContent();
  2426. }
  2427. return PHMS_SUCCESSFUL_RESULT;
  2428. }
  2429. int CInternalNetIntetface::GetHospitalListOfArea(string stringAreaId, string stringRank, string stringBeta)
  2430. {
  2431. int nRet = PHMS_SUCCESSFUL_RESULT;
  2432. m_pPhmsSession->SetSaveType(m_nSaveType);
  2433. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2434. nRet = m_pPhmsSession->GetHospitalListOfArea(stringAreaId, stringRank, stringBeta);
  2435. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2436. {
  2437. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2438. return nRet;
  2439. }
  2440. if(m_nSaveType == 1)
  2441. {
  2442. m_stringContent = m_pPhmsSession->GetContent();
  2443. }
  2444. return PHMS_SUCCESSFUL_RESULT;
  2445. }
  2446. int CInternalNetIntetface::UploadCommonFileSegment (string stringType, string stringExtra, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
  2447. unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath, string stringFileType)
  2448. {
  2449. //验证参数
  2450. if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
  2451. {
  2452. //写日志
  2453. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  2454. return COMMON_PARAM_VALIDATE_FAIL;
  2455. }
  2456. int nRet = PHMS_SUCCESSFUL_RESULT;
  2457. m_pPhmsSession->SetSaveType(m_nSaveType);
  2458. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2459. //获得stringTotalSize参数
  2460. string stringTotalSize;
  2461. stringTotalSize = CUtil::ULongToString(nTotalSize);
  2462. //获得stringOrder
  2463. string stringOrder;
  2464. this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
  2465. //获得Start\End\Md5信息
  2466. vSegmentInfo vSi;
  2467. nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
  2468. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2469. {
  2470. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2471. return nRet;
  2472. }
  2473. //生成临时文件
  2474. string stringTempUploadFilePath;
  2475. nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
  2476. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2477. {
  2478. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2479. return nRet;
  2480. }
  2481. nRet = m_pPhmsSession->UploadCommonFileSegment(stringType, stringExtra, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
  2482. vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
  2483. vSi[2].m_stringMd5, stringTempUploadFilePath, stringFileType);
  2484. try
  2485. {
  2486. File fileTempUploadFile(stringTempUploadFilePath, "gbk");
  2487. fileTempUploadFile.remove(false);
  2488. }
  2489. catch(const Exception&)
  2490. {
  2491. }
  2492. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2493. {
  2494. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2495. return nRet;
  2496. }
  2497. if(m_nSaveType == 1)
  2498. {
  2499. m_stringContent = m_pPhmsSession->GetContent();
  2500. }
  2501. return PHMS_SUCCESSFUL_RESULT;
  2502. }
  2503. int CInternalNetIntetface::SearchSomebody(string stringUserId)
  2504. {
  2505. int nRet = PHMS_SUCCESSFUL_RESULT;
  2506. m_pPhmsSession->SetSaveType(m_nSaveType);
  2507. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2508. nRet = m_pPhmsSession->SearchSomebody(stringUserId);
  2509. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2510. {
  2511. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2512. return nRet;
  2513. }
  2514. if(m_nSaveType == 1)
  2515. {
  2516. m_stringContent = m_pPhmsSession->GetContent();
  2517. }
  2518. return PHMS_SUCCESSFUL_RESULT;
  2519. }
  2520. int CInternalNetIntetface::FollowSomebody(string stringUserId, string stringUsername, string stringNickname, string stringVCode)
  2521. {
  2522. int nRet = PHMS_SUCCESSFUL_RESULT;
  2523. m_pPhmsSession->SetSaveType(m_nSaveType);
  2524. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2525. nRet = m_pPhmsSession->FollowSomebody(stringUserId, stringUsername, stringNickname, stringVCode);
  2526. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2527. {
  2528. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2529. return nRet;
  2530. }
  2531. if(m_nSaveType == 1)
  2532. {
  2533. m_stringContent = m_pPhmsSession->GetContent();
  2534. }
  2535. return PHMS_SUCCESSFUL_RESULT;
  2536. }
  2537. int CInternalNetIntetface::MyFollowing(string stringUserId, string stringNextId, string stringFType)
  2538. {
  2539. int nRet = PHMS_SUCCESSFUL_RESULT;
  2540. m_pPhmsSession->SetSaveType(m_nSaveType);
  2541. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2542. nRet = m_pPhmsSession->MyFollowing(stringUserId, stringNextId, stringFType);
  2543. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2544. {
  2545. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2546. return nRet;
  2547. }
  2548. if(m_nSaveType == 1)
  2549. {
  2550. m_stringContent = m_pPhmsSession->GetContent();
  2551. }
  2552. return PHMS_SUCCESSFUL_RESULT;
  2553. }
  2554. int CInternalNetIntetface::MyFans(string stringUserId, string stringNextId)
  2555. {
  2556. int nRet = PHMS_SUCCESSFUL_RESULT;
  2557. m_pPhmsSession->SetSaveType(m_nSaveType);
  2558. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2559. nRet = m_pPhmsSession->MyFans(stringUserId, stringNextId);
  2560. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2561. {
  2562. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2563. return nRet;
  2564. }
  2565. if(m_nSaveType == 1)
  2566. {
  2567. m_stringContent = m_pPhmsSession->GetContent();
  2568. }
  2569. return PHMS_SUCCESSFUL_RESULT;
  2570. }
  2571. int CInternalNetIntetface::ChangeNicknameOfFollowed(string stringUserId, string stringNickname)
  2572. {
  2573. int nRet = PHMS_SUCCESSFUL_RESULT;
  2574. m_pPhmsSession->SetSaveType(m_nSaveType);
  2575. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2576. nRet = m_pPhmsSession->ChangeNicknameOfFollowed(stringUserId, stringNickname);
  2577. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2578. {
  2579. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2580. return nRet;
  2581. }
  2582. if(m_nSaveType == 1)
  2583. {
  2584. m_stringContent = m_pPhmsSession->GetContent();
  2585. }
  2586. return PHMS_SUCCESSFUL_RESULT;
  2587. }
  2588. int CInternalNetIntetface::CancelFollowing(string stringUserId)
  2589. {
  2590. int nRet = PHMS_SUCCESSFUL_RESULT;
  2591. m_pPhmsSession->SetSaveType(m_nSaveType);
  2592. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2593. nRet = m_pPhmsSession->CancelFollowing(stringUserId);
  2594. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2595. {
  2596. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2597. return nRet;
  2598. }
  2599. if(m_nSaveType == 1)
  2600. {
  2601. m_stringContent = m_pPhmsSession->GetContent();
  2602. }
  2603. return PHMS_SUCCESSFUL_RESULT;
  2604. }
  2605. int CInternalNetIntetface::PublishHealthyKnowledge(vector<HEALTHY_KNOWLEDGE> vHealthKnowledge)
  2606. {
  2607. int nRet = PHMS_SUCCESSFUL_RESULT;
  2608. m_pPhmsSession->SetSaveType(m_nSaveType);
  2609. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2610. nRet = m_pPhmsSession->PublishHealthyKnowledge(vHealthKnowledge);
  2611. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2612. {
  2613. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2614. return nRet;
  2615. }
  2616. if(m_nSaveType == 1)
  2617. {
  2618. m_stringContent = m_pPhmsSession->GetContent();
  2619. }
  2620. return PHMS_SUCCESSFUL_RESULT;
  2621. }
  2622. int CInternalNetIntetface::GetListOfHealthyKnowledge(string stringSenderId, string stringNextId, string stringIds, string stringPageSize, string stringOrderBy)
  2623. {
  2624. int nRet = PHMS_SUCCESSFUL_RESULT;
  2625. m_pPhmsSession->SetSaveType(m_nSaveType);
  2626. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2627. nRet = m_pPhmsSession->GetListOfHealthyKnowledge(stringSenderId, stringNextId, stringIds, stringPageSize, stringOrderBy);
  2628. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2629. {
  2630. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2631. return nRet;
  2632. }
  2633. if(m_nSaveType == 1)
  2634. {
  2635. m_stringContent = m_pPhmsSession->GetContent();
  2636. }
  2637. return PHMS_SUCCESSFUL_RESULT;
  2638. }
  2639. int CInternalNetIntetface::GetCardUserReportList(string stringReportId, string stringReportStartDate, string stringReportEndDate, string stringCaseType, string stringState, string stringOrderBy,
  2640. string stringThirdIdType, string stringThirdId, string stringNextId, string stringPageSize)
  2641. {
  2642. int nRet = PHMS_SUCCESSFUL_RESULT;
  2643. m_pPhmsSession->SetSaveType(m_nSaveType);
  2644. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2645. nRet = m_pPhmsSession->GetCardUserReportList(stringReportId, stringReportStartDate, stringReportEndDate, stringCaseType, stringState, stringOrderBy, stringThirdIdType, stringThirdId, stringNextId, stringPageSize);
  2646. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2647. {
  2648. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2649. return nRet;
  2650. }
  2651. if(m_nSaveType == 1)
  2652. {
  2653. m_stringContent = m_pPhmsSession->GetContent();
  2654. }
  2655. return PHMS_SUCCESSFUL_RESULT;
  2656. }
  2657. int CInternalNetIntetface::ChangeViewLikeCollectCount(string stringHealthTipId, string stringUri, string stringTitle, string stringLike, string stringRead, string stringCollect)
  2658. {
  2659. int nRet = PHMS_SUCCESSFUL_RESULT;
  2660. m_pPhmsSession->SetSaveType(m_nSaveType);
  2661. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2662. nRet = m_pPhmsSession->ChangeViewLikeCollectCount(stringHealthTipId, stringUri, stringTitle, stringLike, stringRead, stringCollect);
  2663. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2664. {
  2665. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2666. return nRet;
  2667. }
  2668. if(m_nSaveType == 1)
  2669. {
  2670. m_stringContent = m_pPhmsSession->GetContent();
  2671. }
  2672. return PHMS_SUCCESSFUL_RESULT;
  2673. }
  2674. int CInternalNetIntetface::ChangeAdviceExecutiveState(string stringSgId, string stringState)
  2675. {
  2676. int nRet = PHMS_SUCCESSFUL_RESULT;
  2677. m_pPhmsSession->SetSaveType(m_nSaveType);
  2678. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2679. nRet = m_pPhmsSession->ChangeAdviceExecutiveState(stringSgId, stringState);
  2680. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2681. {
  2682. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2683. return nRet;
  2684. }
  2685. if(m_nSaveType == 1)
  2686. {
  2687. m_stringContent = m_pPhmsSession->GetContent();
  2688. }
  2689. return PHMS_SUCCESSFUL_RESULT;
  2690. }
  2691. int CInternalNetIntetface::GetTrendRangeValue()
  2692. {
  2693. int nRet = PHMS_SUCCESSFUL_RESULT;
  2694. m_pPhmsSession->SetSaveType(m_nSaveType);
  2695. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2696. nRet = m_pPhmsSession->GetTrendRangeValue();
  2697. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2698. {
  2699. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2700. return nRet;
  2701. }
  2702. if(m_nSaveType == 1)
  2703. {
  2704. m_stringContent = m_pPhmsSession->GetContent();
  2705. }
  2706. return PHMS_SUCCESSFUL_RESULT;
  2707. }
  2708. int CInternalNetIntetface::GetCliniqueReportList(string stringCliniqueSenderId, string stringStartDate,
  2709. string stringEndDate, string stringState, string stringName, string stringPatientSourceCode, string stringYzlb, string stringPIdType, string stringPId, string stringHb, string stringASectionId, string stringNextId, string stringPageSize)
  2710. {
  2711. int nRet = PHMS_SUCCESSFUL_RESULT;
  2712. m_pPhmsSession->SetSaveType(m_nSaveType);
  2713. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2714. nRet = m_pPhmsSession->GetCliniqueReportList(stringCliniqueSenderId, stringStartDate, stringEndDate, stringState, stringName, stringPatientSourceCode, stringYzlb, stringPIdType, stringPId, stringHb, stringASectionId, stringNextId, stringPageSize);
  2715. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2716. {
  2717. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2718. return nRet;
  2719. }
  2720. if(m_nSaveType == 1)
  2721. {
  2722. m_stringContent = m_pPhmsSession->GetContent();
  2723. }
  2724. return PHMS_SUCCESSFUL_RESULT;
  2725. }
  2726. int CInternalNetIntetface::GetUserListBindingOrNot(string stringNextId, string stringPageSize, string stringIsBind, string stringIsActive)
  2727. {
  2728. int nRet = PHMS_SUCCESSFUL_RESULT;
  2729. m_pPhmsSession->SetSaveType(m_nSaveType);
  2730. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2731. nRet = m_pPhmsSession->GetUserListBindingOrNot(stringNextId, stringPageSize, stringIsBind, stringIsActive);
  2732. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2733. {
  2734. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2735. return nRet;
  2736. }
  2737. if(m_nSaveType == 1)
  2738. {
  2739. m_stringContent = m_pPhmsSession->GetContent();
  2740. }
  2741. return PHMS_SUCCESSFUL_RESULT;
  2742. }
  2743. int CInternalNetIntetface::BindUser(string stringUId, string stringUName)
  2744. {
  2745. int nRet = PHMS_SUCCESSFUL_RESULT;
  2746. m_pPhmsSession->SetSaveType(m_nSaveType);
  2747. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2748. nRet = m_pPhmsSession->BindUser(stringUId, stringUName);
  2749. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2750. {
  2751. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2752. return nRet;
  2753. }
  2754. if(m_nSaveType == 1)
  2755. {
  2756. m_stringContent = m_pPhmsSession->GetContent();
  2757. }
  2758. return PHMS_SUCCESSFUL_RESULT;
  2759. }
  2760. int CInternalNetIntetface::UnbindUser(string stringUId)
  2761. {
  2762. int nRet = PHMS_SUCCESSFUL_RESULT;
  2763. m_pPhmsSession->SetSaveType(m_nSaveType);
  2764. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2765. nRet = m_pPhmsSession->UnbindUser(stringUId);
  2766. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2767. {
  2768. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2769. return nRet;
  2770. }
  2771. if(m_nSaveType == 1)
  2772. {
  2773. m_stringContent = m_pPhmsSession->GetContent();
  2774. }
  2775. return PHMS_SUCCESSFUL_RESULT;
  2776. }
  2777. int CInternalNetIntetface::GetCardUserListOfCustomer(string stringThirdId, string stringName, string stringCaseType, string stringStartDate, string stringEndDate, string stringNextId, unsigned int nPageSize)
  2778. {
  2779. int nRet = PHMS_SUCCESSFUL_RESULT;
  2780. m_pPhmsSession->SetSaveType(m_nSaveType);
  2781. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2782. string stringPageSize = CUtil::UIntToString(nPageSize);
  2783. nRet = m_pPhmsSession->GetCardUserListOfCustomer(stringThirdId, stringName, stringCaseType, stringStartDate, stringEndDate, stringNextId, stringPageSize);
  2784. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2785. {
  2786. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2787. return nRet;
  2788. }
  2789. if(m_nSaveType == 1)
  2790. {
  2791. m_stringContent = m_pPhmsSession->GetContent();
  2792. }
  2793. return PHMS_SUCCESSFUL_RESULT;
  2794. }
  2795. int CInternalNetIntetface::SearchCaseAdvanced(string stringHospitalId, string stringDiagnostic,
  2796. string stringName, string stringSex, QUERY_RANGE rangeAge, QUERY_RANGE rangeCreateTime, string stringMode,
  2797. string stringCaseType, QUERY_ECG ecg, string stringFrom, string stringSize)
  2798. {
  2799. int nRet = PHMS_SUCCESSFUL_RESULT;
  2800. m_pPhmsSession->SetSaveType(m_nSaveType);
  2801. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2802. nRet = m_pPhmsSession->SearchCaseAdvanced(stringHospitalId, stringDiagnostic, stringName, stringSex, rangeAge,
  2803. rangeCreateTime, stringMode, stringCaseType, ecg, stringFrom, stringSize);
  2804. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2805. {
  2806. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2807. return nRet;
  2808. }
  2809. if(m_nSaveType == 1)
  2810. {
  2811. m_stringContent = m_pPhmsSession->GetContent();
  2812. }
  2813. return PHMS_SUCCESSFUL_RESULT;
  2814. }
  2815. int CInternalNetIntetface::SearchCaseAdvancedString(string stringHospitalId, string stringDiagnostic,
  2816. string stringName, string stringSex, string stringJsonAge, string stringJsonCreateTime, string stringMode,
  2817. string stringCaseType, string stringJsonEcg, string stringFrom, string stringSize)
  2818. {
  2819. int nRet = PHMS_SUCCESSFUL_RESULT;
  2820. m_pPhmsSession->SetSaveType(m_nSaveType);
  2821. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2822. nRet = m_pPhmsSession->SearchCaseAdvancedString(stringHospitalId, stringDiagnostic, stringName, stringSex, stringJsonAge,
  2823. stringJsonCreateTime, stringMode, stringCaseType, stringJsonEcg, stringFrom, stringSize);
  2824. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2825. {
  2826. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2827. return nRet;
  2828. }
  2829. if(m_nSaveType == 1)
  2830. {
  2831. m_stringContent = m_pPhmsSession->GetContent();
  2832. }
  2833. return PHMS_SUCCESSFUL_RESULT;
  2834. }
  2835. int CInternalNetIntetface::GetPayCode(string stringType, string stringCaseId)
  2836. {
  2837. int nRet = PHMS_SUCCESSFUL_RESULT;
  2838. m_pPhmsSession->SetSaveType(m_nSaveType);
  2839. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2840. nRet = m_pPhmsSession->GetPayCode(stringType, stringCaseId);
  2841. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2842. {
  2843. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2844. return nRet;
  2845. }
  2846. if(m_nSaveType == 1)
  2847. {
  2848. m_stringContent = m_pPhmsSession->GetContent();
  2849. }
  2850. return PHMS_SUCCESSFUL_RESULT;
  2851. }
  2852. int CInternalNetIntetface::GetOrderInfo(string stringType, string stringCaseId)
  2853. {
  2854. int nRet = PHMS_SUCCESSFUL_RESULT;
  2855. m_pPhmsSession->SetSaveType(m_nSaveType);
  2856. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2857. nRet = m_pPhmsSession->GetOrderInfo(stringType, stringCaseId);
  2858. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2859. {
  2860. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2861. return nRet;
  2862. }
  2863. if(m_nSaveType == 1)
  2864. {
  2865. m_stringContent = m_pPhmsSession->GetContent();
  2866. }
  2867. return PHMS_SUCCESSFUL_RESULT;
  2868. }
  2869. int CInternalNetIntetface::SignDoctor(string stringUId)
  2870. {
  2871. int nRet = PHMS_SUCCESSFUL_RESULT;
  2872. m_pPhmsSession->SetSaveType(m_nSaveType);
  2873. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2874. nRet = m_pPhmsSession->SignDoctor(stringUId);
  2875. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2876. {
  2877. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2878. return nRet;
  2879. }
  2880. if(m_nSaveType == 1)
  2881. {
  2882. m_stringContent = m_pPhmsSession->GetContent();
  2883. }
  2884. return PHMS_SUCCESSFUL_RESULT;
  2885. }
  2886. int CInternalNetIntetface::RefundFee(string stringType, string stringCaseId, string stringRefundFee)
  2887. {
  2888. int nRet = PHMS_SUCCESSFUL_RESULT;
  2889. m_pPhmsSession->SetSaveType(m_nSaveType);
  2890. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2891. nRet = m_pPhmsSession->RefundFee(stringType, stringCaseId, stringRefundFee);
  2892. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2893. {
  2894. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2895. return nRet;
  2896. }
  2897. if(m_nSaveType == 1)
  2898. {
  2899. m_stringContent = m_pPhmsSession->GetContent();
  2900. }
  2901. return PHMS_SUCCESSFUL_RESULT;
  2902. }
  2903. int CInternalNetIntetface::HoldPlaceReview(string stringReportId)
  2904. {
  2905. int nRet = PHMS_SUCCESSFUL_RESULT;
  2906. m_pPhmsSession->SetSaveType(m_nSaveType);
  2907. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2908. nRet = m_pPhmsSession->HoldPlaceReview(stringReportId);
  2909. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2910. {
  2911. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2912. return nRet;
  2913. }
  2914. if(m_nSaveType == 1)
  2915. {
  2916. m_stringContent = m_pPhmsSession->GetContent();
  2917. }
  2918. return PHMS_SUCCESSFUL_RESULT;
  2919. }
  2920. int CInternalNetIntetface::RollBackReview(string stringReportId)
  2921. {
  2922. int nRet = PHMS_SUCCESSFUL_RESULT;
  2923. m_pPhmsSession->SetSaveType(m_nSaveType);
  2924. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2925. nRet = m_pPhmsSession->RollBackReview(stringReportId);
  2926. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2927. {
  2928. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2929. return nRet;
  2930. }
  2931. if(m_nSaveType == 1)
  2932. {
  2933. m_stringContent = m_pPhmsSession->GetContent();
  2934. }
  2935. return PHMS_SUCCESSFUL_RESULT;
  2936. }
  2937. int CInternalNetIntetface::ResetReviewHoldPlace(string stringReportId, string stringOccupantId, string stringOccupantName, string stringSuperKey)
  2938. {
  2939. int nRet = PHMS_SUCCESSFUL_RESULT;
  2940. m_pPhmsSession->SetSaveType(m_nSaveType);
  2941. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2942. nRet = m_pPhmsSession->ResetReviewHoldPlace(stringReportId, stringOccupantId, stringOccupantName, stringSuperKey);
  2943. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2944. {
  2945. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2946. return nRet;
  2947. }
  2948. if(m_nSaveType == 1)
  2949. {
  2950. m_stringContent = m_pPhmsSession->GetContent();
  2951. }
  2952. return PHMS_SUCCESSFUL_RESULT;
  2953. }
  2954. int CInternalNetIntetface::ResetCaseHoldPlace(string stringCaseId, string stringReceiverId, string stringOccupantId, string stringOccupantName, string stringSuperKey)
  2955. {
  2956. int nRet = PHMS_SUCCESSFUL_RESULT;
  2957. m_pPhmsSession->SetSaveType(m_nSaveType);
  2958. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2959. nRet = m_pPhmsSession->ResetCaseHoldPlace(stringCaseId, stringReceiverId, stringOccupantId, stringOccupantName, stringSuperKey);
  2960. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2961. {
  2962. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2963. return nRet;
  2964. }
  2965. if(m_nSaveType == 1)
  2966. {
  2967. m_stringContent = m_pPhmsSession->GetContent();
  2968. }
  2969. return PHMS_SUCCESSFUL_RESULT;
  2970. }
  2971. int CInternalNetIntetface::GenerateOrDeletePngZlibReport(string stringServerPath, string stringFlag)
  2972. {
  2973. int nRet = PHMS_SUCCESSFUL_RESULT;
  2974. m_pPhmsSession->SetSaveType(m_nSaveType);
  2975. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2976. nRet = m_pPhmsSession->GenerateOrDeletePngZlibReport(stringServerPath, stringFlag);
  2977. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2978. {
  2979. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2980. return nRet;
  2981. }
  2982. if(m_nSaveType == 1)
  2983. {
  2984. m_stringContent = m_pPhmsSession->GetContent();
  2985. }
  2986. return PHMS_SUCCESSFUL_RESULT;
  2987. }
  2988. int CInternalNetIntetface::GetDailyList(string stringType, string stringStartDate, string stringEndDate, string stringOrderBy, string stringNextId, string stringPageSize)
  2989. {
  2990. int nRet = PHMS_SUCCESSFUL_RESULT;
  2991. m_pPhmsSession->SetSaveType(m_nSaveType);
  2992. m_pPhmsSession->SetFilePath(m_stringFilePath);
  2993. nRet = m_pPhmsSession->GetDailyList(stringType, stringStartDate, stringEndDate, stringOrderBy, stringNextId, stringPageSize);
  2994. if(nRet != PHMS_SUCCESSFUL_RESULT)
  2995. {
  2996. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  2997. return nRet;
  2998. }
  2999. if(m_nSaveType == 1)
  3000. {
  3001. m_stringContent = m_pPhmsSession->GetContent();
  3002. }
  3003. return PHMS_SUCCESSFUL_RESULT;
  3004. }
  3005. int CInternalNetIntetface::AddTag(string stringTagName, string stringTagDescription)
  3006. {
  3007. int nRet = PHMS_SUCCESSFUL_RESULT;
  3008. m_pPhmsSession->SetSaveType(m_nSaveType);
  3009. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3010. nRet = m_pPhmsSession->AddTag(stringTagName, stringTagDescription);
  3011. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3012. {
  3013. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3014. return nRet;
  3015. }
  3016. if(m_nSaveType == 1)
  3017. {
  3018. m_stringContent = m_pPhmsSession->GetContent();
  3019. }
  3020. return PHMS_SUCCESSFUL_RESULT;
  3021. }
  3022. int CInternalNetIntetface::GetTagList(string stringSenderId)
  3023. {
  3024. int nRet = PHMS_SUCCESSFUL_RESULT;
  3025. m_pPhmsSession->SetSaveType(m_nSaveType);
  3026. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3027. nRet = m_pPhmsSession->GetTagList(stringSenderId);
  3028. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3029. {
  3030. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3031. return nRet;
  3032. }
  3033. if(m_nSaveType == 1)
  3034. {
  3035. m_stringContent = m_pPhmsSession->GetContent();
  3036. }
  3037. return PHMS_SUCCESSFUL_RESULT;
  3038. }
  3039. int CInternalNetIntetface::AddCaseToTag(string stringTagId, string stringTagName, string stringCaseId, string stringCaseType, string stringCaseTypeName, string stringPatientName)
  3040. {
  3041. int nRet = PHMS_SUCCESSFUL_RESULT;
  3042. m_pPhmsSession->SetSaveType(m_nSaveType);
  3043. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3044. nRet = m_pPhmsSession->AddCaseToTag(stringTagId, stringTagName, stringCaseId, stringCaseType, stringCaseTypeName, stringPatientName);
  3045. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3046. {
  3047. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3048. return nRet;
  3049. }
  3050. if(m_nSaveType == 1)
  3051. {
  3052. m_stringContent = m_pPhmsSession->GetContent();
  3053. }
  3054. return PHMS_SUCCESSFUL_RESULT;
  3055. }
  3056. int CInternalNetIntetface::GetCaseListOfTag(string stringTagId, string stringSenderId, string stringCaseType)
  3057. {
  3058. int nRet = PHMS_SUCCESSFUL_RESULT;
  3059. m_pPhmsSession->SetSaveType(m_nSaveType);
  3060. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3061. nRet = m_pPhmsSession->GetCaseListOfTag(stringTagId, stringSenderId, stringCaseType);
  3062. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3063. {
  3064. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3065. return nRet;
  3066. }
  3067. if(m_nSaveType == 1)
  3068. {
  3069. m_stringContent = m_pPhmsSession->GetContent();
  3070. }
  3071. return PHMS_SUCCESSFUL_RESULT;
  3072. }
  3073. // int CInternalNetIntetface::CreateSession_GuanXin(string stringUsername, string stringPassword)
  3074. // {
  3075. // int nRet = PHMS_SUCCESSFUL_RESULT;
  3076. // m_pPhmsSession->SetSaveType(m_nSaveType);
  3077. // m_pPhmsSession->SetFilePath(m_stringFilePath);
  3078. // nRet = m_pPhmsSession->CreateSession_GuanXin(stringUsername, stringPassword);
  3079. // if(nRet != PHMS_SUCCESSFUL_RESULT)
  3080. // {
  3081. // CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3082. // return nRet;
  3083. // }
  3084. // if(m_nSaveType == 1)
  3085. // {
  3086. // m_stringContent = m_pPhmsSession->GetContent();
  3087. // }
  3088. // return PHMS_SUCCESSFUL_RESULT;
  3089. // }
  3090. int CInternalNetIntetface::GetAccessToken_GuanXin(string stringUsername, string stringPassword)
  3091. {
  3092. int nRet = PHMS_SUCCESSFUL_RESULT;
  3093. m_pPhmsSession->SetSaveType(m_nSaveType);
  3094. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3095. nRet = m_pPhmsSession->GetAccessToken_GuanXin(stringUsername, stringPassword);
  3096. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3097. {
  3098. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3099. return nRet;
  3100. }
  3101. if(m_nSaveType == 1)
  3102. {
  3103. m_stringContent = m_pPhmsSession->GetContent();
  3104. }
  3105. return PHMS_SUCCESSFUL_RESULT;
  3106. }
  3107. int CInternalNetIntetface::GetPersonInfo_GuanXin(string stringAccessToken, string stringPersonName, string stringPersonGender, string stringPersonIdentity, string stringPersonBirthDate)
  3108. {
  3109. int nRet = PHMS_SUCCESSFUL_RESULT;
  3110. m_pPhmsSession->SetSaveType(m_nSaveType);
  3111. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3112. nRet = m_pPhmsSession->GetPersonInfo_GuanXin(stringAccessToken, stringPersonName, stringPersonGender, stringPersonIdentity, stringPersonBirthDate);
  3113. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3114. {
  3115. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3116. return nRet;
  3117. }
  3118. if(m_nSaveType == 1)
  3119. {
  3120. m_stringContent = m_pPhmsSession->GetContent();
  3121. }
  3122. return PHMS_SUCCESSFUL_RESULT;
  3123. }
  3124. int CInternalNetIntetface::UploadECGData_GuanXin(string stringECGXmlPath, string stringECGDataPath)
  3125. {
  3126. int nRet = PHMS_SUCCESSFUL_RESULT;
  3127. m_pPhmsSession->SetSaveType(m_nSaveType);
  3128. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3129. nRet = m_pPhmsSession->UploadECGData_GuanXin(stringECGXmlPath, stringECGDataPath);
  3130. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3131. {
  3132. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3133. return nRet;
  3134. }
  3135. if(m_nSaveType == 1)
  3136. {
  3137. m_stringContent = m_pPhmsSession->GetContent();
  3138. }
  3139. return PHMS_SUCCESSFUL_RESULT;
  3140. }
  3141. int CInternalNetIntetface::UploadOtherData_GuanXin(string stringOtherXmlPath)
  3142. {
  3143. int nRet = PHMS_SUCCESSFUL_RESULT;
  3144. m_pPhmsSession->SetSaveType(m_nSaveType);
  3145. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3146. nRet = m_pPhmsSession->UploadOtherData_GuanXin(stringOtherXmlPath);
  3147. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3148. {
  3149. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3150. return nRet;
  3151. }
  3152. if(m_nSaveType == 1)
  3153. {
  3154. m_stringContent = m_pPhmsSession->GetContent();
  3155. }
  3156. return PHMS_SUCCESSFUL_RESULT;
  3157. }
  3158. int CInternalNetIntetface::UploadCheckData_GuanXin(string stringCheckXmlPath)
  3159. {
  3160. int nRet = PHMS_SUCCESSFUL_RESULT;
  3161. m_pPhmsSession->SetSaveType(m_nSaveType);
  3162. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3163. nRet = m_pPhmsSession->UploadCheckData_GuanXin(stringCheckXmlPath);
  3164. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3165. {
  3166. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3167. return nRet;
  3168. }
  3169. if(m_nSaveType == 1)
  3170. {
  3171. m_stringContent = m_pPhmsSession->GetContent();
  3172. }
  3173. return PHMS_SUCCESSFUL_RESULT;
  3174. }
  3175. int CInternalNetIntetface::UploadPersonInfo_GuanXin(string stringPersonInfoXmlPath)
  3176. {
  3177. int nRet = PHMS_SUCCESSFUL_RESULT;
  3178. m_pPhmsSession->SetSaveType(m_nSaveType);
  3179. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3180. nRet = m_pPhmsSession->UploadPersonInfo_GuanXin(stringPersonInfoXmlPath);
  3181. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3182. {
  3183. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3184. return nRet;
  3185. }
  3186. if(m_nSaveType == 1)
  3187. {
  3188. m_stringContent = m_pPhmsSession->GetContent();
  3189. }
  3190. return PHMS_SUCCESSFUL_RESULT;
  3191. }
  3192. //自定义内部接口
  3193. int CInternalNetIntetface::DownloadFile(int nThreadCount, string stringUri, unsigned long nFileSize, string stringLocalFilePath, pProgressAndSpeedCallback pCallback)
  3194. {
  3195. if(nThreadCount>3 || nThreadCount<1)
  3196. {
  3197. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_THREAD_COUNT_TOO_LARGE), __FUNCTION__, __FILE__, __LINE__);
  3198. return COMMON_DOWNLOAD_THREAD_COUNT_TOO_LARGE;
  3199. }
  3200. int nRet = PHMS_SUCCESSFUL_RESULT;
  3201. if(nFileSize == 0)
  3202. {
  3203. //应用程序未传入文件大小,需要从服务器获得文件大小
  3204. string stringServerFileSize;
  3205. this->SetSaveType(1);
  3206. nRet = this->GetAlreadyUploadFileSize(stringUri);
  3207. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3208. {
  3209. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3210. return nRet;
  3211. }
  3212. stringServerFileSize = this->GetContent();
  3213. if(stringServerFileSize.size()==0 || stringServerFileSize.compare("0")==0)
  3214. {
  3215. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_FILE_SIZE_0), __FUNCTION__, __FILE__, __LINE__);
  3216. return COMMON_DOWNLOAD_FILE_SIZE_0;
  3217. }
  3218. nFileSize = CUtil::StringToULong(stringServerFileSize);
  3219. }
  3220. const unsigned long nSegmentMaxSize = (1024*1024);
  3221. unsigned long nAlreadyCombineFileSize = 0;
  3222. unsigned long nRemainFileSize = 0;
  3223. unsigned long nAlreadyDownloadFileSize = 0;
  3224. //获得已经合并的文件大小
  3225. File fileLocalFile(stringLocalFilePath, "gbk");
  3226. if(fileLocalFile.exists())
  3227. {
  3228. nAlreadyCombineFileSize = (unsigned long)fileLocalFile.getSize();
  3229. }
  3230. else
  3231. {
  3232. nAlreadyCombineFileSize = 0;
  3233. }
  3234. nAlreadyDownloadFileSize = nAlreadyCombineFileSize;
  3235. if(nAlreadyCombineFileSize == nFileSize)
  3236. {
  3237. if(pCallback != NULL)
  3238. {
  3239. (*pCallback)(100, 0, stringUri.c_str(), stringLocalFilePath.c_str());
  3240. }
  3241. return PHMS_SUCCESSFUL_RESULT;
  3242. }
  3243. if(nAlreadyCombineFileSize > nFileSize)
  3244. {
  3245. //写日志
  3246. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_LOCAL_FILE_MORE_THAN_SERVER_FILE), __FUNCTION__, __FILE__, __LINE__);
  3247. return COMMON_LOCAL_FILE_MORE_THAN_SERVER_FILE;
  3248. }
  3249. else
  3250. {
  3251. nRemainFileSize = nFileSize - nAlreadyCombineFileSize;
  3252. }
  3253. //创建目录,并扫描临时文件,获得每个临时文件的大小,以方便继续下载
  3254. string stringTempDirectory = stringLocalFilePath+"_PHMS_TEMP";
  3255. unsigned long *pTempFileSize = new unsigned long[nThreadCount];
  3256. memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
  3257. this->GetDownloadTempFileSize(stringTempDirectory, nThreadCount, pTempFileSize);
  3258. for(int i=0; i<nThreadCount; i++)
  3259. {
  3260. nAlreadyDownloadFileSize += pTempFileSize[i];
  3261. }
  3262. //创建并启动定时器
  3263. Timer timerDownload(1000, 1000);
  3264. CDownloadTimerCallback downloadTimerCallback(pCallback, nFileSize, stringLocalFilePath, stringTempDirectory, nAlreadyDownloadFileSize, nThreadCount, stringUri);
  3265. TimerCallback<CDownloadTimerCallback> adapterDowoloadTimer(downloadTimerCallback, &CDownloadTimerCallback::onTimer);
  3266. timerDownload.start(adapterDowoloadTimer);
  3267. //下载
  3268. ThreadPool threadPool(1, nThreadCount, 60, 0);
  3269. unsigned long* pSegmentFileSize = new unsigned long[nThreadCount];
  3270. memset(pSegmentFileSize, 0, nThreadCount*sizeof(unsigned long));
  3271. while(nRemainFileSize > 0)
  3272. {
  3273. File fileDir(stringTempDirectory, "gbk");
  3274. try
  3275. {
  3276. fileDir.createDirectory();
  3277. }
  3278. catch(const Exception& e)
  3279. {
  3280. CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
  3281. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_CREATE_DIR_FAIL), __FUNCTION__, __FILE__, __LINE__);
  3282. return COMMON_CREATE_DIR_FAIL;
  3283. }
  3284. //获得分段
  3285. memset(pSegmentFileSize, 0, nThreadCount*sizeof(unsigned long));
  3286. this->DivideSegment(nRemainFileSize, nSegmentMaxSize, nThreadCount, pSegmentFileSize);
  3287. //创建线程,分段下载
  3288. vector<CInternalNetIntetface*> vNet;
  3289. vector<CDownloadThreadCallback*> vDownloadThreadCallback;
  3290. for(unsigned int i=0; i<nThreadCount; i++)
  3291. {
  3292. CDownloadThreadCallback* pDownloadThreadCallback = new CDownloadThreadCallback;
  3293. vDownloadThreadCallback.push_back(pDownloadThreadCallback);
  3294. pDownloadThreadCallback->SetUri(stringUri);
  3295. pDownloadThreadCallback->SetLocalFile(stringTempDirectory+"/"+"PHMS_TEMP_"+CUtil::UIntToString(i));
  3296. //获得之前Segment的总和
  3297. unsigned long nPreSegmentTotal = 0;
  3298. for(unsigned int j=0; j<i; j++)
  3299. {
  3300. nPreSegmentTotal += pSegmentFileSize[j];
  3301. }
  3302. pDownloadThreadCallback->SetStart(nAlreadyCombineFileSize+nPreSegmentTotal+pTempFileSize[i]);
  3303. pDownloadThreadCallback->SetEnd(nAlreadyCombineFileSize+nPreSegmentTotal+pSegmentFileSize[i]-1);
  3304. //cout<<downloadThreadCallback.GetStart()<<" "<<downloadThreadCallback.GetEnd()<<endl;
  3305. CInternalNetIntetface* pNetTemp = new CInternalNetIntetface;
  3306. vNet.push_back(pNetTemp);
  3307. pNetTemp->SetSessionId(this->GetSessionId());
  3308. pNetTemp->SetCommandType(this->GetCommandType());
  3309. pDownloadThreadCallback->SetNet(pNetTemp);
  3310. if(pDownloadThreadCallback->GetStart() <= pDownloadThreadCallback->GetEnd())
  3311. {
  3312. threadPool.start(*pDownloadThreadCallback, "PHMS_TEMP_"+CUtil::UIntToString(i));
  3313. }
  3314. }
  3315. //等待所有线程结束,两分钟,期间只要有一个线程两分钟内未结束,该函数都返回false
  3316. //极致的情况,比如三个线程等待时间有可能无限接近6分钟
  3317. //因为可能有网络太慢不能下载完成的情况,所以改成无限等待
  3318. //threadPool.tryJoinAll(60*1000*3);
  3319. while(1)
  3320. {
  3321. if(m_eventSocketAbort.tryWait(1000))
  3322. {
  3323. for(int i=0; i<vNet.size(); i++)
  3324. {
  3325. vNet[i]->AbortSession();
  3326. }
  3327. threadPool.joinAll();
  3328. break;
  3329. }
  3330. if(threadPool.tryJoinAll(1000))
  3331. {
  3332. break;
  3333. }
  3334. }
  3335. //清理线程对应网络对象
  3336. vector<CInternalNetIntetface*>::const_iterator iter1;
  3337. for(iter1=vNet.begin(); iter1!=vNet.end(); iter1++)
  3338. {
  3339. delete *iter1;
  3340. }
  3341. vNet.clear();
  3342. vector<CDownloadThreadCallback*>::const_iterator iter2;
  3343. for(iter2=vDownloadThreadCallback.begin(); iter2!=vDownloadThreadCallback.end(); iter2++)
  3344. {
  3345. delete *iter2;
  3346. }
  3347. vDownloadThreadCallback.clear();
  3348. //判断是否所有线程都下载成功,并合并文件
  3349. bool bSuccess = true;
  3350. memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
  3351. this->GetDownloadTempFileSize(stringTempDirectory, nThreadCount, pTempFileSize);
  3352. for(int i=0; i<nThreadCount; i++)
  3353. {
  3354. if(pTempFileSize[i] > pSegmentFileSize[i])
  3355. {
  3356. File fileDir(stringTempDirectory, "gbk");
  3357. fileDir.remove(true);
  3358. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_LOCAL_TEMP_TOO_LARGE), __FUNCTION__, __FILE__, __LINE__);
  3359. delete pTempFileSize;
  3360. delete pSegmentFileSize;
  3361. timerDownload.stop();
  3362. return COMMON_LOCAL_TEMP_TOO_LARGE;
  3363. }
  3364. if(pTempFileSize[i] < pSegmentFileSize[i])
  3365. {
  3366. bSuccess = false;
  3367. break;
  3368. }
  3369. }
  3370. if(bSuccess)
  3371. {
  3372. //合并文件
  3373. nRet = this->CombineSegmentFile(stringLocalFilePath, stringTempDirectory, nThreadCount);
  3374. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3375. {
  3376. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3377. delete pTempFileSize;
  3378. delete pSegmentFileSize;
  3379. timerDownload.stop();
  3380. return nRet;
  3381. }
  3382. for(int i=0; i<nThreadCount; i++)
  3383. {
  3384. nAlreadyCombineFileSize += pSegmentFileSize[i];
  3385. }
  3386. nRemainFileSize = nFileSize - nAlreadyCombineFileSize;
  3387. memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
  3388. }
  3389. else
  3390. {
  3391. //写日志
  3392. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_SEGMENT_FAIL_FOR_FILESIEZE_CHANGE), __FUNCTION__, __FILE__, __LINE__);
  3393. delete pTempFileSize;
  3394. delete pSegmentFileSize;
  3395. timerDownload.stop();
  3396. return COMMON_DOWNLOAD_SEGMENT_FAIL_FOR_FILESIEZE_CHANGE;
  3397. }
  3398. }
  3399. delete pTempFileSize;
  3400. delete pSegmentFileSize;
  3401. timerDownload.stop(true);
  3402. return PHMS_SUCCESSFUL_RESULT;
  3403. }
  3404. //UploadCase、UploadReport、UploadAudio三个函数目前只能支持大于3字节的文件上传,若文件小于3字节,上传失败
  3405. //因为UploadCaseSegment、UploadReportSegment、UploadAudioSegment三个函数目前只能支持大于3字节的文件上传
  3406. //因为PHMS协议未定义,当文件无法分出三段的情况下,应如何上传
  3407. int CInternalNetIntetface::UploadCase (string stringCaseId, string stringLocalCasePath, pProgressAndSpeedCallback pCallback)
  3408. {
  3409. const unsigned long nMaxPerTimeSize = 512*1024;
  3410. unsigned long nTotalSize = 0;
  3411. int nRet = PHMS_SUCCESSFUL_RESULT;
  3412. nRet = CUtil::GetFileSize(stringLocalCasePath, nTotalSize);
  3413. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3414. {
  3415. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3416. return nRet;
  3417. }
  3418. if(nTotalSize < 3)
  3419. {
  3420. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3421. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
  3422. return COMMON_UPLOAD_LESS_3_BYTES;
  3423. }
  3424. string stringLocalIniPath = stringLocalCasePath + ".ini";
  3425. string stringServerPath;
  3426. string stringAlreadyUploadSize;
  3427. nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3428. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3429. {
  3430. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3431. return nRet;
  3432. }
  3433. unsigned long nAlreadyUploadSize = 0;
  3434. if(stringAlreadyUploadSize.size() > 0)
  3435. {
  3436. nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
  3437. }
  3438. if(nAlreadyUploadSize == nTotalSize)
  3439. {
  3440. if(pCallback != NULL)
  3441. {
  3442. (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalCasePath.c_str());
  3443. }
  3444. return PHMS_SUCCESSFUL_RESULT;
  3445. }
  3446. if(nAlreadyUploadSize > nTotalSize)
  3447. {
  3448. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3449. return COMMON_UPLOAD_INI_SIZE_ERROR;
  3450. }
  3451. //创建并启动定时器
  3452. Timer timerUpload(1000, 1000);
  3453. CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalCasePath);
  3454. TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
  3455. timerUpload.start(adapterUpload);
  3456. unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
  3457. while(nRemainSize > 0)
  3458. {
  3459. unsigned long nThisTimeUploadSize = 0;
  3460. if(nRemainSize > nMaxPerTimeSize)
  3461. {
  3462. if(nRemainSize - nMaxPerTimeSize <3)
  3463. {
  3464. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3465. nThisTimeUploadSize = nRemainSize;
  3466. }
  3467. else
  3468. {
  3469. nThisTimeUploadSize = nMaxPerTimeSize;
  3470. }
  3471. }
  3472. else
  3473. {
  3474. nThisTimeUploadSize = nRemainSize;
  3475. }
  3476. this->SetSaveType(1);
  3477. nRet = this->UploadCaseSegment(stringCaseId, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalCasePath);
  3478. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3479. {
  3480. timerUpload.stop();
  3481. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3482. return nRet;
  3483. }
  3484. stringServerPath = this->GetContent();
  3485. stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
  3486. nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3487. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3488. {
  3489. timerUpload.stop();
  3490. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3491. return nRet;
  3492. }
  3493. nAlreadyUploadSize += nThisTimeUploadSize;
  3494. nRemainSize = nTotalSize - nAlreadyUploadSize;
  3495. }
  3496. timerUpload.stop(true);
  3497. return PHMS_SUCCESSFUL_RESULT;
  3498. }
  3499. int CInternalNetIntetface::UploadReport(string stringCaseId, string stringReceiverId, string stringCaseType, string stringReportId, string stringLocalReportPath, string stringFileType, pProgressAndSpeedCallback pCallback)
  3500. {
  3501. const unsigned long nMaxPerTimeSize = 512*1024;
  3502. unsigned long nTotalSize = 0;
  3503. int nRet = PHMS_SUCCESSFUL_RESULT;
  3504. nRet = CUtil::GetFileSize(stringLocalReportPath, nTotalSize);
  3505. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3506. {
  3507. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3508. return nRet;
  3509. }
  3510. if(nTotalSize < 3)
  3511. {
  3512. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3513. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
  3514. return COMMON_UPLOAD_LESS_3_BYTES;
  3515. }
  3516. string stringLocalIniPath = stringLocalReportPath + ".ini";
  3517. string stringServerPath;
  3518. string stringAlreadyUploadSize;
  3519. nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3520. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3521. {
  3522. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3523. return nRet;
  3524. }
  3525. unsigned long nAlreadyUploadSize = 0;
  3526. if(stringAlreadyUploadSize.size() > 0)
  3527. {
  3528. nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
  3529. }
  3530. if(nAlreadyUploadSize == nTotalSize)
  3531. {
  3532. if(pCallback != NULL)
  3533. {
  3534. (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalReportPath.c_str());
  3535. }
  3536. return PHMS_SUCCESSFUL_RESULT;
  3537. }
  3538. if(nAlreadyUploadSize > nTotalSize)
  3539. {
  3540. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3541. return COMMON_UPLOAD_INI_SIZE_ERROR;
  3542. }
  3543. //创建并启动定时器
  3544. Timer timerUpload(1000, 1000);
  3545. CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalReportPath);
  3546. TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
  3547. timerUpload.start(adapterUpload);
  3548. unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
  3549. while(nRemainSize > 0)
  3550. {
  3551. unsigned long nThisTimeUploadSize = 0;
  3552. if(nRemainSize > nMaxPerTimeSize)
  3553. {
  3554. if(nRemainSize - nMaxPerTimeSize <3)
  3555. {
  3556. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3557. nThisTimeUploadSize = nRemainSize;
  3558. }
  3559. else
  3560. {
  3561. nThisTimeUploadSize = nMaxPerTimeSize;
  3562. }
  3563. }
  3564. else
  3565. {
  3566. nThisTimeUploadSize = nRemainSize;
  3567. }
  3568. this->SetSaveType(1);
  3569. nRet = this->UploadReportSegment(stringCaseId, stringReceiverId, stringCaseType, stringReportId, nTotalSize,
  3570. nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalReportPath, stringFileType);
  3571. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3572. {
  3573. timerUpload.stop();
  3574. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3575. return nRet;
  3576. }
  3577. stringServerPath = this->GetContent();
  3578. stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
  3579. nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3580. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3581. {
  3582. timerUpload.stop();
  3583. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3584. return nRet;
  3585. }
  3586. nAlreadyUploadSize += nThisTimeUploadSize;
  3587. nRemainSize = nTotalSize - nAlreadyUploadSize;
  3588. }
  3589. timerUpload.stop(true);
  3590. return PHMS_SUCCESSFUL_RESULT;
  3591. }
  3592. int CInternalNetIntetface::UploadAudio(string stringMsgId, string stringLocalAudioPath, pProgressAndSpeedCallback pCallback)
  3593. {
  3594. const unsigned long nMaxPerTimeSize = 512*1024;
  3595. unsigned long nTotalSize = 0;
  3596. int nRet = PHMS_SUCCESSFUL_RESULT;
  3597. nRet = CUtil::GetFileSize(stringLocalAudioPath, nTotalSize);
  3598. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3599. {
  3600. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3601. return nRet;
  3602. }
  3603. if(nTotalSize < 3)
  3604. {
  3605. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3606. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
  3607. return COMMON_UPLOAD_LESS_3_BYTES;
  3608. }
  3609. string stringLocalIniPath = stringLocalAudioPath + ".ini";
  3610. string stringServerPath;
  3611. string stringAlreadyUploadSize;
  3612. nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3613. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3614. {
  3615. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3616. return nRet;
  3617. }
  3618. unsigned long nAlreadyUploadSize = 0;
  3619. if(stringAlreadyUploadSize.size() > 0)
  3620. {
  3621. nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
  3622. }
  3623. if(nAlreadyUploadSize == nTotalSize)
  3624. {
  3625. if(pCallback != NULL)
  3626. {
  3627. (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalAudioPath.c_str());
  3628. }
  3629. return PHMS_SUCCESSFUL_RESULT;
  3630. }
  3631. if(nAlreadyUploadSize > nTotalSize)
  3632. {
  3633. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3634. return COMMON_UPLOAD_INI_SIZE_ERROR;
  3635. }
  3636. //创建并启动定时器
  3637. Timer timerUpload(1000, 1000);
  3638. CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalAudioPath);
  3639. TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
  3640. timerUpload.start(adapterUpload);
  3641. unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
  3642. while(nRemainSize > 0)
  3643. {
  3644. unsigned long nThisTimeUploadSize = 0;
  3645. if(nRemainSize > nMaxPerTimeSize)
  3646. {
  3647. if(nRemainSize - nMaxPerTimeSize <3)
  3648. {
  3649. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3650. nThisTimeUploadSize = nRemainSize;
  3651. }
  3652. else
  3653. {
  3654. nThisTimeUploadSize = nMaxPerTimeSize;
  3655. }
  3656. }
  3657. else
  3658. {
  3659. nThisTimeUploadSize = nRemainSize;
  3660. }
  3661. this->SetSaveType(1);
  3662. nRet = this->UploadAudioSegment(stringMsgId, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalAudioPath);
  3663. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3664. {
  3665. timerUpload.stop();
  3666. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3667. return nRet;
  3668. }
  3669. stringServerPath = this->GetContent();
  3670. stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
  3671. nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3672. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3673. {
  3674. timerUpload.stop();
  3675. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3676. return nRet;
  3677. }
  3678. nAlreadyUploadSize += nThisTimeUploadSize;
  3679. nRemainSize = nTotalSize - nAlreadyUploadSize;
  3680. }
  3681. timerUpload.stop(true);
  3682. return PHMS_SUCCESSFUL_RESULT;
  3683. }
  3684. int CInternalNetIntetface::UploadCommonFile(string& stringUri, string stringType, string stringExtra, string stringLocalFilePath, string stringFileType, pProgressAndSpeedCallback pCallback)
  3685. {
  3686. const unsigned long nMaxPerTimeSize = 512*1024;
  3687. unsigned long nTotalSize = 0;
  3688. int nRet = PHMS_SUCCESSFUL_RESULT;
  3689. nRet = CUtil::GetFileSize(stringLocalFilePath, nTotalSize);
  3690. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3691. {
  3692. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3693. return nRet;
  3694. }
  3695. if(nTotalSize < 3)
  3696. {
  3697. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3698. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
  3699. return COMMON_UPLOAD_LESS_3_BYTES;
  3700. }
  3701. string stringLocalIniPath = stringLocalFilePath + ".ini";
  3702. string stringServerPath;
  3703. string stringAlreadyUploadSize;
  3704. nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3705. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3706. {
  3707. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3708. return nRet;
  3709. }
  3710. unsigned long nAlreadyUploadSize = 0;
  3711. if(stringAlreadyUploadSize.size() > 0)
  3712. {
  3713. nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
  3714. }
  3715. if(nAlreadyUploadSize == nTotalSize)
  3716. {
  3717. if(pCallback != NULL)
  3718. {
  3719. (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalFilePath.c_str());
  3720. }
  3721. stringUri = stringServerPath;
  3722. return PHMS_SUCCESSFUL_RESULT;
  3723. }
  3724. if(nAlreadyUploadSize > nTotalSize)
  3725. {
  3726. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3727. return COMMON_UPLOAD_INI_SIZE_ERROR;
  3728. }
  3729. //创建并启动定时器
  3730. Timer timerUpload(1000, 1000);
  3731. CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalFilePath);
  3732. TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
  3733. timerUpload.start(adapterUpload);
  3734. unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
  3735. while(nRemainSize > 0)
  3736. {
  3737. unsigned long nThisTimeUploadSize = 0;
  3738. if(nRemainSize > nMaxPerTimeSize)
  3739. {
  3740. if(nRemainSize - nMaxPerTimeSize <3)
  3741. {
  3742. //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
  3743. nThisTimeUploadSize = nRemainSize;
  3744. }
  3745. else
  3746. {
  3747. nThisTimeUploadSize = nMaxPerTimeSize;
  3748. }
  3749. }
  3750. else
  3751. {
  3752. nThisTimeUploadSize = nRemainSize;
  3753. }
  3754. this->SetSaveType(1);
  3755. nRet = this->UploadCommonFileSegment(stringType, stringExtra, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalFilePath, stringFileType);
  3756. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3757. {
  3758. timerUpload.stop();
  3759. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3760. return nRet;
  3761. }
  3762. stringServerPath = this->GetContent();
  3763. stringUri = stringServerPath;
  3764. stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
  3765. nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
  3766. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3767. {
  3768. timerUpload.stop();
  3769. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3770. return nRet;
  3771. }
  3772. nAlreadyUploadSize += nThisTimeUploadSize;
  3773. nRemainSize = nTotalSize - nAlreadyUploadSize;
  3774. }
  3775. timerUpload.stop(true);
  3776. return PHMS_SUCCESSFUL_RESULT;
  3777. }
  3778. int CInternalNetIntetface::AbortSession()
  3779. {
  3780. m_eventSocketAbort.set();
  3781. return m_pPhmsSession->AbortSession();
  3782. }
  3783. //内部接口--针对NoPhms接口,直接用http协议请求文件,不通过php
  3784. int CInternalNetIntetface::GetFileWithHttp(string stringUrl, int bContinue)
  3785. {
  3786. int nRet = PHMS_SUCCESSFUL_RESULT;
  3787. m_pPhmsSession->SetSaveType(m_nSaveType);
  3788. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3789. nRet = m_pPhmsSession->ExecuteNoPhmsSession(stringUrl, bContinue, false);
  3790. if(nRet==COMMON_SEND_FAIL || nRet==COMMON_SEND_TIMEOUT || nRet==COMMON_RECV_FAIL || nRet==COMMON_RECV_TIMEOUT )
  3791. {
  3792. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3793. nRet = m_pPhmsSession->ExecuteNoPhmsSession(stringUrl, bContinue, true);
  3794. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3795. {
  3796. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3797. return nRet;
  3798. }
  3799. }
  3800. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3801. {
  3802. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3803. return nRet;
  3804. }
  3805. if(m_nSaveType == 1)
  3806. {
  3807. m_stringContent = m_pPhmsSession->GetContent();
  3808. }
  3809. return PHMS_SUCCESSFUL_RESULT;
  3810. }
  3811. //内部接口--针对Form表单
  3812. int CInternalNetIntetface::PostForm(string stringHost, string stringUrl, map<string, string> mapParam)
  3813. {
  3814. int nRet = PHMS_SUCCESSFUL_RESULT;
  3815. m_pPhmsSession->SetSaveType(m_nSaveType);
  3816. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3817. nRet = m_pPhmsSession->ExecuteFormHttpSession(stringHost, stringUrl, mapParam);
  3818. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3819. {
  3820. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3821. return nRet;
  3822. }
  3823. if(m_nSaveType == 1)
  3824. {
  3825. m_stringContent = m_pPhmsSession->GetContent();
  3826. }
  3827. return PHMS_SUCCESSFUL_RESULT;
  3828. }
  3829. int CInternalNetIntetface::SetCliniqueState(string stringCliniqueId, string stringState)
  3830. {
  3831. int nRet = PHMS_SUCCESSFUL_RESULT;
  3832. m_pPhmsSession->SetSaveType(m_nSaveType);
  3833. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3834. nRet = m_pPhmsSession->SetCliniqueState(stringCliniqueId, stringState);
  3835. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3836. {
  3837. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3838. return nRet;
  3839. }
  3840. if(m_nSaveType == 1)
  3841. {
  3842. m_stringContent = m_pPhmsSession->GetContent();
  3843. }
  3844. return PHMS_SUCCESSFUL_RESULT;
  3845. }
  3846. int CInternalNetIntetface::GetPatientInfoByAppNum(string stringHospitalId, string stringOrderType, string stringOrderId, string stringReqDepart, string stringOrderState, string stringCheckType, string stringStartDate, string stringEndDate, string stringClinicId)
  3847. {
  3848. int nRet = PHMS_SUCCESSFUL_RESULT;
  3849. m_pPhmsSession->SetSaveType(m_nSaveType);
  3850. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3851. nRet = m_pPhmsSession->GetPatientInfoByAppNum(stringHospitalId, stringOrderType, stringOrderId, stringReqDepart, stringOrderState, stringCheckType, stringStartDate, stringEndDate, stringClinicId);
  3852. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3853. {
  3854. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3855. return nRet;
  3856. }
  3857. if(m_nSaveType == 1)
  3858. {
  3859. m_stringContent = m_pPhmsSession->GetContent();
  3860. }
  3861. return PHMS_SUCCESSFUL_RESULT;
  3862. }
  3863. int CInternalNetIntetface::GetPatientInfoByAppNumToHis(string stringHospitalId, string stringOrderType, string stringOrderId)
  3864. {
  3865. int nRet = PHMS_SUCCESSFUL_RESULT;
  3866. m_pPhmsSession->SetSaveType(m_nSaveType);
  3867. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3868. nRet = m_pPhmsSession->GetPatientInfoByAppNumToHis(stringHospitalId, stringOrderType, stringOrderId);
  3869. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3870. {
  3871. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3872. return nRet;
  3873. }
  3874. if(m_nSaveType == 1)
  3875. {
  3876. m_stringContent = m_pPhmsSession->GetContent();
  3877. }
  3878. return PHMS_SUCCESSFUL_RESULT;
  3879. }
  3880. int CInternalNetIntetface::GetPatientInfoByAppNumToPhmsAndHis(string stringHospitalId, string stringOrderType, string stringOrderId)
  3881. {
  3882. int nRet = PHMS_SUCCESSFUL_RESULT;
  3883. m_pPhmsSession->SetSaveType(m_nSaveType);
  3884. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3885. nRet = m_pPhmsSession->GetPatientInfoByAppNumToPhmsAndHis(stringHospitalId, stringOrderType, stringOrderId);
  3886. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3887. {
  3888. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3889. return nRet;
  3890. }
  3891. if(m_nSaveType == 1)
  3892. {
  3893. m_stringContent = m_pPhmsSession->GetContent();
  3894. }
  3895. return PHMS_SUCCESSFUL_RESULT;
  3896. }
  3897. int CInternalNetIntetface::ApplyCheck(string stringCliniqueId, string stringOrderId, string stringOrderType)
  3898. {
  3899. int nRet = PHMS_SUCCESSFUL_RESULT;
  3900. m_pPhmsSession->SetSaveType(m_nSaveType);
  3901. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3902. nRet = m_pPhmsSession->ApplyCheck(stringCliniqueId, stringOrderId, stringOrderType);
  3903. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3904. {
  3905. if(nRet != 220303)
  3906. {
  3907. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3908. }
  3909. return nRet;
  3910. }
  3911. if(m_nSaveType == 1)
  3912. {
  3913. m_stringContent = m_pPhmsSession->GetContent();
  3914. }
  3915. return PHMS_SUCCESSFUL_RESULT;
  3916. }
  3917. int CInternalNetIntetface::GetWaitingCheck(string stringCliniqueId)
  3918. {
  3919. int nRet = PHMS_SUCCESSFUL_RESULT;
  3920. m_pPhmsSession->SetSaveType(m_nSaveType);
  3921. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3922. nRet = m_pPhmsSession->GetWaitingCheck(stringCliniqueId);
  3923. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3924. {
  3925. if(nRet!=220403 && nRet!=220405)
  3926. {
  3927. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3928. }
  3929. return nRet;
  3930. }
  3931. if(m_nSaveType == 1)
  3932. {
  3933. m_stringContent = m_pPhmsSession->GetContent();
  3934. }
  3935. return PHMS_SUCCESSFUL_RESULT;
  3936. }
  3937. int CInternalNetIntetface::GetCliniqueState(string stringCliniqueId)
  3938. {
  3939. int nRet = PHMS_SUCCESSFUL_RESULT;
  3940. m_pPhmsSession->SetSaveType(m_nSaveType);
  3941. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3942. nRet = m_pPhmsSession->GetCliniqueState(stringCliniqueId);
  3943. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3944. {
  3945. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3946. return nRet;
  3947. }
  3948. if(m_nSaveType == 1)
  3949. {
  3950. m_stringContent = m_pPhmsSession->GetContent();
  3951. }
  3952. return PHMS_SUCCESSFUL_RESULT;
  3953. }
  3954. int CInternalNetIntetface::NotifyCaseState(string stringHospitalId, string stringOrderType, string stringOrderId)
  3955. {
  3956. int nRet = PHMS_SUCCESSFUL_RESULT;
  3957. m_pPhmsSession->SetSaveType(m_nSaveType);
  3958. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3959. nRet = m_pPhmsSession->NotifyCaseState(stringHospitalId, stringOrderType, stringOrderId);
  3960. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3961. {
  3962. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3963. return nRet;
  3964. }
  3965. if(m_nSaveType == 1)
  3966. {
  3967. m_stringContent = m_pPhmsSession->GetContent();
  3968. }
  3969. return PHMS_SUCCESSFUL_RESULT;
  3970. }
  3971. int CInternalNetIntetface::NotifyReportState(string stringReportId)
  3972. {
  3973. int nRet = PHMS_SUCCESSFUL_RESULT;
  3974. m_pPhmsSession->SetSaveType(m_nSaveType);
  3975. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3976. nRet = m_pPhmsSession->NotifyReportState(stringReportId);
  3977. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3978. {
  3979. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3980. return nRet;
  3981. }
  3982. if(m_nSaveType == 1)
  3983. {
  3984. m_stringContent = m_pPhmsSession->GetContent();
  3985. }
  3986. return PHMS_SUCCESSFUL_RESULT;
  3987. }
  3988. int CInternalNetIntetface::SetDoctorAgentId(string stringDoctorAgentId)
  3989. {
  3990. int nRet = PHMS_SUCCESSFUL_RESULT;
  3991. m_pPhmsSession->SetSaveType(m_nSaveType);
  3992. m_pPhmsSession->SetFilePath(m_stringFilePath);
  3993. nRet = m_pPhmsSession->DoctorChangeSelfInfo("", "", "", "", "", "", stringDoctorAgentId);
  3994. if(nRet != PHMS_SUCCESSFUL_RESULT)
  3995. {
  3996. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  3997. return nRet;
  3998. }
  3999. if(m_nSaveType == 1)
  4000. {
  4001. m_stringContent = m_pPhmsSession->GetContent();
  4002. }
  4003. return PHMS_SUCCESSFUL_RESULT;
  4004. }
  4005. int CInternalNetIntetface::NotifyAppState(string stringUnitId, string stringOrderId, string stringOrderType, string stringState)
  4006. {
  4007. int nRet = PHMS_SUCCESSFUL_RESULT;
  4008. m_pPhmsSession->SetSaveType(m_nSaveType);
  4009. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4010. nRet = m_pPhmsSession->NotifyAppState(stringUnitId, stringOrderId, stringOrderType, stringState);
  4011. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4012. {
  4013. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4014. return nRet;
  4015. }
  4016. if(m_nSaveType == 1)
  4017. {
  4018. m_stringContent = m_pPhmsSession->GetContent();
  4019. }
  4020. return PHMS_SUCCESSFUL_RESULT;
  4021. }
  4022. int CInternalNetIntetface::VerifyAppState(string stringOrderId, string stringOrderType)
  4023. {
  4024. int nRet = PHMS_SUCCESSFUL_RESULT;
  4025. m_pPhmsSession->SetSaveType(m_nSaveType);
  4026. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4027. nRet = m_pPhmsSession->VerifyAppState(stringOrderId, stringOrderType);
  4028. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4029. {
  4030. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4031. return nRet;
  4032. }
  4033. if(m_nSaveType == 1)
  4034. {
  4035. m_stringContent = m_pPhmsSession->GetContent();
  4036. }
  4037. return PHMS_SUCCESSFUL_RESULT;
  4038. }
  4039. int CInternalNetIntetface::GetHisReportState(string stringHospitalId, string stringOrderType, string stringOrderId)
  4040. {
  4041. int nRet = PHMS_SUCCESSFUL_RESULT;
  4042. m_pPhmsSession->SetSaveType(m_nSaveType);
  4043. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4044. nRet = m_pPhmsSession->GetHisReportState(stringHospitalId, stringOrderType, stringOrderId);
  4045. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4046. {
  4047. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4048. return nRet;
  4049. }
  4050. if(m_nSaveType == 1)
  4051. {
  4052. m_stringContent = m_pPhmsSession->GetContent();
  4053. }
  4054. return PHMS_SUCCESSFUL_RESULT;
  4055. }
  4056. int CInternalNetIntetface::SetHisCriticalValue(string stringHospitalId, string stringCaseId, string stringCriticalValues)
  4057. {
  4058. int nRet = PHMS_SUCCESSFUL_RESULT;
  4059. m_pPhmsSession->SetSaveType(m_nSaveType);
  4060. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4061. nRet = m_pPhmsSession->SetHisCriticalValue(stringHospitalId, stringCaseId, stringCriticalValues);
  4062. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4063. {
  4064. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4065. return nRet;
  4066. }
  4067. if(m_nSaveType == 1)
  4068. {
  4069. m_stringContent = m_pPhmsSession->GetContent();
  4070. }
  4071. return PHMS_SUCCESSFUL_RESULT;
  4072. }
  4073. int CInternalNetIntetface::GetDoctorList_999120(string stringKtCliniqueId, string stringCaseTypeId)
  4074. {
  4075. int nRet = PHMS_SUCCESSFUL_RESULT;
  4076. m_pPhmsSession->SetSaveType(m_nSaveType);
  4077. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4078. nRet = m_pPhmsSession->GetDoctorList_999120(stringKtCliniqueId, stringCaseTypeId);
  4079. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4080. {
  4081. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4082. return nRet;
  4083. }
  4084. if(m_nSaveType == 1)
  4085. {
  4086. m_stringContent = m_pPhmsSession->GetContent();
  4087. }
  4088. return PHMS_SUCCESSFUL_RESULT;
  4089. }
  4090. int CInternalNetIntetface::ValidatePay_999120(string stringConsumeId, string stringKtCliniqueId, string stringCardNumber, string stringKtDoctorId, string stringConsumeMoney, string stringCaseTypeId)
  4091. {
  4092. int nRet = PHMS_SUCCESSFUL_RESULT;
  4093. m_pPhmsSession->SetSaveType(m_nSaveType);
  4094. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4095. nRet = m_pPhmsSession->ValidatePay_999120(stringConsumeId, stringKtCliniqueId, stringCardNumber, stringKtDoctorId, stringConsumeMoney, stringCaseTypeId);
  4096. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4097. {
  4098. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4099. return nRet;
  4100. }
  4101. if(m_nSaveType == 1)
  4102. {
  4103. m_stringContent = m_pPhmsSession->GetContent();
  4104. }
  4105. return PHMS_SUCCESSFUL_RESULT;
  4106. }
  4107. int CInternalNetIntetface::UpdateCaseForConsumerRecord_999120(string stringConsumeId, string stringKtCaseId, string stringCaseTypeId)
  4108. {
  4109. int nRet = PHMS_SUCCESSFUL_RESULT;
  4110. m_pPhmsSession->SetSaveType(m_nSaveType);
  4111. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4112. nRet = m_pPhmsSession->UpdateCaseForConsumerRecord_999120(stringConsumeId, stringKtCaseId, stringCaseTypeId);
  4113. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4114. {
  4115. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4116. return nRet;
  4117. }
  4118. if(m_nSaveType == 1)
  4119. {
  4120. m_stringContent = m_pPhmsSession->GetContent();
  4121. }
  4122. return PHMS_SUCCESSFUL_RESULT;
  4123. }
  4124. int CInternalNetIntetface::ValidatePay_XinJie(string stringRrn, string stringLocalDate)
  4125. {
  4126. int nRet = PHMS_SUCCESSFUL_RESULT;
  4127. m_pPhmsSession->SetSaveType(m_nSaveType);
  4128. //m_pPhmsSession->SetFilePath(m_stringFilePath);
  4129. nRet = m_pPhmsSession->ValidatePay_XinJie(stringRrn, stringLocalDate);
  4130. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4131. {
  4132. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4133. return nRet;
  4134. }
  4135. if(m_nSaveType == 1)
  4136. {
  4137. m_stringContent = m_pPhmsSession->GetContent();
  4138. }
  4139. //使用0102030405060708作为密钥进行AES解密
  4140. CipherKey::ByteVec secret;
  4141. CipherKey::ByteVec vi;
  4142. string::iterator iter;
  4143. string stringSecret = "0102030405060708";
  4144. for(iter=stringSecret.begin(); iter!=stringSecret.end(); iter++)
  4145. {
  4146. secret.push_back(*iter);
  4147. vi.push_back(*iter);
  4148. }
  4149. Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes128", secret, vi));
  4150. string stringIn = m_stringContent;
  4151. for(iter=stringIn.begin(); iter!=stringIn.end(); iter++)
  4152. {
  4153. if(*iter == '+')
  4154. {
  4155. *iter = '*';
  4156. }
  4157. }
  4158. string stringOut;
  4159. try
  4160. {
  4161. stringOut = pCipher->decryptString(stringIn, Cipher::ENC_BASE64);
  4162. }
  4163. catch(Poco::Exception &e)
  4164. {
  4165. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  4166. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_RECV_CONTENT_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4167. return COMMON_RECV_CONTENT_FAIL;
  4168. }
  4169. catch(const ios::failure& error)
  4170. {
  4171. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4172. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_OUTPUT_STREAM_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4173. return COMMON_OUTPUT_STREAM_FAIL;
  4174. }
  4175. try
  4176. {
  4177. File fileTarget(m_stringFilePath, "gbk");
  4178. fileTarget.createFile();
  4179. }
  4180. catch(Exception& e)
  4181. {
  4182. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  4183. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4184. return COMMON_FILE_OPEN_FAIL;
  4185. }
  4186. ofstream ofLocalTargetFile;
  4187. ofLocalTargetFile.exceptions(ios::failbit|ios::badbit);
  4188. try
  4189. {
  4190. ofLocalTargetFile.open(m_stringFilePath.c_str(), ios_base::trunc|ios_base::binary);
  4191. }
  4192. catch(const ios::failure& error)
  4193. {
  4194. //写日志
  4195. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4196. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4197. return COMMON_FILE_OPEN_FAIL;
  4198. }
  4199. try
  4200. {
  4201. ofLocalTargetFile<<stringOut;
  4202. ofLocalTargetFile.flush();
  4203. ofLocalTargetFile.close();
  4204. }
  4205. catch(const ios::failure& error)
  4206. {
  4207. //写日志
  4208. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4209. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4210. return COMMON_FILE_WRITE_FAIL;
  4211. }
  4212. return PHMS_SUCCESSFUL_RESULT;
  4213. }
  4214. int CInternalNetIntetface::NotifyCheck_XinJie(string stringRrn, string stringLocalDate)
  4215. {
  4216. int nRet = PHMS_SUCCESSFUL_RESULT;
  4217. m_pPhmsSession->SetSaveType(m_nSaveType);
  4218. //m_pPhmsSession->SetFilePath(m_stringFilePath);
  4219. nRet = m_pPhmsSession->NotifyCheck_XinJie(stringRrn, stringLocalDate);
  4220. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4221. {
  4222. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4223. return nRet;
  4224. }
  4225. if(m_nSaveType == 1)
  4226. {
  4227. m_stringContent = m_pPhmsSession->GetContent();
  4228. }
  4229. //使用0102030405060708作为密钥进行AES解密
  4230. CipherKey::ByteVec secret;
  4231. CipherKey::ByteVec vi;
  4232. string::iterator iter;
  4233. string stringSecret = "0102030405060708";
  4234. for(iter=stringSecret.begin(); iter!=stringSecret.end(); iter++)
  4235. {
  4236. secret.push_back(*iter);
  4237. vi.push_back(*iter);
  4238. }
  4239. Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes128", secret, vi));
  4240. string stringIn = m_stringContent;
  4241. for(iter=stringIn.begin(); iter!=stringIn.end(); iter++)
  4242. {
  4243. if(*iter == '+')
  4244. {
  4245. *iter = '*';
  4246. }
  4247. }
  4248. string stringOut;
  4249. try
  4250. {
  4251. stringOut = pCipher->decryptString(stringIn, Cipher::ENC_BASE64);
  4252. }
  4253. catch(Poco::Exception &e)
  4254. {
  4255. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  4256. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_RECV_CONTENT_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4257. return COMMON_RECV_CONTENT_FAIL;
  4258. }
  4259. catch(const ios::failure& error)
  4260. {
  4261. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4262. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_OUTPUT_STREAM_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4263. return COMMON_OUTPUT_STREAM_FAIL;
  4264. }
  4265. try
  4266. {
  4267. File fileTarget(m_stringFilePath, "gbk");
  4268. fileTarget.createFile();
  4269. }
  4270. catch(Exception& e)
  4271. {
  4272. CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
  4273. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4274. return COMMON_FILE_OPEN_FAIL;
  4275. }
  4276. ofstream ofLocalTargetFile;
  4277. ofLocalTargetFile.exceptions(ios::failbit|ios::badbit);
  4278. try
  4279. {
  4280. ofLocalTargetFile.open(m_stringFilePath.c_str(), ios_base::trunc|ios_base::binary);
  4281. }
  4282. catch(const ios::failure& error)
  4283. {
  4284. //写日志
  4285. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4286. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4287. return COMMON_FILE_OPEN_FAIL;
  4288. }
  4289. try
  4290. {
  4291. ofLocalTargetFile<<stringOut;
  4292. ofLocalTargetFile.flush();
  4293. ofLocalTargetFile.close();
  4294. }
  4295. catch(const ios::failure& error)
  4296. {
  4297. //写日志
  4298. CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
  4299. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
  4300. return COMMON_FILE_WRITE_FAIL;
  4301. }
  4302. return PHMS_SUCCESSFUL_RESULT;
  4303. }
  4304. int CInternalNetIntetface::UserAuthorize_Telecom(string stringPersonId, string stringName, string stringNation, string stringAddress, string stringRoomId)
  4305. {
  4306. int nRet = PHMS_SUCCESSFUL_RESULT;
  4307. m_pPhmsSession->SetSaveType(m_nSaveType);
  4308. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4309. nRet = m_pPhmsSession->UserAuthorize_Telecom(stringPersonId, stringName, stringNation, stringAddress, stringRoomId);
  4310. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4311. {
  4312. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4313. return nRet;
  4314. }
  4315. if(m_nSaveType == 1)
  4316. {
  4317. m_stringContent = m_pPhmsSession->GetContent();
  4318. }
  4319. return PHMS_SUCCESSFUL_RESULT;
  4320. }
  4321. int CInternalNetIntetface::BloodPressureUpload_Telecom(string stringPersonType, string stringPersonId, string stringSBP, string stringDBP, string stringAverageValue, string stringPulseRate, string stringDetectionTime,
  4322. string stringEquCode, string stringRoomId)
  4323. {
  4324. int nRet = PHMS_SUCCESSFUL_RESULT;
  4325. m_pPhmsSession->SetSaveType(m_nSaveType);
  4326. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4327. nRet = m_pPhmsSession->BloodPressureUpload_Telecom(stringPersonType, stringPersonId, stringSBP, stringDBP, stringAverageValue, stringPulseRate, stringDetectionTime, stringEquCode, stringRoomId);
  4328. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4329. {
  4330. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4331. return nRet;
  4332. }
  4333. if(m_nSaveType == 1)
  4334. {
  4335. m_stringContent = m_pPhmsSession->GetContent();
  4336. }
  4337. return PHMS_SUCCESSFUL_RESULT;
  4338. }
  4339. int CInternalNetIntetface::BloodOxygenUpload_Telecom(string stringPersonType, string stringPersonId, string stringBloodOxygen, string stringPulseRate, string stringDetectionTime,
  4340. string stringEquCode, string stringRoomId)
  4341. {
  4342. int nRet = PHMS_SUCCESSFUL_RESULT;
  4343. m_pPhmsSession->SetSaveType(m_nSaveType);
  4344. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4345. nRet = m_pPhmsSession->BloodOxygenUpload_Telecom(stringPersonType, stringPersonId, stringBloodOxygen, stringPulseRate, stringDetectionTime, stringEquCode, stringRoomId);
  4346. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4347. {
  4348. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4349. return nRet;
  4350. }
  4351. if(m_nSaveType == 1)
  4352. {
  4353. m_stringContent = m_pPhmsSession->GetContent();
  4354. }
  4355. return PHMS_SUCCESSFUL_RESULT;
  4356. }
  4357. int CInternalNetIntetface::BloodSugarUpload_Telecom(string stringPersonType, string stringPersonId, string stringBloodSugar, string stringDetectionTime,
  4358. string stringEquCode, string stringRoomId)
  4359. {
  4360. int nRet = PHMS_SUCCESSFUL_RESULT;
  4361. m_pPhmsSession->SetSaveType(m_nSaveType);
  4362. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4363. nRet = m_pPhmsSession->BloodSugarUpload_Telecom(stringPersonType, stringPersonId, stringBloodSugar, stringDetectionTime, stringEquCode, stringRoomId);
  4364. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4365. {
  4366. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4367. return nRet;
  4368. }
  4369. if(m_nSaveType == 1)
  4370. {
  4371. m_stringContent = m_pPhmsSession->GetContent();
  4372. }
  4373. return PHMS_SUCCESSFUL_RESULT;
  4374. }
  4375. int CInternalNetIntetface::HeightWeightUpload_Telecom(string stringPersonType, string stringPersonId, string stringHeight, string stringWeight, string stringBMI, string stringDetectionTime,
  4376. string stringEquCode, string stringRoomId)
  4377. {
  4378. int nRet = PHMS_SUCCESSFUL_RESULT;
  4379. m_pPhmsSession->SetSaveType(m_nSaveType);
  4380. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4381. nRet = m_pPhmsSession->HeightWeightUpload_Telecom(stringPersonType, stringPersonId, stringHeight, stringWeight, stringBMI, stringDetectionTime, stringEquCode, stringRoomId);
  4382. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4383. {
  4384. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4385. return nRet;
  4386. }
  4387. if(m_nSaveType == 1)
  4388. {
  4389. m_stringContent = m_pPhmsSession->GetContent();
  4390. }
  4391. return PHMS_SUCCESSFUL_RESULT;
  4392. }
  4393. int CInternalNetIntetface::LungUpload_Telecom(string stringPersonType, string stringPersonId, string stringM_B1, string stringBSA, string stringBSA1, string stringMMF, string stringMefSeventyFive, string stringMefFifty,
  4394. string stringMefTwentyFive, string stringMefFVST, string stringIC, string stringIRV, string stringERV, string stringFevOne, string stringFevTwo, string stringFevThree,
  4395. string stringFevOnePer, string stringFevTwoPer, string stringFevThreePer, string stringRR, string stringFVC, string stringPEF, string stringTV, string stringVC, string stringMVV,
  4396. string stringMV, string stringVSTHeight, string stringVSMvvBsa, string stringVSMvvOne, string stringSVC, string stringFevOneZeroFive, string stringFevOneZeroFivePer, string stringPefOne,
  4397. string stringPefTwo, string stringPefThree, string stringFive, string stringFiveOne, string stringFiveTwo, string stringFiveThree, string stringPIF, string stringMifFifty,
  4398. string stringDetectionTime, string stringEquCode, string stringRoomId)
  4399. {
  4400. int nRet = PHMS_SUCCESSFUL_RESULT;
  4401. m_pPhmsSession->SetSaveType(m_nSaveType);
  4402. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4403. nRet = m_pPhmsSession->LungUpload_Telecom(stringPersonType, stringPersonId, stringM_B1, stringBSA, stringBSA1, stringMMF, stringMefSeventyFive, stringMefFifty, stringMefTwentyFive, stringMefFVST, stringIC,
  4404. stringIRV, stringERV, stringFevOne, stringFevTwo, stringFevThree, stringFevOnePer, stringFevTwoPer, stringFevThreePer, stringRR, stringFVC, stringPEF, stringTV, stringVC, stringMVV,
  4405. stringMV, stringVSTHeight, stringVSMvvBsa, stringVSMvvOne, stringSVC, stringFevOneZeroFive, stringFevOneZeroFivePer, stringPefOne, stringPefTwo, stringPefThree, stringFive, stringFiveOne,
  4406. stringFiveTwo, stringFiveThree, stringPIF, stringMifFifty, stringDetectionTime, stringEquCode, stringRoomId);
  4407. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4408. {
  4409. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4410. return nRet;
  4411. }
  4412. if(m_nSaveType == 1)
  4413. {
  4414. m_stringContent = m_pPhmsSession->GetContent();
  4415. }
  4416. return PHMS_SUCCESSFUL_RESULT;
  4417. }
  4418. int CInternalNetIntetface::ECGUpload_Telecom(string stringPersonType, string stringPersonId, string stringDetectionTime, string stringEquCode, string stringRoomId, TELCOM_ECG ecgData)
  4419. {
  4420. int nRet = PHMS_SUCCESSFUL_RESULT;
  4421. m_pPhmsSession->SetSaveType(m_nSaveType);
  4422. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4423. nRet = m_pPhmsSession->ECGUpload_Telecom(stringPersonType, stringPersonId, stringDetectionTime, stringEquCode, stringRoomId, ecgData);
  4424. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4425. {
  4426. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4427. return nRet;
  4428. }
  4429. if(m_nSaveType == 1)
  4430. {
  4431. m_stringContent = m_pPhmsSession->GetContent();
  4432. }
  4433. return PHMS_SUCCESSFUL_RESULT;
  4434. }
  4435. int CInternalNetIntetface::Login_XiKang(string stringUsername, string stringPassword)
  4436. {
  4437. int nRet = PHMS_SUCCESSFUL_RESULT;
  4438. m_pPhmsSession->SetSaveType(m_nSaveType);
  4439. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4440. nRet = m_pPhmsSession->Login_XiKang(stringUsername, stringPassword);
  4441. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4442. {
  4443. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4444. return nRet;
  4445. }
  4446. if(m_nSaveType == 1)
  4447. {
  4448. m_stringContent = m_pPhmsSession->GetContent();
  4449. }
  4450. return PHMS_SUCCESSFUL_RESULT;
  4451. }
  4452. int CInternalNetIntetface::RegisterPatientId_XiKang(string stringName, string stringSex, string stringPhoneNum, string stringProofNum)
  4453. {
  4454. int nRet = PHMS_SUCCESSFUL_RESULT;
  4455. m_pPhmsSession->SetSaveType(m_nSaveType);
  4456. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4457. nRet = m_pPhmsSession->RegisterPatientId_XiKang(stringName, stringSex, stringPhoneNum, stringProofNum);
  4458. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4459. {
  4460. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4461. return nRet;
  4462. }
  4463. if(m_nSaveType == 1)
  4464. {
  4465. m_stringContent = m_pPhmsSession->GetContent();
  4466. }
  4467. return PHMS_SUCCESSFUL_RESULT;
  4468. }
  4469. int CInternalNetIntetface::RegisterPatientInfo_XiKang(string stringPatientOpenId, string stringName, string stringSex, string stringPhoneNum, string stringProofNum, string stringPassword)
  4470. {
  4471. int nRet = PHMS_SUCCESSFUL_RESULT;
  4472. m_pPhmsSession->SetSaveType(m_nSaveType);
  4473. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4474. nRet = m_pPhmsSession->RegisterPatientInfo_XiKang(stringPatientOpenId, stringName, stringSex, stringPhoneNum, stringProofNum, stringPassword);
  4475. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4476. {
  4477. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4478. return nRet;
  4479. }
  4480. if(m_nSaveType == 1)
  4481. {
  4482. m_stringContent = m_pPhmsSession->GetContent();
  4483. }
  4484. return PHMS_SUCCESSFUL_RESULT;
  4485. }
  4486. int CInternalNetIntetface::BindPatient_XiKang(string stringDoctorOpenId, string stringPatientOpenId)
  4487. {
  4488. int nRet = PHMS_SUCCESSFUL_RESULT;
  4489. m_pPhmsSession->SetSaveType(m_nSaveType);
  4490. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4491. nRet = m_pPhmsSession->BindPatient_XiKang(stringDoctorOpenId, stringPatientOpenId);
  4492. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4493. {
  4494. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4495. return nRet;
  4496. }
  4497. if(m_nSaveType == 1)
  4498. {
  4499. m_stringContent = m_pPhmsSession->GetContent();
  4500. }
  4501. return PHMS_SUCCESSFUL_RESULT;
  4502. }
  4503. int CInternalNetIntetface::GetPatientIdList_XiKang(string stringDoctorOpenId)
  4504. {
  4505. int nRet = PHMS_SUCCESSFUL_RESULT;
  4506. m_pPhmsSession->SetSaveType(m_nSaveType);
  4507. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4508. nRet = m_pPhmsSession->GetPatientIdList_XiKang(stringDoctorOpenId);
  4509. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4510. {
  4511. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4512. return nRet;
  4513. }
  4514. if(m_nSaveType == 1)
  4515. {
  4516. m_stringContent = m_pPhmsSession->GetContent();
  4517. }
  4518. return PHMS_SUCCESSFUL_RESULT;
  4519. }
  4520. int CInternalNetIntetface::SearchPatientId_XiKang(string stringKey, string stringValue)
  4521. {
  4522. int nRet = PHMS_SUCCESSFUL_RESULT;
  4523. m_pPhmsSession->SetSaveType(m_nSaveType);
  4524. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4525. nRet = m_pPhmsSession->SearchPatientId_XiKang(stringKey, stringValue);
  4526. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4527. {
  4528. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4529. return nRet;
  4530. }
  4531. if(m_nSaveType == 1)
  4532. {
  4533. m_stringContent = m_pPhmsSession->GetContent();
  4534. }
  4535. return PHMS_SUCCESSFUL_RESULT;
  4536. }
  4537. int CInternalNetIntetface::GetPatientInfo_XiKang(string stringPatientOpenId)
  4538. {
  4539. int nRet = PHMS_SUCCESSFUL_RESULT;
  4540. m_pPhmsSession->SetSaveType(m_nSaveType);
  4541. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4542. nRet = m_pPhmsSession->GetPatientInfo_XiKang(stringPatientOpenId);
  4543. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4544. {
  4545. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4546. return nRet;
  4547. }
  4548. if(m_nSaveType == 1)
  4549. {
  4550. m_stringContent = m_pPhmsSession->GetContent();
  4551. }
  4552. return PHMS_SUCCESSFUL_RESULT;
  4553. }
  4554. int CInternalNetIntetface::GetCaseList_XiKang(vector<string> vPatientOpenId)
  4555. {
  4556. int nRet = PHMS_SUCCESSFUL_RESULT;
  4557. m_pPhmsSession->SetSaveType(m_nSaveType);
  4558. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4559. nRet = m_pPhmsSession->GetCaseList_XiKang(vPatientOpenId);
  4560. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4561. {
  4562. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4563. return nRet;
  4564. }
  4565. if(m_nSaveType == 1)
  4566. {
  4567. m_stringContent = m_pPhmsSession->GetContent();
  4568. }
  4569. return PHMS_SUCCESSFUL_RESULT;
  4570. }
  4571. int CInternalNetIntetface::SubmitCase_XiKang(string stringPatientOpenId, string stringAdvice, string stringCaseType, string stringEcgXmlContent)
  4572. {
  4573. int nRet = PHMS_SUCCESSFUL_RESULT;
  4574. m_pPhmsSession->SetSaveType(m_nSaveType);
  4575. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4576. nRet = m_pPhmsSession->SubmitCase_XiKang(stringPatientOpenId, stringAdvice, stringCaseType, stringEcgXmlContent);
  4577. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4578. {
  4579. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4580. return nRet;
  4581. }
  4582. if(m_nSaveType == 1)
  4583. {
  4584. m_stringContent = m_pPhmsSession->GetContent();
  4585. }
  4586. return PHMS_SUCCESSFUL_RESULT;
  4587. }
  4588. int CInternalNetIntetface::GetReportFile_XiKang(string stringCaseId)
  4589. {
  4590. int nRet = PHMS_SUCCESSFUL_RESULT;
  4591. m_pPhmsSession->SetSaveType(m_nSaveType);
  4592. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4593. nRet = m_pPhmsSession->GetReportFile_XiKang(stringCaseId);
  4594. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4595. {
  4596. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4597. return nRet;
  4598. }
  4599. if(m_nSaveType == 1)
  4600. {
  4601. m_stringContent = m_pPhmsSession->GetContent();
  4602. }
  4603. if(m_stringContent.find(".pdf") == string::npos)
  4604. {
  4605. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_INVALID_URL), __FUNCTION__, __FILE__, __LINE__);
  4606. return COMMON_INVALID_URL;
  4607. }
  4608. this->SetSaveType(2);
  4609. this->SetFilePath(m_stringFilePath);
  4610. string stringWorkingDir = CUtil::GetCurrentAppDir();
  4611. string stringIniFilePath = stringWorkingDir+"PhmsConfig.ini";
  4612. AutoPtr<IniFileConfiguration> iniFile = new IniFileConfiguration(stringIniFilePath, "gbk");
  4613. string stringXiKangPdfAddress = iniFile->getString("XIKANG.PdfAddress", "dlres.xikang.com");
  4614. string stringPdfUrl = "http://";
  4615. stringPdfUrl += stringXiKangPdfAddress;
  4616. //stringPdfUrl += "/phrhealthfile/d53353f72df6472c9d739e82a95b0326.pdf";
  4617. stringPdfUrl += m_stringContent;
  4618. nRet = GetFileWithHttp(stringPdfUrl, false);
  4619. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4620. {
  4621. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4622. return nRet;
  4623. }
  4624. return PHMS_SUCCESSFUL_RESULT;
  4625. }
  4626. int CInternalNetIntetface::UploadFile_XiKang(string stringCaseId, string stringCaseFilePath)
  4627. {
  4628. int nRet = PHMS_SUCCESSFUL_RESULT;
  4629. m_pPhmsSession->SetSaveType(m_nSaveType);
  4630. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4631. nRet = m_pPhmsSession->UploadFile_XiKang(stringCaseId, stringCaseFilePath);
  4632. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4633. {
  4634. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4635. return nRet;
  4636. }
  4637. if(m_nSaveType == 1)
  4638. {
  4639. m_stringContent = m_pPhmsSession->GetContent();
  4640. }
  4641. return PHMS_SUCCESSFUL_RESULT;
  4642. }
  4643. int CInternalNetIntetface::ExecuteGWService(string stringLastPath, string stringJson, string stringFilePath)
  4644. {
  4645. int nRet = PHMS_SUCCESSFUL_RESULT;
  4646. m_pPhmsSession->SetSaveType(m_nSaveType);
  4647. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4648. map<string, string> mapParam;
  4649. mapParam["format"] = "json";
  4650. mapParam["content"] = stringJson;
  4651. if(stringLastPath == "login")
  4652. {
  4653. mapParam["sid"] = "";
  4654. mapParam["sign"] = "";
  4655. mapParam["nonce"] = "";
  4656. }
  4657. else
  4658. {
  4659. mapParam["sid"] = this->GetGWSessionId();
  4660. mapParam["nonce"] = UUIDGenerator::defaultGenerator().createOne().toString().substr(0, 32);
  4661. HMACEngine<SHA1Engine> hmacSign(m_pPhmsSession->GetGWSecretKey());
  4662. hmacSign.update(m_pPhmsSession->GetGWSecretKey() + stringJson + mapParam["sid"] + mapParam["nonce"]);
  4663. mapParam["sign"] = DigestEngine::digestToHex(hmacSign.digest());
  4664. }
  4665. nRet = m_pPhmsSession->ExecuteGWService(stringLastPath, mapParam, stringFilePath);
  4666. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4667. {
  4668. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4669. return nRet;
  4670. }
  4671. if(stringLastPath == "login")
  4672. {
  4673. map<string, string> mapResult;
  4674. CUtil::ParseJsonObjectWithoutArray(m_nSaveType, m_pPhmsSession->GetContent(), m_stringFilePath, mapResult);
  4675. if(mapResult["sid"] != "")
  4676. {
  4677. this->SetGWSessionId(mapResult["sid"]);
  4678. CSessionIdManager::HandleGWSessionSync(mapResult["sid"]);
  4679. }
  4680. if(mapResult["secret_key"] != "")
  4681. {
  4682. m_pPhmsSession->SetGWSecretKey(mapResult["secret_key"]);
  4683. }
  4684. }
  4685. // if(mapResult["data"] != "")
  4686. // {
  4687. // CUtil::ParseJsonObjectWithoutArray(1, mapResult["data"], "", mapResult);
  4688. // if(mapResult["sid"] != "")
  4689. // {
  4690. // this->SetGWSessionId(mapResult["sid"]);
  4691. // CSessionIdManager::HandleGWSessionSync(mapResult["sid"]);
  4692. // }
  4693. // if(mapResult["secret_key"] != "")
  4694. // {
  4695. // m_pPhmsSession->SetGWSecretKey(mapResult["secret_key"]);
  4696. // }
  4697. // }
  4698. if(m_nSaveType == 1)
  4699. {
  4700. m_stringContent = m_pPhmsSession->GetContent();
  4701. }
  4702. return PHMS_SUCCESSFUL_RESULT;
  4703. }
  4704. int CInternalNetIntetface::ExecuteCommonRESTful(string stringIp, string stringPort, string stringUrl, string stringContentType, string stringPayload)
  4705. {
  4706. int nRet = PHMS_SUCCESSFUL_RESULT;
  4707. m_pPhmsSession->SetSaveType(m_nSaveType);
  4708. m_pPhmsSession->SetFilePath(m_stringFilePath);
  4709. nRet = m_pPhmsSession->ExecuteCommonRESTful(stringIp, stringPort, stringUrl, stringContentType, stringPayload);
  4710. if(nRet != PHMS_SUCCESSFUL_RESULT)
  4711. {
  4712. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  4713. return nRet;
  4714. }
  4715. if(m_nSaveType == 1)
  4716. {
  4717. m_stringContent = m_pPhmsSession->GetContent();
  4718. }
  4719. return PHMS_SUCCESSFUL_RESULT;
  4720. }