123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "encoding/json"
- "fmt"
- "github.com/astaxie/beego"
- "github.com/jinzhu/gorm"
- "reflect"
- "strconv"
- "time"
- )
-
- type ManagerCenterApiController struct {
- BaseAuthAPIController
- }
-
- func ManagerCenterRegistRouters() {
- //药品基础库
- beego.Router("/api/basedruglib/create", &ManagerCenterApiController{}, "post:CreateBaseDrugLib")
- beego.Router("/api/basedruglib/edit", &ManagerCenterApiController{}, "post:EditBaseDrugLib")
- beego.Router("/api/basedruglib/get", &ManagerCenterApiController{}, "get:GetBaseDrugLib")
- beego.Router("/api/basedruglib/list", &ManagerCenterApiController{}, "get:GetBaseDrugLibList")
- beego.Router("/api/medicineinsurancepercent/create", &ManagerCenterApiController{}, "post:CreateMedicineInsurancePercent")
- beego.Router("/api/drugunitsafeguard/create", &ManagerCenterApiController{}, "post:CreateDrugUnitSafeguard")
-
- beego.Router("/api/medicineinsurancepercent/get", &ManagerCenterApiController{}, "get:GetMedicineInsurancePercent")
- //beego.Router("/api/drugunitsafeguard/get", &ManagerCenterApiController{}, "get:GetDrugUnitSafeguard")
- beego.Router("/api/drug/basedruglib", &ManagerCenterApiController{}, "get:DeleteBaseDrugById")
- //专项字典
- beego.Router("/api/dictionary/getconfiglist", &ManagerCenterApiController{}, "get,post:GetConfigList")
- beego.Router("/api/dictionary/createconfig", &ManagerCenterApiController{}, "Post:CreateConfig")
- beego.Router("/api/dictionary/createchildconfig", &ManagerCenterApiController{}, "Post:CreateChildConfig")
- beego.Router("/api/dictionary/updatechildconfig", &ManagerCenterApiController{}, "Post:UpdateChildConfig")
- beego.Router("/api/dictionary/deletechildconfig", &ManagerCenterApiController{}, "Post:DeleteChildConfig")
- beego.Router("/api/dictionary/updatetemplate", &ManagerCenterApiController{}, "Post:UpdateTemplate")
- beego.Router("/api/dictionary/getmanageconfiglist", &ManagerCenterApiController{}, "get,post:GetManageConfigList")
-
- //经销商
- beego.Router("/api/stock/dealer/create", &ManagerCenterApiController{}, "post:CreateDealer")
- beego.Router("/api/stock/dealer/modify", &ManagerCenterApiController{}, "post:ModifyDealer")
- //经过测试这个接口完全不会执行,因为被另一个路由占用了
- beego.Router("/api/stock/dealer/list", &ManagerCenterApiController{}, "get:GetDealersList")
- beego.Router("/api/stock/dealer/delete", &ManagerCenterApiController{}, "post:DeleteDealer")
- beego.Router("/api/stock/dealer/get", &ManagerCenterApiController{}, "get:GetDealer")
-
- //厂商
- beego.Router("/api/stock/manufacturer/create", &ManagerCenterApiController{}, "post:CreateManufacturer")
- beego.Router("/api/stock/manufacturer/modify", &ManagerCenterApiController{}, "post:ModifyManufacturer")
- //经过测试这个接口也完全不会执行,因为被另一个路由占用了
- beego.Router("/api/stock/manufacturer/list", &ManagerCenterApiController{}, "get:GetManufacturerList")
- beego.Router("/api/stock/manufacturer/delete", &ManagerCenterApiController{}, "post:DeleteManufacturer")
- beego.Router("/api/stock/manufacturer/get", &ManagerCenterApiController{}, "get:GetManufacturer")
-
- beego.Router("/api/stock/good/info/create", &ManagerCenterApiController{}, "post:CreateGoodInfo")
- beego.Router("/api/stock/good/info/modify", &ManagerCenterApiController{}, "post:ModifyGoodInfo")
- beego.Router("/api/stock/good/info/list", &ManagerCenterApiController{}, "get:GetGoodInfoList")
- beego.Router("/api/info/delete", &ManagerCenterApiController{}, "post:DeleteGoodInfo")
- beego.Router("/api/stock/good/info/get", &ManagerCenterApiController{}, "get:GetGoodInfoByGoodId")
- beego.Router("/api/stock/good/info", &ManagerCenterApiController{}, "get:GetGoodInfoById")
-
- //门诊大病
- beego.Router("/api/mz/sick/create", &ManagerCenterApiController{}, "post:CreateMZSick")
- beego.Router("/api/mz/sick/modify", &ManagerCenterApiController{}, "post:ModifyMZSick")
- beego.Router("/api/mz/sick/list", &ManagerCenterApiController{}, "get:GetMZSickList")
- beego.Router("/api/mz/sick/delete", &ManagerCenterApiController{}, "post:DeleteMZSick")
- beego.Router("/api/mz/sick/get", &ManagerCenterApiController{}, "get:GetMZSick")
-
- beego.Router("/api/addition/create", &ManagerCenterApiController{}, "post:CreateAddition")
- beego.Router("/api/addition/modify", &ManagerCenterApiController{}, "post:ModifyAddition")
- beego.Router("/api/addition/list", &ManagerCenterApiController{}, "get:GetAdditionList")
- beego.Router("/api/addition/delete", &ManagerCenterApiController{}, "post:DeleteAddition")
- beego.Router("/api/addition/get", &ManagerCenterApiController{}, "get:GetAddition")
-
- //门诊诊断
- beego.Router("/api/diagnose/create", &ManagerCenterApiController{}, "post:CreateDiagnose")
- beego.Router("/api/diagnose/modify", &ManagerCenterApiController{}, "post:ModifyDiagnose")
- beego.Router("/api/diagnose/list", &ManagerCenterApiController{}, "get:GetDiagnoseList")
- beego.Router("/api/diagnose/delete", &ManagerCenterApiController{}, "post:DeleteDiagnose")
- beego.Router("/api/diagnose/get", &ManagerCenterApiController{}, "get:GetDiagnose")
- beego.Router("/api/drug/getalldruglist", &ManagerCenterApiController{}, "get:GetAllDrugList")
- beego.Router("/api/drug/postsearchdruglist", &ManagerCenterApiController{}, "get:GetSearchDrugList")
-
- beego.Router("/api/patient/addpatientdiagnose", &ManagerCenterApiController{}, "Post:AddPatientDiagnos")
- beego.Router("/api/patient/getpatientdiagnose", &ManagerCenterApiController{}, "Get:GetPatientDiagnose")
- beego.Router("/api/patient/getpatientdiagnosedetail", &ManagerCenterApiController{}, "Get:GetPatientDiagnoseDetail")
- beego.Router("/api/patient/updatepatientcase", &ManagerCenterApiController{}, "Post:UpdatePatientCase")
- beego.Router("/api/patient/deletepatientdiagnose", &ManagerCenterApiController{}, "Get:DeletePatientDiagnose")
- }
-
- func (c *ManagerCenterApiController) CreateBaseDrugLib() {
- drug_name := c.GetString("drug_name")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- drug_alias := c.GetString("drug_alias")
- drug_alias_pinyin := c.GetString("drug_alias_pinyin")
- drug_alias_wubi := c.GetString("drug_alias_wubi")
- drug_category, _ := c.GetInt64("drug_category")
- drug_spec := c.GetString("drug_spec")
- drug_type, _ := c.GetInt64("drug_type")
- drug_stock_limit := c.GetString("drug_stock_limit")
- drug_origin_place := c.GetString("drug_origin_place")
- drug_dosage_form, _ := c.GetInt64("drug_dosage_form")
- medical_insurance_level, _ := c.GetInt64("medical_insurance_level")
- max_unit := c.GetString("max_unit")
- min_unit := c.GetString("min_unit")
- unit_matrixing := c.GetString("unit_matrixing")
- retail_price, _ := c.GetFloat("retail_price")
- last_price, _ := c.GetFloat("last_price")
- drug_control, _ := c.GetInt64("drug_control")
- number := c.GetString("number")
- drug_classify := c.GetString("drug_classify")
- drug_dose, _ := c.GetFloat("drug_dose")
- drug_dose_unit, _ := c.GetInt64("drug_dose_unit")
- medical_insurance_number := c.GetString("medical_insurance_number")
- provinces_code := c.GetString("provinces_code")
-
- manufacturer, _ := c.GetInt64("manufacturer")
- pharmacology_category, _ := c.GetInt64("pharmacology_category")
- statistics_category, _ := c.GetInt64("statistics_category")
- code := c.GetString("code")
- is_special_diseases, _ := c.GetInt64("is_special_diseases")
- is_record, _ := c.GetInt64("is_record")
- agent := c.GetString("agent")
- drug_status := c.GetString("drug_status")
- limit_remark := c.GetString("limit_remark")
- delivery_way := c.GetString("delivery_way")
- execution_frequency := c.GetString("execution_frequency")
- single_dose, _ := c.GetFloat("single_dose")
- fmt.Println(single_dose)
- prescribing_number, _ := c.GetFloat("prescribing_number")
- label, _ := c.GetInt64("label")
- sort, _ := c.GetInt64("sort")
- is_use_doctor_advice, _ := c.GetInt64("is_use_doctor_advice")
- is_default, _ := c.GetInt64("is_default")
- is_charge_predict, _ := c.GetInt64("is_charge_predict")
- is_statistics_work, _ := c.GetInt64("is_statistics_work")
- is_charge_use, _ := c.GetInt64("is_charge_use")
- dealer, _ := c.GetInt64("dealer")
- prescription_mark, _ := c.GetInt64("prescription_mark")
- social_security_directory_code := c.GetString("social_security_directory_code")
- record_date := c.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- drug_remark := c.GetString("drug_remark")
- //dose, _ := c.GetFloat("dose")
- dose := c.GetString("dose")
- dose_unit := c.GetString("dose_unit")
- min_price, _ := c.GetFloat("min_price")
- min_number, _ := c.GetInt64("min_number")
- drug_day := c.GetString("drug_day")
- hosp_appr_flag, _ := c.GetInt64("hosp_appr_flag")
- lmt_used_flag, _ := c.GetInt64("lmt_used_flag")
- prescribing_number_unit := c.GetString("prescribing_number_unit")
- is_user, _ := c.GetInt64("is_user")
- is_pharmacy, _ := c.GetInt64("is_pharmacy")
- bbx01 := c.GetString("bbx01")
- bby01 := c.GetString("bby01")
- is_project, _ := c.GetInt64("is_project")
- adminInfo := c.GetAdminUserInfo()
- drugLib := &models.BaseDrugLib{
- DrugName: drug_name,
- Pinyin: pinyin,
- Wubi: wubi,
- DrugAlias: drug_alias,
- DrugAliasPinyin: drug_alias_pinyin,
- DrugAliasWubi: drug_alias_wubi,
- DrugCategory: drug_category,
- DrugSpec: drug_spec,
- DrugType: drug_type,
- DrugStockLimit: drug_stock_limit,
- DrugOriginPlace: drug_origin_place,
- MedicalInsuranceLevel: medical_insurance_level,
- DrugDosageForm: drug_dosage_form,
- MaxUnit: max_unit,
- MinUnit: min_unit,
- UnitMatrixing: unit_matrixing,
- RetailPrice: retail_price,
- LastPrice: last_price,
- DrugControl: drug_control,
- Number: number,
- DrugClassify: drug_classify,
- DrugDose: drug_dose,
- DrugDoseUnit: drug_dose_unit,
- MedicalInsuranceNumber: medical_insurance_number,
- ProvincesCode: provinces_code,
- Manufacturer: manufacturer,
- PharmacologyCategory: pharmacology_category,
- StatisticsCategory: statistics_category,
- Code: code,
- IsSpecialDiseases: is_special_diseases,
- IsRecord: is_record,
- Agent: agent,
- DrugStatus: drug_status,
- LimitRemark: limit_remark,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- SingleDose: drug_dose,
- PrescribingNumber: prescribing_number,
- Label: label,
- Sort: sort,
- IsUseDoctorAdvice: is_use_doctor_advice,
- IsDefault: is_default,
- IsChargePredict: is_charge_predict,
- IsStatisticsWork: is_statistics_work,
- IsChargeUse: is_charge_use,
- OrgId: adminInfo.CurrentOrgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Dealer: dealer,
- PrescriptionMark: prescription_mark,
- SocialSecurityDirectoryCode: social_security_directory_code,
- RecordDate: theTime.Unix(),
- DrugRemark: drug_remark,
- DrugDay: drug_day,
- MinNumber: min_number,
- Dose: dose,
- MinPrice: min_price,
- DoseUnit: dose_unit,
- HospApprFlag: hosp_appr_flag,
- LmtUsedFlag: lmt_used_flag,
- PrescribingNumberUnit: prescribing_number_unit,
- IsUse: is_user,
- IsPharmacy: is_pharmacy,
- Bby01: bby01,
- ZuobiaoId: bbx01,
- Bbx01: bbx01,
- IsProject: is_project,
- }
-
- total := service.FindAllDrugLibRecordTotal(adminInfo.CurrentOrgId)
- drug_code := strconv.FormatInt(total+1, 10)
- drug_code = "54000000" + drug_code
- drugLib.DrugCode = drug_code
-
- count := service.FindBaseDrugLibRecordCountOne(drugLib)
-
- if count == 0 {
- if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
-
- drugLib.DrugSpec = drugLib.Dose + drugLib.DoseUnit + "*" + string(drugLib.MinNumber) + drugLib.MinUnit + "/" + drugLib.MaxUnit
- }
- err := service.CreateBaseDrugLib(drugLib)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "创建成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- return
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDrugRepeatDataException)
- return
- }
-
- }
-
- func (c *ManagerCenterApiController) EditBaseDrugLib() {
- id, _ := c.GetInt64("id")
- drug_name := c.GetString("drug_name")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- drug_alias := c.GetString("drug_alias")
- drug_alias_pinyin := c.GetString("drug_alias_pinyin")
- drug_alias_wubi := c.GetString("drug_alias_wubi")
- drug_category, _ := c.GetInt64("drug_category")
- drug_spec := c.GetString("drug_spec")
- drug_type, _ := c.GetInt64("drug_type")
- drug_stock_limit := c.GetString("drug_stock_limit")
- drug_origin_place := c.GetString("drug_origin_place")
- drug_dosage_form, _ := c.GetInt64("drug_dosage_form")
- medical_insurance_level, _ := c.GetInt64("medical_insurance_level")
- max_unit := c.GetString("max_unit")
- min_unit := c.GetString("min_unit")
- unit_matrixing := c.GetString("unit_matrixing")
- retail_price, _ := c.GetFloat("retail_price")
- last_price, _ := c.GetFloat("last_price")
- drug_control, _ := c.GetInt64("drug_control")
- number := c.GetString("number")
- drug_classify := c.GetString("drug_classify")
- drug_dose, _ := c.GetFloat("drug_dose")
- drug_dose_unit, _ := c.GetInt64("drug_dose_unit")
- medical_insurance_number := c.GetString("medical_insurance_number")
- provinces_code := c.GetString("provinces_code")
-
- manufacturer, _ := c.GetInt64("manufacturer")
- pharmacology_category, _ := c.GetInt64("pharmacology_category")
- statistics_category, _ := c.GetInt64("statistics_category")
- code := c.GetString("code")
- is_special_diseases, _ := c.GetInt64("is_special_diseases")
- is_record, _ := c.GetInt64("is_record")
- agent := c.GetString("agent")
- drug_status := c.GetString("drug_status")
- limit_remark := c.GetString("limit_remark")
- delivery_way := c.GetString("delivery_way")
- execution_frequency := c.GetString("execution_frequency")
- single_dose, _ := c.GetFloat("single_dose")
- fmt.Println("sigle_dose", single_dose)
- prescribing_number, _ := c.GetFloat("prescribing_number")
- label, _ := c.GetInt64("label")
- sort, _ := c.GetInt64("sort")
- is_use_doctor_advice, _ := c.GetInt64("is_use_doctor_advice")
- is_default, _ := c.GetInt64("is_default")
- is_charge_predict, _ := c.GetInt64("is_charge_predict")
- is_statistics_work, _ := c.GetInt64("is_statistics_work")
- is_charge_use, _ := c.GetInt64("is_charge_use")
- drug_code := c.GetString("drug_code")
- //unit := c.GetString("unit")
- dealer, _ := c.GetInt64("dealer")
- prescription_mark, _ := c.GetInt64("prescription_mark")
- social_security_directory_code := c.GetString("social_security_directory_code")
- record_date := c.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- drug_remark := c.GetString("drug_remark")
- min_number, _ := c.GetInt64("min_number")
- drug_day := c.GetString("drug_day")
- //dose, _ := c.GetFloat("dose")
- dose := c.GetString("dose")
- dose_unit := c.GetString("dose_unit")
- total, _ := c.GetFloat("total")
-
- min_price, _ := c.GetFloat("min_price")
- hosp_appr_flag, _ := c.GetInt64("hosp_appr_flag")
- lmt_used_flag, _ := c.GetInt64("lmt_used_flag")
- prescribing_number_unit := c.GetString("prescribing_number_unit")
- is_user, _ := c.GetInt64("is_user")
- sum_count, _ := c.GetInt64("sum_count")
- sum_in_count, _ := c.GetInt64("sum_in_count")
- is_pharmacy, _ := c.GetInt64("is_pharmacy")
-
- bbx01 := c.GetString("bbx01")
- bby01 := c.GetString("bby01")
- is_project, _ := c.GetInt64("is_project")
- adminInfo := c.GetAdminUserInfo()
- drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
- drugLib := &models.BaseDrugLib{
- ID: id,
- DrugName: drug_name,
- Pinyin: pinyin,
- Wubi: wubi,
- DrugAlias: drug_alias,
- DrugAliasPinyin: drug_alias_pinyin,
- DrugAliasWubi: drug_alias_wubi,
- DrugCategory: drug_category,
- DrugSpec: drug_spec,
- DrugType: drug_type,
- DrugStockLimit: drug_stock_limit,
- DrugOriginPlace: drug_origin_place,
- MedicalInsuranceLevel: medical_insurance_level,
- DrugDosageForm: drug_dosage_form,
- MaxUnit: max_unit,
- MinUnit: min_unit,
- UnitMatrixing: unit_matrixing,
- RetailPrice: retail_price,
- LastPrice: last_price,
- DrugControl: drug_control,
- Number: number,
- DrugClassify: drug_classify,
- DrugDose: drug_dose,
- DrugDoseUnit: drug_dose_unit,
- MedicalInsuranceNumber: medical_insurance_number,
- Manufacturer: manufacturer,
- PharmacologyCategory: pharmacology_category,
- StatisticsCategory: statistics_category,
- Code: code,
- IsSpecialDiseases: is_special_diseases,
- IsRecord: is_record,
- Agent: agent,
- DrugStatus: drug_status,
- LimitRemark: limit_remark,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- PrescribingNumber: prescribing_number,
- Label: label,
- Sort: sort,
- IsUseDoctorAdvice: is_use_doctor_advice,
- IsDefault: is_default,
- IsChargePredict: is_charge_predict,
- IsStatisticsWork: is_statistics_work,
- IsChargeUse: is_charge_use,
- OrgId: adminInfo.CurrentOrgId,
- Status: 1,
- Ctime: drug.Ctime,
- Mtime: time.Now().Unix(),
- DrugCode: drug_code,
- Dealer: dealer,
- PrescriptionMark: prescription_mark,
- SocialSecurityDirectoryCode: social_security_directory_code,
- RecordDate: theTime.Unix(),
- DrugRemark: drug_remark,
- DrugDay: drug_day,
- HospApprFlag: hosp_appr_flag,
- LmtUsedFlag: lmt_used_flag,
- MinNumber: min_number,
- Dose: dose,
- MinPrice: min_price,
- DoseUnit: dose_unit,
- PrescribingNumberUnit: prescribing_number_unit,
- Total: total,
- SingleDose: drug_dose,
- ProvincesCode: provinces_code,
- IsUse: is_user,
- SumCount: sum_count,
- SumInCount: sum_in_count,
- IsPharmacy: is_pharmacy,
- ZuobiaoId: bbx01,
- Bby01: bby01,
- Bbx01: bbx01,
- IsProject: is_project,
- }
- if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
-
- drugLib.DrugSpec = drugLib.Dose + drugLib.DoseUnit + "*" + string(drugLib.MinNumber) + drugLib.MinUnit + "/" + drugLib.MaxUnit
- }
-
- err := service.UpdateBaseDrugLib(drugLib)
-
- //查询是否存在
- _, errOne := service.GetDrugNameIsExist(id, adminInfo.CurrentOrgId)
- if errOne == gorm.ErrRecordNotFound {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errOne == nil {
- //修改xt_drug_name 表
- drugName := models.XtDrugName{
- DrugName: drug_name,
- }
- service.UpdatedDrugName(id, adminInfo.CurrentOrgId, &drugName)
- }
-
- //查询是否存在
- _, errTwo := service.GetStandNameIsExist(id, adminInfo.CurrentOrgId)
- if errTwo == gorm.ErrRecordNotFound {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errTwo == nil {
- //修改规格xt_stand_name表
- standName := models.XtStandName{
- DrugName: drug_name,
- DrugSpec: drug_spec,
- DrugStockLimit: drug_stock_limit,
- MinUnit: min_unit,
- }
-
- service.UpdateStandName(id, adminInfo.CurrentOrgId, &standName)
- }
-
- _, errThree := service.GetSelfMedicalIsExist(id, adminInfo.CurrentOrgId)
-
- if errThree == gorm.ErrRecordNotFound {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errThree == nil {
- //修改药品表
- medical := models.XtSelfMedical{
- DrugName: drug_name,
- DrugSpec: drug_spec,
- ExecutionFrequency: execution_frequency,
- PrescribingNumber: prescribing_number,
- DeliveryWay: delivery_way,
- SingleDose: single_dose,
- MinUnit: min_unit,
- }
-
- service.UpdateSelfMedical(id, adminInfo.CurrentOrgId, &medical)
- }
-
- _, errFour := service.GetSelfStosckIsExist(id, adminInfo.CurrentOrgId)
- if errFour == gorm.ErrRecordNotFound {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errFour == nil {
- stock := models.XtSelfStock{
- DrugSpec: drug_spec,
- DrugName: drug_name,
- MinUnit: min_unit,
- }
- service.UpdatedSelfStock(&stock, id, adminInfo.CurrentOrgId)
- }
-
- _, errFive := service.GetOutSelfOutStockIsExist(id, adminInfo.CurrentOrgId)
- if errFive == gorm.ErrRecordNotFound {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errFive == nil {
- outStock := models.XtSelfOutStock{
- DrugName: drug_name,
- DrugSpec: drug_spec,
- }
- //修改出库表
- service.UpdatedOutSelfStock(&outStock, id, adminInfo.CurrentOrgId)
- }
-
- _, errSix := service.GetDoctorAdviceIsExist(id, adminInfo.CurrentOrgId)
- if errSix == gorm.ErrRecordNotFound {
- fmt.Println("进来了吗5")
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errSix == nil {
- //查询未执行的医嘱
- advice := models.DoctorAdvice{
- AdviceName: drug_name,
- AdviceDesc: drug_spec,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- SingleDose: single_dose,
- SingleDoseUnit: min_unit,
- }
-
- service.UpdateNoExcuteDoctorAdvice(id, adminInfo.CurrentOrgId, &advice)
- }
-
- _, errSeven := service.GetDoctorAdviceTemplateIsExist(id, adminInfo.CurrentOrgId)
-
- if errSeven == gorm.ErrRecordNotFound {
- fmt.Println("进来了吗6")
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else if errSeven == nil {
- //修改医嘱模板
- template := models.DoctorAdviceTemplate{
- AdviceName: drug_name,
- AdviceDesc: drug_spec,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- SingleDose: single_dose,
- SingleDoseUnit: min_unit,
- }
- service.UpdatedDoctorAdviceTemplate(id, adminInfo.CurrentOrgId, &template)
-
- }
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- return
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- }
-
- func (c *ManagerCenterApiController) GetBaseDrugLib() {
- id, _ := c.GetInt64("id")
- adminInfo := c.GetAdminUserInfo()
- drug, err := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "drug": drug,
- })
- return
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- }
-
- func (c *ManagerCenterApiController) GetBaseDrugLibList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 10)
- is_use, _ := c.GetInt64("is_use", 0)
- is_charge, _ := c.GetInt64("is_charge", 0)
- is_inject, _ := c.GetInt64("is_inject", 0)
- manufacturer, _ := c.GetInt64("manufacturer")
- is_record, _ := c.GetInt64("is_record")
-
- keyword := c.GetString("keyword")
- adminInfo := c.GetAdminUserInfo()
-
- if page <= 0 {
- page = 1
- }
- if limit <= 0 {
- limit = 10
- }
- list, total, _ := service.GetBaseDrugLibList(adminInfo.CurrentOrgId, keyword, page, limit, is_use, is_charge, is_inject, manufacturer, is_record)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- return
- }
-
- func (c *ManagerCenterApiController) CreateMedicineInsurancePercent() {
- module, _ := c.GetInt64("module", 0)
- adminInfo := c.GetAdminUserInfo()
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- var mips []*models.MedicineInsurancePercentage
- var errs error
- record_time := time.Now().Unix()
-
- if dataBody["mip"] != nil && reflect.TypeOf(dataBody["mip"]).String() == "[]interface {}" {
- mip_map, _ := dataBody["mip"].([]interface{})
- if len(mip_map) > 0 {
- for _, item := range mip_map {
- items := item.(map[string]interface{})
-
- if items["type_id"] == nil || reflect.TypeOf(items["type_id"]).String() != "float64" {
- utils.ErrorLog("type_id")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- type_id := int64(items["type_id"].(float64))
-
- if items["medicine_insurance_type"] == nil || reflect.TypeOf(items["medicine_insurance_type"]).String() != "float64" {
- utils.ErrorLog("medicine_insurance_type")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- types := int64(items["medicine_insurance_type"].(float64))
-
- if items["percent"] == nil || reflect.TypeOf(items["percent"]).String() != "string" {
- utils.ErrorLog("percent")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- percent, _ := strconv.ParseFloat(items["percent"].(string), 64)
- //percent := items["percent"].(float64)
- mip_temp := &models.MedicineInsurancePercentage{
- TypeId: type_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- RecordTime: record_time,
- MedicineInsuranceType: types,
- UserOrgId: adminInfo.CurrentOrgId,
- Percent: percent,
- Module: module,
- GoodId: 0,
- }
- mips = append(mips, mip_temp)
-
- }
- }
-
- for _, item := range mips {
- errs = service.CreateMedicineInsurancePercentage(item)
- }
- }
-
- if errs == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "添加成功",
- })
- return
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- }
-
- func (c *ManagerCenterApiController) CreateDrugUnitSafeguard() {
-
- }
-
- // GetPatientsList 取配置信息列表
- func (c *ManagerCenterApiController) GetConfigList() {
- adminUserInfo := c.GetAdminUserInfo()
- configList, _ := service.GetDictionaryConfigList(adminUserInfo.CurrentOrgId)
- c.ServeSuccessJSON(map[string]interface{}{
- "configlist": configList,
- })
- return
-
- }
-
- func (c *ManagerCenterApiController) GetManageConfigList() {
- adminUserInfo := c.GetAdminUserInfo()
- configList, _ := service.GetConfigList(adminUserInfo.CurrentOrgId)
- fmt.Println("configListwowowowowowowowowowowowo", configList)
- c.ServeSuccessJSON(map[string]interface{}{
- "configlist": configList,
- })
- return
- }
-
- // CreateConfig 创建配置信息
- func (c *ManagerCenterApiController) CreateConfig() {
- adminUserInfo := c.GetAdminUserInfo()
-
- var dataconfig models.DictionaryDataconfig
- var resultConfig models.DictionaryConfigViewModel
- code := dictionaryConfigFormData(&dataconfig, c.Ctx.Input.RequestBody)
- if code > 0 {
- c.ServeFailJSONWithSGJErrorCode(code)
- return
- }
- // 验证关键字段的值是否重复
-
- thisConfig, _ := service.FindDictionaryConfigByTitle(dataconfig.Module, dataconfig.FieldName, adminUserInfo.CurrentOrgId)
- if thisConfig.ID > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
- return
- }
-
- fieldValue := service.GetDictionaryChildValue(dataconfig.Module, dataconfig.ParentId, adminUserInfo.CurrentOrgId)
- dataconfig.Value = fieldValue + 1
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- dataconfig.OrgId = adminUserInfo.CurrentOrgId
- dataconfig.CreateUserId = adminUserInfo.AdminUser.Id
- dataconfig.Status = 1
- dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.Remark = string(dataBody["remark"].(string))
- if dataBody["order"] != nil {
- dataconfig.Order = int64(dataBody["order"].(float64))
- } else {
- dataconfig.Order = 0
- }
- err = service.CreateDictionaryConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
- return
- } else {
- resultConfig.ID = dataconfig.ID
- resultConfig.Module = dataconfig.Module
- resultConfig.Name = dataconfig.Name
- resultConfig.OrgId = dataconfig.OrgId
- resultConfig.ParentId = dataconfig.ParentId
- resultConfig.FieldName = dataconfig.FieldName
- resultConfig.CreateUserId = dataconfig.CreateUserId
- resultConfig.Title = dataconfig.Title
- resultConfig.Content = dataconfig.Content
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "dataconfig": resultConfig,
- "msg": "ok",
- })
- return
- }
-
- func (c *ManagerCenterApiController) UpdateTemplate() {
- adminUserInfo := c.GetAdminUserInfo()
- var dataconfig models.DictionaryDataconfig
- code := dictionaryConfigFormData(&dataconfig, c.Ctx.Input.RequestBody)
- if code > 0 {
- c.ServeFailJSONWithSGJErrorCode(code)
- return
- }
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- dataconfig.OrgId = adminUserInfo.CurrentOrgId
- dataconfig.CreateUserId = adminUserInfo.AdminUser.Id
- dataconfig.Status = 1
- dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.Remark = string(dataBody["remark"].(string))
- if dataBody["order"] != nil {
- dataconfig.Order = int64(dataBody["order"].(float64))
- } else {
- dataconfig.Order = 0
- }
-
- // 验证关键字段的值是否重复
- // cur_id := int64(dataBody["id"].(float64))
- // thisConfig,_:=service.FindConfigByTitleForUpdate(dataconfig.Module, dataconfig.Title,dataconfig.OrgId,cur_id)
- // if thisConfig.ID >0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
- // return
- // }
-
- configOrgId := int64(dataBody["org_id"].(float64))
- if configOrgId == 0 {
- dataconfig.DeleteIdSystem = int64(dataBody["id"].(float64))
- err := service.CreateDictionaryConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
- return
- }
- } else {
- dataconfig.ID = int64(dataBody["id"].(float64))
- err = service.UpdateDictionaryTemplate(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "dataconfig": dataconfig,
- "msg": "ok",
- })
- return
- }
- func (c *ManagerCenterApiController) UpdateChildConfig() {
- adminUserInfo := c.GetAdminUserInfo()
- var dataconfig models.DictionaryDataconfig
- code := dictionaryConfigChildFormData(&dataconfig, c.Ctx.Input.RequestBody)
- if code > 0 {
- c.ServeFailJSONWithSGJErrorCode(code)
- return
- }
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- dataconfig.OrgId = adminUserInfo.CurrentOrgId
- dataconfig.CreateUserId = adminUserInfo.AdminUser.Id
- dataconfig.Status = 1
- dataconfig.Value = int(int64(dataBody["value"].(float64)))
- dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.Remark = string(dataBody["remark"].(string))
- dataconfig.Order = int64(dataBody["orders"].(float64))
- dataconfig.Code = string(dataBody["code"].(string))
-
- //if dataBody["orders"] != nil {
- // dataconfig.Order = int64(dataBody["orders"].(float64))
- // fmt.Println("dataconfig",dataconfig.Order)
- //} else {
- // dataconfig.Order = 0
- //}
- configOrgId := int64(dataBody["org_id"].(float64))
- // 验证关键字段的值是否重复
- // configId := int64(dataBody["id"].(float64))
- // thisConfig,_:=service.FindConfigByNameForUpdate(dataconfig.Module, dataconfig.Name,dataconfig.ParentId,dataconfig.OrgId,configId)
- // if thisConfig.ID >0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
- // return
- // }
-
- if configOrgId == 0 {
- dataconfig.DeleteIdSystem = int64(dataBody["id"].(float64))
- err := service.CreateDictionaryConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
- return
- }
- } else {
- dataconfig.ID = int64(dataBody["id"].(float64))
- err = service.UpdateDictionaryChildConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "dataconfig": dataconfig,
- "msg": "ok",
- })
- return
- }
- func (c *ManagerCenterApiController) DeleteChildConfig() {
- adminUserInfo := c.GetAdminUserInfo()
- var dataconfig models.DictionaryDataconfig
- code := dictionaryConfigChildFormData(&dataconfig, c.Ctx.Input.RequestBody)
- if code > 0 {
- c.ServeFailJSONWithSGJErrorCode(code)
- return
- }
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- dataconfig.OrgId = adminUserInfo.CurrentOrgId
- dataconfig.CreateUserId = adminUserInfo.AdminUser.Id
- dataconfig.Status = 0
- dataconfig.Value = int(int64(dataBody["value"].(float64)))
- dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.Remark = string(dataBody["remark"].(string))
- if dataBody["order"] != nil {
- dataconfig.Order = int64(dataBody["order"].(float64))
- } else {
- dataconfig.Order = 0
- }
- configOrgId := int64(dataBody["org_id"].(float64))
-
- if configOrgId == 0 {
- dataconfig.DeleteIdSystem = int64(dataBody["id"].(float64))
- err := service.CreateDictionaryConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
- return
- }
- } else {
- dataconfig.ID = int64(dataBody["id"].(float64))
- err := service.DeleteDictionaryChildConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "dataconfig": dataconfig,
- "msg": "ok",
- })
- return
- }
-
- // CreateChildConfig 创建子配置信息
- func (c *ManagerCenterApiController) CreateChildConfig() {
- adminUserInfo := c.GetAdminUserInfo()
-
- var dataconfig models.DictionaryDataconfig
- code := dictionaryConfigChildFormData(&dataconfig, c.Ctx.Input.RequestBody)
- if code > 0 {
- c.ServeFailJSONWithSGJErrorCode(code)
- return
- }
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- dataconfig.OrgId = adminUserInfo.CurrentOrgId
- dataconfig.CreateUserId = adminUserInfo.AdminUser.Id
- dataconfig.Status = 1
- dataconfig.CreatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.UpdatedTime = time.Now().Format("2006-01-02 15:04:05")
- dataconfig.Remark = string(dataBody["remark"].(string))
- dataconfig.Code = string(dataBody["code"].(string))
- fmt.Println("3444444444", dataconfig.Code)
- if dataBody["order"] != nil {
- dataconfig.Order = int64(dataBody["order"].(float64))
- } else {
- dataconfig.Order = 0
- }
-
- // 验证关键字段的值是否重复
- // thisConfig,_:=service.FindConfigByName(dataconfig.Module, dataconfig.Name,dataconfig.ParentId,dataconfig.OrgId)
- // if thisConfig.ID >0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
- // return
- // }
-
- fieldValue := service.GetDictionaryChildValue(dataconfig.Module, dataconfig.ParentId, dataconfig.OrgId)
- dataconfig.Value = fieldValue + 1
-
- err = service.CreateDictionaryConfig(&dataconfig)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
- return
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "dataconfig": dataconfig,
- "msg": "ok",
- })
- return
- }
-
- func dictionaryConfigFormData(dataconfig *models.DictionaryDataconfig, data []byte) (code int) {
- configBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(data, &configBody)
- utils.InfoLog(string(data))
- if err != nil {
- utils.ErrorLog(err.Error())
- code = enums.ErrorCodeParamWrong
- return
- }
- if configBody["module"] == nil || reflect.TypeOf(configBody["module"]).String() != "string" {
- utils.ErrorLog("module")
- code = enums.ErrorCodeParamWrong
- return
- }
- module, _ := configBody["module"].(string)
- if len(module) == 0 {
- utils.ErrorLog("len(module) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Module = module
-
- if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" {
- if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
- utils.ErrorLog("title")
- code = enums.ErrorCodeParamWrong
- return
- }
- title, _ := configBody["title"].(string)
- if len(title) == 0 {
- utils.ErrorLog("len(title) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Title = title
-
- if configBody["content"] == nil || reflect.TypeOf(configBody["content"]).String() != "string" {
- utils.ErrorLog("content")
- code = enums.ErrorCodeParamWrong
- return
- }
- content, _ := configBody["content"].(string)
- if len(content) == 0 {
- utils.ErrorLog("len(content) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Content = content
- } else {
- if configBody["name"] == nil || reflect.TypeOf(configBody["name"]).String() != "string" {
- utils.ErrorLog("name")
- code = enums.ErrorCodeParamWrong
- return
- }
- name, _ := configBody["name"].(string)
- if len(name) == 0 {
- utils.ErrorLog("len(name) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Name = name
-
- if configBody["field_name"] == nil || reflect.TypeOf(configBody["field_name"]).String() != "string" {
- utils.ErrorLog("field_name")
- code = enums.ErrorCodeParamWrong
- return
- }
- field_name, _ := configBody["field_name"].(string)
- if len(field_name) == 0 {
- utils.ErrorLog("len(field_name) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.FieldName = field_name
- }
- return
- }
-
- func dictionaryConfigChildFormData(dataconfig *models.DictionaryDataconfig, data []byte) (code int) {
- configBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(data, &configBody)
- utils.InfoLog(string(data))
- if err != nil {
- utils.ErrorLog(err.Error())
- code = enums.ErrorCodeParamWrong
- return
- }
-
- if configBody["module"] == nil || reflect.TypeOf(configBody["module"]).String() != "string" {
- utils.ErrorLog("module")
- code = enums.ErrorCodeParamWrong
- return
- }
- module, _ := configBody["module"].(string)
- if len(module) == 0 {
- utils.ErrorLog("len(module) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Module = module
-
- if module == "education" || module == "summary" {
- if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
- utils.ErrorLog("title")
- code = enums.ErrorCodeParamWrong
- return
- }
- title, _ := configBody["title"].(string)
- if len(title) == 0 {
- utils.ErrorLog("len(title) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Title = title
-
- if configBody["content"] == nil || reflect.TypeOf(configBody["content"]).String() != "string" {
- utils.ErrorLog("content")
- code = enums.ErrorCodeParamWrong
- return
- }
- content, _ := configBody["content"].(string)
- if len(content) == 0 {
- utils.ErrorLog("len(content) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Content = content
-
- } else {
- if configBody["parent_id"] == nil || reflect.TypeOf(configBody["parent_id"]).String() != "float64" {
- utils.ErrorLog("module")
- code = enums.ErrorCodeParamWrong
- return
- }
- parent_id := int64(configBody["parent_id"].(float64))
- if parent_id <= 0 {
- utils.ErrorLog("parent_id <= 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.ParentId = parent_id
-
- if configBody["name"] == nil || reflect.TypeOf(configBody["name"]).String() != "string" {
- utils.ErrorLog("name")
- code = enums.ErrorCodeParamWrong
- return
- }
- name, _ := configBody["name"].(string)
- if len(name) == 0 {
- utils.ErrorLog("len(name) == 0")
- code = enums.ErrorCodeParamWrong
- return
- }
- dataconfig.Name = name
-
- }
- return
- }
-
- func (c *ManagerCenterApiController) CreateDealer() {
- dealer_name := c.GetString("dealer_name")
- contact := c.GetString("contact")
- contact_phone := c.GetString("contact_phone")
- platform_number := c.GetString("platform_number")
- email := c.GetString("email")
- contact_address := c.GetString("contact_address")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- if len(dealer_name) <= 0 {
- utils.ErrorLog("len(dealer_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
-
- total := service.FindAllDealerTotal(adminUserInfo.CurrentOrgId)
- totalStr := strconv.FormatInt(total+1, 10)
- code := "1000" + totalStr
- dealer := models.Dealer{
- DealerName: dealer_name,
- Contact: contact,
- ContactPhone: contact_phone,
- ContactAddress: contact_address,
- DealerCode: code,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- Creater: adminUserInfo.AdminUser.Id,
- Email: email,
- PlatformNumber: platform_number,
- OrgId: adminUserInfo.CurrentOrgId,
- Status: 1,
- PinYin: pinyin,
- WuBi: wubi,
- }
-
- err, dealers := service.AddSigleDealer(&dealer)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "dealer": dealers,
- })
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
-
- }
-
- }
- func (c *ManagerCenterApiController) ModifyDealer() {
- id, _ := c.GetInt64("id", 0)
- dealer_name := c.GetString("dealer_name")
- contact := c.GetString("contact")
- contact_phone := c.GetString("contact_phone")
- platform_number := c.GetString("platform_number")
- dealer_code := c.GetString("dealer_code")
- email := c.GetString("email")
- contact_address := c.GetString("contact_address")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- if id <= 0 {
- utils.ErrorLog("id == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(dealer_name) <= 0 {
- utils.ErrorLog("len(dealer_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- dealer := models.Dealer{
- ID: id,
- DealerName: dealer_name,
- Contact: contact,
- ContactPhone: contact_phone,
- ContactAddress: contact_address,
- Mtime: time.Now().Unix(),
- DealerCode: dealer_code,
- Remark: remark,
- Creater: adminUserInfo.AdminUser.Id,
- Email: email,
- PlatformNumber: platform_number,
- Modifier: adminUserInfo.AdminUser.Id,
- OrgId: adminUserInfo.CurrentOrgId,
- Status: 1,
- PinYin: pinyin,
- WuBi: wubi,
- }
-
- err := service.ModifyDealer(&dealer)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "dealer": dealer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetDealersList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 7)
- key, _ := c.GetInt64("key", 0)
- adminUserInfo := c.GetAdminUserInfo()
- deales, total, err := service.FindAllDealerList(adminUserInfo.CurrentOrgId, page, limit, key)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "dealer": deales,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) DeleteDealer() {
- id, _ := c.GetInt64("id", 0)
- total, _ := service.FindStockInByDealerId(id)
- if total > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteDealerWrong)
- return
- }
- err := service.DeleteDealerById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetDealer() {
- id, _ := c.GetInt64("id", 0)
- dealer, err := service.FindDealerById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "dealer": dealer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) CreateManufacturer() {
- manufacturer_name := c.GetString("manufacturer_name")
- contact := c.GetString("contact")
- contact_phone := c.GetString("contact_phone")
- platform_number := c.GetString("platform_number")
- email := c.GetString("email")
- contact_address := c.GetString("contact_address")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- if len(manufacturer_name) <= 0 {
- utils.ErrorLog("len(manufacturer_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- total := service.FindManufacturerTotal(adminUserInfo.CurrentOrgId)
- totalStr := strconv.FormatInt(total+1, 10)
- code := "2000" + totalStr
- manufacturer := models.Manufacturer{
- ManufacturerName: manufacturer_name,
- Contact: contact,
- ContactPhone: contact_phone,
- ContactAddress: contact_address,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- Creater: adminUserInfo.AdminUser.Id,
- Email: email,
- PlatformNumber: platform_number,
- OrgId: adminUserInfo.CurrentOrgId,
- Status: 1,
- ManufacturerCode: code,
- PinYin: pinyin,
- WuBi: wubi,
- }
-
- err, manufacturers := service.AddSigleManufacturer(&manufacturer)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "manufacturer": manufacturers,
- })
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
- func (c *ManagerCenterApiController) ModifyManufacturer() {
-
- id, _ := c.GetInt64("id", 0)
- manufacturer_name := c.GetString("manufacturer_name")
- contact := c.GetString("contact")
- contact_phone := c.GetString("contact_phone")
- platform_number := c.GetString("platform_number")
- email := c.GetString("email")
- contact_address := c.GetString("contact_address")
- remark := c.GetString("remark")
- manufacturer_code := c.GetString("manufacturer_code")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- if id <= 0 {
- utils.ErrorLog("id == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(manufacturer_name) <= 0 {
- utils.ErrorLog("len(manufacturer_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- manufacturer := models.Manufacturer{
- ID: id,
- ManufacturerName: manufacturer_name,
- Contact: contact,
- ContactPhone: contact_phone,
- ContactAddress: contact_address,
- Mtime: time.Now().Unix(),
- Remark: remark,
- Creater: adminUserInfo.AdminUser.Id,
- Email: email,
- PlatformNumber: platform_number,
- Modifier: adminUserInfo.AdminUser.Id,
- OrgId: adminUserInfo.CurrentOrgId,
- ManufacturerCode: manufacturer_code,
- Status: 1,
- PinYin: pinyin,
- WuBi: wubi,
- }
-
- err := service.ModifyManufacturer(&manufacturer)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "manufacturer": manufacturer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
- func (c *ManagerCenterApiController) GetManufacturerList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 10)
- key, _ := c.GetInt64("key", 0)
- adminUserInfo := c.GetAdminUserInfo()
- manufacturer, total, err := service.FindAllManufacturerList(adminUserInfo.CurrentOrgId, page, limit, key)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "manufacturer": manufacturer,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) DeleteManufacturer() {
- id, _ := c.GetInt64("id", 0)
- total, _ := service.FindStockInByManufacturerId(id)
- if total > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteManufacturerWrong)
- return
- }
-
- err := service.DeleteManufacturerById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetManufacturer() {
- id, _ := c.GetInt64("id", 0)
- manufacturer, err := service.FindManufacturerById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "manufacturer": manufacturer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
- func (c *ManagerCenterApiController) GetAllDealer() {
- adminUserInfo := c.GetAdminUserInfo()
- dealer, err := service.FindAllDealer(adminUserInfo.CurrentOrgId)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "dealer": dealer,
- })
- } else {
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetAllManufacturer() {
- adminUserInfo := c.GetAdminUserInfo()
- manufacturer, err := service.FindAllManufacturer(adminUserInfo.CurrentOrgId)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "manufacturer": manufacturer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
-
- func (c *ManagerCenterApiController) CreateGoodInfo() {
- good_id, _ := c.GetInt64("good_id", 0)
- specification_name := c.GetString("specification_name")
- register_number := c.GetString("register_number")
-
- good_unit, _ := c.GetInt64("good_unit", -1)
- buy_price, _ := c.GetFloat("buy_price", 0)
- sell_price, _ := c.GetFloat("sell_price", 0)
- remark := c.GetString("remark")
- manufacturer, _ := c.GetInt64("manufacturer", 0)
- dealer, _ := c.GetInt64("dealer", 0)
- expiry_date_warn_day_count, _ := c.GetInt64("expiry_date_warn_day_count", 0)
- stock_warn_count, _ := c.GetInt64("stock_warn_count", 0)
- is_reuse, _ := c.GetInt64("is_reuse", 0)
-
- good_name := c.GetString("good_name")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- good_kind, _ := c.GetInt64("good_kind", 0)
- medical_insurance_level, _ := c.GetInt64("medical_insurance_level", 0)
- retail_price, _ := c.GetFloat("retail_price", 0)
- fmt.Println(retail_price)
- medical_insurance_number := c.GetString("medical_insurance_number")
- provinces_code := c.GetString("provinces_code")
-
- is_special_diseases, _ := c.GetInt64("is_special_diseases", 0)
- is_record, _ := c.GetInt64("is_record")
- statistics_category, _ := c.GetInt64("statistics_category")
- good_status := c.GetString("good_status")
-
- default_count, _ := c.GetInt64("default_count")
- sign, _ := c.GetInt64("sign")
- is_default, _ := c.GetInt64("is_default")
- is_charge_use, _ := c.GetInt64("is_charge_use")
- is_charge_predict, _ := c.GetInt64("is_charge_predict")
- is_statistics_work, _ := c.GetInt64("is_statistics_work")
- sort, _ := c.GetInt64("sort")
- is_doctor_use, _ := c.GetInt64("is_doctor_use")
- agent := c.GetString("agent")
- good_number := c.GetString("good_number")
-
- social_security_directory_code := c.GetString("social_security_directory_code")
- production_type := c.GetString("production_type")
- special_medical := c.GetString("special_medical")
- min_number, _ := c.GetInt64("min_number")
- packing_unit := c.GetString("packing_unit")
- packing_price, _ := c.GetFloat("packing_price")
- min_unit := c.GetString("min_unit")
- default_count_unit := c.GetString("default_count_unit")
- is_user, _ := c.GetInt64("is_user")
- number := c.GetString("number")
- is_warehouse, _ := c.GetInt64("is_warehouse")
- bbx01 := c.GetString("bbx01")
- bby01 := c.GetString("bby01")
-
- adminUserInfo := c.GetAdminUserInfo()
-
- totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
- if totals > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGoodInfoNameExistError)
- return
- }
-
- total := service.FindAllGoodInfoTotal(adminUserInfo.CurrentOrgId)
- code := strconv.FormatInt(total+1, 10)
- code = "24000000" + code
-
- goodInfo := models.GoodInfo{
- GoodCode: code,
- SpecificationName: specification_name,
- GoodTypeId: good_id,
- GoodUnit: good_unit,
- BuyPrice: buy_price,
- SellPrice: sell_price,
- Remark: remark,
- Ctime: time.Now().Unix(),
- Manufacturer: manufacturer,
- Dealer: dealer,
- ExpiryDateWarnDayCount: expiry_date_warn_day_count,
- StockWarnCount: stock_warn_count,
- IsReuse: is_reuse,
- Status: 1,
- OrgId: adminUserInfo.CurrentOrgId,
- Creater: adminUserInfo.AdminUser.Id,
- GoodName: good_name,
- Pinyin: pinyin,
- Wubi: wubi,
- GoodKind: good_kind,
- MedicalInsuranceNumber: medical_insurance_number,
- IsSpecialDiseases: is_special_diseases,
- IsRecord: is_record,
- StatisticsCategory: statistics_category,
- GoodStatus: good_status,
- DefaultCount: default_count,
- Sign: sign,
- IsDefault: is_default,
- IsChargeUse: is_charge_use,
- IsChargePredict: is_charge_predict,
- IsStatisticsWork: is_statistics_work,
- Sort: sort,
- IsDoctorUse: is_doctor_use,
- Agent: agent,
- GoodNumber: good_number,
- MedicalInsuranceLevel: medical_insurance_level,
- RetailPrice: packing_price,
- SocialSecurityDirectoryCode: social_security_directory_code,
- ProductionType: production_type,
- SpecialMedical: special_medical,
- MinNumber: min_number,
- PackingUnit: packing_unit,
- PackingPrice: packing_price,
- DefaultCountUnit: default_count_unit,
- MinUnit: min_unit,
- RegisterNumber: register_number,
- ProvincesCode: provinces_code,
- IsUser: is_user,
- Number: number,
- IsWarehouse: is_warehouse,
- Bbx01: bbx01,
- Bby01: bby01,
- ZuobiaoId: bbx01,
- }
- err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "goodInfo": goodInfos,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
-
- func (c *ManagerCenterApiController) ModifyGoodInfo() {
- id, _ := c.GetInt64("id", 0)
- good_id, _ := c.GetInt64("good_id", 0)
- specification_name := c.GetString("specification_name")
- good_unit, _ := c.GetInt64("good_unit", -1)
- buy_price, _ := c.GetFloat("buy_price", 0)
- sell_price, _ := c.GetFloat("sell_price", 0)
- remark := c.GetString("remark")
- manufacturer, _ := c.GetInt64("manufacturer", 0)
- dealer, _ := c.GetInt64("dealer", 0)
- expiry_date_warn_day_count, _ := c.GetInt64("expiry_date_warn_day_count", 0)
- stock_warn_count, _ := c.GetInt64("stock_warn_count", 0)
- is_reuse, _ := c.GetInt64("is_reuse", 0)
- code := c.GetString("good_code")
- provinces_code := c.GetString("provinces_code")
-
- good_name := c.GetString("good_name")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- good_kind, _ := c.GetInt64("good_kind", 0)
- medical_insurance_level, _ := c.GetInt64("medical_insurance_level", 0)
- retail_price, _ := c.GetFloat("retail_price", 0)
- fmt.Println(retail_price)
- medical_insurance_number := c.GetString("medical_insurance_number")
- //provinces_code := c.GetString("provinces_code")
-
- is_special_diseases, _ := c.GetInt64("is_special_diseases", 0)
- is_record, _ := c.GetInt64("is_record")
- statistics_category, _ := c.GetInt64("statistics_category")
- good_status := c.GetString("good_status")
-
- default_count, _ := c.GetInt64("default_count")
- sign, _ := c.GetInt64("sign")
- is_default, _ := c.GetInt64("is_default")
- is_charge_use, _ := c.GetInt64("is_charge_use")
- is_charge_predict, _ := c.GetInt64("is_charge_predict")
- is_statistics_work, _ := c.GetInt64("is_statistics_work")
- sort, _ := c.GetInt64("sort")
- is_doctor_use, _ := c.GetInt64("is_doctor_use")
- agent := c.GetString("agent")
- good_number := c.GetString("good_number")
-
- social_security_directory_code := c.GetString("social_security_directory_code")
- production_type := c.GetString("production_type")
- special_medical := c.GetString("special_medical")
-
- min_number, _ := c.GetInt64("min_number")
- packing_unit := c.GetString("packing_unit")
- packing_price, _ := c.GetFloat("packing_price")
- default_count_unit := c.GetString("default_count_unit")
- min_unit := c.GetString("min_unit")
- total, _ := c.GetFloat("total")
- register_number := c.GetString("register_number")
- is_user, _ := c.GetInt64("is_user")
- number := c.GetString("number")
- is_warehouse, _ := c.GetInt64("is_warehouse")
- bbx01 := c.GetString("bbx01")
- bby01 := c.GetString("bby01")
-
- adminUserInfo := c.GetAdminUserInfo()
-
- goodInfo := models.GoodInfo{
- ID: id,
- GoodCode: code,
- SpecificationName: specification_name,
- GoodTypeId: good_id,
- GoodUnit: good_unit,
- BuyPrice: buy_price,
- SellPrice: sell_price,
- Remark: remark,
- Mtime: time.Now().Unix(),
- Manufacturer: manufacturer,
- Dealer: dealer,
- ExpiryDateWarnDayCount: expiry_date_warn_day_count,
- StockWarnCount: stock_warn_count,
- IsReuse: is_reuse,
- Status: 1,
- OrgId: adminUserInfo.CurrentOrgId,
- Modifier: adminUserInfo.AdminUser.Id,
- GoodName: good_name,
- Pinyin: pinyin,
- Wubi: wubi,
- GoodKind: good_kind,
- MedicalInsuranceNumber: medical_insurance_number,
- ProvincesCode: provinces_code,
- IsSpecialDiseases: is_special_diseases,
- IsRecord: is_record,
- StatisticsCategory: statistics_category,
- GoodStatus: good_status,
- DefaultCount: default_count,
- Sign: sign,
- IsDefault: is_default,
- IsChargeUse: is_charge_use,
- IsChargePredict: is_charge_predict,
- IsStatisticsWork: is_statistics_work,
- Sort: sort,
- IsDoctorUse: is_doctor_use,
- Agent: agent,
- GoodNumber: good_number,
- MedicalInsuranceLevel: medical_insurance_level,
- RetailPrice: packing_price,
- SpecialMedical: special_medical,
- SocialSecurityDirectoryCode: social_security_directory_code,
- ProductionType: production_type,
- MinNumber: min_number,
- PackingUnit: packing_unit,
- PackingPrice: packing_price,
- DefaultCountUnit: default_count_unit,
- MinUnit: min_unit,
- Total: total,
- RegisterNumber: register_number,
- IsUser: is_user,
- Number: number,
- IsWarehouse: is_warehouse,
- Bbx01: bbx01,
- Bby01: bby01,
- ZuobiaoId: bbx01,
- }
-
- totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)
- if totals > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGoodInfoNameExistError)
- return
- }
- err, goodInfos := service.ModifyGoodInfo(&goodInfo)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "goodInfo": goodInfos,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
- func (c *ManagerCenterApiController) GetGoodInfoList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 7)
- keyword := c.GetString("keyword")
- is_use, _ := c.GetInt64("is_use")
- is_charge, _ := c.GetInt64("is_charge")
- good_kind, _ := c.GetInt64("good_kind")
- is_mark, _ := c.GetInt64("is_mark")
- manufacturer, _ := c.GetInt64("manufacturer")
- is_type, _ := c.GetInt64("is_type")
- adminUserInfo := c.GetAdminUserInfo()
- goodInfos, total, err := service.FindGoodInfoList(adminUserInfo.CurrentOrgId, page, limit, keyword, is_use, is_charge, good_kind, is_mark, manufacturer, is_type)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": goodInfos,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
- func (c *ManagerCenterApiController) DeleteGoodInfo() {
- id, _ := c.GetInt64("id", 0)
- adminUserInfo := c.GetAdminUserInfo()
-
- total, _ := service.FindWarehouseInfoTotalByGoodId(id)
- total2, _ := service.FindWarehouseOutInfoTotalByGoodId(id)
-
- if total > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteGoodInfoFail)
- return
- }
- if total2 > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteGoodInfoFail)
- return
- }
-
- err := service.DeleteGoodInfoById(id, adminUserInfo.AdminUser.Id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
-
- }
-
- func (c *ManagerCenterApiController) GetGoodInfoByGoodId() {
- id, _ := c.GetInt64("id", 0)
- goodInfo, err := service.FindGoodInfoByGoodId(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": goodInfo,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetGoodInfoById() {
- id, _ := c.GetInt64("id", 0)
- goodInfo, err := service.FindGoodInfoById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "goodInfo": goodInfo,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetMedicineInsurancePercent() {
- adminUser := c.GetAdminUserInfo()
- type_id, _ := c.GetInt64("type_id", 0)
- module, _ := c.GetInt64("module", 0)
-
- mip, err := service.GetLastMedicineInsurance(adminUser.CurrentOrgId, type_id, module)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "mip": mip,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) CreateMZSick() {
- class_name := c.GetString("class_name")
- content_code := c.GetString("content_code")
- country_code := c.GetString("country_code")
- country_content_name := c.GetString("country_content_name")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- if len(class_name) <= 0 {
- utils.ErrorLog("len(class_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(content_code) <= 0 {
- utils.ErrorLog("len(content_code) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
-
- dealer := models.OutpatientServiceSick{
- ClassName: class_name,
- ContentCode: content_code,
- CountryCode: country_code,
- CountryContentName: country_content_name,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- UserOrgId: adminUserInfo.CurrentOrgId,
- Status: 1,
- Pinyin: pinyin,
- Wubi: wubi,
- }
-
- err, dealers := service.AddSigleMZSick(&dealer)
- if err == nil {
-
- redis := service.RedisClient()
- defer redis.Close()
- sick_keys := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + "_sick"
- redis.Set(sick_keys, "", time.Second*60*60*18)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": dealers,
- })
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
-
- }
-
- }
- func (c *ManagerCenterApiController) ModifyMZSick() {
- id, _ := c.GetInt64("id", 0)
-
- class_name := c.GetString("class_name")
- content_code := c.GetString("content_code")
- country_code := c.GetString("country_code")
- country_content_name := c.GetString("country_content_name")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- if id <= 0 {
- utils.ErrorLog("id == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(class_name) <= 0 {
- utils.ErrorLog("len(class_name) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(content_code) <= 0 {
- utils.ErrorLog("len(content_code) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- dealer := models.OutpatientServiceSick{
- ID: id,
- ClassName: class_name,
- ContentCode: content_code,
- CountryCode: country_code,
- CountryContentName: country_content_name,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- UserOrgId: adminUserInfo.CurrentOrgId,
- Pinyin: pinyin,
- Wubi: wubi,
- Status: 1,
- }
-
- err := service.ModifyMZSick(&dealer)
-
- if err == nil {
-
- redis := service.RedisClient()
- defer redis.Close()
- sick_keys := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + "_sick"
- redis.Set(sick_keys, "", time.Second*60*60*18)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": dealer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetMZSickList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 7)
- adminUserInfo := c.GetAdminUserInfo()
- mzSick, total, err := service.FindAllMZSickList(adminUserInfo.CurrentOrgId, page, limit)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": mzSick,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) DeleteMZSick() {
- id, _ := c.GetInt64("id", 0)
- err := service.DeleteMZSickById(id)
- if err == nil {
-
- redis := service.RedisClient()
- defer redis.Close()
- sick_keys := strconv.FormatInt(c.GetAdminUserInfo().CurrentOrgId, 10) + "_sick"
- redis.Set(sick_keys, "", time.Second*60*60*18)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetMZSick() {
- id, _ := c.GetInt64("id", 0)
- mzSick, err := service.FindMZSickById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": mzSick,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) DeleteBaseDrugById() {
-
- id, _ := c.GetInt64("id")
- //查询入库单
- _, errcode := service.GetDrugWareoutInfo(id)
- if errcode == gorm.ErrRecordNotFound {
- //查询出库单
- _, errcodes := service.GetDrugWareOutById(id)
- if errcodes == gorm.ErrRecordNotFound {
- //删除
- service.DeleteBaseDrugById(id)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- c.ServeSuccessJSON(returnData)
- return
- } else if errcodes == nil {
- c.ServeFailJsonSend(enums.ErrorCodeDataException, "已出库")
- return
- }
- } else if errcode == nil {
- c.ServeFailJsonSend(enums.ErrorCodeDataException, "已入库")
- return
- }
- }
-
- func (c *ManagerCenterApiController) CreateAddition() {
- name := c.GetString("name")
- code := c.GetString("code")
- //price, _ := c.GetFloat("price")
-
- price := c.GetString("price")
- price_float, _ := strconv.ParseFloat(price, 64)
-
- if len(name) <= 0 {
- utils.ErrorLog("len(name) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- //if len(code) <= 0 {
- // utils.ErrorLog("len(code) == 0")
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- //}
-
- adminUserInfo := c.GetAdminUserInfo()
-
- addition := models.XtHisAddtionConfig{
- Name: name,
- Code: code,
- Status: 1,
- Price: price_float,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- UserOrgId: adminUserInfo.CurrentOrgId,
- }
-
- err, additions := service.AddSigleAddition(&addition)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "addition": additions,
- })
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
-
- }
-
- }
- func (c *ManagerCenterApiController) ModifyAddition() {
- id, _ := c.GetInt64("id", 0)
-
- name := c.GetString("name")
- code := c.GetString("code")
- price, _ := c.GetFloat("price")
-
- if id <= 0 {
- utils.ErrorLog("id == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(name) <= 0 {
- utils.ErrorLog("len(class_name) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- //if len(code) <= 0 {
- // utils.ErrorLog("len(content_code) == 0")
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- //}
-
- adminUserInfo := c.GetAdminUserInfo()
- addition := models.XtHisAddtionConfig{
- ID: id,
- Name: name,
- Code: code,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- UserOrgId: adminUserInfo.CurrentOrgId,
- Price: price,
- Status: 1,
- }
-
- err := service.ModifyAddition(&addition)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "addition": addition,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetAdditionList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 7)
- adminUserInfo := c.GetAdminUserInfo()
- addition, total, err := service.FindAllAdditionList(adminUserInfo.CurrentOrgId, page, limit)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "addition": addition,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) DeleteAddition() {
- id, _ := c.GetInt64("id", 0)
-
- err := service.DeleteAdditionById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetAddition() {
- id, _ := c.GetInt64("id", 0)
- addition, err := service.FindAdditionById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "addition": addition,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) CreateDiagnose() {
- class_name := c.GetString("class_name")
- content_code := c.GetString("content_code")
- country_code := c.GetString("country_code")
- country_content_name := c.GetString("country_content_name")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
-
- sort, _ := c.GetInt64("sort")
- fmt.Println("sort-------------------", sort)
- if len(class_name) <= 0 {
- utils.ErrorLog("len(class_name) == 0")
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(content_code) <= 0 {
- utils.ErrorLog("len(content_code) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
-
- dealer := models.HisXtDiagnoseConfig{
- ClassName: class_name,
- ContentCode: content_code,
- CountryCode: country_code,
- CountryContentName: country_content_name,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- UserOrgId: adminUserInfo.CurrentOrgId,
- Status: 1,
- Pinyin: pinyin,
- Wubi: wubi,
- Sort: sort,
- }
-
- err, dealers := service.AddSigleDiagnose(&dealer)
- if err == nil {
- redis := service.RedisClient()
- defer redis.Close()
- diagnose_keys := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + "_diagnose"
- redis.Set(diagnose_keys, "", time.Second*60*60*18)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": dealers,
- })
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
-
- }
-
- }
- func (c *ManagerCenterApiController) ModifyDiagnose() {
- id, _ := c.GetInt64("id", 0)
-
- class_name := c.GetString("class_name")
- content_code := c.GetString("content_code")
- country_code := c.GetString("country_code")
- country_content_name := c.GetString("country_content_name")
- remark := c.GetString("remark")
- pinyin := c.GetString("pinyin")
- wubi := c.GetString("wubi")
- sort, _ := c.GetInt64("sort")
- if id <= 0 {
- utils.ErrorLog("id == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(class_name) <= 0 {
- utils.ErrorLog("len(class_name) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(content_code) <= 0 {
- utils.ErrorLog("len(content_code) == 0")
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- dealer := models.HisXtDiagnoseConfig{
- ID: id,
- ClassName: class_name,
- ContentCode: content_code,
- CountryCode: country_code,
- CountryContentName: country_content_name,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Remark: remark,
- UserOrgId: adminUserInfo.CurrentOrgId,
- Pinyin: pinyin,
- Wubi: wubi,
- Status: 1,
- Sort: sort,
- }
-
- err := service.ModifyDiagnose(&dealer)
-
- if err == nil {
- redis := service.RedisClient()
- defer redis.Close()
- diagnose_keys := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + "_diagnose"
- redis.Set(diagnose_keys, "", time.Second*60*60*18)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": dealer,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetDiagnoseList() {
- page, _ := c.GetInt64("page", 1)
- limit, _ := c.GetInt64("limit", 7)
- adminUserInfo := c.GetAdminUserInfo()
- mzSick, total, err := service.FindAllDiagnoseList(adminUserInfo.CurrentOrgId, page, limit)
- if err == nil {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": mzSick,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) DeleteDiagnose() {
- id, _ := c.GetInt64("id", 0)
- err := service.DeleteDiagnoseById(id)
- if err == nil {
- redis := service.RedisClient()
- defer redis.Close()
- diagnose_keys := strconv.FormatInt(c.GetAdminUserInfo().CurrentOrgId, 10) + "_diagnose"
- redis.Set(diagnose_keys, "", time.Second*60*60*18)
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
- func (c *ManagerCenterApiController) GetDiagnose() {
- id, _ := c.GetInt64("id", 0)
- mzSick, err := service.FindDiagnoseById(id)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "sick": mzSick,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetAllDrugList() {
-
- orgId := c.GetAdminUserInfo().CurrentOrgId
-
- list, err := service.GetAllDrugList(orgId)
- manufacturerList, _ := service.GetAllManufacturerList(orgId)
- dealerList, _ := service.GetAllDealerList(orgId)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "manufacturerList": manufacturerList,
- "dealerList": dealerList,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetSearchDrugList() {
- keyword := c.GetString("keyword")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- storehouse_id, _ := c.GetInt64("storehouse_id")
- list, err := service.GetSearchDrugListSix(keyword, orgId, storehouse_id)
-
- manufacturerList, _ := service.GetAllManufacturerList(orgId)
- dealerList, _ := service.GetAllDealerList(orgId)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "manufacturerList": manufacturerList,
- "dealerList": dealerList,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) AddPatientDiagnos() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
-
- class_name := dataBody["class_name"].(string)
- sort := int64(dataBody["sort"].(float64))
-
- orgId := c.GetAdminUserInfo().CurrentOrgId
- diagnose := models.XtPatientDiagnose{
- ClassName: class_name,
- Sort: sort,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- }
-
- err = service.CreatePatientDiagnose(diagnose)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "diagnose": diagnose,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetPatientDiagnose() {
-
- limit, _ := c.GetInt64("limit")
- page, _ := c.GetInt64("page")
- orgId := c.GetAdminUserInfo().CurrentOrgId
-
- list, total, err := service.GetPatientDiagnose(limit, page, orgId)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) GetPatientDiagnoseDetail() {
-
- id, _ := c.GetInt64("id")
-
- detail, err := service.GetPatientDiagnoseDetail(id)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "detail": detail,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) UpdatePatientCase() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
-
- class_name := dataBody["class_name"].(string)
- sort := int64(dataBody["sort"].(float64))
-
- id := int64(dataBody["id"].(float64))
-
- err = service.UpdatePatientCase(class_name, sort, id)
-
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "msg",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (c *ManagerCenterApiController) DeletePatientDiagnose() {
-
- id, _ := c.GetInt64("id")
-
- service.DeletePatientDiagnose(id)
-
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- c.ServeSuccessJSON(returnData)
- return
- }
|