public_api_controller.go 54KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061
  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. }
  65. func (c *PublicApiController) GetDoctorAdviceConfig() {
  66. drugs, _, _ := service.GetPublicDrugDics()
  67. drugways, _, _ := service.GetPublicDrugWayDics()
  68. efs, _, _ := service.GetPublicExecutionFrequencyDics()
  69. c.ServeSuccessJSON(map[string]interface{}{
  70. "drugs": drugs,
  71. "drugways": drugways,
  72. "efs": efs,
  73. })
  74. }
  75. func (c *PublicApiController) GetServerTime() {
  76. timeNow := time.Now()
  77. timeNowStamp := timeNow.Unix()
  78. timeNowStr := timeNow.Format("2006-01-02 15:04:05")
  79. c.ServeSuccessJSON(map[string]interface{}{
  80. "time": timeNowStr,
  81. "timestamp": timeNowStamp,
  82. })
  83. }
  84. func (c *PublicApiController) AppRelease() {
  85. // appId := c.GetString("appid")
  86. version := c.GetString("version")
  87. appType, _ := c.GetInt64("app_type", 0)
  88. appVersion, err := service.GetAppVersionByAppType(appType)
  89. if err != nil {
  90. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  91. return
  92. }
  93. if appVersion == nil {
  94. c.ServeSuccessJSON(map[string]interface{}{
  95. "version": nil,
  96. "state": 2,
  97. })
  98. return
  99. }
  100. state := strings.Compare(version, appVersion.Version)
  101. // state := 1
  102. if state < 0 {
  103. c.ServeSuccessJSON(map[string]interface{}{
  104. "version": appVersion,
  105. "state": appVersion.Status,
  106. })
  107. return
  108. }
  109. c.ServeSuccessJSON(map[string]interface{}{
  110. "version": nil,
  111. "state": 2,
  112. })
  113. return
  114. }
  115. func (this *PublicApiController) GetJson() {
  116. type Global struct {
  117. DeviceSN string
  118. Version string
  119. Timestamp string
  120. InterfaceSource string
  121. }
  122. type RBPResultModel struct {
  123. Sys string
  124. Dia string
  125. HR string
  126. MeasureTime string
  127. }
  128. type ScannerResultModel struct {
  129. Code string
  130. }
  131. type IDCardResultModel struct {
  132. IDCardNo string
  133. UserName string
  134. Age string
  135. Female string
  136. Male string
  137. SocialSecurityNo string
  138. }
  139. type JsonTemp struct {
  140. Global Global
  141. RBPResultModel RBPResultModel
  142. ScannerResultModel ScannerResultModel
  143. IDCardResultModel IDCardResultModel
  144. }
  145. var person JsonTemp
  146. err3 := json.Unmarshal([]byte(this.GetString("params")), &person)
  147. fmt.Println(err3)
  148. fmt.Println(person.Global)
  149. //temp := JsonTemp{
  150. // Global:Global{
  151. // DeviceSN:"1122",
  152. // Version:"1122",
  153. // Timestamp:"1222",
  154. // InterfaceSource:"1233",
  155. // },
  156. // RBPResultModel: RBPResultModel{
  157. // Sys:"12",
  158. // Dia:"22",
  159. // HR:"23",
  160. // MeasureTime:"123",
  161. // },
  162. // ScannerResultModel:ScannerResultModel{
  163. // Code:"1233",
  164. // },
  165. // IDCardResultModel:IDCardResultModel{
  166. // IDCardNo:"123",
  167. // UserName:"123",
  168. // Age:"123",
  169. // Female:"123",
  170. // Male:"123",
  171. // SocialSecurityNo:"123",
  172. // },
  173. //}
  174. //
  175. //jsonBytes, err := json.Marshal(temp)
  176. //if err != nil {
  177. // fmt.Println(err)
  178. //}
  179. //fmt.Println(string(jsonBytes))
  180. }
  181. func (c *PublicApiController) HandleData() {
  182. //service.HandleData()
  183. org_app, _ := service.GetAllAppOrg()
  184. //org_role, _ := service.GetAllRole()
  185. //
  186. //var org_ids []int64
  187. for _, apps := range org_app {
  188. xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
  189. //org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
  190. //org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
  191. //org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
  192. //org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
  193. //org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
  194. //org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
  195. //org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
  196. //org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
  197. //org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
  198. //org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
  199. //org_app_16, _ := service.GetAppByType(int64(apps.OrgId), 16)
  200. //org_app_17, _ := service.GetAppByType(int64(apps.OrgId), 17)
  201. org_app_18, _ := service.GetAppByType(int64(apps.OrgId), 18)
  202. var xt_temp_org_app *models.OrgApp
  203. //var mall_temp_org_app *models.OrgApp
  204. if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  205. app, _ := service.GetOrgAppA(0, 3)
  206. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  207. if org == nil || org.Id == 0 {
  208. continue
  209. }
  210. app.Id = 0
  211. app.OrgId = apps.OrgId
  212. app.Creator = int(org.Creator)
  213. app.Number = 0
  214. app.Status = 1
  215. app.ModifyTime = time.Now().Unix()
  216. app.CreateTime = time.Now().Unix()
  217. service.CreateOrgApp(app)
  218. xt_temp_org_app = app
  219. } else {
  220. xt_temp_org_app = xt_org_app
  221. }
  222. //if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  223. //
  224. // app, _ := service.GetOrgAppA(0, 1)
  225. // //org, _ := service.GetOrgById(int64(12))
  226. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  227. // if org == nil || org.Id == 0 {
  228. // continue
  229. // }
  230. //
  231. //
  232. // app.OrgId = apps.OrgId
  233. // app.Id = 0
  234. //
  235. // app.Creator = int(org.Creator)
  236. // app.Number = 0
  237. // app.Status = 1
  238. // app.ModifyTime = time.Now().Unix()
  239. // app.CreateTime = time.Now().Unix()
  240. // service.CreateOrgApp(app)
  241. //
  242. //}
  243. //
  244. //if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  245. // app, _ := service.GetOrgAppA(0, 4)
  246. // //org, _ := service.GetOrgById(int64(12))
  247. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  248. // if org == nil || org.Id == 0 {
  249. // continue
  250. // }
  251. //
  252. //
  253. // app.OrgId = apps.OrgId
  254. // app.Creator = int(org.Creator)
  255. // app.Number = 0
  256. // app.Id = 0
  257. //
  258. // app.Status = 1
  259. // app.ModifyTime = time.Now().Unix()
  260. // app.CreateTime = time.Now().Unix()
  261. // service.CreateOrgApp(app)
  262. //}
  263. //
  264. //if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  265. // app, _ := service.GetOrgAppA(0, 5)
  266. // //org, _ := service.GetOrgById(int64(12))
  267. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  268. //
  269. // if org == nil || org.Id == 0 {
  270. // continue
  271. // }
  272. //
  273. // app.OrgId = apps.OrgId
  274. // app.Creator = int(org.Creator)
  275. // app.Number = 0
  276. // app.Id = 0
  277. //
  278. // app.Status = 1
  279. // app.ModifyTime = time.Now().Unix()
  280. // app.CreateTime = time.Now().Unix()
  281. // service.CreateOrgApp(app)
  282. // mall_temp_org_app = app
  283. //} else {
  284. // mall_temp_org_app = mall_org_app
  285. //}
  286. //
  287. //if org_app_16 == nil || org_app_16.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  288. // app, _ := service.GetOrgAppA(0, 16)
  289. // //org, _ := service.GetOrgById(int64(12))
  290. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  291. // if org == nil || org.Id == 0 {
  292. // continue
  293. // }
  294. //
  295. // app.OrgId = apps.OrgId
  296. // app.Creator = int(org.Creator)
  297. // app.Number = 11
  298. // app.Id = 0
  299. // app.Status = 1
  300. // app.ModifyTime = time.Now().Unix()
  301. // app.CreateTime = time.Now().Unix()
  302. // app.Pid = xt_temp_org_app.Id
  303. // service.CreateOrgApp(app)
  304. //
  305. //}
  306. //
  307. //if org_app_17 == nil || org_app_17.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  308. // app, _ := service.GetOrgAppA(0, 17)
  309. // //org, _ := service.GetOrgById(int64(12))
  310. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  311. // if org == nil || org.Id == 0 {
  312. // continue
  313. // }
  314. //
  315. // app.OrgId = apps.OrgId
  316. // app.Creator = int(org.Creator)
  317. // app.Number = 12
  318. // app.Id = 0
  319. // app.Status = 1
  320. // app.ModifyTime = time.Now().Unix()
  321. // app.CreateTime = time.Now().Unix()
  322. // app.Pid = xt_temp_org_app.Id
  323. // service.CreateOrgApp(app)
  324. //
  325. //}
  326. if org_app_18 == nil || org_app_18.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  327. app, _ := service.GetOrgAppA(0, 18)
  328. //org, _ := service.GetOrgById(int64(12))
  329. org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  330. if org == nil || org.Id == 0 {
  331. continue
  332. }
  333. app.OrgId = apps.OrgId
  334. app.Creator = int(org.Creator)
  335. app.Number = 5
  336. app.Id = 0
  337. app.Status = 1
  338. app.ModifyTime = time.Now().Unix()
  339. app.CreateTime = time.Now().Unix()
  340. app.Pid = xt_temp_org_app.Id
  341. service.CreateOrgApp(app)
  342. }
  343. //if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  344. // app, _ := service.GetOrgAppA(0, 7)
  345. // //org, _ := service.GetOrgById(int64(12))
  346. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  347. // if org == nil || org.Id == 0 {
  348. // continue
  349. // }
  350. //
  351. //
  352. // app.OrgId = apps.OrgId
  353. // app.Creator = int(org.Creator)
  354. // app.Number = 2
  355. // app.Status = 2
  356. // app.Id = 0
  357. //
  358. // app.ModifyTime = time.Now().Unix()
  359. // app.CreateTime = time.Now().Unix()
  360. // app.Pid = xt_temp_org_app.Id
  361. //
  362. // service.CreateOrgApp(app)
  363. //}
  364. //if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  365. // app, _ := service.GetOrgAppA(0, 8)
  366. // //org, _ := service.GetOrgById(int64(12))
  367. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  368. // if org == nil || org.Id == 0 {
  369. // continue
  370. // }
  371. //
  372. //
  373. // app.OrgId = apps.OrgId
  374. // app.Creator = int(org.Creator)
  375. // app.Number = 3
  376. // app.Id = 0
  377. //
  378. // app.Pid = mall_temp_org_app.Id
  379. //
  380. // app.Status = 1
  381. // app.ModifyTime = time.Now().Unix()
  382. // app.CreateTime = time.Now().Unix()
  383. // service.CreateOrgApp(app)
  384. //}
  385. //if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  386. // app, _ := service.GetOrgAppA(0, 9)
  387. // //org, _ := service.GetOrgById(int64(12))
  388. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  389. // if org == nil || org.Id == 0 {
  390. // continue
  391. // }
  392. //
  393. //
  394. // app.OrgId = apps.OrgId
  395. // app.Pid = xt_temp_org_app.Id
  396. //
  397. // app.Creator = int(org.Creator)
  398. // app.Number = 4
  399. // app.Id = 0
  400. //
  401. // app.Status = 1
  402. // app.ModifyTime = time.Now().Unix()
  403. // app.CreateTime = time.Now().Unix()
  404. // service.CreateOrgApp(app)
  405. //
  406. //}
  407. //if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  408. // app, _ := service.GetOrgAppA(0, 10)
  409. // //org, _ := service.GetOrgById(int64(12))
  410. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  411. // if org == nil || org.Id == 0 {
  412. // continue
  413. // }
  414. //
  415. //
  416. // app.OrgId = apps.OrgId
  417. // app.Creator = int(org.Creator)
  418. // app.Pid = xt_temp_org_app.Id
  419. //
  420. // app.Number = 5
  421. // app.Id = 0
  422. //
  423. // app.Status = 1
  424. // app.ModifyTime = time.Now().Unix()
  425. // app.CreateTime = time.Now().Unix()
  426. // service.CreateOrgApp(app)
  427. //}
  428. //if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  429. // app, _ := service.GetOrgAppA(0, 11)
  430. // //org, _ := service.GetOrgById(int64(12))
  431. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  432. // if org == nil || org.Id == 0 {
  433. // continue
  434. // }
  435. //
  436. //
  437. // app.OrgId = apps.OrgId
  438. // app.Creator = int(org.Creator)
  439. // app.Pid = xt_temp_org_app.Id
  440. // app.Id = 0
  441. //
  442. // app.Number = 6
  443. // app.Status = 1
  444. // app.ModifyTime = time.Now().Unix()
  445. // app.CreateTime = time.Now().Unix()
  446. // service.CreateOrgApp(app)
  447. //}
  448. //if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  449. // app, _ := service.GetOrgAppA(0, 12)
  450. // //org, _ := service.GetOrgById(int64(12))
  451. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  452. // if org == nil || org.Id == 0 {
  453. // continue
  454. // }
  455. //
  456. //
  457. // app.OrgId = apps.OrgId
  458. // app.Creator = int(org.Creator)
  459. // app.Pid = xt_temp_org_app.Id
  460. // app.Number = 7
  461. // app.Status = 1
  462. // app.Id = 0
  463. //
  464. // app.ModifyTime = time.Now().Unix()
  465. // app.CreateTime = time.Now().Unix()
  466. // service.CreateOrgApp(app)
  467. //}
  468. //if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  469. // app, _ := service.GetOrgAppA(0, 13)
  470. // //org, _ := service.GetOrgById(int64(12))
  471. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  472. // if org == nil || org.Id == 0 {
  473. // continue
  474. // }
  475. //
  476. //
  477. // app.OrgId = apps.OrgId
  478. // app.Creator = int(org.Creator)
  479. // app.Pid = xt_temp_org_app.Id
  480. // app.Number = 8
  481. // app.Id = 0
  482. // app.Status = 1
  483. // app.ModifyTime = time.Now().Unix()
  484. // app.CreateTime = time.Now().Unix()
  485. // service.CreateOrgApp(app)
  486. //}
  487. //if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  488. // app, _ := service.GetOrgAppA(0, 14)
  489. // //org, _ := service.GetOrgById(int64(12))
  490. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  491. // if org == nil || org.Id == 0 {
  492. // continue
  493. // }
  494. //
  495. //
  496. // app.OrgId = apps.OrgId
  497. // app.Creator = int(org.Creator)
  498. // app.Pid = xt_temp_org_app.Id
  499. // app.Id = 0
  500. // app.Number = 9
  501. // app.Status = 1
  502. // app.ModifyTime = time.Now().Unix()
  503. // app.CreateTime = time.Now().Unix()
  504. // service.CreateOrgApp(app)
  505. //}
  506. //if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
  507. // app, _ := service.GetOrgAppA(0, 15)
  508. // //org, _ := service.GetOrgById(int64(12))
  509. // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
  510. // if org == nil || org.Id == 0 {
  511. // continue
  512. // }
  513. //
  514. // app.OrgId = apps.OrgId
  515. // app.Creator = int(org.Creator)
  516. // app.Pid = xt_temp_org_app.Id
  517. // app.Number = 10
  518. // app.Status = 1
  519. // app.Id = 0
  520. // app.ModifyTime = time.Now().Unix()
  521. // app.CreateTime = time.Now().Unix()
  522. // service.CreateOrgApp(app)
  523. //}
  524. }
  525. //for _, role := range org_role {
  526. // org_ids = append(org_ids, role.OrgId)
  527. //}
  528. //
  529. //
  530. ////创建内置角色
  531. //InitRoleAndPurviews(org_ids)
  532. //var org_id int = 0
  533. //管理员
  534. //app_roles := service.GetAllUserRoleByUserTypeOne(org_id)
  535. //for _, item := range app_roles{
  536. // var ids string
  537. // if len(item.RoleIds) == 0{
  538. // ids = strconv.FormatInt( item.RoleId,10)
  539. // }else{
  540. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  541. // }
  542. // service.UpdateRoleIds(item.Id, ids)
  543. //}
  544. //护士医生
  545. //app_roles2 := service.GetAllUserRoleByUserTypeOther()
  546. // for _, item := range app_roles2{
  547. // var ids string
  548. // if len(item.RoleIds) == 0{
  549. // ids = strconv.FormatInt( item.RoleId,10)
  550. // }else{
  551. // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
  552. // }
  553. // if item.UserType == 2{
  554. // role := service.FindRoleByUserTypeOne(item.OrgId)
  555. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  556. //
  557. // } else if item.UserType == 3{
  558. // role := service.FindRoleByUserTypeTwo(item.OrgId)
  559. // ids = ids +"," + strconv.FormatInt(role.Id,10)
  560. // }
  561. // service.UpdateRoleIds(item.Id, ids)
  562. // }
  563. //c.ServeSuccessJSON(map[string]interface{}{
  564. // "msg": "ok",
  565. //})
  566. }
  567. func (c *PublicApiController) HandleGroupNo() {
  568. //service.GetAllPatientChargeDetails(10138, 1634054400)
  569. //pts, _ := service.GetHisPrescriptionTemplateTwo()
  570. //for _, item := range pts {
  571. // if len(item.HisPrescriptionAdviceTemplate) > 0 {
  572. // for index, subItem := range item.HisPrescriptionAdviceTemplate {
  573. // subItem.Groupno = int64(index + 1)
  574. // service.SaveAdviceTemplate(subItem)
  575. // }
  576. // }
  577. //}
  578. }
  579. func InitRoleAndPurviews(org_ids []int64) {
  580. roles := LoadRoleConfig("./role.json").Roles
  581. for _, org_id := range org_ids {
  582. app, _ := service.GetOrgAppB(org_id, 3)
  583. role, _ := service.GetSystemRole(org_id)
  584. if app == nil || app.Id == 0 {
  585. continue
  586. }
  587. if len(role) == 0 {
  588. for _, item := range roles {
  589. role := &models.Role{
  590. RoleName: item.RoleName,
  591. RoleIntro: item.RoleIntroduction,
  592. Creator: 0,
  593. OrgId: org_id,
  594. AppId: app.Id,
  595. IsSuperAdmin: false,
  596. Status: 1,
  597. CreateTime: time.Now().Unix(),
  598. ModifyTime: time.Now().Unix(),
  599. Number: item.Number,
  600. IsSystem: item.IsSystem,
  601. }
  602. err := service.CreateOrgRoleB(role)
  603. if err == nil {
  604. purview := &models.RolePurview{
  605. RoleId: role.Id,
  606. OrgId: org_id,
  607. AppId: role.AppId,
  608. PurviewIds: item.PurviewIds,
  609. Status: 1,
  610. CreateTime: time.Now().Unix(),
  611. ModifyTime: time.Now().Unix(),
  612. }
  613. func_purview := &models.SgjUserRoleFuncPurview{
  614. RoleId: role.Id,
  615. OrgId: org_id,
  616. AppId: role.AppId,
  617. PurviewIds: item.FuncIds,
  618. Status: 1,
  619. Ctime: time.Now().Unix(),
  620. Mtime: time.Now().Unix(),
  621. }
  622. service.CreateRolePurviewB(purview)
  623. service.CreateFuncRolePurviewB(func_purview)
  624. }
  625. }
  626. }
  627. }
  628. }
  629. type RoleConfig struct {
  630. Roles []*models.VMUserRoleAndPurview "json:roles"
  631. }
  632. func LoadRoleConfig(dataFile string) *RoleConfig {
  633. var config RoleConfig
  634. _, filename, _, _ := runtime.Caller(1)
  635. datapath := path.Join(path.Dir(filename), dataFile)
  636. config_file, err := os.Open(datapath)
  637. if err != nil {
  638. emit("Failed to open config file '%s': %s\n", datapath, err)
  639. return &config
  640. }
  641. fi, _ := config_file.Stat()
  642. buffer := make([]byte, fi.Size())
  643. _, err = config_file.Read(buffer)
  644. buffer, err = StripComments(buffer) //去掉注释
  645. if err != nil {
  646. emit("Failed to strip comments from json: %s\n", err)
  647. return &config
  648. }
  649. buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
  650. err = json.Unmarshal(buffer, &config) //解析json格式数据
  651. if err != nil {
  652. emit("Failed unmarshalling json: %s\n", err)
  653. return &config
  654. }
  655. return &config
  656. }
  657. type GoodTypesConfig struct {
  658. GoodTypes []*models.VMGoodsType "json:list"
  659. }
  660. func LoadGoodTypeConfig(dataFile string) *GoodTypesConfig {
  661. var config GoodTypesConfig
  662. _, filename, _, _ := runtime.Caller(1)
  663. datapath := path.Join(path.Dir(filename), dataFile)
  664. config_file, err := os.Open(datapath)
  665. if err != nil {
  666. emit("Failed to open config file '%s': %s\n", datapath, err)
  667. return &config
  668. }
  669. fi, _ := config_file.Stat()
  670. buffer := make([]byte, fi.Size())
  671. _, err = config_file.Read(buffer)
  672. buffer, err = StripComments(buffer) //去掉注释
  673. if err != nil {
  674. emit("Failed to strip comments from json: %s\n", err)
  675. return &config
  676. }
  677. buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
  678. err = json.Unmarshal(buffer, &config) //解析json格式数据
  679. if err != nil {
  680. emit("Failed unmarshalling json: %s\n", err)
  681. return &config
  682. }
  683. return &config
  684. }
  685. func (c *PublicApiController) HandleStockData() {
  686. org, _ := service.FindAllOrgByImportType()
  687. for _, item := range org {
  688. if item.Id != 3907 || item.Id != 9779 || item.Id != 9883 {
  689. goodTypes := &models.GoodsType{
  690. TypeCode: "14000000",
  691. TypeName: "穿刺针",
  692. Remark: "",
  693. Ctime: time.Now().Unix(),
  694. Mtime: time.Now().Unix(),
  695. Creater: 0,
  696. Modifier: 0,
  697. OrgId: item.Id,
  698. Status: 1,
  699. Type: 1,
  700. Number: 1,
  701. }
  702. service.AddSigleGoodType(goodTypes)
  703. goodTypes1 := &models.GoodsType{
  704. TypeCode: "14000001",
  705. TypeName: "透析器",
  706. Remark: "",
  707. Ctime: time.Now().Unix(),
  708. Mtime: time.Now().Unix(),
  709. Creater: 0,
  710. Modifier: 0,
  711. OrgId: item.Id,
  712. Status: 1,
  713. Type: 1,
  714. Number: 2,
  715. }
  716. service.AddSigleGoodType(goodTypes1)
  717. goodTypes2 := &models.GoodsType{
  718. TypeCode: "14000002",
  719. TypeName: "灌流器",
  720. Remark: "",
  721. Ctime: time.Now().Unix(),
  722. Mtime: time.Now().Unix(),
  723. Creater: 0,
  724. Modifier: 0,
  725. OrgId: item.Id,
  726. Status: 1,
  727. Type: 1,
  728. Number: 3,
  729. }
  730. service.AddSigleGoodType(goodTypes2)
  731. goodTypes3 := &models.GoodsType{
  732. TypeCode: "14000003",
  733. TypeName: "血路管",
  734. Remark: "",
  735. Ctime: time.Now().Unix(),
  736. Mtime: time.Now().Unix(),
  737. Creater: 0,
  738. Modifier: 0,
  739. OrgId: item.Id,
  740. Status: 1,
  741. Type: 1,
  742. Number: 4,
  743. }
  744. service.AddSigleGoodType(goodTypes3)
  745. goodTypes4 := &models.GoodsType{
  746. TypeCode: "14000004",
  747. TypeName: "血滤补液管",
  748. Remark: "",
  749. Ctime: time.Now().Unix(),
  750. Mtime: time.Now().Unix(),
  751. Creater: 0,
  752. Modifier: 0,
  753. OrgId: item.Id,
  754. Status: 1,
  755. Type: 1,
  756. Number: 5,
  757. }
  758. service.AddSigleGoodType(goodTypes4)
  759. goodTypes5 := &models.GoodsType{
  760. TypeCode: "14000005",
  761. TypeName: "注射器",
  762. Remark: "",
  763. Ctime: time.Now().Unix(),
  764. Mtime: time.Now().Unix(),
  765. Creater: 0,
  766. Modifier: 0,
  767. OrgId: item.Id,
  768. Status: 1,
  769. Type: 1,
  770. Number: 6,
  771. }
  772. service.AddSigleGoodType(goodTypes5)
  773. goodTypes6 := &models.GoodsType{
  774. TypeCode: "14000006",
  775. TypeName: "护理包(内瘘穿刺包)",
  776. Remark: "",
  777. Ctime: time.Now().Unix(),
  778. Mtime: time.Now().Unix(),
  779. Creater: 0,
  780. Modifier: 0,
  781. OrgId: item.Id,
  782. Status: 1,
  783. Type: 1,
  784. Number: 7,
  785. }
  786. service.AddSigleGoodType(goodTypes6)
  787. goodTypes7 := &models.GoodsType{
  788. TypeCode: "14000007",
  789. TypeName: "细菌过滤器",
  790. Remark: "",
  791. Ctime: time.Now().Unix(),
  792. Mtime: time.Now().Unix(),
  793. Creater: 0,
  794. Modifier: 0,
  795. OrgId: item.Id,
  796. Status: 1,
  797. Type: 1,
  798. Number: 8,
  799. }
  800. service.AddSigleGoodType(goodTypes7)
  801. goodTypes8 := &models.GoodsType{
  802. TypeCode: "14000008",
  803. TypeName: "血液透析干粉",
  804. Remark: "",
  805. Ctime: time.Now().Unix(),
  806. Mtime: time.Now().Unix(),
  807. Creater: 0,
  808. Modifier: 0,
  809. OrgId: item.Id,
  810. Status: 1,
  811. Type: 1,
  812. Number: 9,
  813. }
  814. service.AddSigleGoodType(goodTypes8)
  815. goodTypes9 := &models.GoodsType{
  816. TypeCode: "14000009",
  817. TypeName: "A液",
  818. Remark: "",
  819. Ctime: time.Now().Unix(),
  820. Mtime: time.Now().Unix(),
  821. Creater: 0,
  822. Modifier: 0,
  823. OrgId: item.Id,
  824. Status: 1,
  825. Type: 1,
  826. Number: 10,
  827. }
  828. service.AddSigleGoodType(goodTypes9)
  829. goodTypes10 := &models.GoodsType{
  830. TypeCode: "14000010",
  831. TypeName: "B液",
  832. Remark: "",
  833. Ctime: time.Now().Unix(),
  834. Mtime: time.Now().Unix(),
  835. Creater: 0,
  836. Modifier: 0,
  837. OrgId: item.Id,
  838. Status: 1,
  839. Type: 1,
  840. Number: 11,
  841. }
  842. service.AddSigleGoodType(goodTypes10)
  843. goodTypes11 := &models.GoodsType{
  844. TypeCode: "14000011",
  845. TypeName: "导管包",
  846. Remark: "",
  847. Ctime: time.Now().Unix(),
  848. Mtime: time.Now().Unix(),
  849. Creater: 0,
  850. Modifier: 0,
  851. OrgId: item.Id,
  852. Status: 1,
  853. Type: 1,
  854. Number: 12,
  855. }
  856. service.AddSigleGoodType(goodTypes11)
  857. goodTypes12 := &models.GoodsType{
  858. TypeCode: "14000012",
  859. TypeName: "血液透析导管",
  860. Remark: "",
  861. Ctime: time.Now().Unix(),
  862. Mtime: time.Now().Unix(),
  863. Creater: 0,
  864. Modifier: 0,
  865. OrgId: item.Id,
  866. Status: 1,
  867. Type: 1,
  868. Number: 13,
  869. }
  870. service.AddSigleGoodType(goodTypes12)
  871. }
  872. }
  873. }
  874. func (c *PublicApiController) HandleComData() {
  875. org_ids := []int64{3907, 9779, 9883}
  876. for _, id := range org_ids {
  877. //查处所有处方记录
  878. prescriptions, _ := service.FindAllPrescription(id)
  879. if id == 3907 {
  880. for _, item := range prescriptions {
  881. if item.Niprocart > 0 {
  882. before := &models.DialysisBeforePrepare{
  883. UserOrgId: id,
  884. PatientId: item.PatientId,
  885. RecordDate: item.RecordDate,
  886. Count: 1,
  887. Ctime: item.RecordDate,
  888. Mtime: item.RecordDate,
  889. Creater: item.Creater,
  890. Modifier: item.Creater,
  891. Status: 1,
  892. }
  893. before.GoodId = item.Niprocart
  894. before.GoodTypeId = 241
  895. service.AddSigleDialysisBeforePre(before)
  896. }
  897. if item.Jms > 0 {
  898. before := &models.DialysisBeforePrepare{
  899. UserOrgId: id,
  900. PatientId: item.PatientId,
  901. RecordDate: item.RecordDate,
  902. Count: 1,
  903. Ctime: item.RecordDate,
  904. Mtime: item.RecordDate,
  905. Creater: item.Creater,
  906. Modifier: item.Creater,
  907. Status: 1,
  908. }
  909. before.GoodId = item.Jms
  910. before.GoodTypeId = 233
  911. service.AddSigleDialysisBeforePre(before)
  912. }
  913. if item.FistulaNeedleSet > 0 {
  914. before := &models.DialysisBeforePrepare{
  915. UserOrgId: id,
  916. PatientId: item.PatientId,
  917. RecordDate: item.RecordDate,
  918. Count: 1,
  919. Ctime: item.RecordDate,
  920. Mtime: item.RecordDate,
  921. Creater: item.Creater,
  922. Modifier: item.Creater,
  923. Status: 1,
  924. }
  925. before.GoodId = item.FistulaNeedleSet
  926. before.GoodTypeId = 233
  927. service.AddSigleDialysisBeforePre(before)
  928. }
  929. if item.FistulaNeedleSet16 > 0 {
  930. before := &models.DialysisBeforePrepare{
  931. UserOrgId: id,
  932. PatientId: item.PatientId,
  933. RecordDate: item.RecordDate,
  934. Count: 1,
  935. Ctime: item.RecordDate,
  936. Mtime: item.RecordDate,
  937. Creater: item.Creater,
  938. Modifier: item.Creater,
  939. Status: 1,
  940. }
  941. before.GoodId = item.FistulaNeedleSet16
  942. before.GoodTypeId = 233
  943. service.AddSigleDialysisBeforePre(before)
  944. }
  945. if item.Hemoperfusion > 0 {
  946. before := &models.DialysisBeforePrepare{
  947. UserOrgId: id,
  948. PatientId: item.PatientId,
  949. RecordDate: item.RecordDate,
  950. Count: 1,
  951. Ctime: item.RecordDate,
  952. Mtime: item.RecordDate,
  953. Creater: item.Creater,
  954. Modifier: item.Creater,
  955. Status: 1,
  956. }
  957. before.GoodId = item.Hemoperfusion
  958. before.GoodTypeId = 235
  959. service.AddSigleDialysisBeforePre(before)
  960. }
  961. if item.DialyserSterilised > 0 {
  962. before := &models.DialysisBeforePrepare{
  963. UserOrgId: id,
  964. PatientId: item.PatientId,
  965. RecordDate: item.RecordDate,
  966. Count: 1,
  967. Ctime: item.RecordDate,
  968. Mtime: item.RecordDate,
  969. Creater: item.Creater,
  970. Modifier: item.Creater,
  971. Status: 1,
  972. }
  973. before.GoodId = item.DialyserSterilised
  974. before.GoodTypeId = 234
  975. service.AddSigleDialysisBeforePre(before)
  976. }
  977. if item.Filtryzer > 0 {
  978. before := &models.DialysisBeforePrepare{
  979. UserOrgId: id,
  980. PatientId: item.PatientId,
  981. RecordDate: item.RecordDate,
  982. Count: 1,
  983. Ctime: item.RecordDate,
  984. Mtime: item.RecordDate,
  985. Creater: item.Creater,
  986. Modifier: item.Creater,
  987. Status: 1,
  988. }
  989. before.GoodId = item.Filtryzer
  990. before.GoodTypeId = 234
  991. service.AddSigleDialysisBeforePre(before)
  992. }
  993. if item.Dialyzers > 0 {
  994. before := &models.DialysisBeforePrepare{
  995. UserOrgId: id,
  996. PatientId: item.PatientId,
  997. RecordDate: item.RecordDate,
  998. Count: 1,
  999. Ctime: item.RecordDate,
  1000. Mtime: item.RecordDate,
  1001. Creater: item.Creater,
  1002. Modifier: item.Creater,
  1003. Status: 1,
  1004. }
  1005. before.GoodId = item.Dialyzers
  1006. before.GoodTypeId = 234
  1007. service.AddSigleDialysisBeforePre(before)
  1008. }
  1009. if item.Injector > 0 {
  1010. before := &models.DialysisBeforePrepare{
  1011. UserOrgId: id,
  1012. PatientId: item.PatientId,
  1013. RecordDate: item.RecordDate,
  1014. Count: 1,
  1015. Ctime: item.RecordDate,
  1016. Mtime: item.RecordDate,
  1017. Creater: item.Creater,
  1018. Modifier: item.Creater,
  1019. Status: 1,
  1020. }
  1021. before.GoodId = item.Injector
  1022. before.GoodTypeId = 238
  1023. service.AddSigleDialysisBeforePre(before)
  1024. }
  1025. if item.Bloodlines > 0 {
  1026. before := &models.DialysisBeforePrepare{
  1027. UserOrgId: id,
  1028. PatientId: item.PatientId,
  1029. RecordDate: item.RecordDate,
  1030. Count: 1,
  1031. Ctime: item.RecordDate,
  1032. Mtime: item.RecordDate,
  1033. Creater: item.Creater,
  1034. Modifier: item.Creater,
  1035. Status: 1,
  1036. }
  1037. before.GoodId = item.Bloodlines
  1038. before.GoodTypeId = 236
  1039. service.AddSigleDialysisBeforePre(before)
  1040. }
  1041. if item.TubingHemodialysis > 0 {
  1042. before := &models.DialysisBeforePrepare{
  1043. UserOrgId: id,
  1044. PatientId: item.PatientId,
  1045. RecordDate: item.RecordDate,
  1046. Count: 1,
  1047. Ctime: item.RecordDate,
  1048. Mtime: item.RecordDate,
  1049. Creater: item.Creater,
  1050. Modifier: item.Creater,
  1051. Status: 1,
  1052. }
  1053. before.GoodId = item.TubingHemodialysis
  1054. before.GoodTypeId = 237
  1055. service.AddSigleDialysisBeforePre(before)
  1056. }
  1057. if item.Package > 0 {
  1058. before := &models.DialysisBeforePrepare{
  1059. UserOrgId: id,
  1060. PatientId: item.PatientId,
  1061. RecordDate: item.RecordDate,
  1062. Count: 1,
  1063. Ctime: item.RecordDate,
  1064. Mtime: item.RecordDate,
  1065. Creater: item.Creater,
  1066. Modifier: item.Creater,
  1067. Status: 1,
  1068. }
  1069. before.GoodId = item.Package
  1070. before.GoodTypeId = 239
  1071. service.AddSigleDialysisBeforePre(before)
  1072. }
  1073. if item.ALiquid > 0 {
  1074. before := &models.DialysisBeforePrepare{
  1075. UserOrgId: id,
  1076. PatientId: item.PatientId,
  1077. RecordDate: item.RecordDate,
  1078. Count: 1,
  1079. Ctime: item.RecordDate,
  1080. Mtime: item.RecordDate,
  1081. Creater: item.Creater,
  1082. Modifier: item.Creater,
  1083. Status: 1,
  1084. }
  1085. before.GoodId = item.ALiquid
  1086. before.GoodTypeId = 242
  1087. service.AddSigleDialysisBeforePre(before)
  1088. }
  1089. }
  1090. } else if id == 9779 {
  1091. for _, item := range prescriptions {
  1092. if item.Niprocart > 0 {
  1093. before := &models.DialysisBeforePrepare{
  1094. UserOrgId: id,
  1095. PatientId: item.PatientId,
  1096. RecordDate: item.RecordDate,
  1097. Count: 1,
  1098. Ctime: item.RecordDate,
  1099. Mtime: item.RecordDate,
  1100. Creater: item.Creater,
  1101. Modifier: item.Creater,
  1102. Status: 1,
  1103. }
  1104. before.GoodId = item.Niprocart
  1105. before.GoodTypeId = 254
  1106. service.AddSigleDialysisBeforePre(before)
  1107. }
  1108. if item.Jms > 0 {
  1109. before := &models.DialysisBeforePrepare{
  1110. UserOrgId: id,
  1111. PatientId: item.PatientId,
  1112. RecordDate: item.RecordDate,
  1113. Count: 1,
  1114. Ctime: item.RecordDate,
  1115. Mtime: item.RecordDate,
  1116. Creater: item.Creater,
  1117. Modifier: item.Creater,
  1118. Status: 1,
  1119. }
  1120. before.GoodId = item.Jms
  1121. before.GoodTypeId = 246
  1122. service.AddSigleDialysisBeforePre(before)
  1123. }
  1124. if item.FistulaNeedleSet > 0 {
  1125. before := &models.DialysisBeforePrepare{
  1126. UserOrgId: id,
  1127. PatientId: item.PatientId,
  1128. RecordDate: item.RecordDate,
  1129. Count: 1,
  1130. Ctime: item.RecordDate,
  1131. Mtime: item.RecordDate,
  1132. Creater: item.Creater,
  1133. Modifier: item.Creater,
  1134. Status: 1,
  1135. }
  1136. before.GoodId = item.FistulaNeedleSet
  1137. before.GoodTypeId = 246
  1138. service.AddSigleDialysisBeforePre(before)
  1139. }
  1140. if item.FistulaNeedleSet16 > 0 {
  1141. before := &models.DialysisBeforePrepare{
  1142. UserOrgId: id,
  1143. PatientId: item.PatientId,
  1144. RecordDate: item.RecordDate,
  1145. Count: 1,
  1146. Ctime: item.RecordDate,
  1147. Mtime: item.RecordDate,
  1148. Creater: item.Creater,
  1149. Modifier: item.Creater,
  1150. Status: 1,
  1151. }
  1152. before.GoodId = item.FistulaNeedleSet16
  1153. before.GoodTypeId = 246
  1154. service.AddSigleDialysisBeforePre(before)
  1155. }
  1156. if item.Hemoperfusion > 0 {
  1157. before := &models.DialysisBeforePrepare{
  1158. UserOrgId: id,
  1159. PatientId: item.PatientId,
  1160. RecordDate: item.RecordDate,
  1161. Count: 1,
  1162. Ctime: item.RecordDate,
  1163. Mtime: item.RecordDate,
  1164. Creater: item.Creater,
  1165. Modifier: item.Creater,
  1166. Status: 1,
  1167. }
  1168. before.GoodId = item.Hemoperfusion
  1169. before.GoodTypeId = 248
  1170. service.AddSigleDialysisBeforePre(before)
  1171. }
  1172. if item.DialyserSterilised > 0 {
  1173. before := &models.DialysisBeforePrepare{
  1174. UserOrgId: id,
  1175. PatientId: item.PatientId,
  1176. RecordDate: item.RecordDate,
  1177. Count: 1,
  1178. Ctime: item.RecordDate,
  1179. Mtime: item.RecordDate,
  1180. Creater: item.Creater,
  1181. Modifier: item.Creater,
  1182. Status: 1,
  1183. }
  1184. before.GoodId = item.DialyserSterilised
  1185. before.GoodTypeId = 247
  1186. service.AddSigleDialysisBeforePre(before)
  1187. }
  1188. if item.Filtryzer > 0 {
  1189. before := &models.DialysisBeforePrepare{
  1190. UserOrgId: id,
  1191. PatientId: item.PatientId,
  1192. RecordDate: item.RecordDate,
  1193. Count: 1,
  1194. Ctime: item.RecordDate,
  1195. Mtime: item.RecordDate,
  1196. Creater: item.Creater,
  1197. Modifier: item.Creater,
  1198. Status: 1,
  1199. }
  1200. before.GoodId = item.Filtryzer
  1201. before.GoodTypeId = 247
  1202. service.AddSigleDialysisBeforePre(before)
  1203. }
  1204. if item.Dialyzers > 0 {
  1205. before := &models.DialysisBeforePrepare{
  1206. UserOrgId: id,
  1207. PatientId: item.PatientId,
  1208. RecordDate: item.RecordDate,
  1209. Count: 1,
  1210. Ctime: item.RecordDate,
  1211. Mtime: item.RecordDate,
  1212. Creater: item.Creater,
  1213. Modifier: item.Creater,
  1214. Status: 1,
  1215. }
  1216. before.GoodId = item.Dialyzers
  1217. before.GoodTypeId = 247
  1218. service.AddSigleDialysisBeforePre(before)
  1219. }
  1220. if item.Injector > 0 {
  1221. before := &models.DialysisBeforePrepare{
  1222. UserOrgId: id,
  1223. PatientId: item.PatientId,
  1224. RecordDate: item.RecordDate,
  1225. Count: 1,
  1226. Ctime: item.RecordDate,
  1227. Mtime: item.RecordDate,
  1228. Creater: item.Creater,
  1229. Modifier: item.Creater,
  1230. Status: 1,
  1231. }
  1232. before.GoodId = item.Injector
  1233. before.GoodTypeId = 251
  1234. service.AddSigleDialysisBeforePre(before)
  1235. }
  1236. if item.Bloodlines > 0 {
  1237. before := &models.DialysisBeforePrepare{
  1238. UserOrgId: id,
  1239. PatientId: item.PatientId,
  1240. RecordDate: item.RecordDate,
  1241. Count: 1,
  1242. Ctime: item.RecordDate,
  1243. Mtime: item.RecordDate,
  1244. Creater: item.Creater,
  1245. Modifier: item.Creater,
  1246. Status: 1,
  1247. }
  1248. before.GoodId = item.Bloodlines
  1249. before.GoodTypeId = 249
  1250. service.AddSigleDialysisBeforePre(before)
  1251. }
  1252. if item.TubingHemodialysis > 0 {
  1253. before := &models.DialysisBeforePrepare{
  1254. UserOrgId: id,
  1255. PatientId: item.PatientId,
  1256. RecordDate: item.RecordDate,
  1257. Count: 1,
  1258. Ctime: item.RecordDate,
  1259. Mtime: item.RecordDate,
  1260. Creater: item.Creater,
  1261. Modifier: item.Creater,
  1262. Status: 1,
  1263. }
  1264. before.GoodId = item.TubingHemodialysis
  1265. before.GoodTypeId = 250
  1266. service.AddSigleDialysisBeforePre(before)
  1267. }
  1268. if item.Package > 0 {
  1269. before := &models.DialysisBeforePrepare{
  1270. UserOrgId: id,
  1271. PatientId: item.PatientId,
  1272. RecordDate: item.RecordDate,
  1273. Count: 1,
  1274. Ctime: item.RecordDate,
  1275. Mtime: item.RecordDate,
  1276. Creater: item.Creater,
  1277. Modifier: item.Creater,
  1278. Status: 1,
  1279. }
  1280. before.GoodId = item.Package
  1281. before.GoodTypeId = 252
  1282. service.AddSigleDialysisBeforePre(before)
  1283. }
  1284. if item.ALiquid > 0 {
  1285. before := &models.DialysisBeforePrepare{
  1286. UserOrgId: id,
  1287. PatientId: item.PatientId,
  1288. RecordDate: item.RecordDate,
  1289. Count: 1,
  1290. Ctime: item.RecordDate,
  1291. Mtime: item.RecordDate,
  1292. Creater: item.Creater,
  1293. Modifier: item.Creater,
  1294. Status: 1,
  1295. }
  1296. before.GoodId = item.ALiquid
  1297. before.GoodTypeId = 255
  1298. service.AddSigleDialysisBeforePre(before)
  1299. }
  1300. }
  1301. } else if id == 9883 {
  1302. for _, item := range prescriptions {
  1303. if item.Niprocart > 0 {
  1304. before := &models.DialysisBeforePrepare{
  1305. UserOrgId: id,
  1306. PatientId: item.PatientId,
  1307. RecordDate: item.RecordDate,
  1308. Count: 1,
  1309. Ctime: item.RecordDate,
  1310. Mtime: item.RecordDate,
  1311. Creater: item.Creater,
  1312. Modifier: item.Creater,
  1313. Status: 1,
  1314. }
  1315. before.GoodId = item.Niprocart
  1316. before.GoodTypeId = 267
  1317. service.AddSigleDialysisBeforePre(before)
  1318. }
  1319. if item.Jms > 0 {
  1320. before := &models.DialysisBeforePrepare{
  1321. UserOrgId: id,
  1322. PatientId: item.PatientId,
  1323. RecordDate: item.RecordDate,
  1324. Count: 1,
  1325. Ctime: item.RecordDate,
  1326. Mtime: item.RecordDate,
  1327. Creater: item.Creater,
  1328. Modifier: item.Creater,
  1329. Status: 1,
  1330. }
  1331. before.GoodId = item.Jms
  1332. before.GoodTypeId = 259
  1333. service.AddSigleDialysisBeforePre(before)
  1334. }
  1335. if item.FistulaNeedleSet > 0 {
  1336. before := &models.DialysisBeforePrepare{
  1337. UserOrgId: id,
  1338. PatientId: item.PatientId,
  1339. RecordDate: item.RecordDate,
  1340. Count: 1,
  1341. Ctime: item.RecordDate,
  1342. Mtime: item.RecordDate,
  1343. Creater: item.Creater,
  1344. Modifier: item.Creater,
  1345. Status: 1,
  1346. }
  1347. before.GoodId = item.FistulaNeedleSet
  1348. before.GoodTypeId = 259
  1349. service.AddSigleDialysisBeforePre(before)
  1350. }
  1351. if item.FistulaNeedleSet16 > 0 {
  1352. before := &models.DialysisBeforePrepare{
  1353. UserOrgId: id,
  1354. PatientId: item.PatientId,
  1355. RecordDate: item.RecordDate,
  1356. Count: 1,
  1357. Ctime: item.RecordDate,
  1358. Mtime: item.RecordDate,
  1359. Creater: item.Creater,
  1360. Modifier: item.Creater,
  1361. Status: 1,
  1362. }
  1363. before.GoodId = item.FistulaNeedleSet16
  1364. before.GoodTypeId = 259
  1365. service.AddSigleDialysisBeforePre(before)
  1366. }
  1367. if item.Hemoperfusion > 0 {
  1368. before := &models.DialysisBeforePrepare{
  1369. UserOrgId: id,
  1370. PatientId: item.PatientId,
  1371. RecordDate: item.RecordDate,
  1372. Count: 1,
  1373. Ctime: item.RecordDate,
  1374. Mtime: item.RecordDate,
  1375. Creater: item.Creater,
  1376. Modifier: item.Creater,
  1377. Status: 1,
  1378. }
  1379. before.GoodId = item.Hemoperfusion
  1380. before.GoodTypeId = 261
  1381. service.AddSigleDialysisBeforePre(before)
  1382. }
  1383. if item.DialyserSterilised > 0 {
  1384. before := &models.DialysisBeforePrepare{
  1385. UserOrgId: id,
  1386. PatientId: item.PatientId,
  1387. RecordDate: item.RecordDate,
  1388. Count: 1,
  1389. Ctime: item.RecordDate,
  1390. Mtime: item.RecordDate,
  1391. Creater: item.Creater,
  1392. Modifier: item.Creater,
  1393. Status: 1,
  1394. }
  1395. before.GoodId = item.DialyserSterilised
  1396. before.GoodTypeId = 260
  1397. service.AddSigleDialysisBeforePre(before)
  1398. }
  1399. if item.Filtryzer > 0 {
  1400. before := &models.DialysisBeforePrepare{
  1401. UserOrgId: id,
  1402. PatientId: item.PatientId,
  1403. RecordDate: item.RecordDate,
  1404. Count: 1,
  1405. Ctime: item.RecordDate,
  1406. Mtime: item.RecordDate,
  1407. Creater: item.Creater,
  1408. Modifier: item.Creater,
  1409. Status: 1,
  1410. }
  1411. before.GoodId = item.Filtryzer
  1412. before.GoodTypeId = 260
  1413. service.AddSigleDialysisBeforePre(before)
  1414. }
  1415. if item.Dialyzers > 0 {
  1416. before := &models.DialysisBeforePrepare{
  1417. UserOrgId: id,
  1418. PatientId: item.PatientId,
  1419. RecordDate: item.RecordDate,
  1420. Count: 1,
  1421. Ctime: item.RecordDate,
  1422. Mtime: item.RecordDate,
  1423. Creater: item.Creater,
  1424. Modifier: item.Creater,
  1425. Status: 1,
  1426. }
  1427. before.GoodId = item.Dialyzers
  1428. before.GoodTypeId = 260
  1429. service.AddSigleDialysisBeforePre(before)
  1430. }
  1431. if item.Injector > 0 {
  1432. before := &models.DialysisBeforePrepare{
  1433. UserOrgId: id,
  1434. PatientId: item.PatientId,
  1435. RecordDate: item.RecordDate,
  1436. Count: 1,
  1437. Ctime: item.RecordDate,
  1438. Mtime: item.RecordDate,
  1439. Creater: item.Creater,
  1440. Modifier: item.Creater,
  1441. Status: 1,
  1442. }
  1443. before.GoodId = item.Injector
  1444. before.GoodTypeId = 264
  1445. service.AddSigleDialysisBeforePre(before)
  1446. }
  1447. if item.Bloodlines > 0 {
  1448. before := &models.DialysisBeforePrepare{
  1449. UserOrgId: id,
  1450. PatientId: item.PatientId,
  1451. RecordDate: item.RecordDate,
  1452. Count: 1,
  1453. Ctime: item.RecordDate,
  1454. Mtime: item.RecordDate,
  1455. Creater: item.Creater,
  1456. Modifier: item.Creater,
  1457. Status: 1,
  1458. }
  1459. before.GoodId = item.Bloodlines
  1460. before.GoodTypeId = 262
  1461. service.AddSigleDialysisBeforePre(before)
  1462. }
  1463. if item.TubingHemodialysis > 0 {
  1464. before := &models.DialysisBeforePrepare{
  1465. UserOrgId: id,
  1466. PatientId: item.PatientId,
  1467. RecordDate: item.RecordDate,
  1468. Count: 1,
  1469. Ctime: item.RecordDate,
  1470. Mtime: item.RecordDate,
  1471. Creater: item.Creater,
  1472. Modifier: item.Creater,
  1473. Status: 1,
  1474. }
  1475. before.GoodId = item.TubingHemodialysis
  1476. before.GoodTypeId = 263
  1477. service.AddSigleDialysisBeforePre(before)
  1478. }
  1479. if item.Package > 0 {
  1480. before := &models.DialysisBeforePrepare{
  1481. UserOrgId: id,
  1482. PatientId: item.PatientId,
  1483. RecordDate: item.RecordDate,
  1484. Count: 1,
  1485. Ctime: item.RecordDate,
  1486. Mtime: item.RecordDate,
  1487. Creater: item.Creater,
  1488. Modifier: item.Creater,
  1489. Status: 1,
  1490. }
  1491. before.GoodId = item.Package
  1492. before.GoodTypeId = 265
  1493. service.AddSigleDialysisBeforePre(before)
  1494. }
  1495. if item.ALiquid > 0 {
  1496. before := &models.DialysisBeforePrepare{
  1497. UserOrgId: id,
  1498. PatientId: item.PatientId,
  1499. RecordDate: item.RecordDate,
  1500. Count: 1,
  1501. Ctime: item.RecordDate,
  1502. Mtime: item.RecordDate,
  1503. Creater: item.Creater,
  1504. Modifier: item.Creater,
  1505. Status: 1,
  1506. }
  1507. before.GoodId = item.ALiquid
  1508. before.GoodTypeId = 268
  1509. service.AddSigleDialysisBeforePre(before)
  1510. }
  1511. }
  1512. }
  1513. }
  1514. }
  1515. func (c *PublicApiController) HandleHIS() {
  1516. his, _ := service.GetAllHisInfo(9919)
  1517. for _, item := range his {
  1518. fsn := strings.Split(item.FeedetlSn, "-")
  1519. item.FeedetlSn = fsn[0] + "-" + fsn[1] + "-" + strconv.FormatInt(item.ID, 10)
  1520. fmt.Println(item.FeedetlSn)
  1521. service.UpDateHis2(item)
  1522. }
  1523. }
  1524. //func (c *PublicApiController)HandleOrder(){
  1525. // //orders, _ := service.GetAllHisOrder()
  1526. //
  1527. //
  1528. // order, _ := service.GetLastHisOrder()
  1529. //
  1530. // fpNumber, _ := strconv.Atoi(order.FaPiaoNumber)
  1531. //
  1532. //
  1533. // //fmt.Println(fpNumber)
  1534. //
  1535. // //for index, item := range orders {
  1536. // // item.FaPiaoCode ="144072080589"
  1537. // // var zero string
  1538. // // if 1520 + int64(index) >= 1000{
  1539. // // zero = "0000" + strconv.FormatInt(1520 + int64(index),10)
  1540. // // }else if 1520 + int64(index) >= 10000{
  1541. // // zero = "000" + strconv.FormatInt(1520 + int64(index),10)
  1542. // // } else if 1520 + int64(index) >= 100000{
  1543. // // zero = "00" +strconv.FormatInt(1520 + int64(index),10)
  1544. // // } else if 1520 + int64(index) >= 1000000{
  1545. // // zero = "0" +strconv.FormatInt(1520 + int64(index),10)
  1546. // // }else {
  1547. // // zero = strconv.FormatInt(1520 + int64(index),10)
  1548. // // }
  1549. // // item.FaPiaoNumber = zero
  1550. // // service.SaveOrder(item)
  1551. // //}
  1552. //}
  1553. func Mkdir(dir string) {
  1554. // 创建文件夹
  1555. exist, err := PathExists(dir)
  1556. if err != nil {
  1557. fmt.Println(err.Error())
  1558. } else {
  1559. if exist {
  1560. fmt.Println(dir + "文件夹已存在!")
  1561. } else {
  1562. // 文件夹名称,权限
  1563. err := os.Mkdir(dir, os.ModePerm)
  1564. if err != nil {
  1565. fmt.Println(dir+"文件夹创建失败:", err.Error())
  1566. } else {
  1567. fmt.Println(dir + "文件夹创建成功!")
  1568. }
  1569. }
  1570. }
  1571. }
  1572. func PathExists(path string) (bool, error) {
  1573. _, err := os.Stat(path)
  1574. if err == nil {
  1575. return true, nil
  1576. }
  1577. if os.IsNotExist(err) {
  1578. return false, nil
  1579. }
  1580. return false, err
  1581. }
  1582. func (c *PublicApiController) Handle10215() {
  1583. //projects,_ := service.GetAllInfo(10215,2284)
  1584. //
  1585. //for _, item := range projects{
  1586. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1587. //}
  1588. //projects_two,_ := service.GetAllInfo(10215,2277)
  1589. //
  1590. //for _, item := range projects_two{
  1591. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1592. //}
  1593. //service.GetAllInfo(10215,2284)
  1594. //service.GetAllInfo(10215,2277)
  1595. his, _ := service.GetAllPT(10215)
  1596. for _, item := range his {
  1597. //
  1598. //pro := &models.HisPrescriptionProjectTemplate{
  1599. // ProjectId: 1750,
  1600. // Price: 6.00,
  1601. // UserOrgId: 10215,
  1602. // Status: 1,
  1603. // Ctime: time.Now().Unix(),
  1604. // Mtime: time.Now().Unix(),
  1605. // PatientId: item.PatientId,
  1606. // RecordDate: 0,
  1607. // Count: 1,
  1608. // FeedetlSn: "",
  1609. // MedListCodg: "",
  1610. // SingleDose: "1",
  1611. // DeliveryWay: "",
  1612. // ExecutionFrequency: "",
  1613. // Day: "1",
  1614. // Remark: "",
  1615. // Unit: "",
  1616. // Type: 2,
  1617. // PrescriptionId: info.ID,
  1618. // FrequencyType: 1,
  1619. // DayCount: 0,
  1620. // WeekDay: "",
  1621. //}
  1622. //service.CreateHisPrescriptionProjectTemplate(pro)
  1623. //
  1624. //pro2 := &models.HisPrescriptionProjectTemplate{
  1625. // ProjectId: 2462,
  1626. // Price: 4.94,
  1627. // UserOrgId: 10215,
  1628. // Status: 1,
  1629. // Ctime: time.Now().Unix(),
  1630. // Mtime: time.Now().Unix(),
  1631. // PatientId: item.PatientId,
  1632. // RecordDate: 0,
  1633. // Count: 1,
  1634. // FeedetlSn: "",
  1635. // MedListCodg: "",
  1636. // SingleDose: "1",
  1637. // DeliveryWay: "",
  1638. // ExecutionFrequency: "",
  1639. // Day: "1",
  1640. // Remark: "",
  1641. // Unit: "",
  1642. // Type: 3,
  1643. // PrescriptionId: info.ID,
  1644. // FrequencyType: 1,
  1645. // DayCount: 0,
  1646. // WeekDay: "",
  1647. //}
  1648. //service.CreateHisPrescriptionProjectTemplate(pro2)
  1649. //
  1650. //
  1651. infos, _ := service.GetAllPTInfo(10215, item.ID)
  1652. // // fmt.Println(infos)
  1653. for _, subItem := range infos {
  1654. if len(subItem.HisPrescriptionAdviceTemplate) > 0 && len(subItem.HisPrescriptionProjectTemplate) == 0 {
  1655. for _, ssubItem := range subItem.HisPrescriptionAdviceTemplate {
  1656. //if ssubItem.DrugId == 1234 {
  1657. // pro := &models.HisPrescriptionProjectTemplate{
  1658. // ProjectId: 2326,
  1659. // Price: 0.86,
  1660. // UserOrgId: ssubItem.UserOrgId,
  1661. // Status: 1,
  1662. // Ctime: time.Now().Unix(),
  1663. // Mtime: time.Now().Unix(),
  1664. // PatientId: ssubItem.PatientId,
  1665. // RecordDate: ssubItem.AdviceDate,
  1666. // Count: 1,
  1667. // FeedetlSn: "",
  1668. // MedListCodg: "",
  1669. // SingleDose: "1",
  1670. // DeliveryWay: "",
  1671. // ExecutionFrequency: "",
  1672. // Day: "1",
  1673. // Remark: "",
  1674. // Unit: "",
  1675. // Type: 3,
  1676. // PrescriptionId: info.ID,
  1677. // FrequencyType: ssubItem.FrequencyType,
  1678. // DayCount: ssubItem.DayCount,
  1679. // WeekDay: ssubItem.WeekDay,
  1680. // }
  1681. // service.CreateHisPrescriptionProjectTemplate(pro)
  1682. //
  1683. //}
  1684. if ssubItem.DrugId == 1288 {
  1685. info := &models.HisPrescriptionInfoTemplate{
  1686. UserOrgId: item.UserOrgId,
  1687. RecordDate: 0,
  1688. PatientId: item.PatientId,
  1689. Status: 1,
  1690. Ctime: time.Now().Unix(),
  1691. Mtime: time.Now().Unix(),
  1692. Type: 2,
  1693. Creator: 0,
  1694. Modifier: 0,
  1695. PType: 0,
  1696. PTemplateId: item.ID,
  1697. MedType: "14",
  1698. }
  1699. service.CreateHisPrescriptionInfoTemplate(info)
  1700. pro2 := &models.HisPrescriptionProjectTemplate{
  1701. ProjectId: 1727,
  1702. Price: 2.50,
  1703. UserOrgId: ssubItem.UserOrgId,
  1704. Status: 1,
  1705. Ctime: time.Now().Unix(),
  1706. Mtime: time.Now().Unix(),
  1707. PatientId: ssubItem.PatientId,
  1708. RecordDate: ssubItem.AdviceDate,
  1709. Count: 1,
  1710. FeedetlSn: "",
  1711. MedListCodg: "",
  1712. SingleDose: "1",
  1713. DeliveryWay: "",
  1714. ExecutionFrequency: "",
  1715. Day: "1",
  1716. Remark: "",
  1717. Unit: "",
  1718. Type: 2,
  1719. PrescriptionId: info.ID,
  1720. FrequencyType: ssubItem.FrequencyType,
  1721. DayCount: ssubItem.DayCount,
  1722. WeekDay: ssubItem.WeekDay,
  1723. }
  1724. service.CreateHisPrescriptionProjectTemplate(pro2)
  1725. //pro := &models.HisPrescriptionProjectTemplate{
  1726. // ProjectId: 2326,
  1727. // Price: 0.86,
  1728. // UserOrgId: ssubItem.UserOrgId,
  1729. // Status: 1,
  1730. // Ctime: time.Now().Unix(),
  1731. // Mtime: time.Now().Unix(),
  1732. // PatientId: ssubItem.PatientId,
  1733. // RecordDate: ssubItem.AdviceDate,
  1734. // Count: 1,
  1735. // FeedetlSn: "",
  1736. // MedListCodg: "",
  1737. // SingleDose: "1",
  1738. // DeliveryWay: "",
  1739. // ExecutionFrequency: "",
  1740. // Day: "1",
  1741. // Remark: "",
  1742. // Unit: "",
  1743. // Type: 3,
  1744. // PrescriptionId: info.ID,
  1745. // FrequencyType: ssubItem.FrequencyType,
  1746. // DayCount: ssubItem.DayCount,
  1747. // WeekDay: ssubItem.WeekDay,
  1748. //}
  1749. //service.CreateHisPrescriptionProjectTemplate(pro)
  1750. }
  1751. //if ssubItem.DrugId == 1306 {
  1752. //
  1753. // pro := &models.HisPrescriptionProjectTemplate{
  1754. // ProjectId: 2325,
  1755. // Price: 1.11,
  1756. // UserOrgId: ssubItem.UserOrgId,
  1757. // Status: 1,
  1758. // Ctime: time.Now().Unix(),
  1759. // Mtime: time.Now().Unix(),
  1760. // PatientId: ssubItem.PatientId,
  1761. // RecordDate: ssubItem.AdviceDate,
  1762. // Count: 1,
  1763. // FeedetlSn: "",
  1764. // MedListCodg: "",
  1765. // SingleDose: "1",
  1766. // DeliveryWay: "",
  1767. // ExecutionFrequency: "",
  1768. // Day: "1",
  1769. // Remark: "",
  1770. // Unit: "",
  1771. // Type: 3,
  1772. // PrescriptionId: info.ID,
  1773. // FrequencyType: ssubItem.FrequencyType,
  1774. // DayCount: ssubItem.DayCount,
  1775. // WeekDay: ssubItem.WeekDay,
  1776. // }
  1777. // service.CreateHisPrescriptionProjectTemplate(pro)
  1778. //
  1779. // pro2 := &models.HisPrescriptionProjectTemplate{
  1780. // ProjectId: 1727,
  1781. // Price: 2.50,
  1782. // UserOrgId: ssubItem.UserOrgId,
  1783. // Status: 1,
  1784. // Ctime: time.Now().Unix(),
  1785. // Mtime: time.Now().Unix(),
  1786. // PatientId: ssubItem.PatientId,
  1787. // RecordDate: ssubItem.AdviceDate,
  1788. // Count: 1,
  1789. // FeedetlSn: "",
  1790. // MedListCodg: "",
  1791. // SingleDose: "1",
  1792. // DeliveryWay: "",
  1793. // ExecutionFrequency: "",
  1794. // Day: "1",
  1795. // Remark: "",
  1796. // Unit: "",
  1797. // Type: 2,
  1798. // PrescriptionId: info.ID,
  1799. // FrequencyType: ssubItem.FrequencyType,
  1800. // DayCount: ssubItem.DayCount,
  1801. // WeekDay: ssubItem.WeekDay,
  1802. // }
  1803. // service.CreateHisPrescriptionProjectTemplate(pro2)
  1804. //
  1805. //}
  1806. //if ssubItem.DrugId == 1291 {
  1807. //
  1808. // pro := &models.HisPrescriptionProjectTemplate{
  1809. // ProjectId: 2322,
  1810. // Price: 0.68,
  1811. // UserOrgId: ssubItem.UserOrgId,
  1812. // Status: 1,
  1813. // Ctime: time.Now().Unix(),
  1814. // Mtime: time.Now().Unix(),
  1815. // PatientId: ssubItem.PatientId,
  1816. // RecordDate: ssubItem.AdviceDate,
  1817. // Count: 1,
  1818. // FeedetlSn: "",
  1819. // MedListCodg: "",
  1820. // SingleDose: "1",
  1821. // DeliveryWay: "",
  1822. // ExecutionFrequency: "",
  1823. // Day: "1",
  1824. // Remark: "",
  1825. // Unit: "",
  1826. // Type: 3,
  1827. // PrescriptionId: info.ID,
  1828. // FrequencyType: ssubItem.FrequencyType,
  1829. // DayCount: ssubItem.DayCount,
  1830. // WeekDay: ssubItem.WeekDay,
  1831. // }
  1832. // service.CreateHisPrescriptionProjectTemplate(pro)
  1833. //
  1834. // pro2 := &models.HisPrescriptionProjectTemplate{
  1835. // ProjectId: 1727,
  1836. // Price: 2.50,
  1837. // UserOrgId: ssubItem.UserOrgId,
  1838. // Status: 1,
  1839. // Ctime: time.Now().Unix(),
  1840. // Mtime: time.Now().Unix(),
  1841. // PatientId: ssubItem.PatientId,
  1842. // RecordDate: ssubItem.AdviceDate,
  1843. // Count: 1,
  1844. // FeedetlSn: "",
  1845. // MedListCodg: "",
  1846. // SingleDose: "1",
  1847. // DeliveryWay: "",
  1848. // ExecutionFrequency: "",
  1849. // Day: "1",
  1850. // Remark: "",
  1851. // Unit: "",
  1852. // Type: 2,
  1853. // PrescriptionId: info.ID,
  1854. // FrequencyType: ssubItem.FrequencyType,
  1855. // DayCount: ssubItem.DayCount,
  1856. // WeekDay: ssubItem.WeekDay,
  1857. // }
  1858. // service.CreateHisPrescriptionProjectTemplate(pro2)
  1859. //}
  1860. }
  1861. }
  1862. }
  1863. }
  1864. }