ahyb_controller.go 50KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. package ah
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "gdyb/controllers"
  6. "gdyb/enums"
  7. "gdyb/models"
  8. "gdyb/service"
  9. "gdyb/utils"
  10. "github.com/astaxie/beego"
  11. "github.com/axgle/mahonia"
  12. "github.com/gorilla/websocket"
  13. "golang.org/x/text/encoding/simplifiedchinese"
  14. "io/ioutil"
  15. "log"
  16. "net/url"
  17. "os"
  18. "regexp"
  19. "strconv"
  20. "strings"
  21. "syscall"
  22. "time"
  23. "unsafe"
  24. )
  25. type AHybController struct {
  26. controllers.BaseAuthAPIController
  27. }
  28. type Body struct {
  29. ErrMsg string `json:"err_msg"`
  30. InfRefMsgID string `json:"inf_refmsgid"`
  31. InfCode int `json:"infcode"`
  32. Output map[string]interface{} `json:"output"`
  33. }
  34. type Response struct {
  35. Body Body `json:"body"`
  36. Code int `json:"code"`
  37. CSBCode int `json:"csbCode"`
  38. Message string `json:"message"`
  39. RequestID string `json:"requestId"`
  40. State struct{} `json:"state"`
  41. }
  42. func AHybRegistRouters() {
  43. beego.Router("/ahyb/1101", &AHybController{}, "get:PostOne")
  44. beego.Router("/ahyb/2201", &AHybController{}, "get:PostTwo")
  45. beego.Router("/ahyb/2202", &AHybController{}, "get:PostThree")
  46. beego.Router("/ahyb/2203", &AHybController{}, "post:PostFour")
  47. beego.Router("/ahyb/2204", &AHybController{}, "post:PostFive")
  48. beego.Router("/ahyb/2205", &AHybController{}, "get:PostSix")
  49. beego.Router("/ahyb/2206", &AHybController{}, "get:PostSeven")
  50. beego.Router("/ahyb/2207", &AHybController{}, "get:PostEight")
  51. beego.Router("/ahyb/2208", &AHybController{}, "get:PostNine")
  52. beego.Router("/ahyb/5203", &AHybController{}, "get:PostTen")
  53. beego.Router("/ahyb/5301", &AHybController{}, "get:Get5301")
  54. beego.Router("/ahyb/3201", &AHybController{}, "get:Get3201")
  55. beego.Router("/ahyb/9001", &AHybController{}, "get:Get9001")
  56. beego.Router("/ahyb/4101", &AHybController{}, "post:Get4101")
  57. beego.Router("/ahyb/readcard", &AHybController{}, "get:ReadCard")
  58. beego.Router("/ahyb/2503", &AHybController{}, "get:Get2503")
  59. beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
  60. beego.Router("/ahyb/readcardcharge", &AHybController{}, "get:Readcardcharge")
  61. }
  62. func (c *AHybController) Readcardcharge() {
  63. fixmedins_code := c.GetString("fixmedins_code")
  64. secret_key := c.GetString("secret_key")
  65. ak := c.GetString("ak")
  66. org_name := c.GetString("org_name")
  67. doctor := c.GetString("doctor")
  68. //insuplc_admdvs := c.GetString("insuplc_admdvs")
  69. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  70. url := c.GetString("url")
  71. cainfo := c.GetString("cainfo")
  72. operator_id := c.GetString("operator_id")
  73. operator := c.GetString("operator")
  74. _, pBusiCardInfo := c.GetELeCertInfoThree(fixmedins_code, operator_id, operator)
  75. fmt.Println(pBusiCardInfo)
  76. pBusiCardInfo = Remove0000(pBusiCardInfo)
  77. var ele ELeCertData
  78. err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
  79. if err != nil {
  80. utils.ErrorLog("解析失败:%v", err)
  81. }
  82. token := ele.Data.EcToken
  83. fmt.Println(token)
  84. if len(token) > 0 {
  85. userName := ele.Data.UserName
  86. fmt.Println(userName)
  87. userName = Remove0000(userName)
  88. userName = DeleteExtraSpace(userName)
  89. fmt.Println(userName)
  90. enc := mahonia.NewEncoder("gbk")
  91. fmt.Println(enc.ConvertString(userName))
  92. result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
  93. var response Response
  94. if err := json.Unmarshal([]byte(result), &response); err != nil {
  95. fmt.Println("Error decoding JSON:", err)
  96. return
  97. }
  98. if response.Code == 200{
  99. c.ServeSuccessJSON(map[string]interface{}{
  100. "status":"1",
  101. "card_info": "",
  102. "busi_card_info": pBusiCardInfo,
  103. "token": token,
  104. "result": response.Body,
  105. })
  106. }else{
  107. c.ServeSuccessJSON(map[string]interface{}{
  108. "status":"0",
  109. "msg":response.Message,
  110. })
  111. }
  112. } else {
  113. c.ServeSuccessJSON(map[string]interface{}{
  114. "status": "-1",
  115. })
  116. }
  117. }
  118. func (c *AHybController) Get9001() {
  119. url := c.GetString("url")
  120. org_name := c.GetString("org_name")
  121. opera_name := c.GetString("opera_name")
  122. opera_id := c.GetString("opera_id")
  123. fixmedins_code := c.GetString("fixmedins_code")
  124. insuplc_admdvs := c.GetString("insuplc_admdvs")
  125. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  126. secret_key := c.GetString("secret_key")
  127. cainfo := c.GetString("cainfo")
  128. result, inputLog := service.AHyb9001(org_name, opera_name,fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, opera_id,url,cainfo,"")
  129. fmt.Println(result)
  130. fmt.Println(inputLog)
  131. saveJsLog(result, inputLog, "9001", "签到", org_name)
  132. var response Response
  133. if err := json.Unmarshal([]byte(result), &response); err != nil {
  134. fmt.Println("Error decoding JSON:", err)
  135. return
  136. }
  137. if response.Code == 200{
  138. var dat2 map[string]interface{}
  139. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  140. } else {
  141. }
  142. c.ServeSuccessJSON(map[string]interface{}{
  143. "pre": response.Body,
  144. "log": dat2,
  145. "status":"1",
  146. "msg":"",
  147. })
  148. }else{
  149. c.ServeSuccessJSON(map[string]interface{}{
  150. "status":"0",
  151. "msg":response.Message,
  152. })
  153. }
  154. }
  155. func (c *AHybController) Get5301() {
  156. psn_no := c.GetString("psn_no")
  157. org_name := c.GetString("org_name")
  158. doctor := c.GetString("doctor")
  159. fixmedins_code := c.GetString("fixmedins_code")
  160. insuplc_admdvs := c.GetString("insuplc_admdvs")
  161. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  162. secret_key := c.GetString("secret_key")
  163. url := c.GetString("url")
  164. ak := c.GetString("ak")
  165. cainfo := c.GetString("cainfo")
  166. result, inputLog := service.AHyb5301(psn_no, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, cainfo)
  167. //saveJsLog()
  168. saveJsLog(result, inputLog, "5301", "查询备案", org_name)
  169. var response Response
  170. if err := json.Unmarshal([]byte(result), &response); err != nil {
  171. fmt.Println("Error decoding JSON:", err)
  172. return
  173. }
  174. if response.Code == 200{
  175. var dat2 map[string]interface{}
  176. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  177. } else {
  178. }
  179. c.ServeSuccessJSON(map[string]interface{}{
  180. "pre": response.Body,
  181. "log": dat2,
  182. "status":"1",
  183. "msg":"",
  184. })
  185. }else{
  186. c.ServeSuccessJSON(map[string]interface{}{
  187. "status":"0",
  188. "msg":response.Message,
  189. })
  190. }
  191. }
  192. func (c *AHybController) PostOne() {
  193. certNo := c.GetString("cert_no")
  194. org_name := c.GetString("org_name")
  195. doctor := c.GetString("doctor")
  196. fixmedins_code := c.GetString("fixmedins_code")
  197. insuplc_admdvs := c.GetString("insuplc_admdvs")
  198. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  199. id_card_type, _ := c.GetInt64("id_card_type")
  200. card_sn := c.GetString("card_sn")
  201. certificates := c.GetString("certificates")
  202. url := c.GetString("url")
  203. token := c.GetString("token")
  204. name := c.GetString("name")
  205. result, inputLog := service.AHyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, id_card_type, card_sn, certificates, url, name,token)
  206. fmt.Println(result)
  207. fmt.Println(inputLog)
  208. saveJsLog(result, inputLog, "1101", "查询个人信息", org_name)
  209. var response Response
  210. if err := json.Unmarshal([]byte(result), &response); err != nil {
  211. fmt.Println("Error decoding JSON:", err)
  212. return
  213. }
  214. if response.Code == 200{
  215. var dat2 map[string]interface{}
  216. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  217. } else {
  218. }
  219. c.ServeSuccessJSON(map[string]interface{}{
  220. "pre": response.Body,
  221. "log": dat2,
  222. "status":"1",
  223. "msg":"",
  224. })
  225. }else{
  226. c.ServeSuccessJSON(map[string]interface{}{
  227. "status":"0",
  228. "msg":response.Message,
  229. })
  230. }
  231. }
  232. func (c *AHybController) PostTwo() {
  233. psnNo := c.GetString("psn_no")
  234. insutype := c.GetString("insutype")
  235. certNo := c.GetString("cert_no")
  236. org_name := c.GetString("org_name")
  237. opera := c.GetString("opera")
  238. ipt_otp_no := c.GetString("ipt_otp_no")
  239. dept := c.GetString("dept")
  240. verify_number := c.GetString("verify_number")
  241. fixmedins_code := c.GetString("fixmedins_code")
  242. dept_code := c.GetString("dept_code")
  243. doctor_id := c.GetString("doctor_id")
  244. insuplc_admdvs := c.GetString("insuplc_admdvs")
  245. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  246. secret_key := c.GetString("secret_key")
  247. id_card_type, _ := c.GetInt64("id_card_type")
  248. url := c.GetString("url")
  249. ak := c.GetString("ak")
  250. doctor_name := c.GetString("doctor_name")
  251. cainfo := c.GetString("cainfo")
  252. card_sn := c.GetString("card_sn")
  253. result, inputLog := service.AHyb2201(psnNo, insutype, certNo, org_name, opera, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, url, ak, verify_number, cainfo,card_sn)
  254. var response Response
  255. if err := json.Unmarshal([]byte(result), &response); err != nil {
  256. fmt.Println("Error decoding JSON:", err)
  257. return
  258. }
  259. if response.Code == 200{
  260. var dat2 map[string]interface{}
  261. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  262. } else {
  263. }
  264. c.ServeSuccessJSON(map[string]interface{}{
  265. "pre": response.Body,
  266. "log": dat2,
  267. "status":"1",
  268. "msg":"",
  269. })
  270. }else{
  271. c.ServeSuccessJSON(map[string]interface{}{
  272. "status":"0",
  273. "msg":response.Message,
  274. })
  275. }
  276. }
  277. func (c *AHybController) PostThree() {
  278. psnNo := c.GetString("psn_no")
  279. mdtrtId := c.GetString("mdtrt_id")
  280. iptOtpNo := c.GetString("ipt_otp_no")
  281. org_name := c.GetString("org_name")
  282. doctor := c.GetString("doctor")
  283. insuplc_admdvs := c.GetString("insuplc_admdvs")
  284. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  285. secret_key := c.GetString("secret_key")
  286. fixmedins_code := c.GetString("fixmedins_code")
  287. url := c.GetString("url")
  288. ak := c.GetString("ak")
  289. cainfo := c.GetString("cainfo")
  290. result, inputLog := service.AHyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, url, ak, cainfo)
  291. saveJsLog(result, inputLog, "2202", "退号", org_name)
  292. var response Response
  293. if err := json.Unmarshal([]byte(result), &response); err != nil {
  294. fmt.Println("Error decoding JSON:", err)
  295. return
  296. }
  297. if response.Code == 200{
  298. var dat2 map[string]interface{}
  299. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  300. } else {
  301. }
  302. c.ServeSuccessJSON(map[string]interface{}{
  303. "pre": response.Body,
  304. "log": dat2,
  305. "status":"1",
  306. "msg":"",
  307. })
  308. }else{
  309. c.ServeSuccessJSON(map[string]interface{}{
  310. "status":"0",
  311. "msg":response.Message,
  312. })
  313. }
  314. }
  315. func (c *AHybController) PostFour() {
  316. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  317. var respJSON map[string]interface{}
  318. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  319. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  320. return
  321. }
  322. userJSONBytes, _ := json.Marshal(respJSON["config"])
  323. var config []*models.HisXtDiagnoseConfig
  324. if err := json.Unmarshal(userJSONBytes, &config); err != nil {
  325. utils.ErrorLog("解析失败:%v", err)
  326. return
  327. }
  328. fmt.Println(respJSON["psn_no"].(string))
  329. fmt.Println(respJSON["mdtrt_id"].(string))
  330. psnNo := respJSON["psn_no"].(string)
  331. mdtrtId := respJSON["mdtrt_id"].(string)
  332. operator := respJSON["operator"].(string)
  333. department := respJSON["department"].(string)
  334. org_name := respJSON["org_name"].(string)
  335. med_type := respJSON["med_type"].(string)
  336. fixmedins_code := respJSON["fixmedins_code"].(string)
  337. sick_code := respJSON["sick_code"].(string)
  338. sick_name := respJSON["sick_name"].(string)
  339. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  340. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  341. url := respJSON["url"].(string)
  342. begin_time := respJSON["begin_time"].(string)
  343. cainfo := respJSON["cainfo"].(string)
  344. doctor_name := respJSON["doctor_name"].(string)
  345. doctor_number := respJSON["doctor_number"].(string)
  346. //cainfo := c.GetString("cainfo")
  347. result, inputLog := service.AHyb2203(psnNo, mdtrtId, operator, department, org_name, med_type, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sick_code, sick_name, config, url, begin_time, cainfo,doctor_name, doctor_number)
  348. saveJsLog(result, inputLog, "2203", "上传就诊信息", org_name)
  349. var response Response
  350. if err := json.Unmarshal([]byte(result), &response); err != nil {
  351. fmt.Println("Error decoding JSON:", err)
  352. return
  353. }
  354. if response.Code == 200{
  355. var dat2 map[string]interface{}
  356. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  357. } else {
  358. }
  359. c.ServeSuccessJSON(map[string]interface{}{
  360. "pre": response.Body,
  361. "log": dat2,
  362. "status":"1",
  363. "msg":"",
  364. })
  365. }else{
  366. c.ServeSuccessJSON(map[string]interface{}{
  367. "status":"0",
  368. "msg":response.Message,
  369. })
  370. }
  371. }
  372. func (c *AHybController) Get2406() {
  373. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  374. var respJSON map[string]interface{}
  375. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  376. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  377. return
  378. }
  379. psnNo := respJSON["psn_no"].(string)
  380. mdtrtId := respJSON["mdtrt_id"].(string)
  381. operator := respJSON["operator"].(string)
  382. cert_no := respJSON["cert_no"].(string)
  383. org_name := respJSON["org_name"].(string)
  384. psn_name := respJSON["psn_name"].(string)
  385. ipt_otp_no := respJSON["ipt_otp_no"].(string)
  386. ipt_psn_sp_flag_type := respJSON["ipt_psn_sp_flag_type"].(string)
  387. ipt_psn_sp_flag := respJSON["ipt_psn_sp_flag"].(string)
  388. fixmedins_code := respJSON["fixmedins_code"].(string)
  389. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  390. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  391. url := respJSON["url"].(string)
  392. result, inputLog := service.AHyb2406(psnNo, mdtrtId, cert_no, psn_name, operator, ipt_otp_no,ipt_psn_sp_flag_type, ipt_psn_sp_flag,org_name,fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,url)
  393. saveJsLog(result, inputLog, "2406", "上传2406信息", org_name)
  394. var response Response
  395. if err := json.Unmarshal([]byte(result), &response); err != nil {
  396. fmt.Println("Error decoding JSON:", err)
  397. return
  398. }
  399. if response.Code == 200{
  400. var dat2 map[string]interface{}
  401. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  402. } else {
  403. }
  404. c.ServeSuccessJSON(map[string]interface{}{
  405. "pre": response.Body,
  406. "log": dat2,
  407. "status":"1",
  408. "msg":"",
  409. })
  410. }else{
  411. c.ServeSuccessJSON(map[string]interface{}{
  412. "status":"0",
  413. "msg":response.Message,
  414. })
  415. }
  416. }
  417. type All struct {
  418. HisPrescription HisPrescription
  419. mdtrt_id string
  420. psn_no string
  421. }
  422. type HisPrescription struct {
  423. ID int64 `gorm:"column:id" json:"id" form:"id"`
  424. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
  425. RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
  426. PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
  427. HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
  428. Status int64 `gorm:"column:status" json:"status" form:"status"`
  429. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  430. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  431. Number string `gorm:"column:number" json:"number" form:"number"`
  432. Type int64 `gorm:"column:type" json:"type" form:"type"`
  433. Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
  434. Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
  435. Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
  436. HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"advices"`
  437. HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"`
  438. }
  439. func (c *AHybController) PostFive() {
  440. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  441. var respJSON map[string]interface{}
  442. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  443. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  444. return
  445. }
  446. userJSONBytes, _ := json.Marshal(respJSON["pre"])
  447. var hp []*models.HisPrescription
  448. if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
  449. utils.ErrorLog("解析失败:%v", err)
  450. return
  451. }
  452. //fmt.Println("2203A的time_stamp=" + respJSON["time_stamp"].(string))
  453. result, inputLog := service.AHyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
  454. respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["diag_code"].(string), respJSON["url"].(string), respJSON["ak"].(string), respJSON["new_doctor_name"].(string), "", respJSON["cainfo"].(string), respJSON["opter"].(string))
  455. saveJsLog(result, inputLog, "2204", "上传明细", respJSON["org_name"].(string))
  456. var response Response
  457. if err := json.Unmarshal([]byte(result), &response); err != nil {
  458. fmt.Println("Error decoding JSON:", err)
  459. return
  460. }
  461. if response.Code == 200{
  462. var dat2 map[string]interface{}
  463. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  464. } else {
  465. }
  466. c.ServeSuccessJSON(map[string]interface{}{
  467. "pre": response.Body,
  468. "log": dat2,
  469. "status":"1",
  470. "msg":"",
  471. })
  472. }else{
  473. c.ServeSuccessJSON(map[string]interface{}{
  474. "status":"0",
  475. "msg":response.Message,
  476. })
  477. }
  478. }
  479. func (c *AHybController) PostSix() {
  480. psnNo := c.GetString("psn_no")
  481. mdtrtId := c.GetString("mdtrt_id")
  482. chrgBchno := c.GetString("chrg_bchno")
  483. org_name := c.GetString("org_name")
  484. doctor := c.GetString("doctor")
  485. insuplc_admdvs := c.GetString("insuplc_admdvs")
  486. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  487. secret_key := c.GetString("secret_key")
  488. fixmedins_code := c.GetString("fixmedins_code")
  489. url := c.GetString("url")
  490. ak := c.GetString("ak")
  491. cainfo := c.GetString("cainfo")
  492. result, inputLog := service.AHyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, url, ak, cainfo)
  493. fmt.Println(inputLog)
  494. saveJsLog(result, inputLog, "2205", "撤销明细", org_name)
  495. var response Response
  496. if err := json.Unmarshal([]byte(result), &response); err != nil {
  497. fmt.Println("Error decoding JSON:", err)
  498. return
  499. }
  500. if response.Code == 200{
  501. var dat2 map[string]interface{}
  502. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  503. } else {
  504. }
  505. c.ServeSuccessJSON(map[string]interface{}{
  506. "pre": response.Body,
  507. "log": dat2,
  508. "status":"1",
  509. "msg":"",
  510. })
  511. }else{
  512. c.ServeSuccessJSON(map[string]interface{}{
  513. "status":"0",
  514. "msg":response.Message,
  515. })
  516. }
  517. }
  518. func (c *AHybController) PostSeven() {
  519. psnNo := c.GetString("psn_no")
  520. mdtrtId := c.GetString("mdtrt_id")
  521. chrgBchno := c.GetString("chrg_bchno")
  522. certNo := c.GetString("cert_no")
  523. insutype := c.GetString("insutype")
  524. total := c.GetString("total")
  525. org_name := c.GetString("org_name")
  526. doctor := c.GetString("doctor")
  527. fixmedins_code := c.GetString("fixmedins_code")
  528. insuplc_admdvs := c.GetString("insuplc_admdvs")
  529. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  530. secret_key := c.GetString("secret_key")
  531. med_type := c.GetString("med_type")
  532. id_card_type, _ := c.GetInt64("id_card_type")
  533. certificates, _ := c.GetInt64("certificates")
  534. verify_number := c.GetString("verify_number")
  535. cainfo := c.GetString("cainfo")
  536. mdtrt_grp_type := c.GetString("mdtrt_grp_type")
  537. url := c.GetString("url")
  538. ak := c.GetString("ak")
  539. var result string
  540. var inputLog string
  541. result, inputLog = service.AHyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, certificates, url, ak, verify_number, cainfo, mdtrt_grp_type)
  542. saveJsLog(result, inputLog, "2206", "预结算", org_name)
  543. var response Response
  544. if err := json.Unmarshal([]byte(result), &response); err != nil {
  545. fmt.Println("Error decoding JSON:", err)
  546. return
  547. }
  548. if response.Code == 200{
  549. var dat2 map[string]interface{}
  550. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  551. } else {
  552. }
  553. c.ServeSuccessJSON(map[string]interface{}{
  554. "pre": response.Body,
  555. "log": dat2,
  556. "status":"1",
  557. "msg":"",
  558. })
  559. }else{
  560. c.ServeSuccessJSON(map[string]interface{}{
  561. "status":"0",
  562. "msg":response.Message,
  563. })
  564. }
  565. }
  566. func (c *AHybController) PostEight() {
  567. psnNo := c.GetString("psn_no")
  568. mdtrtId := c.GetString("mdtrt_id")
  569. chrgBchno := c.GetString("chrg_bchno")
  570. certNo := c.GetString("cert_no")
  571. insutype := c.GetString("insutype")
  572. total := c.GetString("total")
  573. org_name := c.GetString("org_name")
  574. doctor := c.GetString("doctor")
  575. fixmedins_code := c.GetString("fixmedins_code")
  576. insuplc_admdvs := c.GetString("insuplc_admdvs")
  577. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  578. secret_key := c.GetString("secret_key")
  579. med_type := c.GetString("med_type")
  580. id_card_type, _ := c.GetInt64("id_card_type")
  581. acct_used_flag := c.GetString("acct_used_flag")
  582. url := c.GetString("url")
  583. ak := c.GetString("ak")
  584. verify_number := c.GetString("verify_number")
  585. cainfo := c.GetString("cainfo")
  586. mdtrt_grp_type := c.GetString("mdtrt_grp_type")
  587. var result string
  588. var inputLog string
  589. result, inputLog = service.AHyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, acct_used_flag, url, ak, verify_number, cainfo, mdtrt_grp_type)
  590. saveJsLog(result, inputLog, "2207", "结算", org_name)
  591. var response Response
  592. if err := json.Unmarshal([]byte(result), &response); err != nil {
  593. fmt.Println("Error decoding JSON:", err)
  594. return
  595. }
  596. if response.Code == 200{
  597. var dat2 map[string]interface{}
  598. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  599. } else {
  600. }
  601. c.ServeSuccessJSON(map[string]interface{}{
  602. "pre": response.Body,
  603. "log": dat2,
  604. "status":"1",
  605. "msg":"",
  606. })
  607. }else{
  608. c.ServeSuccessJSON(map[string]interface{}{
  609. "status":"0",
  610. "msg":response.Message,
  611. })
  612. }
  613. }
  614. func (c *AHybController) PostNine() {
  615. psnNo := c.GetString("psn_no")
  616. mdtrtId := c.GetString("mdtrt_id")
  617. setlId := c.GetString("setl_id")
  618. org_name := c.GetString("org_name")
  619. doctor := c.GetString("doctor")
  620. secret_key := c.GetString("secret_key")
  621. fixmedins_code := c.GetString("fixmedins_code")
  622. insuplc_admdvs := c.GetString("insuplc_admdvs")
  623. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  624. url := c.GetString("url")
  625. ak := c.GetString("ak")
  626. cainfo := c.GetString("cainfo")
  627. result, inputLog := service.AHyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, ak, cainfo)
  628. saveJsLog(result, inputLog, "2208", "退费", org_name)
  629. var response Response
  630. if err := json.Unmarshal([]byte(result), &response); err != nil {
  631. fmt.Println("Error decoding JSON:", err)
  632. return
  633. }
  634. if response.Code == 200{
  635. var dat2 map[string]interface{}
  636. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  637. } else {
  638. }
  639. c.ServeSuccessJSON(map[string]interface{}{
  640. "pre": response.Body,
  641. "log": dat2,
  642. "status":"1",
  643. "msg":"",
  644. })
  645. }else{
  646. c.ServeSuccessJSON(map[string]interface{}{
  647. "status":"0",
  648. "msg":response.Message,
  649. })
  650. }
  651. }
  652. func (c *AHybController) PostTen() {
  653. psnNo := c.GetString("psn_no")
  654. mdtrtId := c.GetString("mdtrt_id")
  655. setlId := c.GetString("setl_id")
  656. org_name := c.GetString("org_name")
  657. doctor := c.GetString("doctor")
  658. secret_key := c.GetString("secret_key")
  659. fixmedins_code := c.GetString("fixmedins_code")
  660. insuplc_admdvs := c.GetString("insuplc_admdvs")
  661. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  662. url := c.GetString("url")
  663. ak := c.GetString("ak")
  664. cainfo := c.GetString("cainfo")
  665. baseParams := models.BaseParams{
  666. SecretKey: secret_key,
  667. FixmedinsCode: fixmedins_code,
  668. InsuplcAdmdvs: insuplc_admdvs,
  669. MdtrtareaAdmvs: mdtrtarea_admvs,
  670. OrgName: org_name,
  671. Doctor: doctor,
  672. RequestUrl: url,
  673. AccessKey: ak,
  674. Cainfo: cainfo,
  675. }
  676. businessParams := models.BusinessParams{
  677. PsnNo: psnNo,
  678. MdtrtId: mdtrtId,
  679. SetlId: setlId,
  680. }
  681. result, inputLog := service.AHyb5203(baseParams, businessParams)
  682. saveJsLog(result, inputLog, "5203", "结算单", org_name)
  683. var response Response
  684. if err := json.Unmarshal([]byte(result), &response); err != nil {
  685. fmt.Println("Error decoding JSON:", err)
  686. return
  687. }
  688. if response.Code == 200{
  689. var dat2 map[string]interface{}
  690. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  691. } else {
  692. }
  693. c.ServeSuccessJSON(map[string]interface{}{
  694. "pre": response.Body,
  695. "log": dat2,
  696. "status":"1",
  697. "msg":"",
  698. })
  699. }else{
  700. c.ServeSuccessJSON(map[string]interface{}{
  701. "status":"0",
  702. "msg":response.Message,
  703. })
  704. }
  705. }
  706. func (c *AHybController) Get2503() {
  707. psnNo := c.GetString("psn_no")
  708. insutype := c.GetString("insutype")
  709. sick_code := c.GetString("sick_code")
  710. sick_name := c.GetString("sick_name")
  711. insuplc_admdvs := c.GetString("insuplc_admdvs")
  712. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  713. secret_key := c.GetString("secret_key")
  714. access_key := c.GetString("access_key")
  715. fixmedins_code := c.GetString("fixmedins_code")
  716. org_name := c.GetString("org_name")
  717. check_time := c.GetString("check_time")
  718. doctor_id := c.GetString("doctor_id")
  719. doctor := c.GetString("doctor")
  720. start_time := c.GetString("start_time")
  721. end_time := c.GetString("end_time")
  722. url := c.GetString("url")
  723. cainfo := c.GetString("cainfo")
  724. service.AHyb2503(psnNo, insutype, org_name, doctor, fixmedins_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_name, sick_code, start_time, end_time, check_time, url, access_key, cainfo)
  725. }
  726. func (c *AHybController) Get3201() {
  727. insutype := c.GetString("insutype")
  728. clrType := c.GetString("clr_type")
  729. setlOptins := c.GetString("setl_optins")
  730. stmtBegndate := c.GetString("stmt_begndate")
  731. stmtEnddate := c.GetString("stm_enddate")
  732. medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0)
  733. fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0)
  734. acctPay, _ := c.GetFloat("acct_pay", 0)
  735. fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0)
  736. fixmedins_code := c.GetString("fixmedins_code")
  737. insuplc_admdvs := c.GetString("insuplc_admdvs")
  738. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  739. secret_key := c.GetString("secret_key")
  740. org_name := c.GetString("org_name")
  741. doctor := c.GetString("doctor")
  742. url := c.GetString("url")
  743. ak := c.GetString("ak")
  744. cainfo := c.GetString("cainfo")
  745. result, inputLog := service.AHyb3201(fixmedinsSetlCnt, acctPay, fundPaySumamt, medfeeSumamt, stmtBegndate, stmtEnddate, setlOptins, clrType, insutype, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, ak, secret_key, cainfo)
  746. saveJsLog(result, inputLog, "3201", "对总账", org_name)
  747. var response Response
  748. if err := json.Unmarshal([]byte(result), &response); err != nil {
  749. fmt.Println("Error decoding JSON:", err)
  750. return
  751. }
  752. if response.Code == 200{
  753. var dat2 map[string]interface{}
  754. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  755. } else {
  756. }
  757. c.ServeSuccessJSON(map[string]interface{}{
  758. "pre": response.Body,
  759. "log": dat2,
  760. "status":"1",
  761. "msg":"",
  762. })
  763. }else{
  764. c.ServeSuccessJSON(map[string]interface{}{
  765. "status":"0",
  766. "msg":response.Message,
  767. })
  768. }
  769. }
  770. type ELeData struct {
  771. Data struct {
  772. SiNo string `json:"si_no"`
  773. SiCardNo string `json:"si_card_no"`
  774. SiCardIssueArea string `json:"si_card_issue_area"`
  775. Name string `json:"name"`
  776. Gender string `json:"gender"`
  777. IdType string `json:"id_type"`
  778. IdNo string `json:"id_no"`
  779. EcCardToken string `json:"ecCardToken"`
  780. } `json:"data"`
  781. Code int `json:"code"`
  782. Message string `json:"message"`
  783. }
  784. type ELeCertData struct {
  785. Data struct {
  786. Extra string `json:"extra"`
  787. IDNo string `json:"idNo"`
  788. IDType string `json:"idType"`
  789. EcToken string `json:"ecToken"`
  790. InsuOrg string `json:"insuOrg"`
  791. UserName string `json:"userName"`
  792. EcIndexNo string `json:"ecIndexNo"`
  793. Gender string `json:"gender"`
  794. Birthday string `json:"birthday"`
  795. Nationality string `json:"nationality"`
  796. Email string `json:"email"`
  797. } `json:"data"`
  798. Code int `json:"code"`
  799. Message string `json:"message"`
  800. }
  801. func (c *AHybController) ReadCard() {
  802. fixmedins_code := c.GetString("fixmedins_code")
  803. secret_key := c.GetString("secret_key")
  804. ak := c.GetString("ak")
  805. org_name := c.GetString("org_name")
  806. doctor := c.GetString("doctor")
  807. insuplc_admdvs := c.GetString("insuplc_admdvs")
  808. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  809. url := c.GetString("url")
  810. cainfo := c.GetString("cainfo")
  811. id_card_type := c.GetString("id_card_type")
  812. operator_id := c.GetString("operator_id")
  813. operator := c.GetString("operator")
  814. //result, request := service.AHyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
  815. //fmt.Println(request)
  816. //fmt.Println(result)
  817. //c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
  818. switch id_card_type {
  819. case "1":
  820. pCardInfo := c.GetBasBaseInfo()
  821. pCardInfo = Remove0000(pCardInfo)
  822. fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
  823. fmt.Println(pCardInfo)
  824. bas := strings.Split(pCardInfo, "|")
  825. basNumber := bas[2]
  826. id_card_no := bas[1]
  827. card_sn := bas[3]
  828. id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
  829. if len(pCardInfo) > 0 {
  830. result, _ := service.AHyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, id_card_no, cainfo)
  831. var dat map[string]interface{}
  832. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  833. fmt.Println(dat)
  834. } else {
  835. fmt.Println(err)
  836. }
  837. c.ServeSuccessJSON(map[string]interface{}{
  838. "status": "0",
  839. "card_info": pCardInfo,
  840. "result": dat,
  841. "type": "1",
  842. })
  843. } else {
  844. c.ServeSuccessJSON(map[string]interface{}{
  845. "status": "-1",
  846. })
  847. }
  848. break
  849. case "3": //电子社保卡
  850. _, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
  851. //fmt.Println(pCardInfo)
  852. fmt.Println(pBusiCardInfo)
  853. pBusiCardInfo = Remove0000(pBusiCardInfo)
  854. //pCardInfo = Remove0000(pCardInfo)
  855. var ele ELeData
  856. err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
  857. if err != nil {
  858. utils.ErrorLog("解析失败:%v", err)
  859. }
  860. token := ele.Data.EcCardToken
  861. if len(token) > 0 {
  862. result, _ := service.AHyb1101B(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IdNo)
  863. var dat map[string]interface{}
  864. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  865. fmt.Println(dat)
  866. } else {
  867. fmt.Println(err)
  868. }
  869. c.ServeSuccessJSON(map[string]interface{}{
  870. "status": "0",
  871. //"card_info": pCardInfo,
  872. "busi_card_info": pBusiCardInfo,
  873. "token": token,
  874. "result": dat,
  875. "type": "2",
  876. })
  877. } else {
  878. c.ServeSuccessJSON(map[string]interface{}{
  879. "status": "-1",
  880. })
  881. }
  882. break
  883. case "4": //电子凭证
  884. fmt.Println(operator_id)
  885. fmt.Println(operator)
  886. _, pBusiCardInfo := c.GetELeCertInfoTwo(fixmedins_code, operator_id, operator)
  887. fmt.Println(pBusiCardInfo)
  888. pBusiCardInfo = Remove0000(pBusiCardInfo)
  889. var ele ELeCertData
  890. err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
  891. if err != nil {
  892. utils.ErrorLog("解析失败:%v", err)
  893. }
  894. token := ele.Data.EcToken
  895. fmt.Println(token)
  896. if len(token) > 0 {
  897. userName := ele.Data.UserName
  898. fmt.Println(userName)
  899. userName = Remove0000(userName)
  900. userName = DeleteExtraSpace(userName)
  901. fmt.Println(userName)
  902. enc := mahonia.NewEncoder("gbk")
  903. fmt.Println(enc.ConvertString(userName))
  904. result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
  905. var response Response
  906. if err := json.Unmarshal([]byte(result), &response); err != nil {
  907. fmt.Println("Error decoding JSON:", err)
  908. return
  909. }
  910. if response.Code == 200{
  911. c.ServeSuccessJSON(map[string]interface{}{
  912. "status":"1",
  913. "card_info": "",
  914. "busi_card_info": pBusiCardInfo,
  915. "token": token,
  916. "result": response.Body,
  917. })
  918. }else{
  919. c.ServeSuccessJSON(map[string]interface{}{
  920. "status":"0",
  921. "msg":response.Message,
  922. })
  923. }
  924. } else {
  925. c.ServeSuccessJSON(map[string]interface{}{
  926. "status": "-1",
  927. })
  928. }
  929. break
  930. }
  931. }
  932. func (c *AHybController) TestGetBasBaseInit(code string, secret_key string, ak string) {
  933. DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
  934. Iinit := DllDef.MustFindProc("Init")
  935. //miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  936. str := make([]byte, 2048)
  937. inputData := make(map[string]interface{})
  938. inputData["IP"] = "10.58.65.240"
  939. inputData["PORT"] = "8086"
  940. inputData["TIMEOUT"] = "180"
  941. inputData["LOG_PATH"] = "C:\\log\\"
  942. //inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
  943. inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
  944. inputData["CARD_PASSTYPE"] = "1"
  945. inputData["API_NAME"] = "hssServives"
  946. inputData["API_VERSION"] = "1.0.0"
  947. inputData["ACCESS_KEY"] = ak
  948. inputData["SECRETKEY"] = secret_key
  949. inputData["ORG_ID"] = code
  950. inputData["EXT"] = ""
  951. bytesData, _ := json.Marshal(inputData)
  952. fmt.Println(inputData)
  953. fmt.Println(bytesData)
  954. ret, _, err := Iinit.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&str[0])))
  955. if ret != 0 {
  956. fmt.Println("SSCard的报错原因:", err)
  957. fmt.Println("SSCard的运算结果为:", ret)
  958. fmt.Println("SSCard的返回结果为:", string(str))
  959. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
  960. return
  961. }
  962. fmt.Println("SSCard的返回结果为:", string(str))
  963. result := int(ret)
  964. fmt.Println("SSCard的运算结果为1:", result)
  965. //initFlag = 1
  966. return
  967. }
  968. func (c *AHybController) GetBasBaseInfo() (string) {
  969. DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
  970. readCard := DllDef.MustFindProc("iReadCardBas")
  971. fmt.Println(readCard)
  972. fmt.Println("!!!!!")
  973. pCardInfo := make([]byte, 2048)
  974. ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&pCardInfo[0])))
  975. fmt.Println(ret2)
  976. fmt.Println(DeleteExtraSpace(string(pCardInfo)))
  977. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pCardInfo)), "gbk", "utf-8"))
  978. if ret2 != 0 {
  979. return ""
  980. }
  981. return DeleteExtraSpace(string(pCardInfo))
  982. }
  983. func (c *AHybController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
  984. DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
  985. readCard := DllDef.MustFindProc("EcCardQuery")
  986. fmt.Println(readCard)
  987. fmt.Println("!!!!!")
  988. //pCardInfo := make([]byte, 8192)
  989. pBusiCardInfo := make([]byte, 8192)
  990. //data := make(map[string]interface{})
  991. //pData := make(map[string]interface{})
  992. //inputData := make(map[string]interface{})
  993. //inputData["orgId"] = code
  994. //inputData["businessType"] = "01101"
  995. //inputData["operatorId"] = operator_id
  996. //inputData["operatorName"] = operator_name
  997. //inputData["officeId"] = "001"
  998. //inputData["officeName"] = "血透室"
  999. //data["data"] = inputData
  1000. //data["transType"] = "ec.query"
  1001. //data["orgId"] = code
  1002. //bytesData, _ := json.Marshal(data)
  1003. //pCardInfo = bytesData
  1004. ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
  1005. fmt.Println(ret2)
  1006. //fmt.Println(DeleteExtraSpace(string(bytesData)))
  1007. fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
  1008. //fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
  1009. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
  1010. if ret2 != 0 {
  1011. return "", ""
  1012. }
  1013. return DeleteExtraSpace(""), DeleteExtraSpace(string(pBusiCardInfo))
  1014. }
  1015. func (c *AHybController) GetELeCertInfoFour1(code string, operator_id string, operator_name string) (string, string) {
  1016. DllDef := syscall.MustLoadDLL("NationEcCode.dll")
  1017. readCard := DllDef.MustFindProc("EcQuery")
  1018. pCardInfo := make([]byte, 8192)
  1019. pBusiCardInfo := make([]byte, 8192)
  1020. data := make(map[string]interface{})
  1021. inputData := make(map[string]interface{})
  1022. inputData["orgId"] = code
  1023. inputData["businessType"] = "01301"
  1024. inputData["operatorId"] = operator_id
  1025. inputData["operatorName"] = operator_name
  1026. inputData["officeId"] = "001"
  1027. inputData["officeName"] = "xuetou"
  1028. data["data"] = inputData
  1029. data["transType"] = "ec.query"
  1030. data["orgId"] = code
  1031. bytesData, _ := json.Marshal(data)
  1032. pCardInfo = bytesData
  1033. pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
  1034. ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
  1035. fmt.Println(ret2)
  1036. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
  1037. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
  1038. if ret2 != 0 {
  1039. return "", ""
  1040. }
  1041. return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
  1042. }
  1043. func (c *AHybController) GetELeCertInfoFour(code string, operator_id string, operator_name string) (string, string) {
  1044. DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
  1045. readCard := DllDef.MustFindProc("GetPersonInfo")
  1046. pCardInfo := make([]byte, 8192)
  1047. pBusiCardInfo := make([]byte, 8192)
  1048. data := make(map[string]interface{})
  1049. inputData := make(map[string]interface{})
  1050. inputData["orgId"] = code
  1051. inputData["businessType"] = "01301"
  1052. inputData["operatorId"] = operator_id
  1053. inputData["operatorName"] = operator_name
  1054. inputData["officeId"] = "001"
  1055. inputData["officeName"] = "xuetou"
  1056. data["data"] = inputData
  1057. data["transType"] = "ec.query"
  1058. data["orgId"] = code
  1059. bytesData, _ := json.Marshal(data)
  1060. pCardInfo = bytesData
  1061. pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
  1062. ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
  1063. fmt.Println(ret2)
  1064. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
  1065. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
  1066. if ret2 != 0 {
  1067. return "", ""
  1068. }
  1069. return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
  1070. }
  1071. func (c *AHybController) GetELeCertInfoFour2223(code string, operator_id string, operator_name string) (string, string) {
  1072. DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
  1073. readCard := DllDef.MustFindProc("GetPersonInfo")
  1074. pCardInfo := make([]byte, 8192)
  1075. pBusiCardInfo := make([]byte, 8192)
  1076. data := make(map[string]interface{})
  1077. inputData := make(map[string]interface{})
  1078. inputData["orgId"] = code
  1079. inputData["businessType"] = "01101"
  1080. inputData["operatorId"] = operator_id
  1081. inputData["operatorName"] = operator_name
  1082. inputData["officeId"] = "001"
  1083. inputData["officeName"] = "xuetou"
  1084. data["data"] = inputData
  1085. data["transType"] = "ec.query"
  1086. data["orgId"] = code
  1087. bytesData, _ := json.Marshal(data)
  1088. pCardInfo = bytesData
  1089. pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
  1090. ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
  1091. fmt.Println(ret2)
  1092. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
  1093. fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
  1094. if ret2 != 0 {
  1095. return "", ""
  1096. }
  1097. return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
  1098. }
  1099. func (c *AHybController) GetELeCertInfoTwo(code string, operator_id string, operator_name string) (string, string) {
  1100. // WebSocket服务器地址
  1101. serverURL := "ws://127.0.0.1:8899"
  1102. // 解析WebSocket服务器地址
  1103. u, err := url.Parse(serverURL)
  1104. if err != nil {
  1105. log.Fatal(err)
  1106. }
  1107. // 建立WebSocket连接
  1108. conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
  1109. if err != nil {
  1110. log.Fatal(err)
  1111. }
  1112. defer conn.Close()
  1113. input2 := make(map[string]interface{})
  1114. input := make(map[string]interface{})
  1115. inputData := make(map[string]interface{})
  1116. inputData["orgId"] = code
  1117. inputData["businessType"] = "01101"
  1118. inputData["operatorId"] = operator_id
  1119. inputData["operatorName"] = operator_name
  1120. inputData["officeId"] = "001"
  1121. inputData["officeName"] = "血透室"
  1122. inputData["deviceType"] = ""
  1123. input["data"] = inputData
  1124. input["orgId"] = code
  1125. input["transType"] = "ec.query"
  1126. input2["url"] = "http://10.66.159.55:8080/localcfc/api/hsecfc/localQrCodeQuery"
  1127. input2["indata"] = input
  1128. bytesData, _ := json.Marshal(input2)
  1129. err = conn.WriteMessage(websocket.TextMessage, bytesData)
  1130. if err != nil {
  1131. fmt.Println(err)
  1132. }
  1133. // 接收消息
  1134. _, receivedMessage, err := conn.ReadMessage()
  1135. if err != nil {
  1136. fmt.Println(err)
  1137. }
  1138. return "", string(receivedMessage)
  1139. }
  1140. func (c *AHybController) GetELeCertInfoThree(code string, operator_id string, operator_name string) (string, string) {
  1141. // WebSocket服务器地址
  1142. serverURL := "ws://127.0.0.1:8899"
  1143. // 解析WebSocket服务器地址
  1144. u, err := url.Parse(serverURL)
  1145. if err != nil {
  1146. log.Fatal(err)
  1147. }
  1148. // 建立WebSocket连接
  1149. conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
  1150. if err != nil {
  1151. log.Fatal(err)
  1152. }
  1153. defer conn.Close()
  1154. input2 := make(map[string]interface{})
  1155. input := make(map[string]interface{})
  1156. inputData := make(map[string]interface{})
  1157. inputData["orgId"] = code
  1158. inputData["businessType"] = "01301"
  1159. inputData["operatorId"] = operator_id
  1160. inputData["operatorName"] = operator_name
  1161. inputData["officeId"] = "001"
  1162. inputData["officeName"] = "血透室"
  1163. inputData["deviceType"] = ""
  1164. input["data"] = inputData
  1165. input["orgId"] = code
  1166. input["transType"] = "ec.query"
  1167. input2["url"] = "http://10.66.159.55:8080/localcfc/api/hsecfc/localQrCodeQuery"
  1168. input2["indata"] = input
  1169. bytesData, _ := json.Marshal(input2)
  1170. err = conn.WriteMessage(websocket.TextMessage, bytesData)
  1171. if err != nil {
  1172. fmt.Println(err)
  1173. }
  1174. // 接收消息
  1175. _, receivedMessage, err := conn.ReadMessage()
  1176. if err != nil {
  1177. fmt.Println(err)
  1178. }
  1179. return "", string(receivedMessage)
  1180. }
  1181. func IntPtr(n int) uintptr {
  1182. return uintptr(n)
  1183. }
  1184. func StrPtr(s string) uintptr {
  1185. return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
  1186. }
  1187. type Charset string
  1188. const (
  1189. UTF8 = Charset("UTF-8")
  1190. GB18030 = Charset("GB18030")
  1191. )
  1192. func ConvertToString(src string, srcCode string, tagCode string) string {
  1193. srcCoder := mahonia.NewDecoder(srcCode)
  1194. srcResult := srcCoder.ConvertString(src)
  1195. tagCoder := mahonia.NewDecoder(tagCode)
  1196. _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
  1197. result := string(cdata)
  1198. return result
  1199. }
  1200. func DeleteExtraSpace(s string) string {
  1201. //删除字符串中的多余空格,有多个空格时,仅保留一个空格
  1202. s1 := strings.Replace(s, " ", " ", -1) //替换tab为空格
  1203. regstr := "\\s{2,}" //两个及两个以上空格的正则表达式
  1204. reg, _ := regexp.Compile(regstr) //编译正则表达式
  1205. s2 := make([]byte, len(s1)) //定义字符数组切片
  1206. copy(s2, s1) //将字符串复制到切片
  1207. spc_index := reg.FindStringIndex(string(s2)) //在字符串中搜索
  1208. for len(spc_index) > 0 { //找到适配项
  1209. s2 = append(s2[:spc_index[0]+1], s2[spc_index[1]:]...) //删除多余空格
  1210. spc_index = reg.FindStringIndex(string(s2)) //继续在字符串中搜索
  1211. }
  1212. return string(s2)
  1213. }
  1214. func Remove0000(s string) string {
  1215. str := make([]rune, 0, len(s))
  1216. for _, v := range []rune(s) {
  1217. if v == 0 {
  1218. continue
  1219. }
  1220. str = append(str, v)
  1221. }
  1222. return string(str)
  1223. }
  1224. func saveJsLog(result string, request string, infno string, desc string, org_name string) {
  1225. //org_id, _ := beego.AppConfig.Int64("org_id")
  1226. //miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  1227. dir := org_name + "日志"
  1228. utils.Mkdir(dir)
  1229. month := time.Unix(1557042972, 0).Format("1")
  1230. year := time.Now().Format("2006")
  1231. month = time.Now().Format("01")
  1232. day := time.Now().Format("02")
  1233. hour := time.Now().Format("15")
  1234. min := time.Now().Format("04")
  1235. sec := time.Now().Format("05")
  1236. result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
  1237. file := org_name + "_" + year + month + day + "_log"
  1238. file_name := file + ".txt"
  1239. file_path := org_name + "日志" + "/" + file_name
  1240. exist, _ := utils.PathExists(file_path)
  1241. if exist { //存在
  1242. fmt.Println("存在")
  1243. f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  1244. if err != nil {
  1245. fmt.Println("read fail")
  1246. }
  1247. content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
  1248. n, _ := f.Seek(0, 2)
  1249. _, err = f.WriteAt([]byte(content), n)
  1250. } else { //不存在
  1251. fmt.Println("文件不存在,创建文件")
  1252. f, err := os.Create(org_name + "日志" + "/" + file_name)
  1253. defer f.Close()
  1254. if err != nil {
  1255. } else {
  1256. _, err = f.Write([]byte("记录日志"))
  1257. }
  1258. }
  1259. }
  1260. func (c *AHybController) Get3101() {
  1261. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  1262. var respJSON map[string]interface{}
  1263. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1264. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1265. return
  1266. }
  1267. pdUserJSONBytes, _ := json.Marshal(respJSON["pd"])
  1268. var pd models.PatientDtos
  1269. if err := json.Unmarshal(pdUserJSONBytes, &pd); err != nil {
  1270. utils.ErrorLog("解析失败:%v", err)
  1271. return
  1272. }
  1273. fedUserJSONBytes, _ := json.Marshal(respJSON["fed"])
  1274. var fed models.FsiEncounterDtos
  1275. if err := json.Unmarshal(fedUserJSONBytes, &fed); err != nil {
  1276. utils.ErrorLog("解析失败:%v", err)
  1277. return
  1278. }
  1279. fddUserJSONBytes, _ := json.Marshal(respJSON["fdd"])
  1280. var fdd []*models.FsiDiagnoseDtos
  1281. if err := json.Unmarshal(fddUserJSONBytes, &fdd); err != nil {
  1282. utils.ErrorLog("解析失败:%v", err)
  1283. return
  1284. }
  1285. fodUserJSONBytes, _ := json.Marshal(respJSON["fod"])
  1286. var fod []*models.FsiOrderDtos
  1287. if err := json.Unmarshal(fodUserJSONBytes, &fod); err != nil {
  1288. utils.ErrorLog("解析失败:%v", err)
  1289. return
  1290. }
  1291. fopdUserJSONBytes, _ := json.Marshal(respJSON["fopd"])
  1292. var fopd []*models.FsiOperationDtosData
  1293. if err := json.Unmarshal(fopdUserJSONBytes, &fopd); err != nil {
  1294. utils.ErrorLog("解析失败:%v", err)
  1295. return
  1296. }
  1297. ppUserJSONBytes, _ := json.Marshal(respJSON["pp"])
  1298. var pp models.PublicParams
  1299. if err := json.Unmarshal(ppUserJSONBytes, &pp); err != nil {
  1300. utils.ErrorLog("解析失败:%v", err)
  1301. return
  1302. }
  1303. inputLog, result := service.AHyb3101(pd, fed, fdd, fod, fopd, pp, respJSON["trig_scen"].(string))
  1304. var response Response
  1305. if err := json.Unmarshal([]byte(result), &response); err != nil {
  1306. fmt.Println("Error decoding JSON:", err)
  1307. return
  1308. }
  1309. if response.Code == 200{
  1310. var dat2 map[string]interface{}
  1311. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  1312. } else {
  1313. }
  1314. c.ServeSuccessJSON(map[string]interface{}{
  1315. "pre": response.Body,
  1316. "log": dat2,
  1317. "status":1,
  1318. "msg":"",
  1319. })
  1320. }else{
  1321. c.ServeSuccessJSON(map[string]interface{}{
  1322. "status":0,
  1323. "msg":response.Message,
  1324. })
  1325. }
  1326. }
  1327. func (c *AHybController) Get3102() {
  1328. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  1329. var respJSON map[string]interface{}
  1330. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1331. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1332. return
  1333. }
  1334. pdUserJSONBytes, _ := json.Marshal(respJSON["pd"])
  1335. var pd models.PatientDtos
  1336. if err := json.Unmarshal(pdUserJSONBytes, &pd); err != nil {
  1337. utils.ErrorLog("解析失败:%v", err)
  1338. return
  1339. }
  1340. fedUserJSONBytes, _ := json.Marshal(respJSON["fed"])
  1341. var fed models.FsiEncounterDtos
  1342. if err := json.Unmarshal(fedUserJSONBytes, &fed); err != nil {
  1343. utils.ErrorLog("解析失败:%v", err)
  1344. return
  1345. }
  1346. fddUserJSONBytes, _ := json.Marshal(respJSON["fdd"])
  1347. var fdd []*models.FsiDiagnoseDtos
  1348. if err := json.Unmarshal(fddUserJSONBytes, &fdd); err != nil {
  1349. utils.ErrorLog("解析失败:%v", err)
  1350. return
  1351. }
  1352. fodUserJSONBytes, _ := json.Marshal(respJSON["fod"])
  1353. var fod []*models.FsiOrderDtos
  1354. if err := json.Unmarshal(fodUserJSONBytes, &fod); err != nil {
  1355. utils.ErrorLog("解析失败:%v", err)
  1356. return
  1357. }
  1358. fopdUserJSONBytes, _ := json.Marshal(respJSON["fopd"])
  1359. var fopd []*models.FsiOperationDtosData
  1360. if err := json.Unmarshal(fopdUserJSONBytes, &fopd); err != nil {
  1361. utils.ErrorLog("解析失败:%v", err)
  1362. return
  1363. }
  1364. ppUserJSONBytes, _ := json.Marshal(respJSON["pp"])
  1365. var pp models.PublicParams
  1366. if err := json.Unmarshal(ppUserJSONBytes, &pp); err != nil {
  1367. utils.ErrorLog("解析失败:%v", err)
  1368. return
  1369. }
  1370. _, result := service.AHyb3102(pd, fed, fdd, fod, fopd, pp, respJSON["trig_scen"].(string))
  1371. var response Response
  1372. if err := json.Unmarshal([]byte(result), &response); err != nil {
  1373. fmt.Println("Error decoding JSON:", err)
  1374. return
  1375. }
  1376. if response.Code == 200{
  1377. c.ServeSuccessJSON(map[string]interface{}{
  1378. "pre": response.Body,
  1379. "status":1,
  1380. "msg":"",
  1381. })
  1382. }else{
  1383. c.ServeSuccessJSON(map[string]interface{}{
  1384. "status":0,
  1385. "msg":response.Message,
  1386. })
  1387. }
  1388. }
  1389. func (c *AHybController) Get4101() {
  1390. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  1391. var respJSON map[string]interface{}
  1392. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1393. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1394. return
  1395. }
  1396. struct4101UserJSONBytes, _ := json.Marshal(respJSON["struct4101"])
  1397. var struct4101 service.Struct4101
  1398. if err := json.Unmarshal(struct4101UserJSONBytes, &struct4101); err != nil {
  1399. utils.ErrorLog("解析失败:%v", err)
  1400. return
  1401. }
  1402. ppUserJSONBytes, _ := json.Marshal(respJSON["pp"])
  1403. var pp models.PublicParams
  1404. if err := json.Unmarshal(ppUserJSONBytes, &pp); err != nil {
  1405. utils.ErrorLog("解析失败:%v", err)
  1406. return
  1407. }
  1408. inputLog, result := service.AHyb4101(struct4101, pp)
  1409. saveJsLog(result, inputLog, "4101", "上传明细清单", pp.FixmedinsName)
  1410. var response Response
  1411. if err := json.Unmarshal([]byte(result), &response); err != nil {
  1412. fmt.Println("Error decoding JSON:", err)
  1413. return
  1414. }
  1415. if response.Code == 200{
  1416. var dat2 map[string]interface{}
  1417. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  1418. } else {
  1419. }
  1420. c.ServeSuccessJSON(map[string]interface{}{
  1421. "pre": response.Body,
  1422. "log": dat2,
  1423. "status":1,
  1424. "msg":"",
  1425. })
  1426. }else{
  1427. c.ServeSuccessJSON(map[string]interface{}{
  1428. "status":0,
  1429. "msg":response.Message,
  1430. })
  1431. }
  1432. }
  1433. func ConvertByte2String(byte []byte, charset Charset) string {
  1434. var str string
  1435. switch charset {
  1436. case GB18030:
  1437. decodeBytes, _ := simplifiedchinese.GB18030.NewDecoder().Bytes(byte)
  1438. str = string(decodeBytes)
  1439. case UTF8:
  1440. fallthrough
  1441. default:
  1442. str = string(byte)
  1443. }
  1444. return str
  1445. }