123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- package hb
-
- import (
- "encoding/json"
- "fmt"
- "gdyb/controllers"
- "gdyb/models"
- "gdyb/service"
- "gdyb/utils"
- "github.com/astaxie/beego"
- "io/ioutil"
- )
-
- type HBybController struct {
- controllers.BaseAuthAPIController
- }
-
- func HbybRegistRouters() {
- beego.Router("/hbyb/1101", &HBybController{}, "get:PostOne")
- beego.Router("/hbyb/2201", &HBybController{}, "get:PostTwo")
- beego.Router("/hbyb/2202", &HBybController{}, "get:PostThree")
- beego.Router("/hbyb/2203", &HBybController{}, "post:PostFour")
- beego.Router("/hbyb/2204", &HBybController{}, "post:PostFive")
- beego.Router("/hbyb/2205", &HBybController{}, "get:PostSix")
- beego.Router("/hbyb/2206", &HBybController{}, "get:PostSeven")
- beego.Router("/hbyb/2207", &HBybController{}, "get:PostEight")
- beego.Router("/hbyb/2208", &HBybController{}, "get:PostNine")
- beego.Router("/hbyb/5203", &HBybController{}, "get:PostTen")
- beego.Router("/hbyb/2001", &HBybController{}, "get:Post2001")
- beego.Router("/hbyb/3202", &HBybController{}, "post:Post3202a")
- beego.Router("/hbyb/4101", &HBybController{}, "post:Post4101")
-
- }
- func (c *HBybController) Post3202a() {
-
- body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- return
- }
- userJSONBytes, _ := json.Marshal(respJSON["bps"])
- var bps []*models.BusinessParamsTwo
- if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- return
- }
-
- var baseParams models.BaseParams
- baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
- baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
- baseParams.OrgName = respJSON["org_name"].(string)
- baseParams.Doctor = respJSON["doctor"].(string)
- baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
-
- result := service.Hbyb3202a(baseParams, bps)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
-
- func (c *HBybController) Post4101() {
- body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- return
- }
- userJSONBytes, _ := json.Marshal(respJSON["struct4101"])
- var struct4101 service.Struct4101
- if err := json.Unmarshal(userJSONBytes, &struct4101); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- return
- }
- result, inputLog := service.Hbyb4101(struct4101, respJSON["secret_key"].(string), respJSON["org_name"].(string), respJSON["opera"].(string), respJSON["code"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string))
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- } else {
- }
-
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
- } else {
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "log": dat2,
- })
- }
- func (c *HBybController) Post2001() {
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- secret_key := c.GetString("secret_key")
- psn_no := c.GetString("psn_no")
- insutype := c.GetString("insutype")
- med_type := c.GetString("med_type")
- result, inputLog := service.Hbyb2001(secret_key, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, psn_no, insutype, med_type)
- fmt.Println(result)
- fmt.Println(inputLog)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
-
- } else {
-
- }
-
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
-
- } else {
-
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "log": dat2,
- })
- }
-
- func (c *HBybController) PostOne() {
- certNo := c.GetString("cert_no")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- secret_key := c.GetString("secret_key")
- id_card_type, _ := c.GetInt64("id_card_type")
- card_sn := c.GetString("card_sn")
- certificates := c.GetString("certificates")
- fmt.Println(certNo)
- fmt.Println(org_name)
- fmt.Println(doctor)
- fmt.Println(fixmedins_code)
- fmt.Println(insuplc_admdvs)
- fmt.Println(mdtrtarea_admvs)
- fmt.Println(secret_key)
- fmt.Println(id_card_type)
- fmt.Println(card_sn)
- fmt.Println(certificates)
-
- result, inputLog := service.Hbyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificates)
- fmt.Println(result)
- fmt.Println(inputLog)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
-
- } else {
-
- }
-
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
-
- } else {
-
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "log": dat2,
- })
- }
- func (c *HBybController) PostTwo() {
- psnNo := c.GetString("psn_no")
- insutype := c.GetString("insutype")
- certNo := c.GetString("cert_no")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- ipt_otp_no := c.GetString("ipt_otp_no")
- dept := c.GetString("dept")
- fixmedins_code := c.GetString("fixmedins_code")
- opter := c.GetString("opter")
-
- dept_code := c.GetString("dept_code")
- doctor_id := c.GetString("doctor_id")
- doctor_name := c.GetString("doctor_name")
-
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
-
- secret_key := c.GetString("secret_key")
-
- id_card_type, _ := c.GetInt64("id_card_type")
-
- result, _ := service.Hbyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, opter, doctor_name)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- //fmt.Println(dat["status"])
- } else {
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
- func (c *HBybController) PostThree() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- iptOtpNo := c.GetString("ipt_otp_no")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- secret_key := c.GetString("secret_key")
- fixmedins_code := c.GetString("fixmedins_code")
- result, requestLog := service.Hbyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- } else {
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "request_log": requestLog,
- })
- }
-
- func (c *HBybController) PostFour() {
-
- body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- return
- }
- userJSONBytes, _ := json.Marshal(respJSON["config"])
- var config []*models.HisXtDiagnoseConfig
- if err := json.Unmarshal(userJSONBytes, &config); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- return
- }
-
- psnNo := respJSON["psn_no"].(string)
- mdtrtId := respJSON["mdtrt_id"].(string)
- opter := respJSON["opter"].(string)
- org_name := respJSON["org_name"].(string)
- med_type := respJSON["med_type"].(string)
- doctor_id := respJSON["doctor_id"].(string)
- doctor_name := respJSON["doctor_name"].(string)
- department := respJSON["department"].(string)
- fixmedins_code := respJSON["fixmedins_code"].(string)
- insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
- mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
- secret_key := respJSON["secret_key"].(string)
- sick_code := respJSON["sick_code"].(string)
- sick_name := respJSON["sick_name"].(string)
- dept := respJSON["dept"].(string)
- begin_time := respJSON["begin_time"].(string)
-
- result, request_log := service.Hbyb2203(psnNo, mdtrtId, dept, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, begin_time, doctor_name, opter)
-
- fmt.Println(request_log)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- } else {
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
-
- type All struct {
- HisPrescription HisPrescription
- mdtrt_id string
- psn_no string
- }
- type HisPrescription struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"advices"`
- HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"`
- }
-
- func (c *HBybController) PostFive() {
- body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- return
- }
- userJSONBytes, _ := json.Marshal(respJSON["pre"])
- var hp []*models.HisPrescription
- if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- return
- }
- fmt.Println(respJSON["psn_no"].(string))
- fmt.Println(respJSON["mdtrt_id"].(string))
-
- fmt.Println(respJSON["chrg_bchno"].(string))
- fmt.Println(respJSON["org_name"].(string))
- fmt.Println(respJSON["doctor"].(string))
- fmt.Println(respJSON["doctor_id"].(string))
- fmt.Println(respJSON["dept"].(string))
- fmt.Println(respJSON["fixmedins_code"].(string))
- fmt.Println(respJSON["dept_code"].(string))
- fmt.Println(respJSON["balance_accounts_type"].(string))
- fmt.Println("1111111")
-
- fmt.Println(respJSON["opter"].(string))
- fmt.Println(respJSON["insuplc_admdvs"].(string))
- fmt.Println(respJSON["mdtrtarea_admvs"].(string))
- fmt.Println(respJSON["secret_key"].(string))
-
- result, requestLog := service.Hbyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
- 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["opter"].(string))
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
- fmt.Println(dat2)
- } else {
- fmt.Println(err)
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "request_log": requestLog,
- })
- }
- func (c *HBybController) PostSix() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- chrgBchno := c.GetString("chrg_bchno")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
-
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
-
- secret_key := c.GetString("secret_key")
- fixmedins_code := c.GetString("fixmedins_code")
-
- result, requestlog := service.Hbyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
- fmt.Println(requestlog)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
- func (c *HBybController) PostSeven() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- chrgBchno := c.GetString("chrg_bchno")
- certNo := c.GetString("cert_no")
- insutype := c.GetString("insutype")
- total := c.GetString("total")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- secret_key := c.GetString("secret_key")
- med_type := c.GetString("med_type")
- id_card_type, _ := c.GetInt64("id_card_type")
- certificates, _ := c.GetInt64("certificates")
-
- result, requestlog := service.Hbyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates)
- fmt.Println(requestlog)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
- func (c *HBybController) PostEight() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- chrgBchno := c.GetString("chrg_bchno")
- certNo := c.GetString("cert_no")
- insutype := c.GetString("insutype")
- total := c.GetString("total")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- secret_key := c.GetString("secret_key")
- med_type := c.GetString("med_type")
- id_card_type, _ := c.GetInt64("id_card_type")
- certificates, _ := c.GetInt64("certificates")
-
- fulamt_ownpay_amt, _ := c.GetFloat("fulamt_ownpay_amt")
- overlmt_selfpay, _ := c.GetFloat("overlmt_selfpay")
- preselfpay_amt, _ := c.GetFloat("preselfpay_amt")
- inscp_scp_amt, _ := c.GetFloat("inscp_scp_amt")
-
- acct_used_flag, _ := c.GetInt64("acct_used_flag")
-
- result, srcRequest := service.Hbyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, certificates, acct_used_flag)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(srcRequest), &dat2); err == nil {
- fmt.Println(dat2)
- } else {
- fmt.Println(err)
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- "pre2": dat2,
- })
- }
- func (c *HBybController) PostNine() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- setlId := c.GetString("setl_id")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- secret_key := c.GetString("secret_key")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
- result, src_request := service.Hbyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- fmt.Println(src_request)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
- func (c *HBybController) PostTen() {
- psnNo := c.GetString("psn_no")
- mdtrtId := c.GetString("mdtrt_id")
- setlId := c.GetString("setl_id")
- org_name := c.GetString("org_name")
- doctor := c.GetString("doctor")
- med_type := c.GetString("med_type")
-
- secret_key := c.GetString("secret_key")
- fixmedins_code := c.GetString("fixmedins_code")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
-
- baseParams := models.BaseParams{
- SecretKey: secret_key,
- FixmedinsCode: fixmedins_code,
- InsuplcAdmdvs: insuplc_admdvs,
- MdtrtareaAdmvs: mdtrtarea_admvs,
- OrgName: org_name,
- Doctor: doctor,
- }
-
- businessParams := models.BusinessParams{
- PsnNo: psnNo,
- MdtrtId: mdtrtId,
- SetlId: setlId,
- }
-
- result := service.Hbyb5203(baseParams, businessParams, med_type)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": dat,
- })
- }
|