public_api_controller.go 55KB

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