123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947 |
- #include "InternalNetIntetface.h"
- #include "Poco/Random.h"
- #include "Poco/Buffer.h"
- #include "Poco/Exception.h"
- #include "Poco/MD5Engine.h"
- #include "Poco/Util/IniFileConfiguration.h"
- #include "Poco/Timer.h"
- #include "Poco/AutoPtr.h"
- #include "Poco/Thread.h"
- #include "Poco/ThreadPool.h"
- #include "Poco/File.h"
- #include "Poco/StreamCopier.h"
- #include "Poco/UUIDGenerator.h"
- #include "Poco/Buffer.h"
- #include "Poco/HMACEngine.h"
- #include "Poco/SHA1Engine.h"
- #include "Poco/Crypto/Cipher.h"
- #include "Poco/Crypto/CipherFactory.h"
- #include "Poco/Crypto/CipherKey.h"
- #include <fstream>
- #include <sstream>
- #include "ErrorCode.h"
- #include "PhmsLogger.h"
- #include "Util.h"
- #include "UploadTimerCallback.h"
- #include "DownloadTimerCallback.h"
- #include "DownloadThreadCallback.h"
- #include "SessionIdManager.h"
- #include <vector>
- #include <map>
- using Poco::Random;
- using Poco::MD5Engine;
- using Poco::Exception;
- using Poco::DigestEngine;
- using Poco::Util::IniFileConfiguration;
- using Poco::Timer;
- using Poco::TimerCallback;
- using Poco::AutoPtr;
- using Poco::Thread;
- using Poco::ThreadPool;
- using Poco::File;
- using Poco::StreamCopier;
- using Poco::UUIDGenerator;
- using Poco::Buffer;
- using Poco::HMACEngine;
- using Poco::DigestEngine;
- using Poco::SHA1Engine;
- using Poco::Crypto::Cipher;
- using Poco::Crypto::CipherFactory;
- using Poco::Crypto::CipherKey;
- using namespace std;
- CInternalNetIntetface::CInternalNetIntetface(void):m_nSaveType(0)
- {
- m_pPhmsSession = new CPhmsSession;
- m_eventSocketAbort.reset();
- }
- CInternalNetIntetface::~CInternalNetIntetface(void)
- {
- delete m_pPhmsSession;
- }
- //Setter
- void CInternalNetIntetface::SetSaveType(int nSaveType)
- {
- this->m_nSaveType = nSaveType;
- }
- void CInternalNetIntetface::SetFilePath(string stringFilePath)
- {
- this->m_stringFilePath = stringFilePath;
- }
- void CInternalNetIntetface::SetSessionId(string stringSessionId)
- {
- m_pPhmsSession->SetSessionId(stringSessionId);
- }
- void CInternalNetIntetface::SetCommandType(EnumPhmsCommandType enumCommandType)
- {
- m_pPhmsSession->SetCommandType(enumCommandType);
- }
- void CInternalNetIntetface::SetGWSessionId(string stringSessionId)
- {
- m_pPhmsSession->SetGWSessionId(stringSessionId);
- }
- //Getter
- int CInternalNetIntetface::GetSaveType()
- {
- return m_nSaveType;
- }
- string CInternalNetIntetface::GetContent()
- {
- return m_stringContent;
- }
- string CInternalNetIntetface::GetSessionId()
- {
- return m_pPhmsSession->GetSessionId();
- }
- EnumPhmsCommandType CInternalNetIntetface::GetCommandType()
- {
- return m_pPhmsSession->GetCommandType();
- }
- string CInternalNetIntetface::GetIp()
- {
- return m_stringIp;
- }
- string CInternalNetIntetface::GetGWSessionId()
- {
- return m_pPhmsSession->GetGWSessionId();
- }
- int CInternalNetIntetface::LoadServerPathAndAlreadyUploadSize(string stringLocalIniPath, string& stringServerPath, string& stringAlreadyUploadSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- File fileUploadIniConfig(stringLocalIniPath, "gbk");
- if(!fileUploadIniConfig.exists())
- {
- try
- {
- fileUploadIniConfig.createFile();
- }
- catch(Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- }
- AutoPtr<IniFileConfiguration> iniFile = new IniFileConfiguration(stringLocalIniPath, "gbk");
- //unsigned nAlreadyUploadSize = 0;
- stringServerPath = iniFile->getString("URI", "");
- if(stringServerPath.size() != 0)
- {
- this->SetSaveType(1);
- nRet = this->GetAlreadyUploadFileSize(stringServerPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringAlreadyUploadSize = this->GetContent();
- return StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::StoreServerPathAndAlreadyUploadSize(string stringLocalIniPath, string stringServerPath, string stringAlreadyUploadSize)
- {
- //IniFileConfiguration类只实现了load,未实现store,所以setXXXX函数只修改内存,不能保存到具体流(文件),所以不能用IniFileConfiguration.setString
- //iniFile->setString("URI", stringServerPath);
- //iniFile->setString("ALREADY_UPLOAD_SIZE", stringAlreadyUploadSize);
- ofstream oFstream;
- oFstream.exceptions(ios_base::failbit|ios_base::badbit);
- try
- {
- oFstream.open(stringLocalIniPath.c_str(), ios_base::binary|ios_base::trunc);
- oFstream.write("URI=", 4);
- oFstream.write(stringServerPath.c_str(), (std::streamsize)stringServerPath.size());
- oFstream.write("\n", 1);
- oFstream.write("ALREADY_UPLOAD_SIZE=", 20);
- oFstream.write(stringAlreadyUploadSize.c_str(), (std::streamsize)stringAlreadyUploadSize.size());
- oFstream.write("\n", 1);
- oFstream.close();
- }
- catch(ios::failure& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_WRITE_FAIL;
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetOrder(unsigned long nTotalSize, unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string& stringOrder)
- {
- //获得stringOrder参数
- if(nAlreadyUploadSize==0 && nTotalSize==nThisTimeUploadSize)
- {
- stringOrder = "0";
- }
- if(nAlreadyUploadSize==0 && nTotalSize>nThisTimeUploadSize)
- {
- stringOrder = "1";
- }
- if(nAlreadyUploadSize>0 && nTotalSize>nAlreadyUploadSize+nThisTimeUploadSize)
- {
- stringOrder = "2";
- }
- if(nAlreadyUploadSize>0 && nTotalSize==nAlreadyUploadSize+nThisTimeUploadSize)
- {
- stringOrder = "3";
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUploadSegmentInfo(int nSegmentCount, unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string stringLocalPath, vSegmentInfo& vSI)
- {
- //获得stringStart、stringEnd、stringMd5系列参数
- //****
- //注意:是取nAlreadyUploadSize+nThisTimeUploadSize部分中的三段,不是nThisTimeUploadSize中的三段,取nThisTimeUploadSize中三段的代码没删,注释了
- //****
- unsigned long nPerPartSize = 0;
- unsigned long nModeSize;
- // nPerPartSize = nThisTimeUploadSize/3;;//--------用于取nThisTimeUploadSize的三段
- // nModeSize = nThisTimeUploadSize%3;;//--------用于取nThisTimeUploadSize的三段
- nPerPartSize = (nAlreadyUploadSize+nThisTimeUploadSize)/3;
- nModeSize = (nAlreadyUploadSize+nThisTimeUploadSize)%3;
- string stringStartX;
- string stringEndX;
- string stringMd5X;
-
- //unsigned long nPartXEnd = nAlreadyUploadSize-1;//用于取nThisTimeUploadSize的三段
- unsigned long nPartXEnd = 0-1;
- unsigned long nPartXStart, nPartXSize, nRandomX, nStartX, nEndX;
- for(int i=0; i<nSegmentCount; i++)
- {
- //三段长度的分法:nPerPartSize, nPerPartSize, nPerPartSize+nModeSize
- nPartXStart = nPartXEnd+1;
- if(i == nSegmentCount-1)
- {
- //最后一段加模数
- nPartXEnd = nPartXStart+nPerPartSize+nModeSize-1;
- }
- else
- {
- nPartXEnd = nPartXStart+nPerPartSize-1;
- }
- nPartXSize = nPartXEnd-nPartXStart+1;
- //如果段长度大于1024,则随机取nStartX和nEndX;否则取段的全部
- if(nPartXSize > 1024)
- {
- Random random;
- random.seed();
- nRandomX = random.next(nPartXSize-1024+1);
- nStartX = nPartXStart+nRandomX;
- nEndX = nStartX+1024-1;
- }
- else
- {
- nStartX = nPartXStart;
- nEndX = nPartXEnd;
- }
- //计算md5
- char* bufSrcX = NULL;
- unsigned long nLengthX = nEndX-nStartX+1;
- bufSrcX = new char[nLengthX+1];
- memset(bufSrcX, 0, nLengthX+1);
- ifstream iFStreamX;
- iFStreamX.exceptions(ios::failbit|ios::badbit);
- try
- {
- //open函数默认文本打开,如果文本打开的话读到0就相当于eof了,所以指定ios_base::binary
- iFStreamX.open(stringLocalPath.c_str(), ios_base::binary|ios_base::in);
- iFStreamX.seekg(nStartX, std::ios_base::beg);
- //int nTempLengthX = 0;
- iFStreamX.read(bufSrcX, nLengthX);
- iFStreamX.close();
- }
- catch (ios::failure& e)
- {
- //写日志
- //int nReadCount = iFStreamX.gcount();
- delete bufSrcX;
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_READ_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_READ_FAIL;
- }
- stringMd5X = CUtil::GetMd5(bufSrcX, nLengthX);
- delete bufSrcX;
- stringStartX = CUtil::ULongToString(nStartX);
- stringEndX = CUtil::ULongToString(nEndX);
- SEGMENT_INFO si;
- si.m_stringStart = stringStartX;
- si.m_stringEnd = stringEndX;
- si.m_stringMd5 = stringMd5X;
- vSI.insert(vSI.end(), si);
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GenerateTempUploadFile(int nAlreadyUploadSize, int nThisTimeUploadSize, string stringLocalFilePath, string& stringTempUploadFilePath)
- {
- string stringUuid = UUIDGenerator::defaultGenerator().createOne().toString();
- stringTempUploadFilePath = stringLocalFilePath+"."+stringUuid;
- File fileTempUploadFile(stringTempUploadFilePath, "gbk");
- try
- {
- fileTempUploadFile.createFile();
- }
- catch(Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- ifstream iFstream;
- ofstream oFstream;
- iFstream.exceptions(ios_base::eofbit|ios_base::failbit|ios_base::badbit);
- oFstream.exceptions(ios_base::failbit|ios_base::badbit);
- try
- {
- iFstream.open(stringLocalFilePath.c_str(), ios_base::binary);
- oFstream.open(stringTempUploadFilePath.c_str(), ios_base::binary|ios_base::trunc);
- iFstream.seekg(nAlreadyUploadSize, ios_base::beg);
- Buffer<char> bufFileContent(nThisTimeUploadSize);
- iFstream.read(bufFileContent.begin(), nThisTimeUploadSize);
- oFstream.write(bufFileContent.begin(), nThisTimeUploadSize);
- iFstream.close();
- oFstream.close();
- }
- catch(ios_base::failure& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- if(iFstream.eof() || iFstream.fail() || iFstream.bad())
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_READ_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_READ_FAIL;
- }
- else
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_WRITE_FAIL;
- }
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDownloadTempFileSize(string stringTempDirectory, int nThreadCount, unsigned long* pTempFileSize)
- {
- //创建目录,并扫描临时文件,获得每个临时文件的大小,以方便继续下载
- File fileDir(stringTempDirectory, "gbk");
- try
- {
- fileDir.createDirectory();
- }
- catch(const Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_CREATE_DIR_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_CREATE_DIR_FAIL;
- }
- vector<File> vTempFile;
- vector<File>::const_iterator iter;
- fileDir.list(vTempFile);
- unsigned int nThreadNum = 0;
- for(nThreadNum=0; nThreadNum<nThreadCount; nThreadNum++)
- {
- for(iter=vTempFile.begin(); iter!=vTempFile.end(); iter++)
- {
- if(iter->path().find("PHMS_TEMP_"+CUtil::UIntToString(nThreadNum)) != string::npos)
- {
- pTempFileSize[nThreadNum] = (unsigned long)iter->getSize();
- break;
- }
- }
- if(iter == vTempFile.end())
- {
- pTempFileSize[nThreadNum] = 0;
- }
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DivideSegment(unsigned long nRemainFileSize, unsigned long nSegmentMaxSize, int& nThreadCount, unsigned long* pSegmentFileSize)
- {
- if(nRemainFileSize/(nSegmentMaxSize*nThreadCount) > 0)
- {
- for(int i=0; i<nThreadCount; i++)
- {
- pSegmentFileSize[i] = nSegmentMaxSize;
- }
- }
- else
- {
- //缺点:没有智能的判断文件过小不需要nThreadCount个线程
- //比如剩余2 bytes,要求3 Threads,程序也会创建两个线程(两个请求),去分别要一个字节。这种情况还是非常少见的,以后有时间再优化
- if(nRemainFileSize < nThreadCount)
- {
- //特殊情况,剩余文件size小于线程数
- for(int i=0; i<nRemainFileSize; i++)
- {
- pSegmentFileSize[i] = 1;
- }
- nThreadCount = nRemainFileSize;
- }
- else
- {
- //剩余文件size大于线程数,但小于nSegmentMaxSize*nThreadCount
- for(int i=0; i<nThreadCount-1; i++)
- {
- pSegmentFileSize[i] = nRemainFileSize/nThreadCount;
- }
- pSegmentFileSize[nThreadCount-1] = nRemainFileSize/nThreadCount + nRemainFileSize%nThreadCount;
- }
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::CombineSegmentFile(string stringLocalFile, string stringTempDirectory, int nThreadCount)
- {
- ifstream iFstream;
- ofstream oFstream;
- iFstream.exceptions(ios_base::goodbit);
- oFstream.exceptions(ios_base::eofbit|ios_base::failbit);
- File fileDir(stringTempDirectory, "gbk");
- try
- {
- oFstream.open(stringLocalFile.c_str(), ios_base::out|ios_base::app|ios_base::binary);
- for(int i=0; i<nThreadCount; i++)
- {
-
- string stringTempFile;
- stringTempFile = stringTempDirectory+"/"+"PHMS_TEMP_"+CUtil::UIntToString(i);
- iFstream.open(stringTempFile.c_str(), ios_base::in|ios_base::binary);
- StreamCopier::copyStream(iFstream, oFstream);
- iFstream.clear();//必须清状态,否则下次打开失败
- iFstream.close();
- File fileTempFile(stringTempFile, "gbk");
- fileTempFile.remove();
- }
-
- }
- catch(ios_base::failure& e)
- {
- //写日志
- //iFstream.close();
- //oFstream.close();
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(stringLocalFile, __FUNCTION__, __FILE__, __LINE__);
- fileDir.remove(true);
- if(oFstream.bad())
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_COMBILE_FILE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_COMBILE_FILE_FAIL;
- }
- else
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_COMBILE_FILE_FAIL_BUT_CAN_RETRY), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_COMBILE_FILE_FAIL_BUT_CAN_RETRY;
- }
- }
- oFstream.close();
- try
- {
- fileDir.remove(true);
- }
- catch(const Exception&)
- {
- //防止发生和下载定时器回调遍历文件夹冲突的情况下抛出异常,发生冲突即使删不掉也无所谓。
- //几率非常小,产生的后果影响也非常小(多一个空文件夹),所以就暂时不用互斥量控制了
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::Login(string stringRole, string stringUsername, string stringPassword, string stringLanguage, string stringToken, bool bMustSsl)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->Login(stringRole, stringUsername, stringPassword, stringLanguage, stringToken, bMustSsl);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- if(!m_eventSocketAbort.tryWait(500))
- {
- if(nRet==COMMON_SEND_FAIL || nRet==COMMON_SEND_TIMEOUT || nRet==COMMON_RECV_FAIL || nRet==COMMON_RECV_TIMEOUT)
- {
- m_pPhmsSession->SetUseIp(true);
- nRet = m_pPhmsSession->Login(stringRole, stringUsername, stringPassword, stringLanguage, stringToken, bMustSsl);
- m_pPhmsSession->SetUseIp(false);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- else
- {
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- m_stringIp = m_pPhmsSession->GetIp();
- return PHMS_SUCCESSFUL_RESULT;
- }
- }
- }
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- m_stringIp = m_pPhmsSession->GetIp();
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::MechineRegister(string stringCountry, string stringAreaId, string stringArea, string stringDevice, string stringSignature, string stringSerialnum)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->MechineRegister(stringCountry, stringAreaId, stringArea, stringDevice, stringSignature, stringSerialnum);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::Logout()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->Logout();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetDoctorSign(string stringFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringMd5;
- nRet = CUtil::GetMd5(stringFilePath, stringMd5);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->SetDoctorSign(stringMd5, stringFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetDoctorPhoto(string stringFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringMd5;
- nRet = CUtil::GetMd5(stringFilePath, stringMd5);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->SetDoctorPhoto(stringMd5, stringFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ApplyNewCase(string stringName, string stringThirdId, string stringDataType, string stringDataTypeName, string stringNotes, string stringHospitalId,
- string stringHospitalName, string stringDoctorId, string stringDoctorName, string stringCheckTime, string stringOtherParam, string stringDeviceId, string stringDeviceName,
- string stringMd5, string stringCaseOrigin, string stringYzlb, string stringSex, string stringApplicationNo, string stringAutoMatic)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ApplyNewCase(stringName, stringThirdId, stringDataType, stringDataTypeName, stringNotes, stringHospitalId, stringHospitalName,
- stringDoctorId, stringDoctorName, stringCheckTime, stringOtherParam, stringDeviceId, stringDeviceName, stringMd5, stringCaseOrigin, stringYzlb, stringSex, stringApplicationNo, stringAutoMatic);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadCaseSegment(string stringCaseId, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
- unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath)
- {
- //验证参数
- if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_PARAM_VALIDATE_FAIL;
- }
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
-
- //获得stringTotalSize参数
- string stringTotalSize;
- stringTotalSize = CUtil::ULongToString(nTotalSize);
- //获得stringOrder
- string stringOrder;
- this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
- //获得Start\End\Md5信息
- vSegmentInfo vSi;
- nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- string stringTempUploadFilePath;
- nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->UploadCaseSegment(stringCaseId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
- vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
- vSi[2].m_stringMd5, stringTempUploadFilePath);
- try
- {
- File fileTempUploadFile(stringTempUploadFilePath, "gbk");
- fileTempUploadFile.remove(false);
- }
- catch(const Exception&)
- {
- }
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::CaseHoldPlace(string stringCaseId, string stringReceiverId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->CaseHoldPlace(stringCaseId, stringReceiverId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAutoDownloadCase(string stringCaseType,string stringSenderId,string stringCaseOrigin)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAutoDownloadCase( stringCaseType, stringSenderId, stringCaseOrigin);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadCaseBegin(string stringCaseId, string stringReceiverId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DownloadCaseBegin(stringCaseId, stringReceiverId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadFileSegment(string stringUri, unsigned long nBeginPos, unsigned long nEndPos)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringStart = CUtil::ULongToString(nBeginPos);
- string stringEnd = CUtil::ULongToString(nEndPos);
- nRet = m_pPhmsSession->DownloadFileSegment(stringUri, stringStart, stringEnd);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadCaseComplete(string stringCaseId, string stringReceiverId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DownloadCaseComplete(stringCaseId, stringReceiverId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::InvalidCase(string stringCaseId, string stringReceiverId, string stringReason)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->InvalidCase(stringCaseId, stringReceiverId, stringReason);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::TransmitCase(string stringCaseId, string stringReceiverId, string stringForwardToH, string stringForwardToHospitalName,
- string stringForwardToD, string stringForwardToDoctorName)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->TransmitCase(stringCaseId, stringReceiverId, stringForwardToH, stringForwardToHospitalName, stringForwardToD, stringForwardToDoctorName);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RollbackCase(string stringCaseId, string stringReceiverId, string stringBackTo)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->Rollback(stringCaseId, stringReceiverId, stringBackTo);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetHospitalListOfGroup(string stringHGroupId, string stringType, string stringCaseType, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetHospitalListOfGroup(stringHGroupId, stringType, stringCaseType, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDoctorListOfHospital(string stringHospitalId, string stringDoctorId, string stringCaseType, string stringDoctorType, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetDoctorListOfHospital(stringHospitalId, stringDoctorId, stringCaseType, stringDoctorType, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AnalyzeBegin(string stringCaseId, string stringReceiverId, string stringCaseType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AnalyzeBegin(stringCaseId, stringReceiverId, stringCaseType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AnalyzeComplete(string stringCaseId, string stringReceiverId, string stringCaseType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AnalyzeComplete(stringCaseId, stringReceiverId, stringCaseType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ApplyNewReport(string stringCaseId, string stringReceiverId, string stringDiagnosis, string stringMd5, string stringDigitalSign, string stringTimestampSign, string stringCaseType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ApplyNewReport(stringCaseId, stringReceiverId, stringDiagnosis, stringMd5, stringDigitalSign, stringTimestampSign, stringCaseType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadReportSegment(string stringCaseId, string stringReceiverId, string stringCaseType, string stringReportId, unsigned long nTotalSize,
- unsigned long nAlreadyUploadSize, unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath, string stringFileType)
- {
- //验证参数
- if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_PARAM_VALIDATE_FAIL;
- }
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- //获得stringTotalSize参数
- string stringTotalSize;
- stringTotalSize = CUtil::ULongToString(nTotalSize);
- //获得stringOrder
- string stringOrder;
- this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
- //获得Start\End\Md5信息
- vSegmentInfo vSi;
- nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- string stringTempUploadFilePath;
- nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->UploadReportSegment(stringCaseId, stringReceiverId, stringCaseType, stringReportId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
- vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
- vSi[2].m_stringMd5, stringTempUploadFilePath, stringFileType);
- try
- {
- File fileTempUploadFile(stringTempUploadFilePath, "gbk");
- fileTempUploadFile.remove(false);
- }
- catch(const Exception&)
- {
- }
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadReportBegin(string stringCaseId, string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DownloadReportBegin(stringCaseId, stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadReportComplete(string stringCaseId, string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DownloadReportComplete(stringCaseId, stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAlreadyUploadFileSize(string stringUri)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAlreadyUploadFileSize(stringUri);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetReviewReportList(string stringReportStartDate, string stringReportEndDate,string stringReviewStartDate,
- string stringReviewEndDate, string stringReviewState, string stringCaseType, string stringPtName, string stringSenderId, string stringYzlb, string stringAId,
- string stringReviewerId, string stringReceiverId, string stringCaseId, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetReviewReportList(stringReportStartDate, stringReportEndDate, stringReviewStartDate, stringReviewEndDate,
- stringReviewState, stringCaseType, stringPtName, stringSenderId, stringYzlb, stringAId, stringReviewerId, stringReceiverId, stringCaseId, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ReviewReport(string stringReportKeyId, string stringReviewState, string stringPath, string stringDiagnostic,
- string stringDigitalSign, string stringTimeStampSign)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ReviewReport(stringReportKeyId, stringReviewState, stringPath, stringDiagnostic, stringDigitalSign, stringTimeStampSign);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetReportStateOfCase(string stringCaseId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetReportStateOfCase(stringCaseId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCaseListOfDoctor(string stringCaseId, string stringCaseType, string stringCaseSource, string stringCaseState,
- string stringPatientName, string stringSenderId, string stringReceiverId, string stringStartDate, string stringEndDate, string stringCheckStartDate,
- string stringCheckEndDate, string stringSenderName, string stringDiagnostic, string stringCaseOrigin, string stringYzlb, string stringAId, string stringSex, string stringOrderBy,
- string stringThirdId, string stringLang, string stringIsFullName, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetCaseListOfDoctor(stringCaseId, stringCaseType, stringCaseSource, stringCaseState, stringPatientName,
- stringSenderId, stringReceiverId, stringStartDate, stringEndDate, stringCheckStartDate, stringCheckEndDate, stringSenderName,
- stringDiagnostic, stringCaseOrigin, stringYzlb, stringAId, stringSex, stringOrderBy, stringThirdId, stringLang, stringIsFullName, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetHospitalInfo(string stringHospitalId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetHospitalInfo(stringHospitalId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadIm(string stringSenderId, string stringSenderName, string stringReceiverId, string stringMsgDirection,
- string stringMsgType, string stringMsgContent, string stringCaseId, string stringCaseType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadIm(stringSenderId, stringSenderName, stringReceiverId, stringMsgDirection, stringMsgType, stringMsgContent,
- stringCaseId, stringCaseType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetImList(string stringSenderId, string stringCaseId, string stringCaseType, string stringMsgDirection,
- string stringMsgType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetImList(stringSenderId, stringCaseId, stringCaseType, stringMsgDirection, stringMsgType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetImList2(string stringNextId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetImList2(stringNextId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadImComplete(string stringMsgId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ImDownloadComplete(stringMsgId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SendPhoneMsg (string stringCardId, string stringPhoneNum, string stringMsg)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SendPhoneMsg(stringCardId, stringPhoneNum, stringMsg);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadTrendData(string stringCardId, string stringDeviceId, string stringDeviceName, string stringCaseId, vector<RECORD_DATA> vRecordData)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadTrendData(stringCardId, stringDeviceId, stringDeviceName, stringCaseId, vRecordData);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadTrendDataString(string stringCardId, string stringDeviceId, string stringDeviceName, string stringCaseId, vector<RECORD_DATA_STRING> vRecordData)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadTrendDataString(stringCardId, stringDeviceId, stringDeviceName, stringCaseId, vRecordData);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadTrendDataFile(string stringFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadTrendDataFile(stringFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadAudioSegment (string stringMsgId, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
- unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath)
- {
- //验证参数
- if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_PARAM_VALIDATE_FAIL;
- }
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- //获得stringTotalSize参数
- string stringTotalSize;
- stringTotalSize = CUtil::ULongToString(nTotalSize);
- //获得stringOrder
- string stringOrder;
- this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
- //获得Start\End\Md5信息
- vSegmentInfo vSi;
- nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- //生成临时文件
- string stringTempUploadFilePath;
- nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->UploadAudioSegment(stringMsgId, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
- vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
- vSi[2].m_stringMd5, stringTempUploadFilePath);
- try
- {
- File fileTempUploadFile(stringTempUploadFilePath, "gbk");
- fileTempUploadFile.remove(false);
- }
- catch(const Exception&)
- {
- }
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadAdvice (string stringUserId, string stringUsername, string stringMsg, string stringType, string stringIsSendMsg)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadAdvice(stringUserId, stringUsername, stringMsg, stringType, stringIsSendMsg);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAdvice (string stringSgId, string stringUserId, string stringDoctorId, string stringDownloadState, string stringType,
- string stringStartDate, string stringEndDate, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetAdvice(stringSgId, stringUserId, stringDoctorId, stringDownloadState, stringType, stringStartDate, stringEndDate, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DownloadAdviceComplete (string stringAdviceId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DownloadAdviceComplete(stringAdviceId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetReportListOfCase (string stringCaseId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetReportListOfCase(stringCaseId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- //接口有变动,加了一个参数senderid,表示要查找信息的人,如为空表示自己
- int CInternalNetIntetface::GetSelfInfo (string stringSenderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetSelfInfo(stringSenderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangePwd (string stringOldPwd, string stringNewPwd)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangePwd(stringOldPwd, stringNewPwd);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DoctorChangeInfo (string stringName, string stringSex, string stringTel, string stringBirthdear,
- string stringPosition, string stringNotes)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DoctorChangeSelfInfo(stringName, stringSex, stringTel, stringBirthdear, stringPosition, stringNotes, "");
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::CliniqueChangeInfo (string stringPid, string stringName, string stringTel, string stringNotes)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->CliniqueChangeSelfInfo(stringPid, stringName, stringTel, stringNotes);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UserChangeInfo (string stringPid, string stringName, string stringSex, string stringTel, string stringBirthday,
- string stringAddress, string stringLmp, string stringToken, string stringHeight, string stringWeight, string stringPhoto, string stringVCodeBeFollowed, string stringHospitalId, string stringOtherInfo)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->CardUserChangeSelfInfo(stringPid, stringName, stringSex, stringTel, stringBirthday, stringAddress, stringLmp, stringToken, stringHeight, stringWeight, stringPhoto, stringVCodeBeFollowed, stringHospitalId, stringOtherInfo);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCaseListOfUser (string stringCaseId, string stringCaseType, string stringCaseState, string stringThirdId, string stringName,
- string stringStartDate, string stringEndDate, string stringCheckStartDate, string stringCheckEndDate, string stringCaseOrigin,
- string stringYzlb, string stringSex, string stringIsRead, string stringOrderBy, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetCaseListOfUser(stringCaseId, stringCaseType, stringCaseState, stringThirdId, stringName, stringStartDate, stringEndDate,
- stringCheckStartDate, stringCheckEndDate, stringCaseOrigin, stringYzlb, stringSex, stringIsRead, stringOrderBy, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetReportListOfUser (string stringReportId, string stringReportStartDate, string stringReportEndDate,
- string stringCaseType, string stringReportState, string stringOrderBy, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetReportListOfUser(stringReportId, stringReportStartDate, stringReportEndDate, stringCaseType, stringReportState, stringOrderBy, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCardUserList (string stringCardId, string stringSenderId, string stringPersonId, string stringTel, string stringName,
- string stringType, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetCardUserList(stringCardId, stringSenderId, stringPersonId, stringTel, stringName, stringType, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::KeepSession()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->KeepSession();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::MarkCaseException(string stringCaseId, string stringReceiverId , int nResultFlag)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->MarkCaseException(stringCaseId, stringReceiverId, nResultFlag);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::MarkReportRead(string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->MarkReportRead(stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::Feedback(string stringTitle, string stringNotes, string stringPhone, string stringFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->Feedback(stringTitle, stringNotes, stringPhone, stringFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadTrendData2(string stringTargetPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadTrendData2(stringTargetPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAllTeamList()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAllTeamList();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDoctorListOfTeam(string stringTeamId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDoctorListOfTeam(stringTeamId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetEventStream(string stringCaseId, string stringOriginalHospital)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetEventStream(stringCaseId, stringOriginalHospital);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCaseTypeList(string stringLanguage)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCaseTypeList(stringLanguage);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DoctorHandledCaseStatistics(string stringCaseType, string stringStartTime, string stringEndTime)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DoctorHandledCaseStatistics(stringCaseType, stringStartTime, stringEndTime);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UserRegister(string stringPhone, string stringName, string stringHeigth)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UserRegister(stringPhone, stringName, stringHeigth);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetTrendData(string stringUId, string stringInterUId, string stringTrendType, string stringStartDate, string stringEndDate, string stringNextId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetTrendData(stringUId, stringInterUId, stringTrendType, stringStartDate, stringEndDate, stringNextId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- //目前该接口只支持保存到文件
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetLastPhysiologicalData()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetLastPhysiologicalData();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetHealthDegree(string stringUId, string stringInterUId, string stringDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetHealthDegree(stringUId, stringInterUId, stringDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUserOfNoAdviceAndMostData(string stringDays)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetUserOfNoAdviceAndMostData(stringDays);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AdviceDelay(string stringUId, string stringMinutes)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AdviceDelay(stringUId, stringMinutes);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AdviceComplete(string stringUId, string stringOptionType, string stringAdvice)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AdviceComplete(stringUId, stringOptionType, stringAdvice);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUserListOfNoAdvice(string stringDays, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetUserListOfNoAdvice(stringDays, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AdviceBegin(string stringUId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AdviceBegin(stringUId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUserListOfAdvicing(unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetUserListOfAdvicing(stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::VerifyThirdId(string stringUId, string stringType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->VerifyThirdId(stringUId, stringType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::PersonIdRegister(string stringType, string stringRegFrom, string stringPersonId, string stringName, string stringSex, string stringBirthday, string stringAddress,
- string stringPhone, string stringHeigth, string stringUploadUnitId, string stringHospitalId, string stringHGroupId, string stringScode, string stringWxUId, string stringLmp, string stringWeight, string stringPassword,
- string stringThirdCode, string stringIsRegister)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->PersonIdRegister(stringType, stringRegFrom, stringPersonId, stringName, stringSex, stringBirthday, stringAddress, stringPhone, stringHeigth, stringUploadUnitId,
- stringHospitalId, stringHGroupId, stringScode, stringWxUId, stringLmp, stringWeight, stringPassword, stringThirdCode, stringIsRegister);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetVerificationCode(string stringType, string stringPhone)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetVerificationCode(stringType, stringPhone);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAskList(string stringAskType, string stringAskEnd, string stringDoctorId, string stringIsAsk, string stringUserId, string stringStartTime, string stringEndTime, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetAskList(stringAskType, stringAskEnd, stringDoctorId, stringIsAsk, stringUserId, stringStartTime, stringEndTime, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAskDetail(string stringAskId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAskDetail(stringAskId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetQuestionList(string stringDoctorId, string stringReportType, string stringAskId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetQuestionList(stringDoctorId, stringReportType, stringAskId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SubmitQuestion(string stringUserId, string stringAdvise, string stringReportType, string stringAskId, string stringAskedId, string stringDoctorPhotoPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SubmitQuestion(stringUserId, stringAdvise, stringReportType, stringAskId, stringAskedId, stringDoctorPhotoPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDataDictionary()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDataDictionary();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::LoggingHealthBaseInfo(string stringUserId, string stringWeblock, string stringNation, string stringProfression, string stringCrowd, string stringBloodType,
- string stringJwsJiBing, string stringJwsShouShu, string stringJwsWaiShang, string stringJwsShuXue, string stringJwsBaoLuShi, string stringJwsBaoLuShiBz,
- string stringJwsYiChuanJiBing, string stringGmsGuoMinShi, string stringGmsGuoMinShiBz, string stringJzsFuQin, string stringJzsFuQinBz, string stringJzsMuQin,
- string stringJzsMuQinBz, string stringJzsXdjm, string stringJzsXdjmBz, string stringJzsZiNv, string stringJzsZiNvBz, string stringJzsQiTa)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->LoggingHealthBaseInfo(stringUserId, stringWeblock, stringNation, stringProfression, stringCrowd, stringBloodType, stringJwsJiBing, stringJwsShouShu, stringJwsWaiShang,
- stringJwsShuXue, stringJwsBaoLuShi, stringJwsBaoLuShiBz, stringJwsYiChuanJiBing, stringGmsGuoMinShi, stringGmsGuoMinShiBz, stringJzsFuQin, stringJzsFuQinBz, stringJzsMuQin, stringJzsMuQinBz,
- stringJzsXdjm, stringJzsXdjmBz, stringJzsZiNv, stringJzsZiNvBz, stringJzsQiTa);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::LoggingHealthCurrentInfo(string stringUserId, string stringShfsYinShi, string stringShfsXlzk, string stringShfsXlzkBz, string stringShfsXltz, string stringShfsXiYan,
- string stringShfsYinJiu, string stringShfsSyqk, string stringShfsYunDong, string stringShfsYunDongShiJian, string stringSysjcDanGuChun, string stringSysjcXueChangGui,
- string stringSysjcXueChangGuiBz, string stringSysjcNiaoChangGui, string stringSysjcNiaoChangGuiBz, string stringSysjcQiTa, string stringYongYao, string stringZhuYuan,
- string stringJkwtNaoXueGuan, string stringJkwtNaoXueGuanBz, string stringJkwtShenZang, string stringJkwtShenZangBz, string stringJkwtXinZang, string stringJkwtXinZangBz,
- string stringJkwtXueGuan, string stringJkwtXueGuanBz, string stringJkwtYanBu, string stringJkwtYanBuBz, string stringJkwtShenJing, string stringJkwtQiTa, string stringDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->LoggingHealthCurrentInfo(stringUserId, stringShfsYinShi, stringShfsXlzk, stringShfsXlzkBz, stringShfsXltz, stringShfsXiYan, stringShfsYinJiu, stringShfsSyqk, stringShfsYunDong,
- stringShfsYunDongShiJian, stringSysjcDanGuChun, stringSysjcXueChangGui, stringSysjcXueChangGuiBz, stringSysjcNiaoChangGui, stringSysjcNiaoChangGuiBz, stringSysjcQiTa, stringYongYao, stringZhuYuan,
- stringJkwtNaoXueGuan, stringJkwtNaoXueGuanBz, stringJkwtShenZang, stringJkwtShenZangBz, stringJkwtXinZang, stringJkwtXinZangBz, stringJkwtXueGuan, stringJkwtXueGuanBz, stringJkwtYanBu, stringJkwtYanBuBz,
- stringJkwtShenJing, stringJkwtQiTa, stringDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCliniqueListOfHospital(string stringHospitalId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCliniqueListOfHospital(stringHospitalId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetStatisticsInfo(string stringTypeId, string stringMonth, string stringMonthDay, unsigned int nPageTo, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageTo = CUtil::UIntToString(nPageTo);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetStatisticsInfo(stringTypeId, stringMonth, stringMonthDay, stringPageTo, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UpdateCaseInfo(string stringHospitalId, string stringCaseId, string stringOtherParam, string stringFlag, string stringNotes, string stringReceiverId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UpdateCaseInfo(stringHospitalId, stringCaseId, stringOtherParam, stringFlag, stringNotes, stringReceiverId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUserHealthList(string stringNextId, string stringTypeId, string stringSecondTypeId, string stringName, string stringSex, string stringThirdIdType,
- string stringThirdId, string stringHospitalId, string stringUnitSenderId, string stringIsData, string stringIntervalTime, string stringPopulations, string stringContractDoctor, string stringIsContract, string stringPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetUserHealthList(stringNextId, stringTypeId, stringSecondTypeId, stringName, stringSex, stringThirdIdType, stringThirdId, stringHospitalId,
- stringUnitSenderId, stringIsData, stringIntervalTime, stringPopulations, stringContractDoctor, stringIsContract, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetAdviceImplemention(string stringThirdId, string stringHospitalId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAdviceImplemention(stringThirdId, stringHospitalId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangePersonType(string stringThirdId, string stringPeopleType, string stringHospitalId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangePersonType(stringThirdId, stringPeopleType, stringHospitalId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetNextVisitTime(string stringThirdId, string stringInterViewTime, string stringHospitalId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SetNextVisitTime(stringThirdId, stringInterViewTime, stringHospitalId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPersonTypeList(string stringLanguage)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPersonTypeList(stringLanguage);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::PersonIdRegisterAndLogin(string stringRole, string stringPId, string stringName, string stringSex, string stringBirthday, string stringAddress, string stringDeviceId, string stringMd5,
- string stringLang, string stringRegFrom)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->PersonIdRegisterAndLogin(stringRole, stringPId, stringName, stringSex, stringBirthday, stringAddress, stringDeviceId, stringMd5, stringLang, stringRegFrom);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::CardBindPhone(string stringPhone, string stringScode)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->CardBindPhone(stringPhone, stringScode);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ResetPassword(string stringPhone, string stringScode, string stringNewPwd)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ResetPassword(stringPhone, stringScode, stringNewPwd);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadDaily(string stringType, string stringCreateTime, string stringFiles)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadDaily(stringType, stringCreateTime, stringFiles);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDateListOfDaily(string stringYear, string stringMonth)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDateListOfDaily(stringYear, stringMonth);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDailyOfDate(string stringDate, string stringType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDailyOfDate(stringDate, stringType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ShareDaily(string stringType, string stringCreateTime)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ShareDaily(stringType, stringCreateTime);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::DeleteDaily(string stringType, string stringDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DeleteDaily(stringType, stringDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::PhoneScanQR(string stringQRCode)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->PhoneScanQR(stringQRCode);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::PhoneScanQRVerify(string stringQRCode)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->PhoneScanQRVerify(stringQRCode);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ApplyQRCode(string stringType, string stringScene)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ApplyQRCode(stringType, stringScene);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ValidateUserAccount(string stringLoginId, string stringPassword, string stringRole)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ValidateUserAccount(stringLoginId, stringPassword, stringRole);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RegisterBluetoothDevice(string stringUniqueSN, string stringSerial, string stringBluetoothAddress, string stringBluetoothName, string stringDeviceType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->RegisterBluetoothDevice(stringUniqueSN, stringSerial, stringBluetoothAddress, stringBluetoothName, stringDeviceType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetBluetoothInfoOfDevice(string stringUniqueSN)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetBluetoothInfoOfDevice(stringUniqueSN);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangeDeviceType(string stringUniqueSN, string stringDeviceType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangeDeviceType(stringUniqueSN, stringDeviceType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UnregisterBluetoothDevice(string stringUniqueSN)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UnregisterBluetoothDevice(stringUniqueSN);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetHospitalListOfArea(string stringAreaId, string stringRank, string stringBeta)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetHospitalListOfArea(stringAreaId, stringRank, stringBeta);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadCommonFileSegment (string stringType, string stringExtra, unsigned long nTotalSize, unsigned long nAlreadyUploadSize,
- unsigned long nThisTimeUploadSize, string stringServerPath, string stringLocalPath, string stringFileType)
- {
- //验证参数
- if(nTotalSize<=0 || nAlreadyUploadSize<0 || nThisTimeUploadSize<=0 ||nTotalSize<nAlreadyUploadSize+nThisTimeUploadSize)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_PARAM_VALIDATE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_PARAM_VALIDATE_FAIL;
- }
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- //获得stringTotalSize参数
- string stringTotalSize;
- stringTotalSize = CUtil::ULongToString(nTotalSize);
- //获得stringOrder
- string stringOrder;
- this->GetOrder(nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringOrder);
- //获得Start\End\Md5信息
- vSegmentInfo vSi;
- nRet = this->GetUploadSegmentInfo(3, nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, vSi);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- //生成临时文件
- string stringTempUploadFilePath;
- nRet = this->GenerateTempUploadFile(nAlreadyUploadSize, nThisTimeUploadSize, stringLocalPath, stringTempUploadFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nRet = m_pPhmsSession->UploadCommonFileSegment(stringType, stringExtra, stringOrder, stringTotalSize, stringServerPath, vSi[0].m_stringStart, vSi[0].m_stringEnd,
- vSi[0].m_stringMd5, vSi[1].m_stringStart, vSi[1].m_stringEnd, vSi[1].m_stringMd5, vSi[2].m_stringStart, vSi[2].m_stringEnd,
- vSi[2].m_stringMd5, stringTempUploadFilePath, stringFileType);
- try
- {
- File fileTempUploadFile(stringTempUploadFilePath, "gbk");
- fileTempUploadFile.remove(false);
- }
- catch(const Exception&)
- {
- }
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SearchSomebody(string stringUserId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SearchSomebody(stringUserId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::FollowSomebody(string stringUserId, string stringUsername, string stringNickname, string stringVCode)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->FollowSomebody(stringUserId, stringUsername, stringNickname, stringVCode);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::MyFollowing(string stringUserId, string stringNextId, string stringFType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->MyFollowing(stringUserId, stringNextId, stringFType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::MyFans(string stringUserId, string stringNextId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->MyFans(stringUserId, stringNextId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangeNicknameOfFollowed(string stringUserId, string stringNickname)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangeNicknameOfFollowed(stringUserId, stringNickname);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::CancelFollowing(string stringUserId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->CancelFollowing(stringUserId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::PublishHealthyKnowledge(vector<HEALTHY_KNOWLEDGE> vHealthKnowledge)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->PublishHealthyKnowledge(vHealthKnowledge);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetListOfHealthyKnowledge(string stringSenderId, string stringNextId, string stringIds, string stringPageSize, string stringOrderBy)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetListOfHealthyKnowledge(stringSenderId, stringNextId, stringIds, stringPageSize, stringOrderBy);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCardUserReportList(string stringReportId, string stringReportStartDate, string stringReportEndDate, string stringCaseType, string stringState, string stringOrderBy,
- string stringThirdIdType, string stringThirdId, string stringNextId, string stringPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCardUserReportList(stringReportId, stringReportStartDate, stringReportEndDate, stringCaseType, stringState, stringOrderBy, stringThirdIdType, stringThirdId, stringNextId, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangeViewLikeCollectCount(string stringHealthTipId, string stringUri, string stringTitle, string stringLike, string stringRead, string stringCollect)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangeViewLikeCollectCount(stringHealthTipId, stringUri, stringTitle, stringLike, stringRead, stringCollect);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ChangeAdviceExecutiveState(string stringSgId, string stringState)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ChangeAdviceExecutiveState(stringSgId, stringState);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetTrendRangeValue()
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetTrendRangeValue();
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCliniqueReportList(string stringCliniqueSenderId, string stringStartDate,
- string stringEndDate, string stringState, string stringName, string stringPatientSourceCode, string stringYzlb, string stringPIdType, string stringPId, string stringHb, string stringASectionId, string stringNextId, string stringPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCliniqueReportList(stringCliniqueSenderId, stringStartDate, stringEndDate, stringState, stringName, stringPatientSourceCode, stringYzlb, stringPIdType, stringPId, stringHb, stringASectionId, stringNextId, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetUserListBindingOrNot(string stringNextId, string stringPageSize, string stringIsBind, string stringIsActive)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetUserListBindingOrNot(stringNextId, stringPageSize, stringIsBind, stringIsActive);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::BindUser(string stringUId, string stringUName)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->BindUser(stringUId, stringUName);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UnbindUser(string stringUId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UnbindUser(stringUId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCardUserListOfCustomer(string stringThirdId, string stringName, string stringCaseType, string stringStartDate, string stringEndDate, string stringNextId, unsigned int nPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- string stringPageSize = CUtil::UIntToString(nPageSize);
- nRet = m_pPhmsSession->GetCardUserListOfCustomer(stringThirdId, stringName, stringCaseType, stringStartDate, stringEndDate, stringNextId, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SearchCaseAdvanced(string stringHospitalId, string stringDiagnostic,
- string stringName, string stringSex, QUERY_RANGE rangeAge, QUERY_RANGE rangeCreateTime, string stringMode,
- string stringCaseType, QUERY_ECG ecg, string stringFrom, string stringSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SearchCaseAdvanced(stringHospitalId, stringDiagnostic, stringName, stringSex, rangeAge,
- rangeCreateTime, stringMode, stringCaseType, ecg, stringFrom, stringSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SearchCaseAdvancedString(string stringHospitalId, string stringDiagnostic,
- string stringName, string stringSex, string stringJsonAge, string stringJsonCreateTime, string stringMode,
- string stringCaseType, string stringJsonEcg, string stringFrom, string stringSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SearchCaseAdvancedString(stringHospitalId, stringDiagnostic, stringName, stringSex, stringJsonAge,
- stringJsonCreateTime, stringMode, stringCaseType, stringJsonEcg, stringFrom, stringSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPayCode(string stringType, string stringCaseId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPayCode(stringType, stringCaseId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetOrderInfo(string stringType, string stringCaseId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetOrderInfo(stringType, stringCaseId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SignDoctor(string stringUId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SignDoctor(stringUId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RefundFee(string stringType, string stringCaseId, string stringRefundFee)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->RefundFee(stringType, stringCaseId, stringRefundFee);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::HoldPlaceReview(string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->HoldPlaceReview(stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RollBackReview(string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->RollBackReview(stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ResetReviewHoldPlace(string stringReportId, string stringOccupantId, string stringOccupantName, string stringSuperKey)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ResetReviewHoldPlace(stringReportId, stringOccupantId, stringOccupantName, stringSuperKey);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ResetCaseHoldPlace(string stringCaseId, string stringReceiverId, string stringOccupantId, string stringOccupantName, string stringSuperKey)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ResetCaseHoldPlace(stringCaseId, stringReceiverId, stringOccupantId, stringOccupantName, stringSuperKey);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GenerateOrDeletePngZlibReport(string stringServerPath, string stringFlag)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GenerateOrDeletePngZlibReport(stringServerPath, stringFlag);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDailyList(string stringType, string stringStartDate, string stringEndDate, string stringOrderBy, string stringNextId, string stringPageSize)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDailyList(stringType, stringStartDate, stringEndDate, stringOrderBy, stringNextId, stringPageSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AddTag(string stringTagName, string stringTagDescription)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AddTag(stringTagName, stringTagDescription);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetTagList(string stringSenderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetTagList(stringSenderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AddCaseToTag(string stringTagId, string stringTagName, string stringCaseId, string stringCaseType, string stringCaseTypeName, string stringPatientName)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->AddCaseToTag(stringTagId, stringTagName, stringCaseId, stringCaseType, stringCaseTypeName, stringPatientName);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCaseListOfTag(string stringTagId, string stringSenderId, string stringCaseType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCaseListOfTag(stringTagId, stringSenderId, stringCaseType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- // int CInternalNetIntetface::CreateSession_GuanXin(string stringUsername, string stringPassword)
- // {
- // int nRet = PHMS_SUCCESSFUL_RESULT;
- // m_pPhmsSession->SetSaveType(m_nSaveType);
- // m_pPhmsSession->SetFilePath(m_stringFilePath);
- // nRet = m_pPhmsSession->CreateSession_GuanXin(stringUsername, stringPassword);
- // if(nRet != PHMS_SUCCESSFUL_RESULT)
- // {
- // CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- // return nRet;
- // }
- // if(m_nSaveType == 1)
- // {
- // m_stringContent = m_pPhmsSession->GetContent();
- // }
- // return PHMS_SUCCESSFUL_RESULT;
- // }
- int CInternalNetIntetface::GetAccessToken_GuanXin(string stringUsername, string stringPassword)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetAccessToken_GuanXin(stringUsername, stringPassword);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPersonInfo_GuanXin(string stringAccessToken, string stringPersonName, string stringPersonGender, string stringPersonIdentity, string stringPersonBirthDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPersonInfo_GuanXin(stringAccessToken, stringPersonName, stringPersonGender, stringPersonIdentity, stringPersonBirthDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadECGData_GuanXin(string stringECGXmlPath, string stringECGDataPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadECGData_GuanXin(stringECGXmlPath, stringECGDataPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadOtherData_GuanXin(string stringOtherXmlPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadOtherData_GuanXin(stringOtherXmlPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
-
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadCheckData_GuanXin(string stringCheckXmlPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadCheckData_GuanXin(stringCheckXmlPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadPersonInfo_GuanXin(string stringPersonInfoXmlPath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadPersonInfo_GuanXin(stringPersonInfoXmlPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- //自定义内部接口
- int CInternalNetIntetface::DownloadFile(int nThreadCount, string stringUri, unsigned long nFileSize, string stringLocalFilePath, pProgressAndSpeedCallback pCallback)
- {
- if(nThreadCount>3 || nThreadCount<1)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_THREAD_COUNT_TOO_LARGE), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_DOWNLOAD_THREAD_COUNT_TOO_LARGE;
- }
- int nRet = PHMS_SUCCESSFUL_RESULT;
- if(nFileSize == 0)
- {
- //应用程序未传入文件大小,需要从服务器获得文件大小
- string stringServerFileSize;
- this->SetSaveType(1);
- nRet = this->GetAlreadyUploadFileSize(stringUri);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringServerFileSize = this->GetContent();
- if(stringServerFileSize.size()==0 || stringServerFileSize.compare("0")==0)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_FILE_SIZE_0), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_DOWNLOAD_FILE_SIZE_0;
- }
- nFileSize = CUtil::StringToULong(stringServerFileSize);
- }
- const unsigned long nSegmentMaxSize = (1024*1024);
- unsigned long nAlreadyCombineFileSize = 0;
- unsigned long nRemainFileSize = 0;
- unsigned long nAlreadyDownloadFileSize = 0;
- //获得已经合并的文件大小
- File fileLocalFile(stringLocalFilePath, "gbk");
- if(fileLocalFile.exists())
- {
- nAlreadyCombineFileSize = (unsigned long)fileLocalFile.getSize();
- }
- else
- {
- nAlreadyCombineFileSize = 0;
- }
- nAlreadyDownloadFileSize = nAlreadyCombineFileSize;
- if(nAlreadyCombineFileSize == nFileSize)
- {
- if(pCallback != NULL)
- {
- (*pCallback)(100, 0, stringUri.c_str(), stringLocalFilePath.c_str());
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- if(nAlreadyCombineFileSize > nFileSize)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_LOCAL_FILE_MORE_THAN_SERVER_FILE), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_LOCAL_FILE_MORE_THAN_SERVER_FILE;
- }
- else
- {
- nRemainFileSize = nFileSize - nAlreadyCombineFileSize;
- }
- //创建目录,并扫描临时文件,获得每个临时文件的大小,以方便继续下载
- string stringTempDirectory = stringLocalFilePath+"_PHMS_TEMP";
- unsigned long *pTempFileSize = new unsigned long[nThreadCount];
- memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
- this->GetDownloadTempFileSize(stringTempDirectory, nThreadCount, pTempFileSize);
- for(int i=0; i<nThreadCount; i++)
- {
- nAlreadyDownloadFileSize += pTempFileSize[i];
- }
- //创建并启动定时器
- Timer timerDownload(1000, 1000);
- CDownloadTimerCallback downloadTimerCallback(pCallback, nFileSize, stringLocalFilePath, stringTempDirectory, nAlreadyDownloadFileSize, nThreadCount, stringUri);
- TimerCallback<CDownloadTimerCallback> adapterDowoloadTimer(downloadTimerCallback, &CDownloadTimerCallback::onTimer);
- timerDownload.start(adapterDowoloadTimer);
- //下载
- ThreadPool threadPool(1, nThreadCount, 60, 0);
- unsigned long* pSegmentFileSize = new unsigned long[nThreadCount];
- memset(pSegmentFileSize, 0, nThreadCount*sizeof(unsigned long));
- while(nRemainFileSize > 0)
- {
- File fileDir(stringTempDirectory, "gbk");
- try
- {
- fileDir.createDirectory();
- }
- catch(const Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_CREATE_DIR_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_CREATE_DIR_FAIL;
- }
- //获得分段
- memset(pSegmentFileSize, 0, nThreadCount*sizeof(unsigned long));
- this->DivideSegment(nRemainFileSize, nSegmentMaxSize, nThreadCount, pSegmentFileSize);
- //创建线程,分段下载
- vector<CInternalNetIntetface*> vNet;
- vector<CDownloadThreadCallback*> vDownloadThreadCallback;
- for(unsigned int i=0; i<nThreadCount; i++)
- {
- CDownloadThreadCallback* pDownloadThreadCallback = new CDownloadThreadCallback;
- vDownloadThreadCallback.push_back(pDownloadThreadCallback);
- pDownloadThreadCallback->SetUri(stringUri);
- pDownloadThreadCallback->SetLocalFile(stringTempDirectory+"/"+"PHMS_TEMP_"+CUtil::UIntToString(i));
- //获得之前Segment的总和
- unsigned long nPreSegmentTotal = 0;
- for(unsigned int j=0; j<i; j++)
- {
- nPreSegmentTotal += pSegmentFileSize[j];
- }
- pDownloadThreadCallback->SetStart(nAlreadyCombineFileSize+nPreSegmentTotal+pTempFileSize[i]);
- pDownloadThreadCallback->SetEnd(nAlreadyCombineFileSize+nPreSegmentTotal+pSegmentFileSize[i]-1);
- //cout<<downloadThreadCallback.GetStart()<<" "<<downloadThreadCallback.GetEnd()<<endl;
- CInternalNetIntetface* pNetTemp = new CInternalNetIntetface;
- vNet.push_back(pNetTemp);
- pNetTemp->SetSessionId(this->GetSessionId());
- pNetTemp->SetCommandType(this->GetCommandType());
- pDownloadThreadCallback->SetNet(pNetTemp);
- if(pDownloadThreadCallback->GetStart() <= pDownloadThreadCallback->GetEnd())
- {
- threadPool.start(*pDownloadThreadCallback, "PHMS_TEMP_"+CUtil::UIntToString(i));
- }
- }
- //等待所有线程结束,两分钟,期间只要有一个线程两分钟内未结束,该函数都返回false
- //极致的情况,比如三个线程等待时间有可能无限接近6分钟
- //因为可能有网络太慢不能下载完成的情况,所以改成无限等待
- //threadPool.tryJoinAll(60*1000*3);
- while(1)
- {
- if(m_eventSocketAbort.tryWait(1000))
- {
- for(int i=0; i<vNet.size(); i++)
- {
- vNet[i]->AbortSession();
- }
- threadPool.joinAll();
- break;
- }
- if(threadPool.tryJoinAll(1000))
- {
- break;
- }
- }
- //清理线程对应网络对象
- vector<CInternalNetIntetface*>::const_iterator iter1;
- for(iter1=vNet.begin(); iter1!=vNet.end(); iter1++)
- {
- delete *iter1;
- }
- vNet.clear();
- vector<CDownloadThreadCallback*>::const_iterator iter2;
- for(iter2=vDownloadThreadCallback.begin(); iter2!=vDownloadThreadCallback.end(); iter2++)
- {
- delete *iter2;
- }
- vDownloadThreadCallback.clear();
- //判断是否所有线程都下载成功,并合并文件
- bool bSuccess = true;
- memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
- this->GetDownloadTempFileSize(stringTempDirectory, nThreadCount, pTempFileSize);
- for(int i=0; i<nThreadCount; i++)
- {
- if(pTempFileSize[i] > pSegmentFileSize[i])
- {
- File fileDir(stringTempDirectory, "gbk");
- fileDir.remove(true);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_LOCAL_TEMP_TOO_LARGE), __FUNCTION__, __FILE__, __LINE__);
- delete pTempFileSize;
- delete pSegmentFileSize;
- timerDownload.stop();
- return COMMON_LOCAL_TEMP_TOO_LARGE;
- }
- if(pTempFileSize[i] < pSegmentFileSize[i])
- {
- bSuccess = false;
- break;
- }
- }
- if(bSuccess)
- {
- //合并文件
- nRet = this->CombineSegmentFile(stringLocalFilePath, stringTempDirectory, nThreadCount);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- delete pTempFileSize;
- delete pSegmentFileSize;
- timerDownload.stop();
- return nRet;
- }
- for(int i=0; i<nThreadCount; i++)
- {
- nAlreadyCombineFileSize += pSegmentFileSize[i];
- }
- nRemainFileSize = nFileSize - nAlreadyCombineFileSize;
- memset(pTempFileSize, 0, nThreadCount*sizeof(unsigned long));
- }
- else
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_DOWNLOAD_SEGMENT_FAIL_FOR_FILESIEZE_CHANGE), __FUNCTION__, __FILE__, __LINE__);
- delete pTempFileSize;
- delete pSegmentFileSize;
- timerDownload.stop();
- return COMMON_DOWNLOAD_SEGMENT_FAIL_FOR_FILESIEZE_CHANGE;
- }
- }
- delete pTempFileSize;
- delete pSegmentFileSize;
- timerDownload.stop(true);
- return PHMS_SUCCESSFUL_RESULT;
- }
- //UploadCase、UploadReport、UploadAudio三个函数目前只能支持大于3字节的文件上传,若文件小于3字节,上传失败
- //因为UploadCaseSegment、UploadReportSegment、UploadAudioSegment三个函数目前只能支持大于3字节的文件上传
- //因为PHMS协议未定义,当文件无法分出三段的情况下,应如何上传
- int CInternalNetIntetface::UploadCase (string stringCaseId, string stringLocalCasePath, pProgressAndSpeedCallback pCallback)
- {
- const unsigned long nMaxPerTimeSize = 512*1024;
- unsigned long nTotalSize = 0;
- int nRet = PHMS_SUCCESSFUL_RESULT;
- nRet = CUtil::GetFileSize(stringLocalCasePath, nTotalSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(nTotalSize < 3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_LESS_3_BYTES;
- }
- string stringLocalIniPath = stringLocalCasePath + ".ini";
- string stringServerPath;
- string stringAlreadyUploadSize;
- nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- unsigned long nAlreadyUploadSize = 0;
- if(stringAlreadyUploadSize.size() > 0)
- {
- nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
- }
- if(nAlreadyUploadSize == nTotalSize)
- {
- if(pCallback != NULL)
- {
- (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalCasePath.c_str());
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- if(nAlreadyUploadSize > nTotalSize)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_INI_SIZE_ERROR;
- }
-
- //创建并启动定时器
- Timer timerUpload(1000, 1000);
- CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalCasePath);
- TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
- timerUpload.start(adapterUpload);
-
-
- unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
- while(nRemainSize > 0)
- {
- unsigned long nThisTimeUploadSize = 0;
- if(nRemainSize > nMaxPerTimeSize)
- {
- if(nRemainSize - nMaxPerTimeSize <3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- nThisTimeUploadSize = nRemainSize;
- }
- else
- {
- nThisTimeUploadSize = nMaxPerTimeSize;
- }
- }
- else
- {
- nThisTimeUploadSize = nRemainSize;
- }
- this->SetSaveType(1);
- nRet = this->UploadCaseSegment(stringCaseId, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalCasePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringServerPath = this->GetContent();
- stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
- nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nAlreadyUploadSize += nThisTimeUploadSize;
- nRemainSize = nTotalSize - nAlreadyUploadSize;
- }
- timerUpload.stop(true);
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadReport(string stringCaseId, string stringReceiverId, string stringCaseType, string stringReportId, string stringLocalReportPath, string stringFileType, pProgressAndSpeedCallback pCallback)
- {
- const unsigned long nMaxPerTimeSize = 512*1024;
- unsigned long nTotalSize = 0;
- int nRet = PHMS_SUCCESSFUL_RESULT;
- nRet = CUtil::GetFileSize(stringLocalReportPath, nTotalSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(nTotalSize < 3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_LESS_3_BYTES;
- }
- string stringLocalIniPath = stringLocalReportPath + ".ini";
- string stringServerPath;
- string stringAlreadyUploadSize;
- nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- unsigned long nAlreadyUploadSize = 0;
- if(stringAlreadyUploadSize.size() > 0)
- {
- nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
- }
- if(nAlreadyUploadSize == nTotalSize)
- {
- if(pCallback != NULL)
- {
- (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalReportPath.c_str());
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- if(nAlreadyUploadSize > nTotalSize)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_INI_SIZE_ERROR;
- }
- //创建并启动定时器
- Timer timerUpload(1000, 1000);
- CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalReportPath);
- TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
- timerUpload.start(adapterUpload);
- unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
- while(nRemainSize > 0)
- {
- unsigned long nThisTimeUploadSize = 0;
- if(nRemainSize > nMaxPerTimeSize)
- {
- if(nRemainSize - nMaxPerTimeSize <3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- nThisTimeUploadSize = nRemainSize;
- }
- else
- {
- nThisTimeUploadSize = nMaxPerTimeSize;
- }
- }
- else
- {
- nThisTimeUploadSize = nRemainSize;
- }
- this->SetSaveType(1);
- nRet = this->UploadReportSegment(stringCaseId, stringReceiverId, stringCaseType, stringReportId, nTotalSize,
- nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalReportPath, stringFileType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringServerPath = this->GetContent();
- stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
- nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nAlreadyUploadSize += nThisTimeUploadSize;
- nRemainSize = nTotalSize - nAlreadyUploadSize;
- }
- timerUpload.stop(true);
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadAudio(string stringMsgId, string stringLocalAudioPath, pProgressAndSpeedCallback pCallback)
- {
- const unsigned long nMaxPerTimeSize = 512*1024;
- unsigned long nTotalSize = 0;
- int nRet = PHMS_SUCCESSFUL_RESULT;
- nRet = CUtil::GetFileSize(stringLocalAudioPath, nTotalSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(nTotalSize < 3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_LESS_3_BYTES;
- }
- string stringLocalIniPath = stringLocalAudioPath + ".ini";
- string stringServerPath;
- string stringAlreadyUploadSize;
- nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- unsigned long nAlreadyUploadSize = 0;
- if(stringAlreadyUploadSize.size() > 0)
- {
- nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
- }
- if(nAlreadyUploadSize == nTotalSize)
- {
- if(pCallback != NULL)
- {
- (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalAudioPath.c_str());
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- if(nAlreadyUploadSize > nTotalSize)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_INI_SIZE_ERROR;
- }
- //创建并启动定时器
- Timer timerUpload(1000, 1000);
- CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalAudioPath);
- TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
- timerUpload.start(adapterUpload);
- unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
- while(nRemainSize > 0)
- {
- unsigned long nThisTimeUploadSize = 0;
- if(nRemainSize > nMaxPerTimeSize)
- {
- if(nRemainSize - nMaxPerTimeSize <3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- nThisTimeUploadSize = nRemainSize;
- }
- else
- {
- nThisTimeUploadSize = nMaxPerTimeSize;
- }
- }
- else
- {
- nThisTimeUploadSize = nRemainSize;
- }
- this->SetSaveType(1);
- nRet = this->UploadAudioSegment(stringMsgId, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalAudioPath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringServerPath = this->GetContent();
- stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
- nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nAlreadyUploadSize += nThisTimeUploadSize;
- nRemainSize = nTotalSize - nAlreadyUploadSize;
- }
- timerUpload.stop(true);
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadCommonFile(string& stringUri, string stringType, string stringExtra, string stringLocalFilePath, string stringFileType, pProgressAndSpeedCallback pCallback)
- {
- const unsigned long nMaxPerTimeSize = 512*1024;
- unsigned long nTotalSize = 0;
- int nRet = PHMS_SUCCESSFUL_RESULT;
- nRet = CUtil::GetFileSize(stringLocalFilePath, nTotalSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(nTotalSize < 3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_UPLOAD_LESS_3_BYTES), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_LESS_3_BYTES;
- }
- string stringLocalIniPath = stringLocalFilePath + ".ini";
- string stringServerPath;
- string stringAlreadyUploadSize;
- nRet = LoadServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- unsigned long nAlreadyUploadSize = 0;
- if(stringAlreadyUploadSize.size() > 0)
- {
- nAlreadyUploadSize = CUtil::StringToULong(stringAlreadyUploadSize);
- }
- if(nAlreadyUploadSize == nTotalSize)
- {
- if(pCallback != NULL)
- {
- (*pCallback)(100, 0, stringServerPath.c_str(), stringLocalFilePath.c_str());
- }
- stringUri = stringServerPath;
- return PHMS_SUCCESSFUL_RESULT;
- }
- if(nAlreadyUploadSize > nTotalSize)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_UPLOAD_INI_SIZE_ERROR;
- }
- //创建并启动定时器
- Timer timerUpload(1000, 1000);
- CUploadTimerCallback uploadCallback(pCallback, stringLocalIniPath, nAlreadyUploadSize, nTotalSize, stringLocalFilePath);
- TimerCallback<CUploadTimerCallback> adapterUpload(uploadCallback, &CUploadTimerCallback::onTimer);
- timerUpload.start(adapterUpload);
- unsigned long nRemainSize = nTotalSize-nAlreadyUploadSize;
- while(nRemainSize > 0)
- {
- unsigned long nThisTimeUploadSize = 0;
- if(nRemainSize > nMaxPerTimeSize)
- {
- if(nRemainSize - nMaxPerTimeSize <3)
- {
- //该条件判断是为了不出现少于3字节上传的情况,因为服务器不支持少于3字节的上传
- nThisTimeUploadSize = nRemainSize;
- }
- else
- {
- nThisTimeUploadSize = nMaxPerTimeSize;
- }
- }
- else
- {
- nThisTimeUploadSize = nRemainSize;
- }
- this->SetSaveType(1);
- nRet = this->UploadCommonFileSegment(stringType, stringExtra, nTotalSize, nAlreadyUploadSize, nThisTimeUploadSize, stringServerPath, stringLocalFilePath, stringFileType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- stringServerPath = this->GetContent();
- stringUri = stringServerPath;
- stringAlreadyUploadSize = CUtil::ULongToString(nAlreadyUploadSize+nThisTimeUploadSize);
- nRet = StoreServerPathAndAlreadyUploadSize(stringLocalIniPath, stringServerPath, stringAlreadyUploadSize);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- timerUpload.stop();
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- nAlreadyUploadSize += nThisTimeUploadSize;
- nRemainSize = nTotalSize - nAlreadyUploadSize;
- }
- timerUpload.stop(true);
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::AbortSession()
- {
- m_eventSocketAbort.set();
- return m_pPhmsSession->AbortSession();
- }
- //内部接口--针对NoPhms接口,直接用http协议请求文件,不通过php
- int CInternalNetIntetface::GetFileWithHttp(string stringUrl, int bContinue)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ExecuteNoPhmsSession(stringUrl, bContinue, false);
- if(nRet==COMMON_SEND_FAIL || nRet==COMMON_SEND_TIMEOUT || nRet==COMMON_RECV_FAIL || nRet==COMMON_RECV_TIMEOUT )
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- nRet = m_pPhmsSession->ExecuteNoPhmsSession(stringUrl, bContinue, true);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- }
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- //内部接口--针对Form表单
- int CInternalNetIntetface::PostForm(string stringHost, string stringUrl, map<string, string> mapParam)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ExecuteFormHttpSession(stringHost, stringUrl, mapParam);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetCliniqueState(string stringCliniqueId, string stringState)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SetCliniqueState(stringCliniqueId, stringState);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPatientInfoByAppNum(string stringHospitalId, string stringOrderType, string stringOrderId, string stringReqDepart, string stringOrderState, string stringCheckType, string stringStartDate, string stringEndDate, string stringClinicId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPatientInfoByAppNum(stringHospitalId, stringOrderType, stringOrderId, stringReqDepart, stringOrderState, stringCheckType, stringStartDate, stringEndDate, stringClinicId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPatientInfoByAppNumToHis(string stringHospitalId, string stringOrderType, string stringOrderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPatientInfoByAppNumToHis(stringHospitalId, stringOrderType, stringOrderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPatientInfoByAppNumToPhmsAndHis(string stringHospitalId, string stringOrderType, string stringOrderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPatientInfoByAppNumToPhmsAndHis(stringHospitalId, stringOrderType, stringOrderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ApplyCheck(string stringCliniqueId, string stringOrderId, string stringOrderType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ApplyCheck(stringCliniqueId, stringOrderId, stringOrderType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- if(nRet != 220303)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- }
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetWaitingCheck(string stringCliniqueId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetWaitingCheck(stringCliniqueId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- if(nRet!=220403 && nRet!=220405)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- }
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCliniqueState(string stringCliniqueId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCliniqueState(stringCliniqueId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::NotifyCaseState(string stringHospitalId, string stringOrderType, string stringOrderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->NotifyCaseState(stringHospitalId, stringOrderType, stringOrderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::NotifyReportState(string stringReportId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->NotifyReportState(stringReportId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetDoctorAgentId(string stringDoctorAgentId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->DoctorChangeSelfInfo("", "", "", "", "", "", stringDoctorAgentId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::NotifyAppState(string stringUnitId, string stringOrderId, string stringOrderType, string stringState)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->NotifyAppState(stringUnitId, stringOrderId, stringOrderType, stringState);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::VerifyAppState(string stringOrderId, string stringOrderType)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->VerifyAppState(stringOrderId, stringOrderType);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetHisReportState(string stringHospitalId, string stringOrderType, string stringOrderId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetHisReportState(stringHospitalId, stringOrderType, stringOrderId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SetHisCriticalValue(string stringHospitalId, string stringCaseId, string stringCriticalValues)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SetHisCriticalValue(stringHospitalId, stringCaseId, stringCriticalValues);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetDoctorList_999120(string stringKtCliniqueId, string stringCaseTypeId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetDoctorList_999120(stringKtCliniqueId, stringCaseTypeId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ValidatePay_999120(string stringConsumeId, string stringKtCliniqueId, string stringCardNumber, string stringKtDoctorId, string stringConsumeMoney, string stringCaseTypeId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ValidatePay_999120(stringConsumeId, stringKtCliniqueId, stringCardNumber, stringKtDoctorId, stringConsumeMoney, stringCaseTypeId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UpdateCaseForConsumerRecord_999120(string stringConsumeId, string stringKtCaseId, string stringCaseTypeId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UpdateCaseForConsumerRecord_999120(stringConsumeId, stringKtCaseId, stringCaseTypeId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ValidatePay_XinJie(string stringRrn, string stringLocalDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- //m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ValidatePay_XinJie(stringRrn, stringLocalDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- //使用0102030405060708作为密钥进行AES解密
- CipherKey::ByteVec secret;
- CipherKey::ByteVec vi;
- string::iterator iter;
- string stringSecret = "0102030405060708";
- for(iter=stringSecret.begin(); iter!=stringSecret.end(); iter++)
- {
- secret.push_back(*iter);
- vi.push_back(*iter);
- }
- Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes128", secret, vi));
- string stringIn = m_stringContent;
- for(iter=stringIn.begin(); iter!=stringIn.end(); iter++)
- {
- if(*iter == '+')
- {
- *iter = '*';
- }
- }
- string stringOut;
- try
- {
- stringOut = pCipher->decryptString(stringIn, Cipher::ENC_BASE64);
- }
- catch(Poco::Exception &e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_RECV_CONTENT_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_RECV_CONTENT_FAIL;
- }
- catch(const ios::failure& error)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_OUTPUT_STREAM_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_OUTPUT_STREAM_FAIL;
- }
-
- try
- {
- File fileTarget(m_stringFilePath, "gbk");
- fileTarget.createFile();
- }
- catch(Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- ofstream ofLocalTargetFile;
- ofLocalTargetFile.exceptions(ios::failbit|ios::badbit);
- try
- {
- ofLocalTargetFile.open(m_stringFilePath.c_str(), ios_base::trunc|ios_base::binary);
- }
- catch(const ios::failure& error)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- try
- {
- ofLocalTargetFile<<stringOut;
- ofLocalTargetFile.flush();
- ofLocalTargetFile.close();
- }
- catch(const ios::failure& error)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_WRITE_FAIL;
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::NotifyCheck_XinJie(string stringRrn, string stringLocalDate)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- //m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->NotifyCheck_XinJie(stringRrn, stringLocalDate);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- //使用0102030405060708作为密钥进行AES解密
- CipherKey::ByteVec secret;
- CipherKey::ByteVec vi;
- string::iterator iter;
- string stringSecret = "0102030405060708";
- for(iter=stringSecret.begin(); iter!=stringSecret.end(); iter++)
- {
- secret.push_back(*iter);
- vi.push_back(*iter);
- }
- Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes128", secret, vi));
- string stringIn = m_stringContent;
- for(iter=stringIn.begin(); iter!=stringIn.end(); iter++)
- {
- if(*iter == '+')
- {
- *iter = '*';
- }
- }
- string stringOut;
- try
- {
- stringOut = pCipher->decryptString(stringIn, Cipher::ENC_BASE64);
- }
- catch(Poco::Exception &e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_RECV_CONTENT_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_RECV_CONTENT_FAIL;
- }
- catch(const ios::failure& error)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_OUTPUT_STREAM_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_OUTPUT_STREAM_FAIL;
- }
- try
- {
- File fileTarget(m_stringFilePath, "gbk");
- fileTarget.createFile();
- }
- catch(Exception& e)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(e, __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- ofstream ofLocalTargetFile;
- ofLocalTargetFile.exceptions(ios::failbit|ios::badbit);
- try
- {
- ofLocalTargetFile.open(m_stringFilePath.c_str(), ios_base::trunc|ios_base::binary);
- }
- catch(const ios::failure& error)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_OPEN_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_OPEN_FAIL;
- }
- try
- {
- ofLocalTargetFile<<stringOut;
- ofLocalTargetFile.flush();
- ofLocalTargetFile.close();
- }
- catch(const ios::failure& error)
- {
- //写日志
- CPhmsLogger::GetPhmsLogger()->WriteLog(error.what(), __FUNCTION__, __FILE__, __LINE__);
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_FILE_WRITE_FAIL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_FILE_WRITE_FAIL;
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UserAuthorize_Telecom(string stringPersonId, string stringName, string stringNation, string stringAddress, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UserAuthorize_Telecom(stringPersonId, stringName, stringNation, stringAddress, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::BloodPressureUpload_Telecom(string stringPersonType, string stringPersonId, string stringSBP, string stringDBP, string stringAverageValue, string stringPulseRate, string stringDetectionTime,
- string stringEquCode, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->BloodPressureUpload_Telecom(stringPersonType, stringPersonId, stringSBP, stringDBP, stringAverageValue, stringPulseRate, stringDetectionTime, stringEquCode, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::BloodOxygenUpload_Telecom(string stringPersonType, string stringPersonId, string stringBloodOxygen, string stringPulseRate, string stringDetectionTime,
- string stringEquCode, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->BloodOxygenUpload_Telecom(stringPersonType, stringPersonId, stringBloodOxygen, stringPulseRate, stringDetectionTime, stringEquCode, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::BloodSugarUpload_Telecom(string stringPersonType, string stringPersonId, string stringBloodSugar, string stringDetectionTime,
- string stringEquCode, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->BloodSugarUpload_Telecom(stringPersonType, stringPersonId, stringBloodSugar, stringDetectionTime, stringEquCode, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::HeightWeightUpload_Telecom(string stringPersonType, string stringPersonId, string stringHeight, string stringWeight, string stringBMI, string stringDetectionTime,
- string stringEquCode, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->HeightWeightUpload_Telecom(stringPersonType, stringPersonId, stringHeight, stringWeight, stringBMI, stringDetectionTime, stringEquCode, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::LungUpload_Telecom(string stringPersonType, string stringPersonId, string stringM_B1, string stringBSA, string stringBSA1, string stringMMF, string stringMefSeventyFive, string stringMefFifty,
- string stringMefTwentyFive, string stringMefFVST, string stringIC, string stringIRV, string stringERV, string stringFevOne, string stringFevTwo, string stringFevThree,
- string stringFevOnePer, string stringFevTwoPer, string stringFevThreePer, string stringRR, string stringFVC, string stringPEF, string stringTV, string stringVC, string stringMVV,
- string stringMV, string stringVSTHeight, string stringVSMvvBsa, string stringVSMvvOne, string stringSVC, string stringFevOneZeroFive, string stringFevOneZeroFivePer, string stringPefOne,
- string stringPefTwo, string stringPefThree, string stringFive, string stringFiveOne, string stringFiveTwo, string stringFiveThree, string stringPIF, string stringMifFifty,
- string stringDetectionTime, string stringEquCode, string stringRoomId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->LungUpload_Telecom(stringPersonType, stringPersonId, stringM_B1, stringBSA, stringBSA1, stringMMF, stringMefSeventyFive, stringMefFifty, stringMefTwentyFive, stringMefFVST, stringIC,
- stringIRV, stringERV, stringFevOne, stringFevTwo, stringFevThree, stringFevOnePer, stringFevTwoPer, stringFevThreePer, stringRR, stringFVC, stringPEF, stringTV, stringVC, stringMVV,
- stringMV, stringVSTHeight, stringVSMvvBsa, stringVSMvvOne, stringSVC, stringFevOneZeroFive, stringFevOneZeroFivePer, stringPefOne, stringPefTwo, stringPefThree, stringFive, stringFiveOne,
- stringFiveTwo, stringFiveThree, stringPIF, stringMifFifty, stringDetectionTime, stringEquCode, stringRoomId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ECGUpload_Telecom(string stringPersonType, string stringPersonId, string stringDetectionTime, string stringEquCode, string stringRoomId, TELCOM_ECG ecgData)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ECGUpload_Telecom(stringPersonType, stringPersonId, stringDetectionTime, stringEquCode, stringRoomId, ecgData);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::Login_XiKang(string stringUsername, string stringPassword)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->Login_XiKang(stringUsername, stringPassword);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RegisterPatientId_XiKang(string stringName, string stringSex, string stringPhoneNum, string stringProofNum)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->RegisterPatientId_XiKang(stringName, stringSex, stringPhoneNum, stringProofNum);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::RegisterPatientInfo_XiKang(string stringPatientOpenId, string stringName, string stringSex, string stringPhoneNum, string stringProofNum, string stringPassword)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->RegisterPatientInfo_XiKang(stringPatientOpenId, stringName, stringSex, stringPhoneNum, stringProofNum, stringPassword);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::BindPatient_XiKang(string stringDoctorOpenId, string stringPatientOpenId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->BindPatient_XiKang(stringDoctorOpenId, stringPatientOpenId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPatientIdList_XiKang(string stringDoctorOpenId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPatientIdList_XiKang(stringDoctorOpenId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SearchPatientId_XiKang(string stringKey, string stringValue)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SearchPatientId_XiKang(stringKey, stringValue);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetPatientInfo_XiKang(string stringPatientOpenId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetPatientInfo_XiKang(stringPatientOpenId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetCaseList_XiKang(vector<string> vPatientOpenId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetCaseList_XiKang(vPatientOpenId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::SubmitCase_XiKang(string stringPatientOpenId, string stringAdvice, string stringCaseType, string stringEcgXmlContent)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->SubmitCase_XiKang(stringPatientOpenId, stringAdvice, stringCaseType, stringEcgXmlContent);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::GetReportFile_XiKang(string stringCaseId)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->GetReportFile_XiKang(stringCaseId);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- if(m_stringContent.find(".pdf") == string::npos)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(COMMON_INVALID_URL), __FUNCTION__, __FILE__, __LINE__);
- return COMMON_INVALID_URL;
- }
- this->SetSaveType(2);
- this->SetFilePath(m_stringFilePath);
- string stringWorkingDir = CUtil::GetCurrentAppDir();
- string stringIniFilePath = stringWorkingDir+"PhmsConfig.ini";
- AutoPtr<IniFileConfiguration> iniFile = new IniFileConfiguration(stringIniFilePath, "gbk");
- string stringXiKangPdfAddress = iniFile->getString("XIKANG.PdfAddress", "dlres.xikang.com");
- string stringPdfUrl = "http://";
- stringPdfUrl += stringXiKangPdfAddress;
- //stringPdfUrl += "/phrhealthfile/d53353f72df6472c9d739e82a95b0326.pdf";
- stringPdfUrl += m_stringContent;
- nRet = GetFileWithHttp(stringPdfUrl, false);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::UploadFile_XiKang(string stringCaseId, string stringCaseFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->UploadFile_XiKang(stringCaseId, stringCaseFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ExecuteGWService(string stringLastPath, string stringJson, string stringFilePath)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- map<string, string> mapParam;
- mapParam["format"] = "json";
- mapParam["content"] = stringJson;
- if(stringLastPath == "login")
- {
- mapParam["sid"] = "";
- mapParam["sign"] = "";
- mapParam["nonce"] = "";
- }
- else
- {
- mapParam["sid"] = this->GetGWSessionId();
- mapParam["nonce"] = UUIDGenerator::defaultGenerator().createOne().toString().substr(0, 32);
- HMACEngine<SHA1Engine> hmacSign(m_pPhmsSession->GetGWSecretKey());
- hmacSign.update(m_pPhmsSession->GetGWSecretKey() + stringJson + mapParam["sid"] + mapParam["nonce"]);
- mapParam["sign"] = DigestEngine::digestToHex(hmacSign.digest());
- }
- nRet = m_pPhmsSession->ExecuteGWService(stringLastPath, mapParam, stringFilePath);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(stringLastPath == "login")
- {
- map<string, string> mapResult;
- CUtil::ParseJsonObjectWithoutArray(m_nSaveType, m_pPhmsSession->GetContent(), m_stringFilePath, mapResult);
- if(mapResult["sid"] != "")
- {
- this->SetGWSessionId(mapResult["sid"]);
- CSessionIdManager::HandleGWSessionSync(mapResult["sid"]);
- }
- if(mapResult["secret_key"] != "")
- {
- m_pPhmsSession->SetGWSecretKey(mapResult["secret_key"]);
- }
- }
- // if(mapResult["data"] != "")
- // {
- // CUtil::ParseJsonObjectWithoutArray(1, mapResult["data"], "", mapResult);
- // if(mapResult["sid"] != "")
- // {
- // this->SetGWSessionId(mapResult["sid"]);
- // CSessionIdManager::HandleGWSessionSync(mapResult["sid"]);
- // }
- // if(mapResult["secret_key"] != "")
- // {
- // m_pPhmsSession->SetGWSecretKey(mapResult["secret_key"]);
- // }
- // }
-
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
- int CInternalNetIntetface::ExecuteCommonRESTful(string stringIp, string stringPort, string stringUrl, string stringContentType, string stringPayload)
- {
- int nRet = PHMS_SUCCESSFUL_RESULT;
- m_pPhmsSession->SetSaveType(m_nSaveType);
- m_pPhmsSession->SetFilePath(m_stringFilePath);
- nRet = m_pPhmsSession->ExecuteCommonRESTful(stringIp, stringPort, stringUrl, stringContentType, stringPayload);
- if(nRet != PHMS_SUCCESSFUL_RESULT)
- {
- CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
- return nRet;
- }
- if(m_nSaveType == 1)
- {
- m_stringContent = m_pPhmsSession->GetContent();
- }
- return PHMS_SUCCESSFUL_RESULT;
- }
|