Просмотр исходного кода

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 лет назад
Родитель
Сommit
9110cbd427
2 измененных файлов: 196 добавлений и 14 удалений
  1. 3 3
      conf/app.conf
  2. 193 11
      controllers/sg/his_api_controller.go

+ 3 - 3
conf/app.conf Просмотреть файл

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 9919
48
+org_id = 10265
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com
@@ -53,10 +53,10 @@ call_domain = https://hf.sgjyun.com
53 53
 front_end_domain = "https://xt.kuyicloud.com/#"
54 54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55 55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56
+#gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57 57
 #gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58 58
 #内蒙古
59
-#gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
59
+gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60 60
 gdyb_paasid = "sg03_prd"
61 61
 #gdyb_paasid = "jm_sc_yjyy"
62 62
 #gdyb_paasid="zh_prd_yjyy"

+ 193 - 11
controllers/sg/his_api_controller.go Просмотреть файл

@@ -2613,6 +2613,21 @@ type ResultThirteen struct {
2613 2613
 	WarnInfo    interface{} `json:"warn_info"`
2614 2614
 }
2615 2615
 
2616
+type ResultThirteen10265 struct {
2617
+	ErrMsg      string `json:"err_msg"`
2618
+	InfRefmsgid string `json:"inf_refmsgid"`
2619
+	Infcode     int64  `json:"infcode"`
2620
+	Output      struct {
2621
+		Result struct {
2622
+			TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
2623
+		} `json:"result"`
2624
+	} `json:"output"`
2625
+	RefmsgTime  string      `json:"refmsg_time"`
2626
+	RespondTime string      `json:"respond_time"`
2627
+	Signtype    interface{} `json:"signtype"`
2628
+	WarnInfo    interface{} `json:"warn_info"`
2629
+}
2630
+
2616 2631
 type ResultFourteen struct {
2617 2632
 	ErrMsg      string `json:"err_msg"`
2618 2633
 	InfRefmsgid string `json:"inf_refmsgid"`
@@ -7664,7 +7679,7 @@ func (c *HisApiController) PsnUnPutOnRecord() {
7664 7679
 }
7665 7680
 func (c *HisApiController) PsnPutNCDSOnRecord() {
7666 7681
 	patient_id, _ := c.GetInt64("patient_id")
7667
-	insutype := c.GetString("insutype")
7682
+	insutype_two := c.GetString("insutype")
7668 7683
 	psn_no := c.GetString("psn_no")
7669 7684
 	doctor_id, _ := c.GetInt64("doctor_id")
7670 7685
 	sick_id, _ := c.GetInt64("sick_id")
@@ -7675,8 +7690,88 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
7675 7690
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
7676 7691
 	sick, _ := service.FindSickById(sick_id)
7677 7692
 	doctor, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
7693
+
7694
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
7695
+	result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
7696
+	var res ResultTwo
7697
+	var res10265 ResultTwo10265
7698
+
7699
+	if miConfig.Code == "H15049901371" {
7700
+		if err := json.Unmarshal([]byte(result), &res10265); err != nil {
7701
+			utils.ErrorLog("解析失败:%v", err)
7702
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7703
+			return
7704
+		}
7705
+		res.ErrMsg = res10265.ErrMsg
7706
+		res.Output = res10265.Output
7707
+		res.InfRefmsgid = res10265.InfRefmsgid
7708
+
7709
+	} else {
7710
+		if err := json.Unmarshal([]byte(result), &res); err != nil {
7711
+			utils.ErrorLog("解析失败:%v", err)
7712
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7713
+			return
7714
+		}
7715
+	}
7716
+	Iinfos, _ := json.Marshal(res.Output.Iinfo)
7717
+	infoStr := string(Iinfos)
7718
+	var rf []*ResultFive
7719
+	json.Unmarshal([]byte(infoStr), &rf)
7720
+
7721
+	var insuplc_admdvs string
7722
+	var insutype string
7723
+	var is390 int = 0
7724
+	var is310 int = 0
7725
+	var insutypes []*ResultFive
7726
+
7727
+	for _, item := range rf {
7728
+		if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
7729
+			insutypes = append(insutypes, item)
7730
+		}
7731
+	}
7732
+
7733
+	if len(insutypes) == 1 {
7734
+		insutype = insutypes[0].Insutype
7735
+		//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
7736
+	} else {
7737
+		for _, i := range insutypes {
7738
+			if i.Insutype == "390" {
7739
+				is390 = 1
7740
+			}
7741
+
7742
+			if i.Insutype == "310" {
7743
+				is310 = 1
7744
+			}
7745
+		}
7746
+	}
7747
+	if is390 == 1 {
7748
+		insutype = "390"
7749
+	}
7750
+
7751
+	if is310 == 1 {
7752
+		insutype = "310"
7753
+	}
7754
+
7755
+	if len(insutypes) == 2 {
7756
+		insutype = insutype_two
7757
+	}
7758
+
7759
+	if len(insutypes) == 0 {
7760
+		insutype = "310"
7761
+	}
7762
+
7763
+	if len(insutype_two) > 0 {
7764
+		insutype = insutype_two
7765
+	}
7766
+
7767
+	for _, item := range rf {
7768
+		if item.Insutype == insutype {
7769
+			insuplc_admdvs = item.InsuplcAdmdvs
7770
+		}
7771
+	}
7772
+
7678 7773
 	if config.IsOpen == 1 {
7679
-		result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode)
7774
+		result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode)
7680 7775
 		var dat map[string]interface{}
