陈少旭 3 dagen geleden
bovenliggende
commit
d74df44dfa
1 gewijzigde bestanden met toevoegingen van 210 en 143 verwijderingen
  1. 210 143
      controllers/sg/his_api_controller.go

+ 210 - 143
controllers/sg/his_api_controller.go Bestand weergeven

@@ -6,14 +6,8 @@ import (
6 6
 	"encoding/base64"
7 7
 	//"github.com/jung-kurt/gofpdf"
8 8
 
9
-	//"github.com/tjfoc/gmsm/sm3"
10
-	"math"
11
-
12
-	"strings"
13
-	//"crypto/x509/pkix"
14 9
 	"encoding/json"
15 10
 	"fmt"
16
-
17 11
 	"gdyb/controllers"
18 12
 	"gdyb/enums"
19 13
 	"gdyb/models"
@@ -27,7 +21,8 @@ import (
27 21
 	"github.com/shopspring/decimal"
28 22
 	"io"
29 23
 	"io/ioutil"
30
-
24
+	//"github.com/tjfoc/gmsm/sm3"
25
+	"math"
31 26
 	"math/rand"
32 27
 	"net/http"
33 28
 	"net/url"
@@ -35,12 +30,10 @@ import (
35 30
 	"path/filepath"
36 31
 	"regexp"
37 32
 	"strconv"
38
-
33
+	"strings"
39 34
 	"syscall"
40 35
 	"time"
41 36
 	"unsafe"
42
-	"github.com/go-ole/go-ole"
43
-
44 37
 )
45 38
 
46 39
 type HisApiController struct {
@@ -213,9 +206,6 @@ func HisManagerApiRegistRouters() {
213 206
 	beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
214 207
 	//beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
215 208
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
216
-	
217
-	
218
-	
219 209
 
220 210
 }
221 211
 func (c *HisApiController) Get3201() {
@@ -2286,10 +2276,6 @@ func (c *HisApiController) DeleteXSandBG() {
2286 2276
 
2287 2277
 }
2288 2278
 
2289
-
2290
-
2291
-
2292
-
2293 2279
 //func (c *HisApiController) BatchFJ3501AND3502() {
2294 2280
 //	//ids := c.GetString("ids")
2295 2281
 //	start_time := c.GetString("start_time")
@@ -2828,7 +2814,6 @@ func (c *HisApiController) DeleteXSandBG() {
2828 2814
 //	}
2829 2815
 //}
2830 2816
 
2831
-
2832 2817
 //func (c *HisApiController) DeleteXSandBGTwo() {
2833 2818
 //	patient_id, _ := c.GetInt64("patient_id")
2834 2819
 //	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -4413,7 +4398,7 @@ func (c *HisApiController) ChangeDrugtwo() {
4413 4398
 						item.Bchno = number
4414 4399
 						item.SaleDate = time.Now().Format("2006-01-02")
4415 4400
 
4416
-						 service.SaveDF(item)
4401
+						service.SaveDF(item)
4417 4402
 						//if err5 == nil {
4418 4403
 						//	if item.IsChange == 0 { //没变更,进行变更操作
4419 4404
 						//		bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
@@ -4466,8 +4451,7 @@ func (c *HisApiController) ChangeDrugtwo() {
4466 4451
 					}
4467 4452
 				}
4468 4453
 
4469
-			} else
4470
-			{ //还没结算
4454
+			} else { //还没结算
4471 4455
 				var res3507for10188 FJ3507ResultFor10188
4472 4456
 
4473 4457
 				if item.IsChange == 0 { //没变更,进行变更操作
@@ -4738,9 +4722,6 @@ func (c *HisApiController) ChangeDrugtwo() {
4738 4722
 	}
4739 4723
 }
4740 4724
 
4741
-
4742
-
4743
-
4744 4725
 func (c *HisApiController) ChangeDrugthree() {
4745 4726
 
4746 4727
 	//ids := c.GetString("ids")
@@ -5181,13 +5162,6 @@ func (c *HisApiController) ChangeDrugthree() {
5181 5162
 	}
5182 5163
 }
5183 5164
 
5184
-
5185
-
5186
-
5187
-
5188
-
5189
-
5190
-
5191 5165
 func (c *HisApiController) ChangeDrugTen() {
5192 5166
 	start_time_str := c.GetString("start_time")
5193 5167
 	end_time_str := c.GetString("end_time")
@@ -5729,30 +5703,6 @@ func ChangeDrugTenone() {
5729 5703
 
5730 5704
 }
5731 5705
 
5732
-
5733
-
5734
-
5735
-
5736
-
5737
-
5738
-
5739
-
5740
-
5741
-
5742
-
5743
-
5744
-
5745
-
5746
-
5747
-
5748
-
5749
-
5750
-
5751
-
5752
-
5753
-
5754
-
5755
-
5756 5706
 func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5757 5707
 	var struct3502 models.Struct3502
5758 5708
 	struct3502.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
@@ -5834,8 +5784,7 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5834 5784
 	struct3505.Bchno = "---"
5835 5785
 	struct3505.FixmedinsCode = miConfig.Code
5836 5786
 	struct3505.Code = miConfig.Code
5837
-	struct3505.FinlTrnsPric =  drug.HisDoctorAdviceInfo.Price
5838
-
5787
+	struct3505.FinlTrnsPric = drug.HisDoctorAdviceInfo.Price
5839 5788
 
5840 5789
 	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
5841 5790
 	struct3505.PrscDrName = roles.UserName
@@ -5864,14 +5813,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5864 5813
 		struct3505.PharPracCertNo = "2015026440262015440501001198"
5865 5814
 	}
5866 5815
 
5867
-
5868
-
5869 5816
 	if org_id == 9919 {
5870 5817
 		struct3505.PharName = "周君权"
5871 5818
 		struct3505.PharPracCertNo = "089644396094401375"
5872 5819
 	}
5873 5820
 
5874
-
5875 5821
 	if org_id == 10644 {
5876 5822
 		struct3505.PharName = "陈金娣"
5877 5823
 		struct3505.PharPracCertNo = "20181441500320100066"
@@ -5948,13 +5894,13 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5948 5894
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5949 5895
 		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5950 5896
 		return result1, result2
5951
-	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5952
-		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey,struct3505.AccessKey,struct3505.RequestUrl)
5897
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5898
+		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5953 5899
 		return result1, result2
5954
-	}else if miConfig.MdtrtareaAdmvs == "340699" {
5955
-		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey,struct3505.RequestUrl)
5900
+	} else if miConfig.MdtrtareaAdmvs == "340699" {
5901
+		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5956 5902
 		return result1, result2
5957
-	}else if miConfig.MdtrtareaAdmvs == "150499" {
5903
+	} else if miConfig.MdtrtareaAdmvs == "150499" {
5958 5904
 
5959 5905
 		data := make(map[string]interface{})
5960 5906
 		data["struct_3505s"] = struct3505
@@ -5978,7 +5924,7 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5978 5924
 		result, _ := json.Marshal(respJSON)
5979 5925
 		return string(result), ""
5980 5926
 
5981
-	}  else {
5927
+	} else {
5982 5928
 		data := make(map[string]interface{})
5983 5929
 		data["struct_3505s"] = struct3505
5984 5930
 		client := &http.Client{}
@@ -13542,7 +13488,6 @@ func (c *HisApiController) GetPsnNcdsInfo() {
13542 13488
 	} else if miConfig.MdtrtareaAdmvs == "340699" {
13543 13489
 		psn_info, _ := service.GetHisPatientByPatientId(patient_id)
13544 13490
 
13545
-
13546 13491
 		var api string
13547 13492
 
13548 13493
 		api = miConfig.SecretKey + "ahyb/5301?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName +
@@ -13584,11 +13529,6 @@ func (c *HisApiController) GetPsnNcdsInfo() {
13584 13529
 			return
13585 13530
 		}
13586 13531
 
13587
-
13588
-
13589
-
13590
-
13591
-
13592 13532
 	} else if miConfig.MdtrtareaAdmvs == "360302" {
13593 13533
 		p, _ := service.GetHisPatientById(patient_id)
13594 13534
 
@@ -14130,7 +14070,6 @@ func (c *HisApiController) ReadCard() {
14130 14070
 	admin_user_id, _ := c.GetInt64("admin_user_id")
14131 14071
 	certificates, _ := c.GetInt64("certificates")
14132 14072
 
14133
-
14134 14073
 	//
14135 14074
 	insuplc_admdvs_str := c.GetString("insuplc_admdvs")
14136 14075
 	id_card_no := c.GetString("id_card_no")
@@ -15161,27 +15100,25 @@ func (c *HisApiController) ReadCard() {
15161 15100
 			fmt.Println(basStr)
15162 15101
 			bas := strings.Split(basStr, "|")
15163 15102
 			basNumber := bas[2] //卡号
15164
-			card_sn := bas[3] //
15103
+			card_sn := bas[3]   //
15165 15104
 
15166 15105
 			id_card_No := bas[1] //卡号
15167 15106
 
15168
-
15169 15107
 			fmt.Println(basNumber)
15170 15108
 			fmt.Println(card_sn)
15171 15109
 			fmt.Println(id_card_No)
15172 15110
 
15173 15111
 			var patient service.Patients
15174
-			if len(id_card_No) == 0{
15112
+			if len(id_card_No) == 0 {
15175 15113
 
15176 15114
 				patient, _ = service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15177 15115
 
15178
-			}else{
15116
+			} else {
15179 15117
 				patient, _ = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15180 15118
 
15181
-
15182 15119
 			}
15183 15120
 
15184
-			result, _ := service.Jxyb1101bycard(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey,patient.Name,patient.IdCardNo)
15121
+			result, _ := service.Jxyb1101bycard(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, patient.Name, patient.IdCardNo)
15185 15122
 
15186 15123
 			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
15187 15124
 			var dat map[string]interface{}
@@ -15202,17 +15139,14 @@ func (c *HisApiController) ReadCard() {
15202 15139
 			if res.Infcode == 0 {
15203 15140
 				var pateint2 service.Patients
15204 15141
 				var err error
15205
-				if len(id_card_No) == 0{
15142
+				if len(id_card_No) == 0 {
15206 15143
 					pateint2, err = service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15207 15144
 
15208
-
15209
-
15210
-				}else{
15145
+				} else {
15211 15146
 					pateint2, err = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15212 15147
 
15213 15148
 					//patient, _ = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15214 15149
 
15215
-
15216 15150
 				}
15217 15151
 				if err == gorm.ErrRecordNotFound {
15218 15152
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
@@ -16748,22 +16682,22 @@ func (c *HisApiController) ReadCard() {
16748 16682
 
16749 16683
 			}
16750 16684
 
16751
-		}  else if miConfig.MdtrtareaAdmvs == "340699" {
16685
+		} else if miConfig.MdtrtareaAdmvs == "340699" {
16752 16686
 			var insuplc_admdvs string
16753 16687
 			if len(patient.InsuplcAdmdvs) > 0 {
16754 16688
 				insuplc_admdvs = patient.InsuplcAdmdvs
16755 16689
 			} else {
16756
-				if len(insuplc_admdvs_str) > 0{
16690
+				if len(insuplc_admdvs_str) > 0 {
16757 16691
 
16758 16692
 					insuplc_admdvs = insuplc_admdvs_str
16759
-				}else{
16693
+				} else {
16760 16694
 					insuplc_admdvs = miConfig.InsuplcAdmdvs
16761 16695
 				}
16762 16696
 			}
16763 16697
 			//请求内网数据
16764 16698
 			api := miConfig.SecretKey + "ahyb/1101?url=" + miConfig.Url + "&cert_no=" + patient.IdCardNo +
16765 16699
 				"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
16766
-				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name+"&token="+""
16700
+				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name + "&token=" + ""
16767 16701
 
16768 16702
 			resp, requestErr := http.Get(api)
16769 16703
 			if requestErr != nil {
@@ -16784,18 +16718,17 @@ func (c *HisApiController) ReadCard() {
16784 16718
 			}
16785 16719
 
16786 16720
 			status := respJSON["data"].(map[string]interface{})["status"].(string)
16787
-			if  status == "0"{
16721
+			if status == "0" {
16788 16722
 				err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)
16789 16723
 				c.ServeSuccessJSON(map[string]interface{}{
16790 16724
 					"failed_code": -10,
16791
-					"msg":        err_msg,
16725
+					"msg":         err_msg,
16792 16726
 				})
16793 16727
 				return
16794 16728
 			}
16795 16729
 			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
16796 16730
 			var res ResultTwo
16797 16731
 
16798
-
16799 16732
 			result, _ := json.Marshal(respJSON)
16800 16733
 			fmt.Println("log")
16801 16734
 			fmt.Println(string(result))
@@ -16822,9 +16755,9 @@ func (c *HisApiController) ReadCard() {
16822 16755
 					infoStr := string(Iinfos)
16823 16756
 					idetinfoStr := string(Idetinfos)
16824 16757
 					psn := &models.HisPsn{
16825
-						PsnNo: res.Output.Baseinfo.PsnNo,
16826
-						PatientId: patient.ID,
16827
-						Certno:    res.Output.Baseinfo.Certno,
16758
+						PsnNo:       res.Output.Baseinfo.PsnNo,
16759
+						PatientId:   patient.ID,
16760
+						Certno:      res.Output.Baseinfo.Certno,
16828 16761
 						Gend:        res.Output.Baseinfo.Gend,
16829 16762
 						Naty:        res.Output.Baseinfo.Naty,
16830 16763
 						PsnCertType: res.Output.Baseinfo.PsnCertType,
@@ -16875,12 +16808,10 @@ func (c *HisApiController) ReadCard() {
16875 16808
 					}
16876 16809
 
16877 16810
 					c.ServeSuccessJSON(map[string]interface{}{
16878
-						"patient": patient,
16811
+						"patient":  patient,
16879 16812
 						"insutype": insutype,
16880
-						"number":  res.Output.Baseinfo.Certno,
16881
-						"info":  res,
16882
-
16883
-
16813
+						"number":   res.Output.Baseinfo.Certno,
16814
+						"info":     res,
16884 16815
 					})
16885 16816
 				}
16886 16817
 			} else {
@@ -16888,8 +16819,7 @@ func (c *HisApiController) ReadCard() {
16888 16819
 				return
16889 16820
 			}
16890 16821
 
16891
-
16892
-		}else {
16822
+		} else {
16893 16823
 			SFZStr := c.GetSFZBaseInfo()
16894 16824
 			id_card_str := strings.Split(SFZStr, "^")
16895 16825
 			id_card_number := id_card_str[0]
@@ -19639,7 +19569,6 @@ func (c *HisApiController) GetBasBaseInfo1111() string {
19639 19569
 	return ConvertToString(string(str), "gbk", "utf-8")
19640 19570
 }
19641 19571
 
19642
-
19643 19572
 func (c *HisApiController) GetBasBaseInfo22222() string {
19644 19573
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
19645 19574
 	readCard := DllDef.MustFindProc("iReadCardUnclassifiedBas")
@@ -19653,7 +19582,6 @@ func (c *HisApiController) GetBasBaseInfo22222() string {
19653 19582
 	readCard.Call(uintptr(1), (uintptr)(unsafe.Pointer(&str1[0])))
19654 19583
 	//ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
19655 19584
 
19656
-
19657 19585
 	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
19658 19586
 	//if err != nil {
19659 19587
 	//	fmt.Println("Error opening file:", err)
@@ -19705,7 +19633,6 @@ func (c *HisApiController) GetBasBaseInfo22222() string {
19705 19633
 	return ConvertToString(string(str1), "gbk", "utf-8")
19706 19634
 }
19707 19635
 
19708
-
19709 19636
 func (c *HisApiController) GetahBasBaseInfo() string {
19710 19637
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
19711 19638
 	readCard := DllDef.MustFindProc("iReadCardBas")
@@ -25613,8 +25540,6 @@ type Result5301 struct {
25613 25540
 	WarnInfo    interface{} `json:"warn_info"`
25614 25541
 }
25615 25542
 
25616
-
25617
-
25618 25543
 type Result5301For10265 struct {
25619 25544
 	ErrMsg      string `json:"err_msg"`
25620 25545
 	InfRefmsgid string `json:"inf_refmsgid"`
@@ -26044,7 +25969,6 @@ func (c *HisApiController) GetRegisterInfo() {
26044 25969
 			verify_number = psn_info.VerifyNumber
26045 25970
 			idetinfoStr = psn_info.Idetinfo
26046 25971
 
26047
-
26048 25972
 		} else if miConfig.MdtrtareaAdmvs == "430800" {
26049 25973
 			if id_card_type == 1 {
26050 25974
 				psn_info, _ := service.GetPsnByPatientId(id)
@@ -26860,7 +26784,7 @@ func (c *HisApiController) GetRegisterInfo() {
26860 26784
 				his.Insutype = insutype
26861 26785
 				var api string
26862 26786
 				ipt_otp_no = timeFormat
26863
-				api = miConfig.SecretKey + "ahyb/2201?verify_number="+cert_no+"&cert_no="+IdCardNo+"&psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
26787
+				api = miConfig.SecretKey + "ahyb/2201?verify_number=" + cert_no + "&cert_no=" + IdCardNo + "&psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
26864 26788
 					"&org_name=" + miConfig.OrgName + "&opera=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
26865 26789
 					"&insuplc_admdvs=" + insuplc_admdvs_temp + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_info.DoctorNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
26866 26790
 
@@ -26925,7 +26849,7 @@ func (c *HisApiController) GetRegisterInfo() {
26925 26849
 				his.Insutype = insutype
26926 26850
 				var api string
26927 26851
 				ipt_otp_no = timeFormat
26928
-				api = miConfig.SecretKey + "ahyb/2201?psn_no=" + PsnNo +"&verify_number="+cert_no+"&cert_no="+IdCardNo+ "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
26852
+				api = miConfig.SecretKey + "ahyb/2201?psn_no=" + PsnNo + "&verify_number=" + cert_no + "&cert_no=" + IdCardNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
26929 26853
 					"&org_name=" + miConfig.OrgName + "&opera=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
26930 26854
 					"&insuplc_admdvs=" + insuplc_admdvs_temp + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_info.DoctorNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
26931 26855
 
@@ -27307,9 +27231,76 @@ func (c *HisApiController) GetRegisterInfo() {
27307 27231
 						insuplc_admdvs_temp = miConfig.MdtrtareaAdmvs
27308 27232
 
27309 27233
 					}
27234
+					var result string
27235
+					var requestLog string
27236
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" {
27237
+						var hisPrescription []*models.HisPrescription
27238
+						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
27239
+						if res3101.Infcode == 0 {
27240
+							if len(res3101.Output.Result) > 0 {
27241
+								for _, item := range res3101.Output.Result {
27242
+									if len(res3101.ErrMsg) == 0 {
27243
+										res3101.ErrMsg = item.VolaCont
27244
+									} else {
27245
+										res3101.ErrMsg = res3101.ErrMsg + "\n" + item.VolaCont
27246
+									}
27247
+								}
27248
+								c.ServeSuccessJSON(map[string]interface{}{
27249
+									"failed_code": -10,
27250
+									"msg":         res3101.ErrMsg,
27251
+								})
27252
+								return
27253
+							} else {
27254
+
27255
+								hour := time.Now().Format("15")
27256
+								min := time.Now().Format("04")
27257
+								sec := time.Now().Format("05")
27258
+
27259
+								record_time_two := record_time + " " + hour + ":" + min + ":" + sec
27260
+
27261
+								fmt.Println(record_time_two)
27262
+
27263
+								result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27264
+								saveLog(result, requestLog, "2201A", "挂号")
27265
+								if miConfig.Code == "H15049901371" {
27266
+
27267
+									if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
27268
+										utils.ErrorLog("解析失败:%v", err)
27269
+										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
27270
+										return
27271
+									}
27272
+									resThree.ErrMsg = resThree10265.ErrMsg
27273
+									resThree.Output = resThree10265.Output
27274
+									resThree.InfRefmsgid = resThree10265.InfRefmsgid
27275
+								} else {
27276
+									if err := json.Unmarshal([]byte(result), &resThree); err != nil {
27277
+										utils.ErrorLog("解析失败:%v", err)
27278
+										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
27279
+										return
27280
+									}
27281
+								}
27282
+
27283
+								if miConfig.Code == "H15049901371" {
27284
+									infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
27285
+								} else {
27286
+									infocode = resThree.Infcode
27287
+
27288
+								}
27289
+
27290
+							}
27291
+
27292
+						} else if res3101.Infcode != 0 {
27293
+							c.ServeSuccessJSON(map[string]interface{}{
27294
+								"failed_code": -10,
27295
+								"msg":         res3101.ErrMsg,
27296
+							})
27297
+							return
27298
+						}
27299
+					} else {
27300
+						result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27301
+						saveLog(result, requestLog, "2201A", "挂号")
27302
+					}
27310 27303
 
27311
-					result, requestLog := service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27312
-					saveLog(result, requestLog, "2201A", "挂号")
27313 27304
 					if miConfig.Code == "H15049901371" {
27314 27305
 
27315 27306
 						if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
@@ -30286,7 +30277,7 @@ func (c *HisApiController) GetUploadInfo() {
30286 30277
 					psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
30287 30278
 				} else if his.IdCardType == 4 {
30288 30279
 					psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
30289
-					cert_no =psn_info.VerifyNumber
30280
+					cert_no = psn_info.VerifyNumber
30290 30281
 					psn_info.VerifyNumber = psn_info.VerifyNumber
30291 30282
 				} else {
30292 30283
 					cert_no = his.Certno
@@ -30988,7 +30979,7 @@ func (c *HisApiController) GetPreUploadInfo() {
30988 30979
 	var config []*models.HisXtDiagnoseConfig
30989 30980
 	for _, item := range diagnosis_ids {
30990 30981
 		id, _ := strconv.ParseInt(item, 10, 64)
30991
-		if  id > 0 {
30982
+		if id > 0 {
30992 30983
 			diagnosisConfig, _ := service.FindDiagnoseById(id)
30993 30984
 			config = append(config, &diagnosisConfig)
30994 30985
 		}
@@ -32033,7 +32024,7 @@ func (c *HisApiController) GetPreUploadInfo() {
32033 32024
 
32034 32025
 			}
32035 32026
 		} else if his.Insutype == "310" {
32036
-			if miConfig.MdtrtareaAdmvs == "341203"{
32027
+			if miConfig.MdtrtareaAdmvs == "341203" {
32037 32028
 				if reg_type == 992102 {
32038 32029
 					data["diag_code"] = "ZDZ940"
32039 32030
 
@@ -32043,14 +32034,9 @@ func (c *HisApiController) GetPreUploadInfo() {
32043 32034
 
32044 32035
 				}
32045 32036
 
32037
+			} else {
32046 32038
 
32047
-			}else{
32048
-
32049
-
32050
-
32051
-					data["diag_code"] = sickConfig.CountryCode
32052
-
32053
-
32039
+				data["diag_code"] = sickConfig.CountryCode
32054 32040
 
32055 32041
 			}
32056 32042
 
@@ -32659,29 +32645,67 @@ func (c *HisApiController) GetPreUploadInfo() {
32659 32645
 						res.Infcode = infocode
32660 32646
 
32661 32647
 					} else {
32662
-						result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode, admin_user_id)
32663
-						var dat map[string]interface{}
32664
-						if err := json.Unmarshal([]byte(result), &dat); err == nil {
32665
-							fmt.Println(dat)
32648
+						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" {
32649
+							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
32650
+							if result3101.Infcode == 0 {
32651
+								if len(result3101.Output.Result) > 0 {
32652
+									var errMsgs []string
32653
+									for _, item := range result3101.Output.Result {
32654
+										errMsgs = append(errMsgs, item.VolaCont)
32655
+
32656
+									}
32657
+									c.ServeSuccessJSON(map[string]interface{}{
32658
+										"failed_code": -10,
32659
+										"msg":         errMsgs,
32660
+									})
32661
+									return
32662
+								} else {
32663
+									result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode, admin_user_id)
32664
+									var dat map[string]interface{}
32665
+									if err := json.Unmarshal([]byte(result), &dat); err == nil {
32666
+										fmt.Println(dat)
32667
+									} else {
32668
+										fmt.Println(err)
32669
+									}
32670
+									saveLog(result, request_log, "2204", "上传费用明细")
32671
+
32672
+									userJSONBytes, _ := json.Marshal(dat)
32673
+									if err := json.Unmarshal(userJSONBytes, &res); err != nil {
32674
+										utils.ErrorLog("解析失败:%v", err)
32675
+										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
32676
+										return
32677
+									}
32678
+
32679
+								}
32680
+							} else {
32681
+								c.ServeSuccessJSON(map[string]interface{}{
32682
+									"failed_code": -10,
32683
+									"msg":         result3101.ErrMsg,
32684
+								})
32685
+								return
32686
+							}
32687
+
32666 32688
 						} else {
32667
-							fmt.Println(err)
32668
-						}
32669
-						saveLog(result, request_log, "2204", "上传费用明细")
32689
+							result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode, admin_user_id)
32690
+							var dat map[string]interface{}
32691
+							if err := json.Unmarshal([]byte(result), &dat); err == nil {
32692
+								fmt.Println(dat)
32693
+							} else {
32694
+								fmt.Println(err)
32695
+							}
32696
+							saveLog(result, request_log, "2204", "上传费用明细")
32670 32697
 
32671
-						userJSONBytes, _ := json.Marshal(dat)
32698
+							userJSONBytes, _ := json.Marshal(dat)
32672 32699
 
32673
-						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
32674
-							utils.ErrorLog("解析失败:%v", err)
32675
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
32676
-							return
32700
+							if err := json.Unmarshal(userJSONBytes, &res); err != nil {
32701
+								utils.ErrorLog("解析失败:%v", err)
32702
+								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
32703
+								return
32704
+							}
32677 32705
 						}
32678
-
32679 32706
 					}
32680
-
32681 32707
 				}
32682
-
32683 32708
 			}
32684
-
32685 32709
 			var total_two float64
32686 32710
 			if res.Infcode == -1 {
32687 32711
 				errlog := &models.HisOrderError{
@@ -34029,11 +34053,56 @@ func (c *HisApiController) GetPreUploadInfo() {
34029 34053
 							var request_log string
34030 34054
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
34031 34055
 							allTotal = fmt.Sprintf("%.2f", total_two)
34032
-							if his.IdCardType == 4 {
34033
-								result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34056
+							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" {
34057
+
34058
+								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
34059
+								if result3101.Infcode == 0 {
34060
+									if len(result3101.Output.Result) > 0 {
34061
+										var errMsgs []string
34062
+										for _, item := range result3101.Output.Result {
34063
+											errMsgs = append(errMsgs, item.VolaCont)
34064
+
34065
+										}
34066
+										c.ServeSuccessJSON(map[string]interface{}{
34067
+											"failed_code": -10,
34068
+											"msg":         errMsgs,
34069
+										})
34070
+										return
34071
+									} else {
34072
+										var result string
34073
+										var request_log string
34074
+										psn_info, _ := service.GetPsnByPatientId(his.PatientId)
34075
+										allTotal = fmt.Sprintf("%.2f", total_two)
34076
+										if his.IdCardType == 4 {
34077
+											result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34078
+										} else {
34079
+											result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34080
+
34081
+										}
34082
+
34083
+										var dat map[string]interface{}
34084
+										if err := json.Unmarshal([]byte(result), &dat); err == nil {
34085
+											fmt.Println(dat)
34086
+										} else {
34087
+											fmt.Println(err)
34088
+										}
34089
+										saveLog(result, request_log, "2206", "预结算")
34090
+
34091
+									}
34092
+								} else {
34093
+									c.ServeSuccessJSON(map[string]interface{}{
34094
+										"failed_code": -10,
34095
+										"msg":         result3101.ErrMsg,
34096
+									})
34097
+									return
34098
+								}
34034 34099
 							} else {
34035
-								result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34100
+								if his.IdCardType == 4 {
34101
+									result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34102
+								} else {
34103
+									result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
34036 34104
 
34105
+								}
34037 34106
 							}
34038 34107
 
34039 34108
 							var dat map[string]interface{}
@@ -38716,7 +38785,6 @@ func (c *HisApiController) GetSettleAccounts() {
38716 38785
 		} else if miConfig.MdtrtareaAdmvs == "360302" {
38717 38786
 			baseParams.InsuplcAdmdvs = his.InsuplcAdmdvs
38718 38787
 
38719
-
38720 38788
 			result, requestLog := service.Jxyb5203(baseParams, businessParams)
38721 38789
 			saveLog(result, requestLog, "5203", "结算单")
38722 38790
 			var dat map[string]interface{}
@@ -38734,7 +38802,6 @@ func (c *HisApiController) GetSettleAccounts() {
38734 38802
 		} else if miConfig.MdtrtareaAdmvs == "361025" {
38735 38803
 			baseParams.InsuplcAdmdvs = his.InsuplcAdmdvs
38736 38804
 
38737
-
38738 38805
 			result, requestLog := service.Jxyb5203(baseParams, businessParams)
38739 38806
 			saveLog(result, requestLog, "5203", "结算单")
38740 38807
 			var dat map[string]interface{}
@@ -39227,7 +39294,7 @@ func (c *HisApiController) GetSettleAccounts() {
39227 39294
 		res.Output.Setlinfo.PsnCashPay = order.PsnCashPay
39228 39295
 
39229 39296
 		if res.Infcode == 0 {
39230
-			if adminUser.CurrentOrgId == 10215 || adminUser.CurrentOrgId == 10387 || adminUser.CurrentOrgId == 9919 || adminUser.CurrentOrgId == 10088 || adminUser.CurrentOrgId == 10150 || adminUser.CurrentOrgId == 10454 || adminUser.CurrentOrgId == 10644 || adminUser.CurrentOrgId == 10653 || adminUser.CurrentOrgId == 10210{
39297
+			if adminUser.CurrentOrgId == 10215 || adminUser.CurrentOrgId == 10387 || adminUser.CurrentOrgId == 9919 || adminUser.CurrentOrgId == 10088 || adminUser.CurrentOrgId == 10150 || adminUser.CurrentOrgId == 10454 || adminUser.CurrentOrgId == 10644 || adminUser.CurrentOrgId == 10653 || adminUser.CurrentOrgId == 10210 {
39231 39298
 				c.ServeSuccessJSON(map[string]interface{}{
39232 39299
 					"diagnosis":            name,
39233 39300
 					"order_infos":          orderInfos,