public_api_controller.go 55KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060
  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(10138)
  1526. record, _ := service.FindFapiaoByIsUse(10138)
  1527. last_order, _ := service.GetAllHisOrderTwo(10138)
  1528. if record.ID > 0 {
  1529. for index, item := range orders {
  1530. item.FaPiaoCode = record.FapiaoCode
  1531. var zero string
  1532. max_number, _ := strconv.ParseInt(last_order.FaPiaoNumber, 10, 64)
  1533. number, _ := strconv.ParseInt(record.FapiaoNumber, 10, 64)
  1534. number = number + max_number
  1535. if number+int64(index) >= 1000 {
  1536. zero = "0000" + strconv.FormatInt(number+int64(index), 10)
  1537. } else if number+int64(index) >= 10000 {
  1538. zero = "000" + strconv.FormatInt(number+int64(index), 10)
  1539. } else if number+int64(index) >= 100000 {
  1540. zero = "00" + strconv.FormatInt(number+int64(index), 10)
  1541. } else if number+int64(index) >= 1000000 {
  1542. zero = "0" + strconv.FormatInt(number+int64(index), 10)
  1543. } else {
  1544. zero = strconv.FormatInt(number+int64(index), 10)
  1545. }
  1546. item.FaPiaoNumber = zero
  1547. item.FaPiaoBatchnumberId = record.ID
  1548. service.SaveOrder(item)
  1549. }
  1550. }
  1551. }
  1552. func Mkdir(dir string) {
  1553. // 创建文件夹
  1554. exist, err := PathExists(dir)
  1555. if err != nil {
  1556. fmt.Println(err.Error())
  1557. } else {
  1558. if exist {
  1559. fmt.Println(dir + "文件夹已存在!")
  1560. } else {
  1561. // 文件夹名称,权限
  1562. err := os.Mkdir(dir, os.ModePerm)
  1563. if err != nil {
  1564. fmt.Println(dir+"文件夹创建失败:", err.Error())
  1565. } else {
  1566. fmt.Println(dir + "文件夹创建成功!")
  1567. }
  1568. }
  1569. }
  1570. }
  1571. func PathExists(path string) (bool, error) {
  1572. _, err := os.Stat(path)
  1573. if err == nil {
  1574. return true, nil
  1575. }
  1576. if os.IsNotExist(err) {
  1577. return false, nil
  1578. }
  1579. return false, err
  1580. }
  1581. func (c *PublicApiController) Handle10215() {
  1582. //projects,_ := service.GetAllInfo(10215,2284)
  1583. //
  1584. //for _, item := range projects{
  1585. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1586. //}
  1587. //projects_two,_ := service.GetAllInfo(10215,2277)
  1588. //
  1589. //for _, item := range projects_two{
  1590. // service.UpdateStatus(item.ID, item.PrescriptionId)
  1591. //}
  1592. //service.GetAllInfo(10215,2284)
  1593. //service.GetAllInfo(10215,2277)
  1594. his, _ := service.GetAllPT(10215)
  1595. for _, item := range his {
  1596. //
  1597. //pro := &models.HisPrescriptionProjectTemplate{
  1598. // ProjectId: 1750,
  1599. // Price: 6.00,
  1600. // UserOrgId: 10215,
  1601. // Status: 1,
  1602. // Ctime: time.Now().Unix(),
  1603. // Mtime: time.Now().Unix(),
  1604. // PatientId: item.PatientId,
  1605. // RecordDate: 0,
  1606. // Count: 1,
  1607. // FeedetlSn: "",
  1608. // MedListCodg: "",
  1609. // SingleDose: "1",
  1610. // DeliveryWay: "",
  1611. // ExecutionFrequency: "",
  1612. // Day: "1",
  1613. // Remark: "",
  1614. // Unit: "",
  1615. // Type: 2,
  1616. // PrescriptionId: info.ID,
  1617. // FrequencyType: 1,
  1618. // DayCount: 0,
  1619. // WeekDay: "",
  1620. //}
  1621. //service.CreateHisPrescriptionProjectTemplate(pro)
  1622. //
  1623. //pro2 := &models.HisPrescriptionProjectTemplate{
  1624. // ProjectId: 2462,
  1625. // Price: 4.94,
  1626. // UserOrgId: 10215,
  1627. // Status: 1,
  1628. // Ctime: time.Now().Unix(),
  1629. // Mtime: time.Now().Unix(),
  1630. // PatientId: item.PatientId,
  1631. // RecordDate: 0,
  1632. // Count: 1,
  1633. // FeedetlSn: "",
  1634. // MedListCodg: "",
  1635. // SingleDose: "1",
  1636. // DeliveryWay: "",
  1637. // ExecutionFrequency: "",
  1638. // Day: "1",
  1639. // Remark: "",
  1640. // Unit: "",
  1641. // Type: 3,
  1642. // PrescriptionId: info.ID,
  1643. // FrequencyType: 1,
  1644. // DayCount: 0,
  1645. // WeekDay: "",
  1646. //}
  1647. //service.CreateHisPrescriptionProjectTemplate(pro2)
  1648. //
  1649. //
  1650. infos, _ := service.GetAllPTInfo(10215, item.ID)
  1651. // // fmt.Println(infos)
  1652. for _, subItem := range infos {
  1653. if len(subItem.HisPrescriptionAdviceTemplate) > 0 && len(subItem.HisPrescriptionProjectTemplate) == 0 {
  1654. for _, ssubItem := range subItem.HisPrescriptionAdviceTemplate {
  1655. //if ssubItem.DrugId == 1234 {
  1656. // pro := &models.HisPrescriptionProjectTemplate{
  1657. // ProjectId: 2326,
  1658. // Price: 0.86,
  1659. // UserOrgId: ssubItem.UserOrgId,
  1660. // Status: 1,
  1661. // Ctime: time.Now().Unix(),
  1662. // Mtime: time.Now().Unix(),
  1663. // PatientId: ssubItem.PatientId,
  1664. // RecordDate: ssubItem.AdviceDate,
  1665. // Count: 1,
  1666. // FeedetlSn: "",
  1667. // MedListCodg: "",
  1668. // SingleDose: "1",
  1669. // DeliveryWay: "",
  1670. // ExecutionFrequency: "",
  1671. // Day: "1",
  1672. // Remark: "",
  1673. // Unit: "",
  1674. // Type: 3,
  1675. // PrescriptionId: info.ID,
  1676. // FrequencyType: ssubItem.FrequencyType,
  1677. // DayCount: ssubItem.DayCount,
  1678. // WeekDay: ssubItem.WeekDay,
  1679. // }
  1680. // service.CreateHisPrescriptionProjectTemplate(pro)
  1681. //
  1682. //}
  1683. if ssubItem.DrugId == 1288 {
  1684. info := &models.HisPrescriptionInfoTemplate{
  1685. UserOrgId: item.UserOrgId,
  1686. RecordDate: 0,
  1687. PatientId: item.PatientId,
  1688. Status: 1,
  1689. Ctime: time.Now().Unix(),
  1690. Mtime: time.Now().Unix(),
  1691. Type: 2,
  1692. Creator: 0,
  1693. Modifier: 0,
  1694. PType: 0,
  1695. PTemplateId: item.ID,
  1696. MedType: "14",
  1697. }
  1698. service.CreateHisPrescriptionInfoTemplate(info)
  1699. pro2 := &models.HisPrescriptionProjectTemplate{
  1700. ProjectId: 1727,
  1701. Price: 2.50,
  1702. UserOrgId: ssubItem.UserOrgId,
  1703. Status: 1,
  1704. Ctime: time.Now().Unix(),
  1705. Mtime: time.Now().Unix(),
  1706. PatientId: ssubItem.PatientId,
  1707. RecordDate: ssubItem.AdviceDate,
  1708. Count: "1",
  1709. FeedetlSn: "",
  1710. MedListCodg: "",
  1711. SingleDose: "1",
  1712. DeliveryWay: "",
  1713. ExecutionFrequency: "",
  1714. Day: "1",
  1715. Remark: "",
  1716. Unit: "",
  1717. Type: 2,
  1718. PrescriptionId: info.ID,
  1719. FrequencyType: ssubItem.FrequencyType,
  1720. DayCount: ssubItem.DayCount,
  1721. WeekDay: ssubItem.WeekDay,
  1722. }
  1723. service.CreateHisPrescriptionProjectTemplate(pro2)
  1724. //pro := &models.HisPrescriptionProjectTemplate{
  1725. // ProjectId: 2326,
  1726. // Price: 0.86,
  1727. // UserOrgId: ssubItem.UserOrgId,
  1728. // Status: 1,
  1729. // Ctime: time.Now().Unix(),
  1730. // Mtime: time.Now().Unix(),
  1731. // PatientId: ssubItem.PatientId,
  1732. // RecordDate: ssubItem.AdviceDate,
  1733. // Count: 1,
  1734. // FeedetlSn: "",
  1735. // MedListCodg: "",
  1736. // SingleDose: "1",
  1737. // DeliveryWay: "",
  1738. // ExecutionFrequency: "",
  1739. // Day: "1",
  1740. // Remark: "",
  1741. // Unit: "",
  1742. // Type: 3,
  1743. // PrescriptionId: info.ID,
  1744. // FrequencyType: ssubItem.FrequencyType,
  1745. // DayCount: ssubItem.DayCount,
  1746. // WeekDay: ssubItem.WeekDay,
  1747. //}
  1748. //service.CreateHisPrescriptionProjectTemplate(pro)
  1749. }
  1750. //if ssubItem.DrugId == 1306 {
  1751. //
  1752. // pro := &models.HisPrescriptionProjectTemplate{
  1753. // ProjectId: 2325,
  1754. // Price: 1.11,
  1755. // UserOrgId: ssubItem.UserOrgId,
  1756. // Status: 1,
  1757. // Ctime: time.Now().Unix(),
  1758. // Mtime: time.Now().Unix(),
  1759. // PatientId: ssubItem.PatientId,
  1760. // RecordDate: ssubItem.AdviceDate,
  1761. // Count: 1,
  1762. // FeedetlSn: "",
  1763. // MedListCodg: "",
  1764. // SingleDose: "1",
  1765. // DeliveryWay: "",
  1766. // ExecutionFrequency: "",
  1767. // Day: "1",
  1768. // Remark: "",
  1769. // Unit: "",
  1770. // Type: 3,
  1771. // PrescriptionId: info.ID,
  1772. // FrequencyType: ssubItem.FrequencyType,
  1773. // DayCount: ssubItem.DayCount,
  1774. // WeekDay: ssubItem.WeekDay,
  1775. // }
  1776. // service.CreateHisPrescriptionProjectTemplate(pro)
  1777. //
  1778. // pro2 := &models.HisPrescriptionProjectTemplate{
  1779. // ProjectId: 1727,
  1780. // Price: 2.50,
  1781. // UserOrgId: ssubItem.UserOrgId,
  1782. // Status: 1,
  1783. // Ctime: time.Now().Unix(),
  1784. // Mtime: time.Now().Unix(),
  1785. // PatientId: ssubItem.PatientId,
  1786. // RecordDate: ssubItem.AdviceDate,
  1787. // Count: 1,
  1788. // FeedetlSn: "",
  1789. // MedListCodg: "",
  1790. // SingleDose: "1",
  1791. // DeliveryWay: "",
  1792. // ExecutionFrequency: "",
  1793. // Day: "1",
  1794. // Remark: "",
  1795. // Unit: "",
  1796. // Type: 2,
  1797. // PrescriptionId: info.ID,
  1798. // FrequencyType: ssubItem.FrequencyType,
  1799. // DayCount: ssubItem.DayCount,
  1800. // WeekDay: ssubItem.WeekDay,
  1801. // }
  1802. // service.CreateHisPrescriptionProjectTemplate(pro2)
  1803. //
  1804. //}
  1805. //if ssubItem.DrugId == 1291 {
  1806. //
  1807. // pro := &models.HisPrescriptionProjectTemplate{
  1808. // ProjectId: 2322,
  1809. // Price: 0.68,
  1810. // UserOrgId: ssubItem.UserOrgId,
  1811. // Status: 1,
  1812. // Ctime: time.Now().Unix(),
  1813. // Mtime: time.Now().Unix(),
  1814. // PatientId: ssubItem.PatientId,
  1815. // RecordDate: ssubItem.AdviceDate,
  1816. // Count: 1,
  1817. // FeedetlSn: "",
  1818. // MedListCodg: "",
  1819. // SingleDose: "1",
  1820. // DeliveryWay: "",
  1821. // ExecutionFrequency: "",
  1822. // Day: "1",
  1823. // Remark: "",
  1824. // Unit: "",
  1825. // Type: 3,
  1826. // PrescriptionId: info.ID,
  1827. // FrequencyType: ssubItem.FrequencyType,
  1828. // DayCount: ssubItem.DayCount,
  1829. // WeekDay: ssubItem.WeekDay,
  1830. // }
  1831. // service.CreateHisPrescriptionProjectTemplate(pro)
  1832. //
  1833. // pro2 := &models.HisPrescriptionProjectTemplate{
  1834. // ProjectId: 1727,
  1835. // Price: 2.50,
  1836. // UserOrgId: ssubItem.UserOrgId,
  1837. // Status: 1,
  1838. // Ctime: time.Now().Unix(),
  1839. // Mtime: time.Now().Unix(),
  1840. // PatientId: ssubItem.PatientId,
  1841. // RecordDate: ssubItem.AdviceDate,
  1842. // Count: 1,
  1843. // FeedetlSn: "",
  1844. // MedListCodg: "",
  1845. // SingleDose: "1",
  1846. // DeliveryWay: "",
  1847. // ExecutionFrequency: "",
  1848. // Day: "1",
  1849. // Remark: "",
  1850. // Unit: "",
  1851. // Type: 2,
  1852. // PrescriptionId: info.ID,
  1853. // FrequencyType: ssubItem.FrequencyType,
  1854. // DayCount: ssubItem.DayCount,
  1855. // WeekDay: ssubItem.WeekDay,
  1856. // }
  1857. // service.CreateHisPrescriptionProjectTemplate(pro2)
  1858. //}
  1859. }
  1860. }
  1861. }
  1862. }
  1863. }