7681 7776
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
7682 7777
 			fmt.Println(dat)
@@ -7685,11 +7780,26 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
7685 7780
 		}
7686 7781
 		userJSONBytes, _ := json.Marshal(dat)
7687 7782
 		var res2 ResultThirteen
7688
-		if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
7689
-			utils.ErrorLog("解析失败:%v", err)
7690
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7691
-			return
7783
+		var res10265 ResultThirteen10265
7784
+
7785
+		if miConfig.Code == "H15049901371" {
7786
+			if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
7787
+				utils.ErrorLog("解析失败:%v", err)
7788
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7789
+				return
7790
+			}
7791
+			res2.ErrMsg = res10265.ErrMsg
7792
+			res2.Output = res10265.Output
7793
+			res2.InfRefmsgid = res10265.InfRefmsgid
7794
+
7795
+		} else {
7796
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
7797
+				utils.ErrorLog("解析失败:%v", err)
7798
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7799
+				return
7800
+			}
7692 7801
 		}
7802
+
7693 7803
 		if res2.Infcode == 0 {
7694 7804
 			psnResult := &models.GdybPsnNcdsRecord{
7695 7805
 				UserOrgId:     adminUser.CurrentOrgId,
@@ -7728,12 +7838,84 @@ func (c *HisApiController) PsnPutUnNCDSOnRecord() {
7728 7838
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
7729 7839
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
7730 7840
 
7731
-	var user_name string
7841
+	//config, _ := service.Ge(adminUser.CurrentOrgId)
7842
+	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, id)
7843
+	//role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
7844
+	//var user_name string
7732 7845
 	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
7733
-	if role.ID == 0 {
7734
-		user_name = "xxx"
7846
+	//if role.ID == 0 {
7847
+	//	user_name = "xxx"
7848
+	//} else {
7849
+	//	user_name = role.UserName
7850
+	//}
7851
+	result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
7852
+	var res ResultTwo
7853
+	var res10265 ResultTwo10265
7854
+
7855
+	if miConfig.Code == "H15049901371" {
7856
+		if err := json.Unmarshal([]byte(result), &res10265); err != nil {
7857
+			utils.ErrorLog("解析失败:%v", err)
7858
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7859
+			return
7860
+		}
7861
+		res.ErrMsg = res10265.ErrMsg
7862
+		res.Output = res10265.Output
7863
+		res.InfRefmsgid = res10265.InfRefmsgid
7864
+
7735 7865
 	} else {
7736
-		user_name = role.UserName
7866
+		if err := json.Unmarshal([]byte(result), &res); err != nil {
7867
+			utils.ErrorLog("解析失败:%v", err)
7868
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7869
+			return
7870
+		}
7871
+	}
7872
+	Iinfos, _ := json.Marshal(res.Output.Iinfo)
7873
+	infoStr := string(Iinfos)
7874
+	var rf []*ResultFive
7875
+	json.Unmarshal([]byte(infoStr), &rf)
7876
+
7877
+	var insuplc_admdvs string
7878
+	var insutype string
7879
+	var is390 int = 0
7880
+	var is310 int = 0
7881
+	var insutypes []*ResultFive
7882
+
7883
+	for _, item := range rf {
7884
+		if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
7885
+			insutypes = append(insutypes, item)
7886
+		}
7887
+	}
7888
+
7889
+	if len(insutypes) == 1 {
7890
+		insutype = insutypes[0].Insutype
7891
+		//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
7892
+	} else {
7893
+		for _, i := range insutypes {
7894
+			if i.Insutype == "390" {
7895
+				is390 = 1
7896
+			}
7897
+
7898
+			if i.Insutype == "310" {
7899
+				is310 = 1
7900
+			}
7901
+		}
7902
+	}
7903
+	if is390 == 1 {
7904
+		insutype = "390"
7905
+	}
7906
+
7907
+	if is310 == 1 {
7908
+		insutype = "310"
7909
+	}
7910
+
7911
+	if len(insutypes) == 0 {
7912
+		insutype = "310"
7913
+	}
7914
+
7915
+	for _, item := range rf {
7916
+		if item.Insutype == insutype {
7917
+			insuplc_admdvs = item.InsuplcAdmdvs
7918
+		}
7737 7919
 	}
7738 7920
 
7739 7921
 	psn_record, _ := service.GetPsnNCDSRecordById(id)
@@ -7742,7 +7924,7 @@ func (c *HisApiController) PsnPutUnNCDSOnRecord() {
7742 7924
 		return
7743 7925
 	}
7744 7926
 	if config.IsOpen == 1 {
7745
-		result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, user_name, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
7927
+		result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
7746 7928
 		var dat map[string]interface{}
7747 7929
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
7748 7930
 			fmt.Println(dat)