public_api_controller.go 69KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559
  1. package controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/models"
  5. "XT_New/service"
  6. "encoding/json"
  7. "fmt"
  8. "os"
  9. "path"
  10. "runtime"
  11. "strconv"
  12. "strings"
  13. "time"
  14. "github.com/astaxie/beego"
  15. )
  16. type PublicApiController struct {
  17. BaseAPIController
  18. }
  19. //var f_a *os.File
  20. //
  21. //
  22. // func init() {
  23. // org_id, _ := beego.AppConfig.Int64("org_id")
  24. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  25. // Mkdir(miConfig.OrgName+"日志")
  26. // month := time.Unix(1557042972, 0).Format("1")
  27. // year := time.Now().Format("2006")
  28. // month = time.Now().Format("01")
  29. // day := time.Now().Format("02")
  30. // file := strconv.FormatInt( org_id, 10) + "_"+ year + month + day + "_log"
  31. // file_name := file + ".txt"
  32. // file_path := miConfig.OrgName+"日志" + "/" + file_name
  33. // exist, _ := PathExists(file_path)
  34. // if exist {//存在
  35. // f_a, _ := os.OpenFile(file_path,os.O_WRONLY,0644)
  36. // content := "新的日志内容吧"
  37. // n, _ := f_a.Seek(0,2)
  38. // f_a.WriteAt([]byte(content),n)
  39. //
  40. // } else { //不存在
  41. // fmt.Println("文件不存在,创建文件")
  42. // f, err := os.Create(miConfig.OrgName+"日志" + "/" + file_name)
  43. // defer f.Close()
  44. // if err !=nil {
  45. // } else {
  46. // _,err=f.Write([]byte("记录日志"))
  47. // }
  48. // }
  49. //
  50. // }
  51. func PublicApiRegistRouters() {
  52. beego.Router("/api/public/getadviceconfig", &PublicApiController{}, "Get:GetDoctorAdviceConfig")
  53. beego.Router("/api/public/servertime", &PublicApiController{}, "Get:GetServerTime")
  54. beego.Router("/api/app/release", &PublicApiController{}, "Get:AppRelease")
  55. beego.Router("/api/get", &PublicApiController{}, "Get:GetJson")
  56. beego.Router("/api/public/handledata", &PublicApiController{}, "get:HandleData")
  57. beego.Router("/api/public/handlestockdata", &PublicApiController{}, "get:HandleStockData")
  58. beego.Router("/api/public/handlecomdata", &PublicApiController{}, "get:HandleComData")
  59. beego.Router("/hello", &PublicApiController{}, "get:HandleComData")
  60. beego.Router("/handel", &PublicApiController{}, "get:HandleHIS")
  61. beego.Router("/groupno", &PublicApiController{}, "get:HandleGroupNo")
  62. beego.Router("/handle10215", &PublicApiController{}, "get:Handle10215")
  63. beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
  64. beego.Router("/handelHis", &PublicApiController{}, "get:HandleHisTwo")
  65. beego.Router("/handelProject", &PublicApiController{}, "get:HandleProject")
  66. beego.Router("/handelsettledata", &PublicApiController{}, "get:HandleSettleData")
  67. beego.Router("/handelhispatient", &PublicApiController{}, "get:HandleHisPatient")
  68. //beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
  69. beego.Router("/handleExportData", &PublicApiController{}, "get:HandleExportAllData")
  70. beego.Router("/handleExportData10138", &PublicApiController{}, "get:HandleExportData10138")
  71. beego.Router("/handleData10265", &PublicApiController{}, "get:HandleData10265")
  72. //beego.Router("/handleData10265two", &PublicApiController{}, "get:HandleData10265two")
  73. beego.Router("/handleData10106", &PublicApiController{}, "get:HandleData10106")
  74. beego.Router("/handleData10318", &PublicApiController{}, "get:HandleData10318")
  75. beego.Router("/handleOne", &PublicApiController{}, "get:HandleOne")
  76. beego.Router("/handelschedule", &PublicApiController{}, "get:HandleSchedule")
  77. //beego.Router("/handelscheduleTwo", &PublicApiController{}, "get:HandleScheduleTwo")
  78. //
  79. //
  80. //
  81. //beego.Router("/handelhispatienttwo", &PublicApiController{}, "get:HandleHisPatientTwo")
  82. //beego.Router("/handleorderinfo", &PublicApiController{}, "get:HandleOrderInfoData")
  83. //
  84. //beego.Router("/hande10138", &PublicApiController{}, "get:HandleOrderInfoData10138")
  85. //935887
  86. beego.Router("/handle10210", &PublicApiController{}, "get:Handle10210")
  87. beego.Router("/handle10210", &PublicApiController{}, "get:Handle10210")
  88. //beego.Router("/handle10028", &PublicApiController{}, "get:Handle10028")
  89. beego.Router("/handleTeamData", &PublicApiController{}, "get:HandleTeamData")
  90. }
  91. func (c *PublicApiController) HandleTeamData() {
  92. teams, _ := service.GetAllProjectTeam(10191)
  93. var hisProjectList []*models.XtHisProjectList
  94. for _, item := range teams {
  95. ids := strings.Split(item.ItemId, ",")
  96. project, _ := service.GetProjectHisListByIds(ids)
  97. for _, sp := range project {
  98. sp.PN = item.ProjectTeam
  99. }
  100. hisProjectList = append(hisProjectList, project...)
  101. }
  102. c.ServeSuccessJSON(map[string]interface{}{
  103. "ps": hisProjectList,
  104. })
  105. }
  106. type ResultFiveT struct {
  107. Balc float64 `json:"balc"`
  108. CvlservFlag string `json:"cvlserv_flag"`
  109. EmpName string `json:"emp_name"`
  110. InsuplcAdmdvs string `json:"insuplc_admdvs"`
  111. Insutype string `json:"insutype"`
  112. PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
  113. PausInsuDate string `json:"paus_insu_date"`
  114. PsnInsuDate string `json:"psn_insu_date"`
  115. PsnInsuStas string `json:"psn_insu_stas"`
  116. PsnType string `json:"psn_type"`
  117. }
  118. func (c *PublicApiController) HandleSchedule() {
  119. //fmt.Println("~~~~~~")
  120. service.GetLongSolution()
  121. }
  122. //func (c *PublicApiController) Handle10028() {
  123. // HisPrescriptionTemplates, _ := service.GetHisPrescriptionTemplatesListTwo()
  124. // for _, item := range HisPrescriptionTemplates {
  125. // prescription, _ := service.GetHisPrescriptionTemplatetwo(item.ID)
  126. // for _, subitem := range prescription {
  127. // subitem.Status = 1
  128. // service.CreateHisPrescriptionInfoTemplate(subitem)
  129. // }
  130. // }
  131. //
  132. //}
  133. func (c *PublicApiController) Handle10210() {
  134. doctor_advices, _ := service.GetHisDoctorAdviceInfothree(10210, 1683561600)
  135. for _, item := range doctor_advices {
  136. strs := strings.Split(item.FeedetlSn, "-")
  137. news := strs[0] + "-" + strs[1] + "-" + strconv.FormatInt(item.ID, 10)
  138. item.FeedetlSn = news
  139. service.SaveHisDoctorAdvice(item)
  140. }
  141. projects, _ := service.GetHisPrescriptionProjectByIDFour(10210, 1683561600)
  142. for _, item := range projects {
  143. strs := strings.Split(item.FeedetlSn, "-")
  144. news := strs[0] + "-" + strs[1] + "-" + strconv.FormatInt(item.ID, 10)
  145. item.FeedetlSn = news
  146. service.SaveHisProject(item)
  147. }
  148. //doctor, _ := service.GetHisDoctorAdviceInfotwo(935886)
  149. //index := 0
  150. //total := 100
  151. //for index = 0; index < total; index++ {
  152. // doctor.ID = 0
  153. // service.SaveHisDoctorAdvice(&doctor)
  154. //}
  155. //doctor2, _ := service.GetHisDoctorAdviceInfotwo(935887)
  156. //index2 := 0
  157. //total2 := 100
  158. //for index2 = 0; index2 < total2; index2++ {
  159. // doctor2.ID = 0
  160. // service.SaveHisDoctorAdvice(&doctor2)
  161. //}
  162. //p, _ := service.GetHisPrescriptionProjectByID(2242486)
  163. //index3 := 0
  164. //total3 := 50
  165. //for index3 = 0; index3 < total3; index3++ {
  166. // p.ID = 0
  167. // service.SaveHisProject(&p)
  168. //}
  169. //p2, _ := service.GetHisPrescriptionProjectByIDThree(2242487)
  170. //index4 := 0
  171. //total4 := 100
  172. //for index4 = 0; index4 < total4; index4++ {
  173. // p2.ID = 0
  174. // service.SaveHisProject(&p2)
  175. //}
  176. //
  177. //p3, _ := service.GetHisPrescriptionProjectByIDThree(2242488)
  178. //index5 := 0
  179. //total5 := 100
  180. //for index5 = 0; index5 < total5; index5++ {
  181. // p3.ID = 0
  182. // service.SaveHisProject(&p3)
  183. //}
  184. //
  185. //p4, _ := service.GetHisPrescriptionProjectByIDThree(2242489)
  186. //index6 := 0
  187. //total6 := 100
  188. //for index6 = 0; index6 < total6; index6++ {
  189. // p4.ID = 0
  190. // service.SaveHisProject(&p4)
  191. //}
  192. }
  193. func (c *PublicApiController) HandleOne() {
  194. //fmt.Println("~~~~~~")
  195. //start_time := c.GetString("start_time")
  196. //end_time := c.GetString("end_time")
  197. //
  198. //timeLayout := "2006-01-02"
  199. //loc, _ := time.LoadLocation("Local")
  200. //startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  201. //if err != nil {
  202. //}
  203. //startRecordDateTime := startTime.Unix()
  204. //endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  205. //if err != nil {
  206. //}
  207. //endRecordDateTime := endTime.Unix()
  208. //orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
  209. //c.ServeSuccessJSON(map[string]interface{}{
  210. // "order": orders,
  211. //})
  212. }
  213. //func (c *PublicApiController) HandleScheduleTwo() {
  214. // models, _ := service.GetAllSchMode()
  215. // for _, item := range models {
  216. // if item.Mode == 1 {
  217. // templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
  218. // thisTime := time.Now()
  219. // _, theWeek := thisTime.ISOWeek()
  220. // templates[0].Week = theWeek
  221. // service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
  222. // } else if item.Mode == 2 {
  223. // templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
  224. // now := time.Now()
  225. // nextSecWeek := now.AddDate(0, 0, 14)
  226. // nextWeek := now.AddDate(0, 0, 7)
  227. // if item.ExecuteTimes%2 == 0 { //下第二周生成的是
  228. // templates[0].Week = service.GetWeeks(nextWeek.Format("2006-01-02 15:04:05"))
  229. // templates[1].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
  230. // service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
  231. // service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
  232. //
  233. // } else if item.ExecuteTimes%2 == 1 {
  234. // templates[0].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
  235. // templates[1].Week = service.GetWeeks(nextWeek.Format("2006-01-02 15:04:05"))
  236. // service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
  237. // service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
  238. //
  239. // }
  240. //
  241. // }
  242. // }
  243. //
  244. //}
  245. func (c *PublicApiController) HandleHisPatient() {
  246. ps, _ := service.GetHisPatient11111(10215)
  247. for _, item := range ps {
  248. var rf []*ResultFiveT
  249. json.Unmarshal([]byte(item.Iinfo), &rf)
  250. var insuplc_admdvs string
  251. var insutype string
  252. var is390 int = 0
  253. var is310 int = 0
  254. var insutypes []*ResultFiveT
  255. for _, item := range rf {
  256. if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  257. insutypes = append(insutypes, item)
  258. }
  259. }
  260. fmt.Println(insutypes)
  261. if len(insutypes) == 1 {
  262. insutype = insutypes[0].Insutype
  263. is390 = 1
  264. fmt.Println("111111")
  265. //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  266. } else {
  267. fmt.Println("222222")
  268. for _, i := range insutypes {
  269. if i.Insutype == "390" {
  270. is390 = 1
  271. }
  272. if i.Insutype == "310" {
  273. is310 = 1
  274. }
  275. }
  276. }
  277. if is390 == 1 {
  278. insutype = "390"
  279. }
  280. if is310 == 1 {
  281. insutype = "310"
  282. }
  283. if len(insutypes) == 0 {
  284. insutype = "390"
  285. }
  286. for _, item := range rf {
  287. if item.Insutype == insutype {
  288. insuplc_admdvs = item.InsuplcAdmdvs
  289. }
  290. }
  291. item.InsuplcAdmdvs = insuplc_admdvs
  292. service.SaveHP(item)
  293. }
  294. }
  295. //func (c *PublicApiController) HandleHisPatientTwo() {
  296. //
  297. // ps, _ := service.GetHisPatient2222(10188)
  298. // for _, item := range ps {
  299. // var rf []*ResultFiveT
  300. // json.Unmarshal([]byte(item.Iinfo), &rf)
  301. // var insuplc_admdvs string
  302. //
  303. // for _, subItem := range rf {
  304. // if subItem.Insutype == item.Insutype {
  305. // insuplc_admdvs = subItem.InsuplcAdmdvs
  306. // }
  307. // }
  308. // item.InsuplcAdmdvs = insuplc_admdvs
  309. // service.SaveHPtWO(item)
  310. // }
  311. //}
  312. func (c *PublicApiController) HandleSettleData() {
  313. orders, _ := service.GetHisOrderDetailThree()
  314. c.ServeSuccessJSON(map[string]interface{}{
  315. "order": orders,
  316. })
  317. }
  318. //func (c *PublicApiController) HandleData10106() {
  319. // start_time := c.GetString("start_time")
  320. // end_time := c.GetString("end_time")
  321. //
  322. // timeLayout := "2006-01-02"
  323. // loc, _ := time.LoadLocation("Local")
  324. // startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  325. // if err != nil {
  326. //
  327. // }
  328. // startRecordDateTime := startTime.Unix()
  329. //
  330. // endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  331. // if err != nil {
  332. //
  333. // }
  334. // endRecordDateTime := endTime.Unix()
  335. // fmt.Println(startRecordDateTime)
  336. // fmt.Println(endRecordDateTime)
  337. //
  338. // orders, _ := service.GetHisOrderDetail10106(startRecordDateTime, endRecordDateTime)
  339. // c.ServeSuccessJSON(map[string]interface{}{
  340. // "order": orders,
  341. // })
  342. //}
  343. func (c *PublicApiController) HandleData10106() {
  344. start_time := c.GetString("start_time")
  345. end_time := c.GetString("end_time")
  346. timeLayout := "2006-01-02"
  347. loc, _ := time.LoadLocation("Local")
  348. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  349. if err != nil {
  350. }
  351. startRecordDateTime := startTime.Unix()
  352. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  353. if err != nil {
  354. }
  355. endRecordDateTime := endTime.Unix()
  356. fmt.Println(startRecordDateTime)
  357. fmt.Println(endRecordDateTime)
  358. orders, _ := service.GetHisOrderDetail10106(startRecordDateTime, endRecordDateTime)
  359. c.ServeSuccessJSON(map[string]interface{}{
  360. "order": orders,
  361. })
  362. }
  363. func (c *PublicApiController) HandleData10318() {
  364. start_time := c.GetString("start_time")
  365. end_time := c.GetString("end_time")
  366. timeLayout := "2006-01-02"
  367. loc, _ := time.LoadLocation("Local")
  368. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  369. if err != nil {
  370. }
  371. startRecordDateTime := startTime.Unix()
  372. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  373. if err != nil {
  374. }
  375. endRecordDateTime := endTime.Unix()
  376. fmt.Println(startRecordDateTime)
  377. fmt.Println(endRecordDateTime)
  378. orders, _ := service.GetHisOrderDetail10318(startRecordDateTime, endRecordDateTime)
  379. c.ServeSuccessJSON(map[string]interface{}{
  380. "order": orders,
  381. })
  382. }
  383. func (c *PublicApiController) HandleProject() {
  384. prescriptions := service.GetAllProjectPrescription()
  385. for _, item := range prescriptions {
  386. ps := service.GetAllProject(item.ID)
  387. for _, subItem := range ps {
  388. subItem.Status = 0
  389. service.SaveHisProject(subItem)
  390. }
  391. }
  392. }
  393. func (c *PublicApiController) HandleHisTwo() {
  394. hiss := service.GetAllPrivateHis(10215)
  395. for _, item := range hiss {
  396. patient, _ := service.GetPatientByID(10215, item.PatientId)
  397. item.Gender = patient.Gender
  398. service.SaveHis(item)
  399. }
  400. }
  401. func (c *PublicApiController) GetDoctorAdviceConfig() {
  402. drugs, _, _ := service.GetPublicDrugDics()
  403. drugways, _, _ := service.GetPublicDrugWayDics()
  404. efs, _, _ := service.GetPublicExecutionFrequencyDics()
  405. c.ServeSuccessJSON(map[string]interface{}{
  406. "drugs": drugs,
  407. "drugways": drugways,
  408. "efs": efs,
  409. })
  410. }
  411. func (c *PublicApiController) GetServerTime() {
  412. timeNow := time.Now()
  413. timeNowStamp := timeNow.Unix()
  414. timeNowStr := timeNow.Format("2006-01-02 15:04:05")
  415. c.ServeSuccessJSON(map[string]interface{}{
  416. "time": timeNowStr,
  417. "timestamp": timeNowStamp,
  418. })
  419. }
  420. func (c *PublicApiController) AppRelease() {
  421. // appId := c.GetString("appid")
  422. version := c.GetString("version")
  423. appType, _ := c.GetInt64("app_type", 0)
  424. appVersion, err := service.GetAppVersionByAppType(appType)
  425. if err != nil {
  426. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  427. return
  428. }
  429. if appVersion == nil {
  430. c.ServeSuccessJSON(map[string]interface{}{
  431. "version": nil,
  432. "state": 2,
  433. })
  434. return
  435. }
  436. state := strings.Compare(version, appVersion.Version)
  437. // state := 1
  438. if state < 0 {
  439. c.ServeSuccessJSON(map[string]interface{}{
  440. "version": appVersion,
  441. "state": appVersion.Status,
  442. })
  443. return
  444. }
  445. c.ServeSuccessJSON(map[string]interface{}{
  446. "version": nil,
  447. "state": 2,
  448. })
  449. return
  450. }
  451. func (this *PublicApiController) GetJson() {
  452. type Global struct {
  453. DeviceSN string
  454. Version string
  455. Timestamp string
  456. InterfaceSource string
  457. }
  458. type RBPResultModel struct {
  459. Sys string
  460. Dia string
  461. HR string
  462. MeasureTime string
  463. }
  464. type ScannerResultModel struct {
  465. Code string
  466. }
  467. type IDCardResultModel struct {
  468. IDCardNo string
  469. UserName string
  470. Age string
  471. Female string
  472. Male string
  473. SocialSecurityNo string
  474. }
  475. type JsonTemp struct {
  476. Global Global
  477. RBPResultModel RBPResultModel
  478. ScannerResultModel ScannerResultModel
  479. IDCardResultModel IDCardResultModel
  480. }
  481. var person JsonTemp
  482. err3 := json.Unmarshal([]byte(this.GetString("params")), &person)
  483. fmt.Println(err3)
  484. fmt.Println(person.Global)
  485. //temp := JsonTemp{
  486. // Global:Global{
  487. // DeviceSN:"1122",
  488. // Version:"1122",
  489. // Timestamp:"1222",
  490. // InterfaceSource:"1233",
  491. // },
  492. // RBPResultModel: RBPResultModel{
  493. // Sys:"12",
  494. // Dia:"22",
  495. // HR:"23",
  496. // MeasureTime:"123",
  497. // },
  498. // ScannerResultModel:ScannerResultModel{
  499. // Code:"1233",
  500. // },
  501. // IDCardResultModel:IDCardResultModel{
  502. // IDCardNo:"123",
  503. // UserName:"123",
  504. // Age:"123",
  505. // Female:"123",
  506. // Male:"123",
  507. // SocialSecurityNo:"123",
  508. // },
  509. //}
  510. //
  511. //jsonBytes, err := json.Marshal(temp)
  512. //if err != nil {
  513. // fmt.Println(err)
  514. //}
  515. //fmt.Println(string(jsonBytes))
  516. }
  517. func (c *PublicApiController) HandleData() {
  518. //service.HandleData()
  519. org_app, _ := service.GetAllAppOrg()
  520. //org_role, _ := service.GetAllRole()
  521. //
  522. //var org_ids []int64
  523. for _, apps := range org_app {
  524. xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
  525. //org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
  526. //org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
  527. //org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
  528. //org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
  529. //org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
  530. //org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
  531. //org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
  532. //org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
  533. //org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
  534. //org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
  535. //org_app_16, _ := service.GetAppByType(int64(apps.OrgId), 16)
  536. //org_app_17, _ := service.GetAppByType(int64(apps.OrgId), 17)
  537. org_app_18, _ := service.GetAppByType(int64(apps.OrgId), 18)
  538. var xt_temp_org_app *models.OrgApp
  539. //var mall_temp_org_app *models.OrgApp
  540. if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  541. app, _ := service.GetOrgAppA(0, 3)
  542. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  543. if org == nil || org.Id == 0 {
  544. continue
  545. }
  546. app.Id = 0
  547. app.OrgId = apps.OrgId
  548. app.Creator = int(org.Creator)
  549. app.Number = 0
  550. app.Status = 1
  551. app.ModifyTime = time.Now().Unix()
  552. app.CreateTime = time.Now().Unix()
  553. service.CreateOrgApp(app)
  554. xt_temp_org_app = app
  555. } else {
  556. xt_temp_org_app = xt_org_app
  557. }
  558. //if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  559. //
  560. // app, _ := service.GetOrgAppA(0, 1)
  561. // //org, _ := service.GetOrgById(int64(12))
  562. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  563. // if org == nil || org.Id == 0 {
  564. // continue
  565. // }
  566. //
  567. //
  568. // app.OrgId = apps.OrgId
  569. // app.Id = 0
  570. //
  571. // app.Creator = int(org.Creator)
  572. // app.Number = 0
  573. // app.Status = 1
  574. // app.ModifyTime = time.Now().Unix()
  575. // app.CreateTime = time.Now().Unix()
  576. // service.CreateOrgApp(app)
  577. //
  578. //}
  579. //
  580. //if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  581. // app, _ := service.GetOrgAppA(0, 4)
  582. // //org, _ := service.GetOrgById(int64(12))
  583. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  584. // if org == nil || org.Id == 0 {
  585. // continue
  586. // }
  587. //
  588. //
  589. // app.OrgId = apps.OrgId
  590. // app.Creator = int(org.Creator)
  591. // app.Number = 0
  592. // app.Id = 0
  593. //
  594. // app.Status = 1
  595. // app.ModifyTime = time.Now().Unix()
  596. // app.CreateTime = time.Now().Unix()
  597. // service.CreateOrgApp(app)
  598. //}
  599. //
  600. //if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  601. // app, _ := service.GetOrgAppA(0, 5)
  602. // //org, _ := service.GetOrgById(int64(12))
  603. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  604. //
  605. // if org == nil || org.Id == 0 {
  606. // continue
  607. // }
  608. //
  609. // app.OrgId = apps.OrgId
  610. // app.Creator = int(org.Creator)
  611. // app.Number = 0
  612. // app.Id = 0
  613. //
  614. // app.Status = 1
  615. // app.ModifyTime = time.Now().Unix()
  616. // app.CreateTime = time.Now().Unix()
  617. // service.CreateOrgApp(app)
  618. // mall_temp_org_app = app
  619. //} else {
  620. // mall_temp_org_app = mall_org_app
  621. //}
  622. //
  623. //if org_app_16 == nil || org_app_16.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  624. // app, _ := service.GetOrgAppA(0, 16)
  625. // //org, _ := service.GetOrgById(int64(12))
  626. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  627. // if org == nil || org.Id == 0 {
  628. // continue
  629. // }
  630. //
  631. // app.OrgId = apps.OrgId
  632. // app.Creator = int(org.Creator)
  633. // app.Number = 11
  634. // app.Id = 0
  635. // app.Status = 1
  636. // app.ModifyTime = time.Now().Unix()
  637. // app.CreateTime = time.Now().Unix()
  638. // app.Pid = xt_temp_org_app.Id
  639. // service.CreateOrgApp(app)
  640. //
  641. //}
  642. //
  643. //if org_app_17 == nil || org_app_17.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  644. // app, _ := service.GetOrgAppA(0, 17)
  645. // //org, _ := service.GetOrgById(int64(12))
  646. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  647. // if org == nil || org.Id == 0 {
  648. // continue
  649. // }
  650. //
  651. // app.OrgId = apps.OrgId
  652. // app.Creator = int(org.Creator)
  653. // app.Number = 12
  654. // app.Id = 0
  655. // app.Status = 1
  656. // app.ModifyTime = time.Now().Unix()
  657. // app.CreateTime = time.Now().Unix()
  658. // app.Pid = xt_temp_org_app.Id
  659. // service.CreateOrgApp(app)
  660. //
  661. //}
  662. if org_app_18 == nil || org_app_18.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  663. app, _ := service.GetOrgAppA(0, 18)
  664. //org, _ := service.GetOrgById(int64(12))
  665. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  666. if org == nil || org.Id == 0 {
  667. continue
  668. }
  669. app.OrgId = apps.OrgId
  670. app.Creator = int(org.Creator)
  671. app.Number = 5
  672. app.Id = 0
  673. app.Status = 1
  674. app.ModifyTime = time.Now().Unix()
  675. app.CreateTime = time.Now().Unix()
  676. app.Pid = xt_temp_org_app.Id
  677. service.CreateOrgApp(app)
  678. }
  679. //if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  680. // app, _ := service.GetOrgAppA(0, 7)
  681. // //org, _ := service.GetOrgById(int64(12))
  682. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  683. // if org == nil || org.Id == 0 {
  684. // continue
  685. // }
  686. //
  687. //
  688. // app.OrgId = apps.OrgId
  689. // app.Creator = int(org.Creator)
  690. // app.Number = 2
  691. // app.Status = 2
  692. // app.Id = 0
  693. //
  694. // app.ModifyTime = time.Now().Unix()
  695. // app.CreateTime = time.Now().Unix()
  696. // app.Pid = xt_temp_org_app.Id
  697. //
  698. // service.CreateOrgApp(app)
  699. //}
  700. //if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  701. // app, _ := service.GetOrgAppA(0, 8)
  702. // //org, _ := service.GetOrgById(int64(12))
  703. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  704. // if org == nil || org.Id == 0 {
  705. // continue
  706. // }
  707. //
  708. //
  709. // app.OrgId = apps.OrgId
  710. // app.Creator = int(org.Creator)
  711. // app.Number = 3
  712. // app.Id = 0
  713. //
  714. // app.Pid = mall_temp_org_app.Id
  715. //
  716. // app.Status = 1
  717. // app.ModifyTime = time.Now().Unix()
  718. // app.CreateTime = time.Now().Unix()
  719. // service.CreateOrgApp(app)
  720. //}
  721. //if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  722. // app, _ := service.GetOrgAppA(0, 9)
  723. // //org, _ := service.GetOrgById(int64(12))
  724. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  725. // if org == nil || org.Id == 0 {
  726. // continue
  727. // }
  728. //
  729. //
  730. // app.OrgId = apps.OrgId
  731. // app.Pid = xt_temp_org_app.Id
  732. //
  733. // app.Creator = int(org.Creator)
  734. // app.Number = 4
  735. // app.Id = 0
  736. //
  737. // app.Status = 1
  738. // app.ModifyTime = time.Now().Unix()
  739. // app.CreateTime = time.Now().Unix()
  740. // service.CreateOrgApp(app)
  741. //
  742. //}
  743. //if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  744. // app, _ := service.GetOrgAppA(0, 10)
  745. // //org, _ := service.GetOrgById(int64(12))
  746. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  747. // if org == nil || org.Id == 0 {
  748. // continue
  749. // }
  750. //
  751. //
  752. // app.OrgId = apps.OrgId
  753. // app.Creator = int(org.Creator)
  754. // app.Pid = xt_temp_org_app.Id
  755. //
  756. // app.Number = 5
  757. // app.Id = 0
  758. //
  759. // app.Status = 1
  760. // app.ModifyTime = time.Now().Unix()
  761. // app.CreateTime = time.Now().Unix()
  762. // service.CreateOrgApp(app)
  763. //}
  764. //if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  765. // app, _ := service.GetOrgAppA(0, 11)
  766. // //org, _ := service.GetOrgById(int64(12))
  767. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  768. // if org == nil || org.Id == 0 {
  769. // continue
  770. // }
  771. //
  772. //
  773. // app.OrgId = apps.OrgId
  774. // app.Creator = int(org.Creator)
  775. // app.Pid = xt_temp_org_app.Id
  776. // app.Id = 0
  777. //
  778. // app.Number = 6
  779. // app.Status = 1
  780. // app.ModifyTime = time.Now().Unix()
  781. // app.CreateTime = time.Now().Unix()
  782. // service.CreateOrgApp(app)
  783. //}
  784. //if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  785. // app, _ := service.GetOrgAppA(0, 12)
  786. // //org, _ := service.GetOrgById(int64(12))
  787. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  788. // if org == nil || org.Id == 0 {
  789. // continue
  790. // }
  791. //
  792. //
  793. // app.OrgId = apps.OrgId
  794. // app.Creator = int(org.Creator)
  795. // app.Pid = xt_temp_org_app.Id
  796. // app.Number = 7
  797. // app.Status = 1
  798. // app.Id = 0
  799. //
  800. // app.ModifyTime = time.Now().Unix()
  801. // app.CreateTime = time.Now().Unix()
  802. // service.CreateOrgApp(app)
  803. //}
  804. //if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  805. // app, _ := service.GetOrgAppA(0, 13)
  806. // //org, _ := service.GetOrgById(int64(12))
  807. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  808. // if org == nil || org.Id == 0 {
  809. // continue
  810. // }
  811. //
  812. //
  813. // app.OrgId = apps.OrgId
  814. // app.Creator = int(org.Creator)
  815. // app.Pid = xt_temp_org_app.Id
  816. // app.Number = 8
  817. // app.Id = 0
  818. // app.Status = 1
  819. // app.ModifyTime = time.Now().Unix()
  820. // app.CreateTime = time.Now().Unix()
  821. // service.CreateOrgApp(app)
  822. //}
  823. //if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  824. // app, _ := service.GetOrgAppA(0, 14)
  825. // //org, _ := service.GetOrgById(int64(12))
  826. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  827. // if org == nil || org.Id == 0 {
  828. // continue
  829. // }
  830. //
  831. //
  832. // app.OrgId = apps.OrgId
  833. // app.Creator = int(org.Creator)
  834. // app.Pid = xt_temp_org_app.Id
  835. // app.Id = 0
  836. // app.Number = 9
  837. // app.Status = 1
  838. // app.ModifyTime = time.Now().Unix()
  839. // app.CreateTime = time.Now().Unix()
  840. // service.CreateOrgApp(app)
  841. //}
  842. //if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  843. // app, _ := service.GetOrgAppA(0, 15)
  844. // //org, _ := service.GetOrgById(int64(12))
  845. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  846. // if org == nil || org.Id == 0 {
  847. // continue
  848. // }
  849. //
  850. // app.OrgId = apps.OrgId
  851. // app.Creator = int(org.Creator)
  852. // app.Pid = xt_temp_org_app.Id
  853. // app.Number = 10
  854. // app.Status = 1
  855. // app.Id = 0
  856. // app.ModifyTime = time.Now().Unix()
  857. // app.CreateTime = time.Now().Unix()
  858. // service.CreateOrgApp(app)
  859. //}
  860. }
  861. //for _, role := range org_role {
  862. // org_ids = append(org_ids, role.OrgId)
  863. //}
  864. //
  865. //
  866. ////创建内置角色
  867. //InitRoleAndPurviews(org_ids)
  868. //var org_id int = 0
  869. //管理员
  870. //app_roles := service.GetAllUserRoleByUserTypeOne(org_id)
  871. //for _, item := range app_roles{
  872. // var ids string
  873. // if len(item.RoleIds) == 0{
  874. // ids = strconv.FormatInt( item.RoleId,10)
  875. // }else{
  876. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  877. // }
  878. // service.UpdateRoleIds(item.Id, ids)
  879. //}
  880. //护士医生
  881. //app_roles2 := service.GetAllUserRoleByUserTypeOther()
  882. // for _, item := range app_roles2{
  883. // var ids string
  884. // if len(item.RoleIds) == 0{
  885. // ids = strconv.FormatInt( item.RoleId,10)
  886. // }else{
  887. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  888. // }
  889. // if item.UserType == 2{
  890. // role := service.FindRoleByUserTypeOne(item.OrgId)
  891. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  892. //
  893. // } else if item.UserType == 3{
  894. // role := service.FindRoleByUserTypeTwo(item.OrgId)
  895. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  896. // }
  897. // service.UpdateRoleIds(item.Id, ids)
  898. // }
  899. //c.ServeSuccessJSON(map[string]interface{}{
  900. // "msg": "ok",
  901. //})
  902. }
  903. func (c *PublicApiController) HandleGroupNo() {
  904. //service.GetAllPatientChargeDetails(10138, 1634054400)
  905. //pts, _ := service.GetHisPrescriptionTemplateTwo()
  906. //for _, item := range pts {
  907. // if len(item.HisPrescriptionAdviceTemplate) > 0 {
  908. // for index, subItem := range item.HisPrescriptionAdviceTemplate {
  909. // subItem.Groupno = int64(index + 1)
  910. // service.SaveAdviceTemplate(subItem)
  911. // }
  912. // }
  913. //}
  914. }
  915. func InitRoleAndPurviews(org_ids []int64) {
  916. roles := LoadRoleConfig("./role.json").Roles
  917. for _, org_id := range org_ids {
  918. app, _ := service.GetOrgAppB(org_id, 3)
  919. role, _ := service.GetSystemRole(org_id)
  920. if app == nil || app.Id == 0 {
  921. continue
  922. }
  923. if len(role) == 0 {
  924. for _, item := range roles {
  925. role := &models.Role{
  926. RoleName: item.RoleName,
  927. RoleIntro: item.RoleIntroduction,
  928. Creator: 0,
  929. OrgId: org_id,
  930. AppId: app.Id,
  931. IsSuperAdmin: false,
  932. Status: 1,
  933. CreateTime: time.Now().Unix(),
  934. ModifyTime: time.Now().Unix(),
  935. Number: item.Number,
  936. IsSystem: item.IsSystem,
  937. }
  938. err := service.CreateOrgRoleB(role)
  939. if err == nil {
  940. purview := &models.RolePurview{
  941. RoleId: role.Id,
  942. OrgId: org_id,
  943. AppId: role.AppId,
  944. PurviewIds: item.PurviewIds,
  945. Status: 1,
  946. CreateTime: time.Now().Unix(),
  947. ModifyTime: time.Now().Unix(),
  948. }
  949. func_purview := &models.SgjUserRoleFuncPurview{
  950. RoleId: role.Id,
  951. OrgId: org_id,
  952. AppId: role.AppId,
  953. PurviewIds: item.FuncIds,
  954. Status: 1,
  955. Ctime: time.Now().Unix(),
  956. Mtime: time.Now().Unix(),
  957. }
  958. service.CreateRolePurviewB(purview)
  959. service.CreateFuncRolePurviewB(func_purview)
  960. }
  961. }
  962. }
  963. }
  964. }
  965. type RoleConfig struct {
  966. Roles []*models.VMUserRoleAndPurview "json:roles"
  967. }
  968. func LoadRoleConfig(dataFile string) *RoleConfig {
  969. var config RoleConfig
  970. _, filename, _, _ := runtime.Caller(1)
  971. datapath := path.Join(path.Dir(filename), dataFile)
  972. config_file, err := os.Open(datapath)
  973. if err != nil {
  974. emit("Failed to open config file '%s': %s\n", datapath, err)
  975. return &config
  976. }
  977. fi, _ := config_file.Stat()
  978. buffer := make([]byte, fi.Size())
  979. _, err = config_file.Read(buffer)
  980. buffer, err = StripComments(buffer) //去掉注释
  981. if err != nil {
  982. emit("Failed to strip comments from json: %s\n", err)
  983. return &config
  984. }
  985. buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
  986. err = json.Unmarshal(buffer, &config) //解析json格式数据
  987. if err != nil {
  988. emit("Failed unmarshalling json: %s\n", err)
  989. return &config
  990. }
  991. return &config
  992. }
  993. type GoodTypesConfig struct {
  994. GoodTypes []*models.VMGoodsType "json:list"
  995. }
  996. func LoadGoodTypeConfig(dataFile string) *GoodTypesConfig {
  997. var config GoodTypesConfig
  998. _, filename, _, _ := runtime.Caller(1)
  999. datapath := path.Join(path.Dir(filename), dataFile)
  1000. config_file, err := os.Open(datapath)
  1001. if err != nil {
  1002. emit("Failed to open config file '%s': %s\n", datapath, err)
  1003. return &config
  1004. }
  1005. fi, _ := config_file.Stat()
  1006. buffer := make([]byte, fi.Size())
  1007. _, err = config_file.Read(buffer)
  1008. buffer, err = StripComments(buffer) //去掉注释
  1009. if err != nil {
  1010. emit("Failed to strip comments from json: %s\n", err)
  1011. return &config
  1012. }
  1013. buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
  1014. err = json.Unmarshal(buffer, &config) //解析json格式数据
  1015. if err != nil {
  1016. emit("Failed unmarshalling json: %s\n", err)
  1017. return &config
  1018. }
  1019. return &config
  1020. }
  1021. func (c *PublicApiController) HandleStockData() {
  1022. org, _ := service.FindAllOrgByImportType()
  1023. for _, item := range org {
  1024. if item.Id != 3907 || item.Id != 9779 || item.Id != 9883 {
  1025. goodTypes := &models.GoodsType{
  1026. TypeCode: "14000000",
  1027. TypeName: "穿刺针",
  1028. Remark: "",
  1029. Ctime: time.Now().Unix(),
  1030. Mtime: time.Now().Unix(),
  1031. Creater: 0,
  1032. Modifier: 0,
  1033. OrgId: item.Id,
  1034. Status: 1,
  1035. Type: 1,
  1036. Number: 1,
  1037. }
  1038. service.AddSigleGoodType(goodTypes)
  1039. goodTypes1 := &models.GoodsType{
  1040. TypeCode: "14000001",
  1041. TypeName: "透析器",
  1042. Remark: "",
  1043. Ctime: time.Now().Unix(),
  1044. Mtime: time.Now().Unix(),
  1045. Creater: 0,
  1046. Modifier: 0,
  1047. OrgId: item.Id,
  1048. Status: 1,
  1049. Type: 1,
  1050. Number: 2,
  1051. }
  1052. service.AddSigleGoodType(goodTypes1)
  1053. goodTypes2 := &models.GoodsType{
  1054. TypeCode: "14000002",
  1055. TypeName: "灌流器",
  1056. Remark: "",
  1057. Ctime: time.Now().Unix(),
  1058. Mtime: time.Now().Unix(),
  1059. Creater: 0,
  1060. Modifier: 0,
  1061. OrgId: item.Id,
  1062. Status: 1,
  1063. Type: 1,
  1064. Number: 3,
  1065. }
  1066. service.AddSigleGoodType(goodTypes2)
  1067. goodTypes3 := &models.GoodsType{
  1068. TypeCode: "14000003",
  1069. TypeName: "血路管",
  1070. Remark: "",
  1071. Ctime: time.Now().Unix(),
  1072. Mtime: time.Now().Unix(),
  1073. Creater: 0,
  1074. Modifier: 0,
  1075. OrgId: item.Id,
  1076. Status: 1,
  1077. Type: 1,
  1078. Number: 4,
  1079. }
  1080. service.AddSigleGoodType(goodTypes3)
  1081. goodTypes4 := &models.GoodsType{
  1082. TypeCode: "14000004",
  1083. TypeName: "血滤补液管",
  1084. Remark: "",
  1085. Ctime: time.Now().Unix(),
  1086. Mtime: time.Now().Unix(),
  1087. Creater: 0,
  1088. Modifier: 0,
  1089. OrgId: item.Id,
  1090. Status: 1,
  1091. Type: 1,
  1092. Number: 5,
  1093. }
  1094. service.AddSigleGoodType(goodTypes4)
  1095. goodTypes5 := &models.GoodsType{
  1096. TypeCode: "14000005",
  1097. TypeName: "注射器",
  1098. Remark: "",
  1099. Ctime: time.Now().Unix(),
  1100. Mtime: time.Now().Unix(),
  1101. Creater: 0,
  1102. Modifier: 0,
  1103. OrgId: item.Id,
  1104. Status: 1,
  1105. Type: 1,
  1106. Number: 6,
  1107. }
  1108. service.AddSigleGoodType(goodTypes5)
  1109. goodTypes6 := &models.GoodsType{
  1110. TypeCode: "14000006",
  1111. TypeName: "护理包(内瘘穿刺包)",
  1112. Remark: "",
  1113. Ctime: time.Now().Unix(),
  1114. Mtime: time.Now().Unix(),
  1115. Creater: 0,
  1116. Modifier: 0,
  1117. OrgId: item.Id,
  1118. Status: 1,
  1119. Type: 1,
  1120. Number: 7,
  1121. }
  1122. service.AddSigleGoodType(goodTypes6)
  1123. goodTypes7 := &models.GoodsType{
  1124. TypeCode: "14000007",
  1125. TypeName: "细菌过滤器",
  1126. Remark: "",
  1127. Ctime: time.Now().Unix(),
  1128. Mtime: time.Now().Unix(),
  1129. Creater: 0,
  1130. Modifier: 0,
  1131. OrgId: item.Id,
  1132. Status: 1,
  1133. Type: 1,
  1134. Number: 8,
  1135. }
  1136. service.AddSigleGoodType(goodTypes7)
  1137. goodTypes8 := &models.GoodsType{
  1138. TypeCode: "14000008",
  1139. TypeName: "血液透析干粉",
  1140. Remark: "",
  1141. Ctime: time.Now().Unix(),
  1142. Mtime: time.Now().Unix(),
  1143. Creater: 0,
  1144. Modifier: 0,
  1145. OrgId: item.Id,
  1146. Status: 1,
  1147. Type: 1,
  1148. Number: 9,
  1149. }
  1150. service.AddSigleGoodType(goodTypes8)
  1151. goodTypes9 := &models.GoodsType{
  1152. TypeCode: "14000009",
  1153. TypeName: "A液",
  1154. Remark: "",
  1155. Ctime: time.Now().Unix(),
  1156. Mtime: time.Now().Unix(),
  1157. Creater: 0,
  1158. Modifier: 0,
  1159. OrgId: item.Id,
  1160. Status: 1,
  1161. Type: 1,
  1162. Number: 10,
  1163. }
  1164. service.AddSigleGoodType(goodTypes9)
  1165. goodTypes10 := &models.GoodsType{
  1166. TypeCode: "14000010",
  1167. TypeName: "B液",
  1168. Remark: "",
  1169. Ctime: time.Now().Unix(),
  1170. Mtime: time.Now().Unix(),
  1171. Creater: 0,
  1172. Modifier: 0,
  1173. OrgId: item.Id,
  1174. Status: 1,
  1175. Type: 1,
  1176. Number: 11,
  1177. }
  1178. service.AddSigleGoodType(goodTypes10)
  1179. goodTypes11 := &models.GoodsType{
  1180. TypeCode: "14000011",
  1181. TypeName: "导管包",
  1182. Remark: "",
  1183. Ctime: time.Now().Unix(),
  1184. Mtime: time.Now().Unix(),
  1185. Creater: 0,
  1186. Modifier: 0,
  1187. OrgId: item.Id,
  1188. Status: 1,
  1189. Type: 1,
  1190. Number: 12,
  1191. }
  1192. service.AddSigleGoodType(goodTypes11)
  1193. goodTypes12 := &models.GoodsType{
  1194. TypeCode: "14000012",
  1195. TypeName: "血液透析导管",
  1196. Remark: "",
  1197. Ctime: time.Now().Unix(),
  1198. Mtime: time.Now().Unix(),
  1199. Creater: 0,
  1200. Modifier: 0,
  1201. OrgId: item.Id,
  1202. Status: 1,
  1203. Type: 1,
  1204. Number: 13,
  1205. }
  1206. service.AddSigleGoodType(goodTypes12)
  1207. }
  1208. }
  1209. }
  1210. func (c *PublicApiController) HandleComData() {
  1211. org_ids := []int64{3907, 9779, 9883}
  1212. for _, id := range org_ids {
  1213. //查处所有处方记录
  1214. prescriptions, _ := service.FindAllPrescription(id)
  1215. if id == 3907 {
  1216. for _, item := range prescriptions {
  1217. if item.Niprocart > 0 {
  1218. before := &models.DialysisBeforePrepare{
  1219. UserOrgId: id,
  1220. PatientId: item.PatientId,
  1221. RecordDate: item.RecordDate,
  1222. Count: 1,
  1223. Ctime: item.RecordDate,
  1224. Mtime: item.RecordDate,
  1225. Creater: item.Creater,
  1226. Modifier: item.Creater,
  1227. Status: 1,
  1228. }
  1229. before.GoodId = item.Niprocart
  1230. before.GoodTypeId = 241
  1231. service.AddSigleDialysisBeforePre(before)
  1232. }
  1233. if item.Jms > 0 {
  1234. before := &models.DialysisBeforePrepare{
  1235. UserOrgId: id,
  1236. PatientId: item.PatientId,
  1237. RecordDate: item.RecordDate,
  1238. Count: 1,
  1239. Ctime: item.RecordDate,
  1240. Mtime: item.RecordDate,
  1241. Creater: item.Creater,
  1242. Modifier: item.Creater,
  1243. Status: 1,
  1244. }
  1245. before.GoodId = item.Jms
  1246. before.GoodTypeId = 233
  1247. service.AddSigleDialysisBeforePre(before)
  1248. }
  1249. if item.FistulaNeedleSet > 0 {
  1250. before := &models.DialysisBeforePrepare{
  1251. UserOrgId: id,
  1252. PatientId: item.PatientId,
  1253. RecordDate: item.RecordDate,
  1254. Count: 1,
  1255. Ctime: item.RecordDate,
  1256. Mtime: item.RecordDate,
  1257. Creater: item.Creater,
  1258. Modifier: item.Creater,
  1259. Status: 1,
  1260. }
  1261. before.GoodId = item.FistulaNeedleSet
  1262. before.GoodTypeId = 233
  1263. service.AddSigleDialysisBeforePre(before)
  1264. }
  1265. if item.FistulaNeedleSet16 > 0 {
  1266. before := &models.DialysisBeforePrepare{
  1267. UserOrgId: id,
  1268. PatientId: item.PatientId,
  1269. RecordDate: item.RecordDate,
  1270. Count: 1,
  1271. Ctime: item.RecordDate,
  1272. Mtime: item.RecordDate,
  1273. Creater: item.Creater,
  1274. Modifier: item.Creater,
  1275. Status: 1,
  1276. }
  1277. before.GoodId = item.FistulaNeedleSet16
  1278. before.GoodTypeId = 233
  1279. service.AddSigleDialysisBeforePre(before)
  1280. }
  1281. if item.Hemoperfusion > 0 {
  1282. before := &models.DialysisBeforePrepare{
  1283. UserOrgId: id,
  1284. PatientId: item.PatientId,
  1285. RecordDate: item.RecordDate,
  1286. Count: 1,
  1287. Ctime: item.RecordDate,
  1288. Mtime: item.RecordDate,
  1289. Creater: item.Creater,
  1290. Modifier: item.Creater,
  1291. Status: 1,
  1292. }
  1293. before.GoodId = item.Hemoperfusion
  1294. before.GoodTypeId = 235
  1295. service.AddSigleDialysisBeforePre(before)
  1296. }
  1297. if item.DialyserSterilised > 0 {
  1298. before := &models.DialysisBeforePrepare{
  1299. UserOrgId: id,
  1300. PatientId: item.PatientId,
  1301. RecordDate: item.RecordDate,
  1302. Count: 1,
  1303. Ctime: item.RecordDate,
  1304. Mtime: item.RecordDate,
  1305. Creater: item.Creater,
  1306. Modifier: item.Creater,
  1307. Status: 1,
  1308. }
  1309. before.GoodId = item.DialyserSterilised
  1310. before.GoodTypeId = 234
  1311. service.AddSigleDialysisBeforePre(before)
  1312. }
  1313. if item.Filtryzer > 0 {
  1314. before := &models.DialysisBeforePrepare{
  1315. UserOrgId: id,
  1316. PatientId: item.PatientId,
  1317. RecordDate: item.RecordDate,
  1318. Count: 1,
  1319. Ctime: item.RecordDate,
  1320. Mtime: item.RecordDate,
  1321. Creater: item.Creater,
  1322. Modifier: item.Creater,
  1323. Status: 1,
  1324. }
  1325. before.GoodId = item.Filtryzer
  1326. before.GoodTypeId = 234
  1327. service.AddSigleDialysisBeforePre(before)
  1328. }
  1329. if item.Dialyzers > 0 {
  1330. before := &models.DialysisBeforePrepare{
  1331. UserOrgId: id,
  1332. PatientId: item.PatientId,
  1333. RecordDate: item.RecordDate,
  1334. Count: 1,
  1335. Ctime: item.RecordDate,
  1336. Mtime: item.RecordDate,
  1337. Creater: item.Creater,
  1338. Modifier: item.Creater,
  1339. Status: 1,
  1340. }
  1341. before.GoodId = item.Dialyzers
  1342. before.GoodTypeId = 234
  1343. service.AddSigleDialysisBeforePre(before)
  1344. }
  1345. if item.Injector > 0 {
  1346. before := &models.DialysisBeforePrepare{
  1347. UserOrgId: id,
  1348. PatientId: item.PatientId,
  1349. RecordDate: item.RecordDate,
  1350. Count: 1,
  1351. Ctime: item.RecordDate,
  1352. Mtime: item.RecordDate,
  1353. Creater: item.Creater,
  1354. Modifier: item.Creater,
  1355. Status: 1,
  1356. }
  1357. before.GoodId = item.Injector
  1358. before.GoodTypeId = 238
  1359. service.AddSigleDialysisBeforePre(before)
  1360. }
  1361. if item.Bloodlines > 0 {
  1362. before := &models.DialysisBeforePrepare{
  1363. UserOrgId: id,
  1364. PatientId: item.PatientId,
  1365. RecordDate: item.RecordDate,
  1366. Count: 1,
  1367. Ctime: item.RecordDate,
  1368. Mtime: item.RecordDate,
  1369. Creater: item.Creater,
  1370. Modifier: item.Creater,
  1371. Status: 1,
  1372. }
  1373. before.GoodId = item.Bloodlines
  1374. before.GoodTypeId = 236
  1375. service.AddSigleDialysisBeforePre(before)
  1376. }
  1377. if item.TubingHemodialysis > 0 {
  1378. before := &models.DialysisBeforePrepare{
  1379. UserOrgId: id,
  1380. PatientId: item.PatientId,
  1381. RecordDate: item.RecordDate,
  1382. Count: 1,
  1383. Ctime: item.RecordDate,
  1384. Mtime: item.RecordDate,
  1385. Creater: item.Creater,
  1386. Modifier: item.Creater,
  1387. Status: 1,
  1388. }
  1389. before.GoodId = item.TubingHemodialysis
  1390. before.GoodTypeId = 237
  1391. service.AddSigleDialysisBeforePre(before)
  1392. }
  1393. if item.Package > 0 {
  1394. before := &models.DialysisBeforePrepare{
  1395. UserOrgId: id,
  1396. PatientId: item.PatientId,
  1397. RecordDate: item.RecordDate,
  1398. Count: 1,
  1399. Ctime: item.RecordDate,
  1400. Mtime: item.RecordDate,
  1401. Creater: item.Creater,
  1402. Modifier: item.Creater,
  1403. Status: 1,
  1404. }
  1405. before.GoodId = item.Package
  1406. before.GoodTypeId = 239
  1407. service.AddSigleDialysisBeforePre(before)
  1408. }
  1409. if item.ALiquid > 0 {
  1410. before := &models.DialysisBeforePrepare{
  1411. UserOrgId: id,
  1412. PatientId: item.PatientId,
  1413. RecordDate: item.RecordDate,
  1414. Count: 1,
  1415. Ctime: item.RecordDate,
  1416. Mtime: item.RecordDate,
  1417. Creater: item.Creater,
  1418. Modifier: item.Creater,
  1419. Status: 1,
  1420. }
  1421. before.GoodId = item.ALiquid
  1422. before.GoodTypeId = 242
  1423. service.AddSigleDialysisBeforePre(before)
  1424. }
  1425. }
  1426. } else if id == 9779 {
  1427. for _, item := range prescriptions {
  1428. if item.Niprocart > 0 {
  1429. before := &models.DialysisBeforePrepare{
  1430. UserOrgId: id,
  1431. PatientId: item.PatientId,
  1432. RecordDate: item.RecordDate,
  1433. Count: 1,
  1434. Ctime: item.RecordDate,
  1435. Mtime: item.RecordDate,
  1436. Creater: item.Creater,
  1437. Modifier: item.Creater,
  1438. Status: 1,
  1439. }
  1440. before.GoodId = item.Niprocart
  1441. before.GoodTypeId = 254
  1442. service.AddSigleDialysisBeforePre(before)
  1443. }
  1444. if item.Jms > 0 {
  1445. before := &models.DialysisBeforePrepare{
  1446. UserOrgId: id,
  1447. PatientId: item.PatientId,
  1448. RecordDate: item.RecordDate,
  1449. Count: 1,
  1450. Ctime: item.RecordDate,
  1451. Mtime: item.RecordDate,
  1452. Creater: item.Creater,
  1453. Modifier: item.Creater,
  1454. Status: 1,
  1455. }
  1456. before.GoodId = item.Jms
  1457. before.GoodTypeId = 246
  1458. service.AddSigleDialysisBeforePre(before)
  1459. }
  1460. if item.FistulaNeedleSet > 0 {
  1461. before := &models.DialysisBeforePrepare{
  1462. UserOrgId: id,
  1463. PatientId: item.PatientId,
  1464. RecordDate: item.RecordDate,
  1465. Count: 1,
  1466. Ctime: item.RecordDate,
  1467. Mtime: item.RecordDate,
  1468. Creater: item.Creater,
  1469. Modifier: item.Creater,
  1470. Status: 1,
  1471. }
  1472. before.GoodId = item.FistulaNeedleSet
  1473. before.GoodTypeId = 246
  1474. service.AddSigleDialysisBeforePre(before)
  1475. }
  1476. if item.FistulaNeedleSet16 > 0 {
  1477. before := &models.DialysisBeforePrepare{
  1478. UserOrgId: id,
  1479. PatientId: item.PatientId,
  1480. RecordDate: item.RecordDate,
  1481. Count: 1,
  1482. Ctime: item.RecordDate,
  1483. Mtime: item.RecordDate,
  1484. Creater: item.Creater,
  1485. Modifier: item.Creater,
  1486. Status: 1,
  1487. }
  1488. before.GoodId = item.FistulaNeedleSet16
  1489. before.GoodTypeId = 246
  1490. service.AddSigleDialysisBeforePre(before)
  1491. }
  1492. if item.Hemoperfusion > 0 {
  1493. before := &models.DialysisBeforePrepare{
  1494. UserOrgId: id,
  1495. PatientId: item.PatientId,
  1496. RecordDate: item.RecordDate,
  1497. Count: 1,
  1498. Ctime: item.RecordDate,
  1499. Mtime: item.RecordDate,
  1500. Creater: item.Creater,
  1501. Modifier: item.Creater,
  1502. Status: 1,
  1503. }
  1504. before.GoodId = item.Hemoperfusion
  1505. before.GoodTypeId = 248
  1506. service.AddSigleDialysisBeforePre(before)
  1507. }
  1508. if item.DialyserSterilised > 0 {
  1509. before := &models.DialysisBeforePrepare{
  1510. UserOrgId: id,
  1511. PatientId: item.PatientId,
  1512. RecordDate: item.RecordDate,
  1513. Count: 1,
  1514. Ctime: item.RecordDate,
  1515. Mtime: item.RecordDate,
  1516. Creater: item.Creater,
  1517. Modifier: item.Creater,
  1518. Status: 1,
  1519. }
  1520. before.GoodId = item.DialyserSterilised
  1521. before.GoodTypeId = 247
  1522. service.AddSigleDialysisBeforePre(before)
  1523. }
  1524. if item.Filtryzer > 0 {
  1525. before := &models.DialysisBeforePrepare{
  1526. UserOrgId: id,
  1527. PatientId: item.PatientId,
  1528. RecordDate: item.RecordDate,
  1529. Count: 1,
  1530. Ctime: item.RecordDate,
  1531. Mtime: item.RecordDate,
  1532. Creater: item.Creater,
  1533. Modifier: item.Creater,
  1534. Status: 1,
  1535. }
  1536. before.GoodId = item.Filtryzer
  1537. before.GoodTypeId = 247
  1538. service.AddSigleDialysisBeforePre(before)
  1539. }
  1540. if item.Dialyzers > 0 {
  1541. before := &models.DialysisBeforePrepare{
  1542. UserOrgId: id,
  1543. PatientId: item.PatientId,
  1544. RecordDate: item.RecordDate,
  1545. Count: 1,
  1546. Ctime: item.RecordDate,
  1547. Mtime: item.RecordDate,
  1548. Creater: item.Creater,
  1549. Modifier: item.Creater,
  1550. Status: 1,
  1551. }
  1552. before.GoodId = item.Dialyzers
  1553. before.GoodTypeId = 247
  1554. service.AddSigleDialysisBeforePre(before)
  1555. }
  1556. if item.Injector > 0 {
  1557. before := &models.DialysisBeforePrepare{
  1558. UserOrgId: id,
  1559. PatientId: item.PatientId,
  1560. RecordDate: item.RecordDate,
  1561. Count: 1,
  1562. Ctime: item.RecordDate,
  1563. Mtime: item.RecordDate,
  1564. Creater: item.Creater,
  1565. Modifier: item.Creater,
  1566. Status: 1,
  1567. }
  1568. before.GoodId = item.Injector
  1569. before.GoodTypeId = 251
  1570. service.AddSigleDialysisBeforePre(before)
  1571. }
  1572. if item.Bloodlines > 0 {
  1573. before := &models.DialysisBeforePrepare{
  1574. UserOrgId: id,
  1575. PatientId: item.PatientId,
  1576. RecordDate: item.RecordDate,
  1577. Count: 1,
  1578. Ctime: item.RecordDate,
  1579. Mtime: item.RecordDate,
  1580. Creater: item.Creater,
  1581. Modifier: item.Creater,
  1582. Status: 1,
  1583. }
  1584. before.GoodId = item.Bloodlines
  1585. before.GoodTypeId = 249
  1586. service.AddSigleDialysisBeforePre(before)
  1587. }
  1588. if item.TubingHemodialysis > 0 {
  1589. before := &models.DialysisBeforePrepare{
  1590. UserOrgId: id,
  1591. PatientId: item.PatientId,
  1592. RecordDate: item.RecordDate,
  1593. Count: 1,
  1594. Ctime: item.RecordDate,
  1595. Mtime: item.RecordDate,
  1596. Creater: item.Creater,
  1597. Modifier: item.Creater,
  1598. Status: 1,
  1599. }
  1600. before.GoodId = item.TubingHemodialysis
  1601. before.GoodTypeId = 250
  1602. service.AddSigleDialysisBeforePre(before)
  1603. }
  1604. if item.Package > 0 {
  1605. before := &models.DialysisBeforePrepare{
  1606. UserOrgId: id,
  1607. PatientId: item.PatientId,
  1608. RecordDate: item.RecordDate,
  1609. Count: 1,
  1610. Ctime: item.RecordDate,
  1611. Mtime: item.RecordDate,
  1612. Creater: item.Creater,
  1613. Modifier: item.Creater,
  1614. Status: 1,
  1615. }
  1616. before.GoodId = item.Package
  1617. before.GoodTypeId = 252
  1618. service.AddSigleDialysisBeforePre(before)
  1619. }
  1620. if item.ALiquid > 0 {
  1621. before := &models.DialysisBeforePrepare{
  1622. UserOrgId: id,
  1623. PatientId: item.PatientId,
  1624. RecordDate: item.RecordDate,
  1625. Count: 1,
  1626. Ctime: item.RecordDate,
  1627. Mtime: item.RecordDate,
  1628. Creater: item.Creater,
  1629. Modifier: item.Creater,
  1630. Status: 1,
  1631. }
  1632. before.GoodId = item.ALiquid
  1633. before.GoodTypeId = 255
  1634. service.AddSigleDialysisBeforePre(before)
  1635. }
  1636. }
  1637. } else if id == 9883 {
  1638. for _, item := range prescriptions {
  1639. if item.Niprocart > 0 {
  1640. before := &models.DialysisBeforePrepare{
  1641. UserOrgId: id,
  1642. PatientId: item.PatientId,
  1643. RecordDate: item.RecordDate,
  1644. Count: 1,
  1645. Ctime: item.RecordDate,
  1646. Mtime: item.RecordDate,
  1647. Creater: item.Creater,
  1648. Modifier: item.Creater,
  1649. Status: 1,
  1650. }
  1651. before.GoodId = item.Niprocart
  1652. before.GoodTypeId = 267
  1653. service.AddSigleDialysisBeforePre(before)
  1654. }
  1655. if item.Jms > 0 {
  1656. before := &models.DialysisBeforePrepare{
  1657. UserOrgId: id,
  1658. PatientId: item.PatientId,
  1659. RecordDate: item.RecordDate,
  1660. Count: 1,
  1661. Ctime: item.RecordDate,
  1662. Mtime: item.RecordDate,
  1663. Creater: item.Creater,
  1664. Modifier: item.Creater,
  1665. Status: 1,
  1666. }
  1667. before.GoodId = item.Jms
  1668. before.GoodTypeId = 259
  1669. service.AddSigleDialysisBeforePre(before)
  1670. }
  1671. if item.FistulaNeedleSet > 0 {
  1672. before := &models.DialysisBeforePrepare{
  1673. UserOrgId: id,
  1674. PatientId: item.PatientId,
  1675. RecordDate: item.RecordDate,
  1676. Count: 1,
  1677. Ctime: item.RecordDate,
  1678. Mtime: item.RecordDate,
  1679. Creater: item.Creater,
  1680. Modifier: item.Creater,
  1681. Status: 1,
  1682. }
  1683. before.GoodId = item.FistulaNeedleSet
  1684. before.GoodTypeId = 259
  1685. service.AddSigleDialysisBeforePre(before)
  1686. }
  1687. if item.FistulaNeedleSet16 > 0 {
  1688. before := &models.DialysisBeforePrepare{
  1689. UserOrgId: id,
  1690. PatientId: item.PatientId,
  1691. RecordDate: item.RecordDate,
  1692. Count: 1,
  1693. Ctime: item.RecordDate,
  1694. Mtime: item.RecordDate,
  1695. Creater: item.Creater,
  1696. Modifier: item.Creater,
  1697. Status: 1,
  1698. }
  1699. before.GoodId = item.FistulaNeedleSet16
  1700. before.GoodTypeId = 259
  1701. service.AddSigleDialysisBeforePre(before)
  1702. }
  1703. if item.Hemoperfusion > 0 {
  1704. before := &models.DialysisBeforePrepare{
  1705. UserOrgId: id,
  1706. PatientId: item.PatientId,
  1707. RecordDate: item.RecordDate,
  1708. Count: 1,
  1709. Ctime: item.RecordDate,
  1710. Mtime: item.RecordDate,
  1711. Creater: item.Creater,
  1712. Modifier: item.Creater,
  1713. Status: 1,
  1714. }
  1715. before.GoodId = item.Hemoperfusion
  1716. before.GoodTypeId = 261
  1717. service.AddSigleDialysisBeforePre(before)
  1718. }
  1719. if item.DialyserSterilised > 0 {
  1720. before := &models.DialysisBeforePrepare{
  1721. UserOrgId: id,
  1722. PatientId: item.PatientId,
  1723. RecordDate: item.RecordDate,
  1724. Count: 1,
  1725. Ctime: item.RecordDate,
  1726. Mtime: item.RecordDate,
  1727. Creater: item.Creater,
  1728. Modifier: item.Creater,
  1729. Status: 1,
  1730. }
  1731. before.GoodId = item.DialyserSterilised
  1732. before.GoodTypeId = 260
  1733. service.AddSigleDialysisBeforePre(before)
  1734. }
  1735. if item.Filtryzer > 0 {
  1736. before := &models.DialysisBeforePrepare{
  1737. UserOrgId: id,
  1738. PatientId: item.PatientId,
  1739. RecordDate: item.RecordDate,
  1740. Count: 1,
  1741. Ctime: item.RecordDate,
  1742. Mtime: item.RecordDate,
  1743. Creater: item.Creater,
  1744. Modifier: item.Creater,
  1745. Status: 1,
  1746. }
  1747. before.GoodId = item.Filtryzer
  1748. before.GoodTypeId = 260
  1749. service.AddSigleDialysisBeforePre(before)
  1750. }
  1751. if item.Dialyzers > 0 {
  1752. before := &models.DialysisBeforePrepare{
  1753. UserOrgId: id,
  1754. PatientId: item.PatientId,
  1755. RecordDate: item.RecordDate,
  1756. Count: 1,
  1757. Ctime: item.RecordDate,
  1758. Mtime: item.RecordDate,
  1759. Creater: item.Creater,
  1760. Modifier: item.Creater,
  1761. Status: 1,
  1762. }
  1763. before.GoodId = item.Dialyzers
  1764. before.GoodTypeId = 260
  1765. service.AddSigleDialysisBeforePre(before)
  1766. }
  1767. if item.Injector > 0 {
  1768. before := &models.DialysisBeforePrepare{
  1769. UserOrgId: id,
  1770. PatientId: item.PatientId,
  1771. RecordDate: item.RecordDate,
  1772. Count: 1,
  1773. Ctime: item.RecordDate,
  1774. Mtime: item.RecordDate,
  1775. Creater: item.Creater,
  1776. Modifier: item.Creater,
  1777. Status: 1,
  1778. }
  1779. before.GoodId = item.Injector
  1780. before.GoodTypeId = 264
  1781. service.AddSigleDialysisBeforePre(before)
  1782. }
  1783. if item.Bloodlines > 0 {
  1784. before := &models.DialysisBeforePrepare{
  1785. UserOrgId: id,
  1786. PatientId: item.PatientId,
  1787. RecordDate: item.RecordDate,
  1788. Count: 1,
  1789. Ctime: item.RecordDate,
  1790. Mtime: item.RecordDate,
  1791. Creater: item.Creater,
  1792. Modifier: item.Creater,
  1793. Status: 1,
  1794. }
  1795. before.GoodId = item.Bloodlines
  1796. before.GoodTypeId = 262
  1797. service.AddSigleDialysisBeforePre(before)
  1798. }
  1799. if item.TubingHemodialysis > 0 {
  1800. before := &models.DialysisBeforePrepare{
  1801. UserOrgId: id,
  1802. PatientId: item.PatientId,
  1803. RecordDate: item.RecordDate,
  1804. Count: 1,
  1805. Ctime: item.RecordDate,
  1806. Mtime: item.RecordDate,
  1807. Creater: item.Creater,
  1808. Modifier: item.Creater,
  1809. Status: 1,
  1810. }
  1811. before.GoodId = item.TubingHemodialysis
  1812. before.GoodTypeId = 263
  1813. service.AddSigleDialysisBeforePre(before)
  1814. }
  1815. if item.Package > 0 {
  1816. before := &models.DialysisBeforePrepare{
  1817. UserOrgId: id,
  1818. PatientId: item.PatientId,
  1819. RecordDate: item.RecordDate,
  1820. Count: 1,
  1821. Ctime: item.RecordDate,
  1822. Mtime: item.RecordDate,
  1823. Creater: item.Creater,
  1824. Modifier: item.Creater,
  1825. Status: 1,
  1826. }
  1827. before.GoodId = item.Package
  1828. before.GoodTypeId = 265
  1829. service.AddSigleDialysisBeforePre(before)
  1830. }
  1831. if item.ALiquid > 0 {
  1832. before := &models.DialysisBeforePrepare{
  1833. UserOrgId: id,
  1834. PatientId: item.PatientId,
  1835. RecordDate: item.RecordDate,
  1836. Count: 1,
  1837. Ctime: item.RecordDate,
  1838. Mtime: item.RecordDate,
  1839. Creater: item.Creater,
  1840. Modifier: item.Creater,
  1841. Status: 1,
  1842. }
  1843. before.GoodId = item.ALiquid
  1844. before.GoodTypeId = 268
  1845. service.AddSigleDialysisBeforePre(before)
  1846. }
  1847. }
  1848. }
  1849. }
  1850. }
  1851. func (c *PublicApiController) HandleHIS() {
  1852. his, _ := service.GetAllHisInfo(9919)
  1853. for _, item := range his {
  1854. fsn := strings.Split(item.FeedetlSn, "-")
  1855. item.FeedetlSn = fsn[0] + "-" + fsn[1] + "-" + strconv.FormatInt(item.ID, 10)
  1856. fmt.Println(item.FeedetlSn)
  1857. service.UpDateHis2(item)
  1858. }
  1859. }
  1860. func (c *PublicApiController) HandleOrder() {
  1861. orders, _ := service.GetAllHisOrder(10106)
  1862. record, _ := service.FindFapiaoByIsUse(10106)
  1863. last_order, _ := service.GetAllHisOrderTwo(10106)
  1864. if record.ID > 0 {
  1865. for index, item := range orders {
  1866. item.FaPiaoCode = record.FapiaoCode
  1867. var zero string
  1868. max_number, _ := strconv.ParseInt(last_order.FaPiaoNumber, 10, 64)
  1869. number, _ := strconv.ParseInt(record.FapiaoNumber, 10, 64)
  1870. number = number + max_number
  1871. if number+int64(index) >= 1000 {
  1872. zero = "0000" + strconv.FormatInt(number+int64(index), 10)
  1873. } else if number+int64(index) >= 10000 {
  1874. zero = "000" + strconv.FormatInt(number+int64(index), 10)
  1875. } else if number+int64(index) >= 100000 {
  1876. zero = "00" + strconv.FormatInt(number+int64(index), 10)
  1877. } else if number+int64(index) >= 1000000 {
  1878. zero = "0" + strconv.FormatInt(number+int64(index), 10)
  1879. } else {
  1880. zero = strconv.FormatInt(number+int64(index), 10)
  1881. }
  1882. item.FaPiaoNumber = zero
  1883. item.FaPiaoBatchnumberId = record.ID
  1884. service.SaveOrder(item)
  1885. }
  1886. }
  1887. }
  1888. func Mkdir(dir string) {
  1889. // 创建文件夹
  1890. exist, err := PathExists(dir)
  1891. if err != nil {
  1892. fmt.Println(err.Error())
  1893. } else {
  1894. if exist {
  1895. fmt.Println(dir + "文件夹已存在!")
  1896. } else {
  1897. // 文件夹名称,权限
  1898. err := os.Mkdir(dir, os.ModePerm)
  1899. if err != nil {
  1900. fmt.Println(dir+"文件夹创建失败:", err.Error())
  1901. } else {
  1902. fmt.Println(dir + "文件夹创建成功!")
  1903. }
  1904. }
  1905. }
  1906. }
  1907. func PathExists(path string) (bool, error) {
  1908. _, err := os.Stat(path)
  1909. if err == nil {
  1910. return true, nil
  1911. }
  1912. if os.IsNotExist(err) {
  1913. return false, nil
  1914. }
  1915. return false, err
  1916. }
  1917. func (c *PublicApiController) Handle10215() {
  1918. //projects,_ := service.GetAllInfo(10215,2284)
  1919. //
  1920. //for _, item := range projects{
  1921. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1922. //}
  1923. //projects_two,_ := service.GetAllInfo(10215,2277)
  1924. //
  1925. //for _, item := range projects_two{
  1926. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1927. //}
  1928. //service.GetAllInfo(10215,2284)
  1929. //service.GetAllInfo(10215,2277)
  1930. his, _ := service.GetAllPT(10215)
  1931. for _, item := range his {
  1932. //
  1933. //pro := &models.HisPrescriptionProjectTemplate{
  1934. // ProjectId: 1750,
  1935. // Price: 6.00,
  1936. // UserOrgId: 10215,
  1937. // Status: 1,
  1938. // Ctime: time.Now().Unix(),
  1939. // Mtime: time.Now().Unix(),
  1940. // PatientId: item.PatientId,
  1941. // RecordDate: 0,
  1942. // Count: 1,
  1943. // FeedetlSn: "",
  1944. // MedListCodg: "",
  1945. // SingleDose: "1",
  1946. // DeliveryWay: "",
  1947. // ExecutionFrequency: "",
  1948. // Day: "1",
  1949. // Remark: "",
  1950. // Unit: "",
  1951. // Type: 2,
  1952. // PrescriptionId: info.ID,
  1953. // FrequencyType: 1,
  1954. // DayCount: 0,
  1955. // WeekDay: "",
  1956. //}
  1957. //service.CreateHisPrescriptionProjectTemplate(pro)
  1958. //
  1959. //pro2 := &models.HisPrescriptionProjectTemplate{
  1960. // ProjectId: 2462,
  1961. // Price: 4.94,
  1962. // UserOrgId: 10215,
  1963. // Status: 1,
  1964. // Ctime: time.Now().Unix(),
  1965. // Mtime: time.Now().Unix(),
  1966. // PatientId: item.PatientId,
  1967. // RecordDate: 0,
  1968. // Count: 1,
  1969. // FeedetlSn: "",
  1970. // MedListCodg: "",
  1971. // SingleDose: "1",
  1972. // DeliveryWay: "",
  1973. // ExecutionFrequency: "",
  1974. // Day: "1",
  1975. // Remark: "",
  1976. // Unit: "",
  1977. // Type: 3,
  1978. // PrescriptionId: info.ID,
  1979. // FrequencyType: 1,
  1980. // DayCount: 0,
  1981. // WeekDay: "",
  1982. //}
  1983. //service.CreateHisPrescriptionProjectTemplate(pro2)
  1984. //
  1985. //
  1986. infos, _ := service.GetAllPTInfo(10215, item.ID)
  1987. // // fmt.Println(infos)
  1988. for _, subItem := range infos {
  1989. if len(subItem.HisPrescriptionAdviceTemplate) > 0 && len(subItem.HisPrescriptionProjectTemplate) == 0 {
  1990. for _, ssubItem := range subItem.HisPrescriptionAdviceTemplate {
  1991. //if ssubItem.DrugId == 1234 {
  1992. // pro := &models.HisPrescriptionProjectTemplate{
  1993. // ProjectId: 2326,
  1994. // Price: 0.86,
  1995. // UserOrgId: ssubItem.UserOrgId,
  1996. // Status: 1,
  1997. // Ctime: time.Now().Unix(),
  1998. // Mtime: time.Now().Unix(),
  1999. // PatientId: ssubItem.PatientId,
  2000. // RecordDate: ssubItem.AdviceDate,
  2001. // Count: 1,
  2002. // FeedetlSn: "",
  2003. // MedListCodg: "",
  2004. // SingleDose: "1",
  2005. // DeliveryWay: "",
  2006. // ExecutionFrequency: "",
  2007. // Day: "1",
  2008. // Remark: "",
  2009. // Unit: "",
  2010. // Type: 3,
  2011. // PrescriptionId: info.ID,
  2012. // FrequencyType: ssubItem.FrequencyType,
  2013. // DayCount: ssubItem.DayCount,
  2014. // WeekDay: ssubItem.WeekDay,
  2015. // }
  2016. // service.CreateHisPrescriptionProjectTemplate(pro)
  2017. //
  2018. //}
  2019. if ssubItem.DrugId == 1288 {
  2020. info := &models.HisPrescriptionInfoTemplate{
  2021. UserOrgId: item.UserOrgId,
  2022. RecordDate: 0,
  2023. PatientId: item.PatientId,
  2024. Status: 1,
  2025. Ctime: time.Now().Unix(),
  2026. Mtime: time.Now().Unix(),
  2027. Type: 2,
  2028. Creator: 0,
  2029. Modifier: 0,
  2030. PType: 0,
  2031. PTemplateId: item.ID,
  2032. MedType: "14",
  2033. }
  2034. service.CreateHisPrescriptionInfoTemplate(info)
  2035. pro2 := &models.HisPrescriptionProjectTemplate{
  2036. ProjectId: 1727,
  2037. Price: 2.50,
  2038. UserOrgId: ssubItem.UserOrgId,
  2039. Status: 1,
  2040. Ctime: time.Now().Unix(),
  2041. Mtime: time.Now().Unix(),
  2042. PatientId: ssubItem.PatientId,
  2043. RecordDate: ssubItem.AdviceDate,
  2044. Count: "1",
  2045. FeedetlSn: "",
  2046. MedListCodg: "",
  2047. SingleDose: "1",
  2048. DeliveryWay: "",
  2049. ExecutionFrequency: "",
  2050. Day: "1",
  2051. Remark: "",
  2052. Unit: "",
  2053. Type: 2,
  2054. PrescriptionId: info.ID,
  2055. FrequencyType: ssubItem.FrequencyType,
  2056. DayCount: ssubItem.DayCount,
  2057. WeekDay: ssubItem.WeekDay,
  2058. }
  2059. service.CreateHisPrescriptionProjectTemplate(pro2)
  2060. //pro := &models.HisPrescriptionProjectTemplate{
  2061. // ProjectId: 2326,
  2062. // Price: 0.86,
  2063. // UserOrgId: ssubItem.UserOrgId,
  2064. // Status: 1,
  2065. // Ctime: time.Now().Unix(),
  2066. // Mtime: time.Now().Unix(),
  2067. // PatientId: ssubItem.PatientId,
  2068. // RecordDate: ssubItem.AdviceDate,
  2069. // Count: 1,
  2070. // FeedetlSn: "",
  2071. // MedListCodg: "",
  2072. // SingleDose: "1",
  2073. // DeliveryWay: "",
  2074. // ExecutionFrequency: "",
  2075. // Day: "1",
  2076. // Remark: "",
  2077. // Unit: "",
  2078. // Type: 3,
  2079. // PrescriptionId: info.ID,
  2080. // FrequencyType: ssubItem.FrequencyType,
  2081. // DayCount: ssubItem.DayCount,
  2082. // WeekDay: ssubItem.WeekDay,
  2083. //}
  2084. //service.CreateHisPrescriptionProjectTemplate(pro)
  2085. }
  2086. //if ssubItem.DrugId == 1306 {
  2087. //
  2088. // pro := &models.HisPrescriptionProjectTemplate{
  2089. // ProjectId: 2325,
  2090. // Price: 1.11,
  2091. // UserOrgId: ssubItem.UserOrgId,
  2092. // Status: 1,
  2093. // Ctime: time.Now().Unix(),
  2094. // Mtime: time.Now().Unix(),
  2095. // PatientId: ssubItem.PatientId,
  2096. // RecordDate: ssubItem.AdviceDate,
  2097. // Count: 1,
  2098. // FeedetlSn: "",
  2099. // MedListCodg: "",
  2100. // SingleDose: "1",
  2101. // DeliveryWay: "",
  2102. // ExecutionFrequency: "",
  2103. // Day: "1",
  2104. // Remark: "",
  2105. // Unit: "",
  2106. // Type: 3,
  2107. // PrescriptionId: info.ID,
  2108. // FrequencyType: ssubItem.FrequencyType,
  2109. // DayCount: ssubItem.DayCount,
  2110. // WeekDay: ssubItem.WeekDay,
  2111. // }
  2112. // service.CreateHisPrescriptionProjectTemplate(pro)
  2113. //
  2114. // pro2 := &models.HisPrescriptionProjectTemplate{
  2115. // ProjectId: 1727,
  2116. // Price: 2.50,
  2117. // UserOrgId: ssubItem.UserOrgId,
  2118. // Status: 1,
  2119. // Ctime: time.Now().Unix(),
  2120. // Mtime: time.Now().Unix(),
  2121. // PatientId: ssubItem.PatientId,
  2122. // RecordDate: ssubItem.AdviceDate,
  2123. // Count: 1,
  2124. // FeedetlSn: "",
  2125. // MedListCodg: "",
  2126. // SingleDose: "1",
  2127. // DeliveryWay: "",
  2128. // ExecutionFrequency: "",
  2129. // Day: "1",
  2130. // Remark: "",
  2131. // Unit: "",
  2132. // Type: 2,
  2133. // PrescriptionId: info.ID,
  2134. // FrequencyType: ssubItem.FrequencyType,
  2135. // DayCount: ssubItem.DayCount,
  2136. // WeekDay: ssubItem.WeekDay,
  2137. // }
  2138. // service.CreateHisPrescriptionProjectTemplate(pro2)
  2139. //
  2140. //}
  2141. //if ssubItem.DrugId == 1291 {
  2142. //
  2143. // pro := &models.HisPrescriptionProjectTemplate{
  2144. // ProjectId: 2322,
  2145. // Price: 0.68,
  2146. // UserOrgId: ssubItem.UserOrgId,
  2147. // Status: 1,
  2148. // Ctime: time.Now().Unix(),
  2149. // Mtime: time.Now().Unix(),
  2150. // PatientId: ssubItem.PatientId,
  2151. // RecordDate: ssubItem.AdviceDate,
  2152. // Count: 1,
  2153. // FeedetlSn: "",
  2154. // MedListCodg: "",
  2155. // SingleDose: "1",
  2156. // DeliveryWay: "",
  2157. // ExecutionFrequency: "",
  2158. // Day: "1",
  2159. // Remark: "",
  2160. // Unit: "",
  2161. // Type: 3,
  2162. // PrescriptionId: info.ID,
  2163. // FrequencyType: ssubItem.FrequencyType,
  2164. // DayCount: ssubItem.DayCount,
  2165. // WeekDay: ssubItem.WeekDay,
  2166. // }
  2167. // service.CreateHisPrescriptionProjectTemplate(pro)
  2168. //
  2169. // pro2 := &models.HisPrescriptionProjectTemplate{
  2170. // ProjectId: 1727,
  2171. // Price: 2.50,
  2172. // UserOrgId: ssubItem.UserOrgId,
  2173. // Status: 1,
  2174. // Ctime: time.Now().Unix(),
  2175. // Mtime: time.Now().Unix(),
  2176. // PatientId: ssubItem.PatientId,
  2177. // RecordDate: ssubItem.AdviceDate,
  2178. // Count: 1,
  2179. // FeedetlSn: "",
  2180. // MedListCodg: "",
  2181. // SingleDose: "1",
  2182. // DeliveryWay: "",
  2183. // ExecutionFrequency: "",
  2184. // Day: "1",
  2185. // Remark: "",
  2186. // Unit: "",
  2187. // Type: 2,
  2188. // PrescriptionId: info.ID,
  2189. // FrequencyType: ssubItem.FrequencyType,
  2190. // DayCount: ssubItem.DayCount,
  2191. // WeekDay: ssubItem.WeekDay,
  2192. // }
  2193. // service.CreateHisPrescriptionProjectTemplate(pro2)
  2194. //}
  2195. }
  2196. }
  2197. }
  2198. }
  2199. }
  2200. func (c *PublicApiController) HandleExportAllData() {
  2201. orders, _ := service.GetHisOrderDetail9504()
  2202. c.ServeSuccessJSON(map[string]interface{}{
  2203. "order": orders,
  2204. })
  2205. }
  2206. func (c *PublicApiController) HandleExportData10138() {
  2207. orders, _ := service.GetHisOrderDetail10138()
  2208. c.ServeSuccessJSON(map[string]interface{}{
  2209. "order": orders,
  2210. })
  2211. }
  2212. func (c *PublicApiController) HandleData10265() {
  2213. orders, _ := service.GetHisOrder10265()
  2214. for _, items := range orders {
  2215. if items.AdviceId == 0 && items.ProjectId > 0 {
  2216. p, _ := service.GetHisPrescriptionProjectByIDTwo(items.ProjectId)
  2217. if p.Type == 2 {
  2218. if p.HisProject.CostClassify == 3 {
  2219. items.MedChrgitmType = "04"
  2220. }
  2221. if p.HisProject.CostClassify == 2 {
  2222. items.MedChrgitmType = "05"
  2223. }
  2224. if p.HisProject.CostClassify == 8 {
  2225. items.MedChrgitmType = "03"
  2226. }
  2227. //p.HisProject.CostClassify == 8
  2228. } else {
  2229. items.MedChrgitmType = "08"
  2230. }
  2231. }
  2232. service.SaveOrderInfo(items)
  2233. }
  2234. }
  2235. //func (c *PublicApiController) HandleData10265two() {
  2236. // orders, _ := service.GetHisOrder10265two()
  2237. // for _, items := range orders {
  2238. // if items.AdviceId == 0 && items.ProjectId > 0 {
  2239. // p, _ := service.GetHisPrescriptionProjectByIDTwoone(items.ProjectId)
  2240. // if p.Type == 2 {
  2241. // if p.HisProject.MedicalCoverage == 1 {
  2242. // items.ChrgitmLv = "01"
  2243. // } else if p.HisProject.MedicalCoverage == 2 {
  2244. // items.ChrgitmLv = "02"
  2245. // } else {
  2246. // items.ChrgitmLv = "03"
  2247. // }
  2248. // } else {
  2249. // if p.GoodInfo.MedicalInsuranceLevel == 1 {
  2250. // items.ChrgitmLv = "01"
  2251. // } else if p.GoodInfo.MedicalInsuranceLevel == 2 {
  2252. // items.ChrgitmLv = "02"
  2253. // } else {
  2254. // items.ChrgitmLv = "03"
  2255. // }
  2256. // }
  2257. // }
  2258. // if items.AdviceId > 0 && items.ProjectId == 0 {
  2259. // info, _ := service.GetHisDoctorAdviceInfo(items.AdviceId)
  2260. // if info.Drug.MedicalInsuranceLevel == 1 {
  2261. // items.ChrgitmLv = "01"
  2262. // } else if info.Drug.MedicalInsuranceLevel == 2 {
  2263. // items.ChrgitmLv = "02"
  2264. // } else {
  2265. // items.ChrgitmLv = "03"
  2266. // }
  2267. // }
  2268. // service.SaveOrderInfo(items)
  2269. // }
  2270. //}
  2271. //func (c *PublicApiController) HandleOrderInfoData() {
  2272. // orders, _ := service.GetHisOrderInfoDetail()
  2273. // c.ServeSuccessJSON(map[string]interface{}{
  2274. // "info": orders,
  2275. // })
  2276. //}
  2277. //
  2278. //func (c *PublicApiController)HandleOrderInfoData10138(){
  2279. // start_time := c.GetString("start_time")
  2280. // end_time := c.GetString("end_time")
  2281. // timeLayout := "2006-01-02"
  2282. // loc, _ := time.LoadLocation("Local")
  2283. // startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  2284. // if err != nil {
  2285. //
  2286. // }
  2287. // startRecordDateTime := startTime.Unix()
  2288. // endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  2289. // if err != nil {
  2290. //
  2291. // }
  2292. // endRecordDateTime := endTime.Unix()
  2293. // orders, _ := service.GetHisAllPatientOrder(startRecordDateTime,endRecordDateTime)
  2294. // for _, item := range orders{
  2295. // for _, subItem := range item.HisOrder10138{
  2296. // info, _ := service.GetHisOrderInfoDetail10138(subItem.Number)
  2297. // subItem.VmHisOrderInfo9504 = info
  2298. // }
  2299. // }
  2300. // c.ServeSuccessJSON(map[string]interface{}{
  2301. // "info": orders,
  2302. // })
  2303. //
  2304. //}