test_user 1 month ago
parent
commit
20a8b71e10

+ 41 - 0
common/crypto.go View File

1
+package common
2
+
3
+import (
4
+	"crypto/hmac"
5
+	"crypto/sha256"
6
+)
7
+
8
+const (
9
+	// HMAC签名算法
10
+	HMAC_SHA256 = "HMAC-SHA256"
11
+)
12
+
13
+// HMAC_Sha256 加密
14
+func HMAC_Sha256(data string, secret string) []byte {
15
+	h := hmac.New(sha256.New, []byte(secret))
16
+	h.Write([]byte(data))
17
+	return h.Sum(nil)
18
+}
19
+
20
+// RSASHA256 加密
21
+// func RSASHA256(data string, Key string) (string, error) {
22
+// 	h := sha256.New()
23
+// 	h.Write([]byte(data))
24
+// 	hashed := h.Sum(nil)
25
+// 	block, _ := pem.Decode([]byte(Key))
26
+// 	if block == nil {
27
+// 		return "", errors.New("private key error")
28
+// 	}
29
+
30
+// 	privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
31
+// 	if err != nil {
32
+// 		return "", err
33
+// 	}
34
+
35
+// 	signature, err := rsa.SignPKCS1v15(cryptorand.Reader, privateKey, crypto.SHA256, hashed)
36
+// 	if err != nil {
37
+// 		return "", err
38
+// 	}
39
+
40
+// 	return base64.StdEncoding.EncodeToString(signature), nil
41
+// }

+ 29 - 0
common/json.go View File

1
+package common
2
+
3
+import (
4
+	"encoding/json"
5
+	"gdyb/utils"
6
+
7
+)
8
+
9
+func GetPostDataWithMap(post map[string]interface{}) (string, error) {
10
+	//json := jsoniter.Config{
11
+	//	MarshalFloatWith6Digits: true,
12
+	//	EscapeHTML:              false,
13
+	//	SortMapKeys:             true, //本身高灯平台仅要求对最外层json key进行asci码升序排序,但map是无序且随机的,所以签名和post数据均排序以保持一致
14
+	//	UseNumber:               true,
15
+	//	DisallowUnknownFields:   false,
16
+	//	CaseSensitive:           true,
17
+	//}.Froze()
18
+
19
+	s, err := json.Marshal(&post)
20
+	utils.ErrorLog("解析失败:%v", post)
21
+	utils.ErrorLog("解析失败:%v", err)
22
+	utils.ErrorLog("解析失败:%v",string(s))
23
+
24
+	if err != nil {
25
+		return "", err
26
+	}
27
+
28
+	return string(s), nil
29
+}

+ 27 - 0
common/rand.go View File

1
+package common
2
+
3
+import (
4
+	"fmt"
5
+	"math/rand"
6
+	"strings"
7
+	"time"
8
+)
9
+
10
+const (
11
+	numLen = 10 //随机序列长度
12
+)
13
+
14
+var (
15
+	numeric = [numLen]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} //随机序列
16
+)
17
+
18
+func GetRand(width int) string {
19
+	r := len(numeric)
20
+	rand.Seed(time.Now().UnixNano())
21
+
22
+	var sb strings.Builder
23
+	for i := 0; i < width; i++ {
24
+		fmt.Fprintf(&sb, "%d", numeric[rand.Intn(r)])
25
+	}
26
+	return sb.String()
27
+}

+ 234 - 12
controllers/coordinate/coordinate_controller.go View File

3124
 		var recordStartTime int64
3124
 		var recordStartTime int64
3125
 		var recordEndTime int64
3125
 		var recordEndTime int64
3126
 
3126
 
3127
+		var dias []string
3128
+		start_time_str := c.GetString("start_time")
3129
+		end_time_str := c.GetString("end_time")
3130
+		theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
3131
+		if err != nil {
3132
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3133
+			return
3134
+		}
3135
+		recordStartTime = theStartTime.Unix()
3136
+		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
3137
+		if err != nil {
3138
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3139
+			return
3140
+		}
3141
+		recordEndTime = theEndTime.Unix()
3142
+		if settle_accounts_type == 1{
3143
+			patientPrescription, _ := service.FindPatientPrescriptionInfoTwo(org_id, patient.ID, recordDateTime, 2)
3144
+			if patientPrescription.ID == 0 {
3145
+				patientPrescription, _ = service.FindLastPatientPrescriptionInfo(org_id, patient.ID, recordDateTime)
3146
+			}
3147
+			diass := strings.Split(patientPrescription.Diagnosis,",")
3148
+			for _, subdiaitem := range  diass{
3149
+				if subdiaitem != "716"{
3150
+					dias = append(dias,subdiaitem)
3151
+				}
3152
+
3153
+			}
3154
+
3155
+
3156
+		}else {
3157
+			var recordStartTime2 int64
3158
+			var recordEndTime2 int64
3159
+
3160
+			start_time_str2 := c.GetString("start_time")
3161
+			end_time_str2 := c.GetString("end_time")
3162
+			theStartTime2, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str2+" 00:00:00", loc)
3163
+			if err != nil {
3164
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3165
+				return
3166
+			}
3167
+			recordStartTime2 = theStartTime2.Unix()
3168
+			theEndTime2, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str2+" 00:00:00", loc)
3169
+			if err != nil {
3170
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3171
+				return
3172
+			}
3173
+			recordEndTime2 = theEndTime2.Unix()
3174
+			patientPrescription, _ := service.FindPatientPrescriptionInfoThree(org_id, patient.ID, recordStartTime2, recordEndTime2, 2)
3175
+			for _, spinfo := range patientPrescription {
3176
+				fmt.Println(spinfo.Diagnosis)
3177
+
3178
+				diass := strings.Split(spinfo.Diagnosis,",")
3179
+				fmt.Println(diass)
3180
+				for _, dia := range diass {
3181
+					fmt.Println(dia)
3182
+
3183
+					if dia != "716" {
3184
+						dias = append(dias,dia)
3185
+					}
3186
+				}
3187
+
3188
+			}
3189
+		}
3190
+
3191
+		newArr := make([]string, 0)
3192
+		for i := 0; i < len(dias); i++ {
3193
+			repeat := false
3194
+			for j := i + 1; j < len(dias); j++ {
3195
+				if dias[i] == dias[j] {
3196
+					repeat = true
3197
+					break
3198
+				}
3199
+			}
3200
+			if !repeat {
3201
+				newArr = append(newArr, dias[i])
3202
+			}
3203
+		}
3204
+
3205
+
3206
+
3207
+
3208
+
3127
 		var prescriptions []models.HisPrescription
3209
 		var prescriptions []models.HisPrescription
3128
 		if settle_accounts_type == 1 { //日结
3210
 		if settle_accounts_type == 1 { //日结
3129
 			prescriptions, _ = service.GetUnSettleHisPrescriptionFiveone(p_id)
3211
 			prescriptions, _ = service.GetUnSettleHisPrescriptionFiveone(p_id)
3855
 								}
3937
 								}
3856
 								if subitem.HisProject.CostClassify == 3 {
3938
 								if subitem.HisProject.CostClassify == 3 {
3857
 									var ie_cbm1 models.IEtwo
3939
 									var ie_cbm1 models.IEtwo
3858
-									if subitem.TeamId > 0{
3859
-										//ie_cbm1.BBX01 = subitem.HisProject.
3860
-										team := service.GetBbx01ByTeamID(subitem.TeamId)
3861
-										ie_cbm1.BBX01 = team.Bbx01
3862
-									}else{
3863
-										ie_cbm1.BBX01 = subitem.HisProject.ZuobiaoId
3864
-									}
3940
+									//if subitem.TeamId > 0{
3941
+									//	//ie_cbm1.BBX01 = subitem.HisProject.
3942
+									//	team := service.GetBbx01ByTeamID(subitem.TeamId)
3943
+									//	ie_cbm1.BBX01 = team.Bbx01
3944
+									//}else{
3945
+									ie_cbm1.BBX01 = subitem.HisProject.ZuobiaoId
3946
+									//}
3865
 									ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
3947
 									ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
3866
 									ie_cbm1.VAF04 = strconv.FormatInt(int64(li.Acf01), 10)
3948
 									ie_cbm1.VAF04 = strconv.FormatInt(int64(li.Acf01), 10)
3867
 									ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
3949
 									ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
4094
 							ie_cbm1.VAO26 = ""
4176
 							ie_cbm1.VAO26 = ""
4095
 							ie_cbm1.IAD04 = ""
4177
 							ie_cbm1.IAD04 = ""
4096
 							ie_cbm1.IAD01 = ""
4178
 							ie_cbm1.IAD01 = ""
4179
+							ie_cbm1.VAO25 = "1"
4180
+							ie_cbm1.VAO35 = ""
4181
+							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
4182
+						}
4183
+					}
4184
+				}
4185
+
4186
+
4187
+
4188
+				for index, item := range big_ps[start-1 : stop] {
4189
+					//sick, _ := service.FindSickById(sick_type)
4190
+					//item.VMHisPrescriptionInfo.Diagnosis = "716"
4191
+					//dias := strings.Split(item.VMHisPrescriptionInfo.Diagnosis, ",")
4192
+					//service.get
4193
+
4194
+					//诊断
4195
+					for _, subitem := range newArr {
4196
+						diagnosisConfig, _ := service.FindDiagnoseByIdtwo(subitem)
4197
+						if index == 0 {
4198
+							var ie_cbm1 models.IEthree
4199
+							ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
4200
+							//ie_cbm1.CBMID = strconv.FormatInt(int64(index+1), 10)
4201
+							ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
4202
+							ie_cbm1.VAA07 = strconv.FormatInt(int64(li.Vaa07), 10)
4203
+							ie_cbm1.ACF01 = strconv.FormatInt(int64(li.Acf01), 10)
4204
+							ie_cbm1.VAO06 = strconv.FormatInt(int64(index+1), 10)
4205
+							ie_cbm1.VAO07 = "1"
4206
+							ie_cbm1.VAO10 = "0"
4207
+							ie_cbm1.VAO11 = "1"
4208
+							ie_cbm1.BAK01A =""
4209
+							ie_cbm1.CAM01 = diagnosisConfig.ContentCode
4210
+							ie_cbm1.VAO15 = diagnosisConfig.ClassName
4211
+							ie_cbm1.VAO18 = "0"
4212
+							ie_cbm1.VAO22 = "1"
4213
+							ie_cbm1.IAA01 = ""
4214
+							ie_cbm1.IAD03 = ""
4215
+							ie_cbm1.BAK01B = ""
4216
+							ie_cbm1.VAO26 = ""
4217
+							ie_cbm1.IAD04 = ""
4218
+							ie_cbm1.IAD01 = ""
4219
+							ie_cbm1.VAO25 = "2"
4220
+							ie_cbm1.VAO35 = ""
4221
+							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
4222
+
4223
+						} else {
4224
+							var ie_cbm1 models.IEthree
4225
+							ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
4226
+							ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
4227
+							ie_cbm1.VAA07 = strconv.FormatInt(int64(li.Vaa07), 10)
4228
+							ie_cbm1.ACF01 = strconv.FormatInt(int64(li.Acf01), 10)
4229
+							ie_cbm1.VAO06 = strconv.FormatInt(int64(index+1), 10)
4230
+							ie_cbm1.VAO07 = "1"
4231
+							ie_cbm1.VAO10 = "0"
4232
+							ie_cbm1.VAO11 = "1"
4233
+							ie_cbm1.BAK01A = ""
4234
+							ie_cbm1.CAM01 = diagnosisConfig.ContentCode
4235
+							ie_cbm1.VAO15 = diagnosisConfig.ClassName
4236
+							ie_cbm1.VAO18 = "0"
4237
+							ie_cbm1.VAO22 = "1"
4238
+							ie_cbm1.IAA01 = ""
4239
+							ie_cbm1.IAD03 = ""
4240
+							ie_cbm1.BAK01B = ""
4241
+							ie_cbm1.VAO26 = ""
4242
+							ie_cbm1.IAD04 = ""
4243
+							ie_cbm1.IAD01 = ""
4097
 							ie_cbm1.VAO25 = "2"
4244
 							ie_cbm1.VAO25 = "2"
4098
 							ie_cbm1.VAO35 = ""
4245
 							ie_cbm1.VAO35 = ""
4099
 							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
4246
 							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
4100
 						}
4247
 						}
4101
 					}
4248
 					}
4102
 				}
4249
 				}
4250
+
4103
 				////
4251
 				////
4104
 				//////检验检查医嘱
4252
 				//////检验检查医嘱
4105
 				//for _, item := range prescriptions{
4253
 				//for _, item := range prescriptions{
4147
 				client := &http.Client{}
4295
 				client := &http.Client{}
4148
 				fmt.Println(string(xmlStr2))
4296
 				fmt.Println(string(xmlStr2))
4149
 				saveLog("", string(xmlStr2), "1111", "上传明细xml", "")
4297
 				saveLog("", string(xmlStr2), "1111", "上传明细xml", "")
4150
-
4151
 				req, _ = http.NewRequest("POST", "http://127.0.0.1:9532/"+"nmg/coordinate/upload", bytes.NewBufferString(string(bytesData)))
4298
 				req, _ = http.NewRequest("POST", "http://127.0.0.1:9532/"+"nmg/coordinate/upload", bytes.NewBufferString(string(bytesData)))
4152
 				resp, _ := client.Do(req)
4299
 				resp, _ := client.Do(req)
4153
 				defer resp.Body.Close()
4300
 				defer resp.Body.Close()
4583
 			}
4730
 			}
4584
 
4731
 
4585
 			// 输出JSON字符串
4732
 			// 输出JSON字符串
4586
-			fmt.Println(string(jsonString))
4733
+			//fmt.Println(string(jsonString))
4587
 			saveLog("", string(jsonString), "1111333", "122222224444", "")
4734
 			saveLog("", string(jsonString), "1111333", "122222224444", "")
4588
 
4735
 
4589
 
4736
 
4826
 						ie_cbm1.CBM07 = "10"
4973
 						ie_cbm1.CBM07 = "10"
4827
 					}
4974
 					}
4828
 					if item.MedType == "190"{
4975
 					if item.MedType == "190"{
4829
-						ie_cbm1.CBM06 = "1"
4976
+						ie_cbm1.CBM07 = "1"
4830
 					}
4977
 					}
4831
 
4978
 
4832
 					ie_cbm1.BCK01B = strconv.FormatInt(int64(li.Bck01B), 10)
4979
 					ie_cbm1.BCK01B = strconv.FormatInt(int64(li.Bck01B), 10)
5622
 				for index, item := range big_ps[start-1 : stop] {
5769
 				for index, item := range big_ps[start-1 : stop] {
5623
 					sick, _ := service.FindSickById(sick_type)
5770
 					sick, _ := service.FindSickById(sick_type)
5624
 					item.VMHisPrescriptionInfo.Diagnosis = "716"
5771
 					item.VMHisPrescriptionInfo.Diagnosis = "716"
5625
-					dias := strings.Split(item.VMHisPrescriptionInfo.Diagnosis, ",")
5772
+					diass := strings.Split(item.VMHisPrescriptionInfo.Diagnosis, ",")
5626
 					//service.get
5773
 					//service.get
5627
 
5774
 
5628
 					//诊断
5775
 					//诊断
5629
-					for _, subitem := range dias {
5776
+					for _, subitem := range diass {
5630
 						diagnosisConfig, _ := service.FindDiagnoseByIdtwo(subitem)
5777
 						diagnosisConfig, _ := service.FindDiagnoseByIdtwo(subitem)
5631
 						if index == 0 {
5778
 						if index == 0 {
5632
 							var ie_cbm1 models.IEthree
5779
 							var ie_cbm1 models.IEthree
5675
 							ie_cbm1.VAO26 = ""
5822
 							ie_cbm1.VAO26 = ""
5676
 							ie_cbm1.IAD04 = ""
5823
 							ie_cbm1.IAD04 = ""
5677
 							ie_cbm1.IAD01 = ""
5824
 							ie_cbm1.IAD01 = ""
5825
+							ie_cbm1.VAO25 = "1"
5826
+							ie_cbm1.VAO35 = ""
5827
+							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
5828
+						}
5829
+					}
5830
+				}
5831
+
5832
+
5833
+				for index, item := range big_ps[start-1 : stop] {
5834
+					//sick, _ := service.FindSickById(sick_type)
5835
+					//item.VMHisPrescriptionInfo.Diagnosis = "716"
5836
+					//dias := strings.Split(item.VMHisPrescriptionInfo.Diagnosis, ",")
5837
+					//service.get
5838
+					//诊断
5839
+					for _, subitem := range newArr {
5840
+						diagnosisConfig, _ := service.FindDiagnoseByIdtwo(subitem)
5841
+						//fmt.Println("6666666666666")
5842
+						//fmt.Println(diagnosisConfig)
5843
+						jsonString2, err := json.Marshal(diagnosisConfig)
5844
+						if err != nil {
5845
+							fmt.Println("转换失败:", err)
5846
+							return
5847
+						}
5848
+						saveLog("", string(jsonString2), "444", "55555", "")
5849
+
5850
+						if index == 0 {
5851
+							var ie_cbm1 models.IEthree
5852
+							ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
5853
+							//ie_cbm1.CBMID = strconv.FormatInt(int64(index+1), 10)
5854
+							ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
5855
+							ie_cbm1.VAA07 = strconv.FormatInt(int64(li.Vaa07), 10)
5856
+							ie_cbm1.ACF01 = strconv.FormatInt(int64(li.Acf01), 10)
5857
+							ie_cbm1.VAO06 = strconv.FormatInt(int64(index+1), 10)
5858
+							ie_cbm1.VAO07 = "1"
5859
+							ie_cbm1.VAO10 = "0"
5860
+							ie_cbm1.VAO11 = "1"
5861
+							ie_cbm1.BAK01A = ""
5862
+							ie_cbm1.CAM01 = diagnosisConfig.ContentCode
5863
+							ie_cbm1.VAO15 = diagnosisConfig.ClassName
5864
+							ie_cbm1.VAO18 = "0"
5865
+							ie_cbm1.VAO22 = "1"
5866
+							ie_cbm1.IAA01 = ""
5867
+							ie_cbm1.IAD03 = ""
5868
+							ie_cbm1.BAK01B = ""
5869
+							ie_cbm1.VAO26 = ""
5870
+							ie_cbm1.IAD04 = ""
5871
+							ie_cbm1.IAD01 = ""
5872
+							ie_cbm1.VAO25 = "2"
5873
+							ie_cbm1.VAO35 = ""
5874
+							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
5875
+
5876
+						} else {
5877
+							var ie_cbm1 models.IEthree
5878
+							ie_cbm1.CBMID = strconv.FormatInt(int64(item.ID), 10)
5879
+							ie_cbm1.VAA01 = strconv.FormatInt(int64(li.Vaa01), 10)
5880
+							ie_cbm1.VAA07 = strconv.FormatInt(int64(li.Vaa07), 10)
5881
+							ie_cbm1.ACF01 = strconv.FormatInt(int64(li.Acf01), 10)
5882
+							ie_cbm1.VAO06 = strconv.FormatInt(int64(index+1), 10)
5883
+							ie_cbm1.VAO07 = "1"
5884
+							ie_cbm1.VAO10 = "0"
5885
+							ie_cbm1.VAO11 = "1"
5886
+							ie_cbm1.BAK01A = ""
5887
+							ie_cbm1.CAM01 = diagnosisConfig.ContentCode
5888
+							ie_cbm1.VAO15 = diagnosisConfig.ClassName
5889
+							ie_cbm1.VAO18 = "0"
5890
+							ie_cbm1.VAO22 = "1"
5891
+							ie_cbm1.IAA01 = ""
5892
+							ie_cbm1.IAD03 = ""
5893
+							ie_cbm1.BAK01B = ""
5894
+							ie_cbm1.VAO26 = ""
5895
+							ie_cbm1.IAD04 = ""
5896
+							ie_cbm1.IAD01 = ""
5678
 							ie_cbm1.VAO25 = "2"
5897
 							ie_cbm1.VAO25 = "2"
5679
 							ie_cbm1.VAO35 = ""
5898
 							ie_cbm1.VAO35 = ""
5680
 							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
5899
 							vAO1.Ie = append(vAO1.Ie, ie_cbm1)
5681
 						}
5900
 						}
5682
 					}
5901
 					}
5683
 				}
5902
 				}
5903
+
5904
+
5684
 				////
5905
 				////
5685
 				//////检验检查医嘱
5906
 				//////检验检查医嘱
5686
 				//for _, item := range prescriptions{
5907
 				//for _, item := range prescriptions{
5728
 				client := &http.Client{}
5949
 				client := &http.Client{}
5729
 				fmt.Println(string(xmlStr2))
5950
 				fmt.Println(string(xmlStr2))
5730
 				saveLog("", string(xmlStr2), "1111", "上传明细xml", "")
5951
 				saveLog("", string(xmlStr2), "1111", "上传明细xml", "")
5952
+
5731
 				req, _ = http.NewRequest("POST", "http://127.0.0.1:9532/"+"nmg/coordinate/upload", bytes.NewBufferString(string(bytesData)))
5953
 				req, _ = http.NewRequest("POST", "http://127.0.0.1:9532/"+"nmg/coordinate/upload", bytes.NewBufferString(string(bytesData)))
5732
 				resp, _ := client.Do(req)
5954
 				resp, _ := client.Do(req)
5733
 				defer resp.Body.Close()
5955
 				defer resp.Body.Close()

+ 96 - 0
controllers/hb/hbyb_controller.go View File

57
 	beego.Router("/hbyb/2305", &HBybController{}, "get:Post2305")
57
 	beego.Router("/hbyb/2305", &HBybController{}, "get:Post2305")
58
 
58
 
59
 
59
 
60
+	beego.Router("/hbyb/3204", &HBybController{}, "post:Post3204")
61
+	beego.Router("/hbyb/8404", &HBybController{}, "post:Post8404")
62
+	beego.Router("/hbyb/3204a", &HBybController{}, "post:Post3204a")
63
+
64
+
65
+
60
 
66
 
61
 }
67
 }
62
 
68
 
69
+
70
+
63
 func (c *HBybController) Post2401() {
71
 func (c *HBybController) Post2401() {
64
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
72
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
65
 	var respJSON map[string]interface{}
73
 	var respJSON map[string]interface{}
485
 }
493
 }
486
 
494
 
487
 
495
 
496
+func (c *HBybController) Post3204a() {
497
+
498
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
499
+	var respJSON map[string]interface{}
500
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
501
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
502
+		return
503
+	}
504
+	userJSONBytes, _ := json.Marshal(respJSON["bps"])
505
+	var bps []*models.BusinessParamsTwo
506
+	if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
507
+		utils.ErrorLog("解析失败:%v", err)
508
+		return
509
+	}
510
+
511
+	var baseParams models.BaseParams
512
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
513
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
514
+	baseParams.OrgName = respJSON["org_name"].(string)
515
+	baseParams.Doctor = respJSON["doctor"].(string)
516
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
517
+
518
+	result := service.Hbyb3204a(baseParams, bps)
519
+	var dat map[string]interface{}
520
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
521
+		fmt.Println(dat)
522
+	} else {
523
+		fmt.Println(err)
524
+	}
525
+	c.ServeSuccessJSON(map[string]interface{}{
526
+		"pre": dat,
527
+	})
528
+}
529
+
530
+
531
+func (c *HBybController) Post3204() {
532
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
533
+	var respJSON map[string]interface{}
534
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
535
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
536
+		return
537
+	}
538
+	var baseParams models.BaseParams
539
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
540
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
541
+	baseParams.OrgName = respJSON["org_name"].(string)
542
+	baseParams.Doctor = respJSON["doctor"].(string)
543
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
544
+	result := service.Hbyb3204(baseParams, respJSON["id"].(string))
545
+	var dat map[string]interface{}
546
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
547
+		fmt.Println(dat)
548
+	} else {
549
+		fmt.Println(err)
550
+	}
551
+	c.ServeSuccessJSON(map[string]interface{}{
552
+		"pre": dat,
553
+	})
554
+}
555
+
556
+
557
+func (c *HBybController) Post8404() {
558
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
559
+	var respJSON map[string]interface{}
560
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
561
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
562
+		return
563
+	}
564
+	var baseParams models.BaseParams
565
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
566
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
567
+	baseParams.OrgName = respJSON["org_name"].(string)
568
+	baseParams.Doctor = respJSON["doctor"].(string)
569
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
570
+	result := service.Hbyb8404(baseParams,respJSON["month"].(string))
571
+	var dat map[string]interface{}
572
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
573
+		fmt.Println(dat)
574
+	} else {
575
+		fmt.Println(err)
576
+	}
577
+	c.ServeSuccessJSON(map[string]interface{}{
578
+		"pre": dat,
579
+	})
580
+}
581
+
582
+
583
+
488
 func (c *HBybController) Post1608() {
584
 func (c *HBybController) Post1608() {
489
 
585
 
490
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
586
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)

+ 3 - 3
controllers/js/jsyb_controller.go View File

1058
 	}
1058
 	}
1059
 
1059
 
1060
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3507s"])
1060
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3507s"])
1061
-	var struct3507 []models.Struct3507
1061
+	var struct3507 models.Struct3507
1062
 	if err := json.Unmarshal(userJSONBytes, &struct3507); err != nil {
1062
 	if err := json.Unmarshal(userJSONBytes, &struct3507); err != nil {
1063
 		utils.ErrorLog("解析失败:%v", err)
1063
 		utils.ErrorLog("解析失败:%v", err)
1064
 		return
1064
 		return
1065
 	}
1065
 	}
1066
 
1066
 
1067
-	result, request_log := service.Jsyb3507(struct3507[0])
1068
-	saveJsLog(result, request_log, "3507", "库存盘点", struct3507[0].OrgName)
1067
+	result, request_log := service.Jsyb3507(struct3507)
1068
+	saveJsLog(result, request_log, "3507", "库存盘点", struct3507.OrgName)
1069
 	var dat2 map[string]interface{}
1069
 	var dat2 map[string]interface{}
1070
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
1070
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
1071
 	} else {
1071
 	} else {

File diff suppressed because it is too large
+ 1512 - 0
controllers/sg/fapiao_controller.go


File diff suppressed because it is too large
+ 3766 - 422
controllers/sg/his_api_controller.go


+ 6 - 13
controllers/zh/zh_his_api_controller.go View File

1549
 				insuplc_admdvs = miConfig.InsuplcAdmdvs
1549
 				insuplc_admdvs = miConfig.InsuplcAdmdvs
1550
 			}
1550
 			}
1551
 
1551
 
1552
-			result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 1, patient.Name,admin_user_id)
1552
+			result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 1, "",admin_user_id)
1553
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1553
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1554
 		}
1554
 		}
1555
 		//result := service.Gdyb1101A(id_card_no, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
1555
 		//result := service.Gdyb1101A(id_card_no, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
3805
 		for _, item := range prescriptions {
3805
 		for _, item := range prescriptions {
3806
 			if item.Type == 1 { //药品
3806
 			if item.Type == 1 { //药品
3807
 				for _, subItem := range item.HisDoctorAdviceInfo {
3807
 				for _, subItem := range item.HisDoctorAdviceInfo {
3808
-					if len(subItem.BaseDrugLib.MedicalInsuranceNumber) == 0 {
3808
+					if len(subItem.BaseDrugLib.MedicalInsuranceNumber) == 0 &&  subItem.Price > 0{
3809
 
3809
 
3810
 						empty_code_errs = append(empty_code_errs,subItem.BaseDrugLib.DrugName)
3810
 						empty_code_errs = append(empty_code_errs,subItem.BaseDrugLib.DrugName)
3811
 					}
3811
 					}
3817
 					//var randNum int
3817
 					//var randNum int
3818
 					//randNum = rand.Intn(10000) + 1000
3818
 					//randNum = rand.Intn(10000) + 1000
3819
 					if subItem.Type == 2 {
3819
 					if subItem.Type == 2 {
3820
-						if len(subItem.HisProject.MedicalCode) == 0 {
3820
+						if len(subItem.HisProject.MedicalCode) == 0  &&  subItem.Price > 0{
3821
 							empty_code_errs = append(empty_code_errs,subItem.HisProject.ProjectName)
3821
 							empty_code_errs = append(empty_code_errs,subItem.HisProject.ProjectName)
3822
 
3822
 
3823
 						}
3823
 						}
3824
 					} else if subItem.Type == 3 {
3824
 					} else if subItem.Type == 3 {
3825
-						if len(subItem.GoodInfo.MedicalInsuranceNumber) == 0 {
3825
+						if len(subItem.GoodInfo.MedicalInsuranceNumber) == 0 &&  subItem.Price > 0 {
3826
 							empty_code_errs = append(empty_code_errs,subItem.GoodInfo.GoodName)
3826
 							empty_code_errs = append(empty_code_errs,subItem.GoodInfo.GoodName)
3827
 
3827
 
3828
 						}
3828
 						}
3850
 			tm := time.Unix(item.PreTime, 0)
3850
 			tm := time.Unix(item.PreTime, 0)
3851
 			if item.Type == 1 { //药品
3851
 			if item.Type == 1 { //药品
3852
 				for _, subItem := range item.HisDoctorAdviceInfo {
3852
 				for _, subItem := range item.HisDoctorAdviceInfo {
3853
-					if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
3854
 						//var randNum int
3853
 						//var randNum int
3855
 						//randNum = rand.Intn(10000) + 1000
3854
 						//randNum = rand.Intn(10000) + 1000
3856
 						cus := &models.NewCustom{
3855
 						cus := &models.NewCustom{
3865
 						}
3864
 						}
3866
 
3865
 
3867
 						customs = append(customs, cus)
3866
 						customs = append(customs, cus)
3868
-					}
3867
+
3869
 				}
3868
 				}
3870
 			}
3869
 			}
3871
 
3870
 
3874
 					//var randNum int
3873
 					//var randNum int
3875
 					//randNum = rand.Intn(10000) + 1000
3874
 					//randNum = rand.Intn(10000) + 1000
3876
 					if subItem.Type == 2 {
3875
 					if subItem.Type == 2 {
3877
-						if len(subItem.HisProject.MedicalCode) > 0 {
3878
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3876
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3879
 							cus := &models.NewCustom{
3877
 							cus := &models.NewCustom{
3880
 								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
3878
 								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
3887
 								DoctorId:         item.Creator,
3885
 								DoctorId:         item.Creator,
3888
 							}
3886
 							}
3889
 							customs = append(customs, cus)
3887
 							customs = append(customs, cus)
3890
-						}
3888
+
3891
 					} else if subItem.Type == 3 {
3889
 					} else if subItem.Type == 3 {
3892
-						if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 && subItem.GoodInfo.IsUser != 1 {
3893
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3890
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3894
-
3895
 							cus := &models.NewCustom{
3891
 							cus := &models.NewCustom{
3896
 								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
3892
 								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
3897
 								Cut:              fmt.Sprintf("%.4f", cnt),
3893
 								Cut:              fmt.Sprintf("%.4f", cnt),
3903
 								DoctorId:         item.Creator,
3899
 								DoctorId:         item.Creator,
3904
 							}
3900
 							}
3905
 							customs = append(customs, cus)
3901
 							customs = append(customs, cus)
3906
-						}
3907
 					}
3902
 					}
3908
 				}
3903
 				}
3909
 			}
3904
 			}
3910
-
3911
 		}
3905
 		}
3912
-
3913
 		//总页数,向上取整,注意除之前要先转换类型为float64
3906
 		//总页数,向上取整,注意除之前要先转换类型为float64
3914
 		pagecount = int(math.Ceil(float64(len(customs)) / float64(pagesize)))
3907
 		pagecount = int(math.Ceil(float64(len(customs)) / float64(pagesize)))
3915
 		var ress []*ResultFour
3908
 		var ress []*ResultFour

+ 89 - 0
invoice/sdk.go View File

1
+package invoice
2
+
3
+import (
4
+	"encoding/base64"
5
+	"errors"
6
+	"io/ioutil"
7
+	"net/http"
8
+	"strconv"
9
+	"strings"
10
+	"time"
11
+
12
+
13
+	"gdyb/common"
14
+)
15
+
16
+func NewSdk(algorithm, appkey, appsecret, privateKey, env string) *Client {
17
+	return &Client{
18
+		env:        env,
19
+		appkey:     appkey,
20
+		appsecret:  appsecret,
21
+		algorithm:  algorithm,
22
+		privateKey: privateKey,
23
+	}
24
+}
25
+
26
+type Client struct {
27
+	env        string
28
+	appkey     string
29
+	appsecret  string
30
+	privateKey string
31
+	algorithm  string
32
+}
33
+
34
+func (this *Client) HttpPost(baseUrl string, routerAddress string, post map[string]interface{}) ([]byte, error) {
35
+
36
+	// 获取转换后的post字符串
37
+	postData, err := common.GetPostDataWithMap(post)
38
+	if err != nil {
39
+		return nil, err
40
+	}
41
+
42
+	timestamp := strconv.FormatInt(time.Now().Unix(), 10)                //获取时间戳
43
+	nonce := common.GetRand(6)                                           //6位随机数
44
+	auth, err := this.getAuth(routerAddress, postData, timestamp, nonce) //认证串
45
+	if err != nil {
46
+		return nil, err
47
+	}
48
+
49
+	client := &http.Client{}
50
+
51
+	reqest, err := http.NewRequest("POST", baseUrl+routerAddress, strings.NewReader((postData)))
52
+	if err != nil {
53
+		return nil, err
54
+	}
55
+
56
+	reqest.Header.Add("Authorization", auth)
57
+	reqest.Header.Add("Content-Type", "application/json")
58
+
59
+	r, err := client.Do(reqest)
60
+	if err != nil {
61
+		return nil, err
62
+	}
63
+	defer r.Body.Close()
64
+
65
+	return ioutil.ReadAll(r.Body)
66
+}
67
+
68
+// getAuth 获取授权字符串
69
+func (this *Client) getAuth(routerAddress string, postData string, timestamp string, nonce string) (string, error) {
70
+
71
+	originStr := "algorithm=" + this.algorithm + "|appkey=" + this.appkey + "|nonce=" + nonce + "|timestamp=" + timestamp + "|" + routerAddress + "|" + postData
72
+
73
+	var signs string
74
+	var err error
75
+	switch this.algorithm {
76
+	case common.HMAC_SHA256:
77
+		signs = base64.StdEncoding.EncodeToString(common.HMAC_Sha256(originStr, this.appsecret))
78
+	default:
79
+		panic(errors.New("algorithm not exists"))
80
+	}
81
+
82
+	if err != nil {
83
+		return "", err
84
+	}
85
+
86
+	auth := "algorithm=" + this.algorithm + ",appkey=" + this.appkey + ",nonce=" + nonce + ",timestamp=" + timestamp + ",signature=" + signs
87
+
88
+	return auth, nil
89
+}

+ 678 - 22
main.go View File

1
 package main
1
 package main
2
 
2
 
3
-
4
-
5
-
6
 import (
3
 import (
7
 	_ "gdyb/routers"
4
 	_ "gdyb/routers"
8
 	 "gdyb/service"
5
 	 "gdyb/service"
15
 	"os"
12
 	"os"
16
 	"fmt"
13
 	"fmt"
17
 	"github.com/astaxie/beego"
14
 	"github.com/astaxie/beego"
18
-	//"github.com/qiniu/api.v7/auth/qbox"
19
-	//"github.com/qiniu/api.v7/storage"
20
-	//"github.com/qiniu/roapi.v7/auth/qbox"
21
-	//"github.com/qiniu/api.v7/storage"
22
-	//"strconv"
23
-	//"time"
15
+	"github.com/shopspring/decimal"
16
+	"net/http"
17
+	"bytes"
18
+	"io/ioutil"
24
 )
19
 )
20
+type ResultSeventeenOther struct {
21
+	ErrMsg      string `json:"err_msg"`
22
+	InfRefmsgid string `json:"inf_refmsgid"`
23
+	Infcode     string `json:"infcode"`
24
+	Output      struct {
25
+		SetlListId string `json:"setl_list_id"`
26
+	} `json:"output"`
27
+	RefmsgTime  string `json:"refmsg_time"`
28
+	RespondTime string `json:"respond_time"`
29
+	Signtype    string `json:"signtype"`
30
+	WarnInfo    string `json:"warn_info"`
31
+}
32
+type ResultSix struct {
33
+	Cainfo      interface{} `json:"cainfo"`
34
+	ErrMsg      string      `json:"err_msg"`
35
+	InfRefmsgid string      `json:"inf_refmsgid"`
36
+	Infcode     int64       `json:"infcode"`
37
+	Output      struct {
38
+	} `json:"output"`
39
+	RefmsgTime  string      `json:"refmsg_time"`
40
+	RespondTime string      `json:"respond_time"`
41
+	Signtype    interface{} `json:"signtype"`
42
+	WarnMsg     interface{} `json:"warn_msg"`
43
+}
44
+type ResultEmpty10265 struct {
45
+	Cainfo      interface{} `json:"cainfo"`
46
+	ErrMsg      string      `json:"err_msg"`
47
+	InfRefmsgid string      `json:"inf_refmsgid"`
48
+	Infcode     string      `json:"infcode"`
49
+	Output      struct {
50
+	} `json:"output"`
51
+	RefmsgTime  string      `json:"refmsg_time"`
52
+	RespondTime string      `json:"respond_time"`
53
+	Signtype    interface{} `json:"signtype"`
54
+	WarnMsg     interface{} `json:"warn_msg"`
55
+}
25
 
56
 
26
 func init() {
57
 func init() {
27
 	//service.ConnectNMMSDB()
58
 	//service.ConnectNMMSDB()
28
 	service.ConnectDB()
59
 	service.ConnectDB()
29
-	org_id, _ := beego.AppConfig.Int64("org_id")
30
-	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
31
-	////CreateLog(miConfig)
32
-	////UploadLog(miConfig)31
33
-	if org_id == 10191 {
34
-		service.GetFjAuthorizationInfo(miConfig.Code)
35
-	}
36
-
37
-
38
-
39
-
60
+	//org_id, _ := beego.AppConfig.Int64("org_id")
61
+	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
62
+	//////CreateLog(miConfig)
63
+	//////UploadLog(miConfig)31
64
+	//if org_id == 10191 {
65
+	//	service.GetFjAuthorizationInfo(miConfig.Code)
66
+	//}
40
 }
67
 }
41
 func main() {
68
 func main() {
42
 	//service.AutoCreateStock()
69
 	//service.AutoCreateStock()
49
 
76
 
50
 	//深圳百霖
77
 	//深圳百霖
51
 	//GetblBatchSettleList()
78
 	//GetblBatchSettleList()
52
-	//GetblbrBatchSettleList()8
79
+	//GetblbrBatchSettleList()
53
 	//深圳百霖贝尔
80
 	//深圳百霖贝尔
54
 	//GetbrBatchSettleList()
81
 	//GetbrBatchSettleList()
55
 
82
 
65
 
92
 
66
 	//赤峰费森
93
 	//赤峰费森
67
 	//GetcfBatchSettleList()
94
 	//GetcfBatchSettleList()
68
-
95
+	//GetNMSettleListHospital()
96
+	//Get4202()
69
 	beego.Run()
97
 	beego.Run()
70
 
98
 
71
 }
99
 }
5114
 ////	}
5142
 ////	}
5115
 ////	fmt.Println(ret.Key, ret.Hash)
5143
 ////	fmt.Println(ret.Key, ret.Hash)
5116
 ////}
5144
 ////}
5145
+func  GetNMSettleListHospital() {
5146
+	admin_user_id :=   int64(2738)
5147
+	var orders []*models.HisOrder
5148
+	orders, _ = service.GetAllHisOrder10265()
5149
+	for _, item := range orders{
5150
+		order_id := item.ID
5151
+		order, _ := service.GetHisOrderByIDTwo(order_id)
5152
+		roles, _ := service.GetDoctorListTwo(10265)
5153
+		his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
5154
+		admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
5155
+		curRoles, _ := service.GetAdminUserInfoByID(10265, admin_user_id)
5156
+		depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
5157
+		miConfig, _ := service.FindMedicalInsuranceInfo(10265)
5158
+		if order.ID == 0 {
5159
+			continue
5160
+		}
5161
+		struct4101 := service.Struct4101{
5162
+			PsnNo:          order.PsnNo,
5163
+			MdtrtId:        order.MdtrtId,
5164
+			SetlId:         order.SetlId,
5165
+			PsnName:        order.PsnName,
5166
+			Gend:           order.Gend,
5167
+			Brdy:           his.Brdy,
5168
+			Age:            int64(order.Age),
5169
+			Naty:           order.Naty,
5170
+			PatnCertType:   "01",
5171
+			Certno:         order.Certno,
5172
+			Prfs:           "90",
5173
+			ConerName:      roles[0].UserName,
5174
+			PatnRlts:       "99",
5175
+			ConerAddr:      miConfig.OrgName,
5176
+			ConerTel:       admin.Mobile,
5177
+			HiType:         order.Insutype,
5178
+			Insuplc:        miConfig.InsuplcAdmdvs,
5179
+			MaindiagFlag:   "1",
5180
+			BillCode:       order.SetlId,
5181
+			BillNo:         order.SetlId,
5182
+			BizSn:          order.Number,
5183
+			PsnSelfPay:     order.PsnPartAmt,
5184
+			PsnOwnPay:      order.PsnPartAmt,
5185
+			AcctPay:        order.AcctPay,
5186
+			PsnCashpay:     order.PsnCashPay,
5187
+			HiPaymtd:       "1",
5188
+			Hsorg:          miConfig.InsuplcAdmdvs,
5189
+			HsorgOpter:     miConfig.InsuplcAdmdvs,
5190
+			MedinsFillPsn:  curRoles.UserName,
5191
+			MedinsFillDept: depart.Name,
5192
+			IptMedType:     "2",
5193
+			AdmTime:        his.InHosptialTime,
5194
+			AdmEndTime:     his.OutHosptialTime,
5195
+		}
5196
+		struct4101.SetlBegnDate = order.SetlTime
5197
+		struct4101.SetlEndDate = order.SetlTime
5198
+
5199
+
5200
+		var tempDiaginfos []service.DiaginfoStructTwo
5201
+		var tempOpspdiseinfo2 service.OpspdiseinfoStruct
5202
+		var tempOpspdiseinfos []service.OpspdiseinfoStruct
5203
+
5204
+		diagnosis_ids_arr := strings.Split(his.Diagnosis, ",")
5205
+		diagnosis_ids_arr = RemoveRepeatedPurviewElement2(diagnosis_ids_arr)
5206
+
5207
+
5208
+			var config []*models.HisXtDiagnoseConfig
5209
+			for _, item := range diagnosis_ids_arr {
5210
+				id, _ := strconv.ParseInt(item, 10, 64)
5211
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
5212
+				if diagnosisConfig.ID > 0 {
5213
+					config = append(config, &diagnosisConfig)
5214
+				}
5215
+			}
5216
+			for index, item := range config {
5217
+				if item.ID > 0 {
5218
+					if index == 0 {
5219
+						var tempDiaginfo service.DiaginfoStructTwo
5220
+						tempDiaginfo.DiagCode = item.CountryCode
5221
+						tempDiaginfo.DiagName = item.CountryContentName
5222
+						tempDiaginfo.DiagType = "1"
5223
+						tempDiaginfo.MaindiagFlag = "1"
5224
+						tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
5225
+					} else {
5226
+						var tempDiaginfo service.DiaginfoStructTwo
5227
+						tempDiaginfo.DiagCode = item.CountryCode
5228
+						tempDiaginfo.DiagName = item.CountryContentName
5229
+						tempDiaginfo.DiagType = "1"
5230
+						tempDiaginfo.MaindiagFlag = "0"
5231
+						tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
5232
+					}
5233
+				}
5234
+			}
5235
+			struct4101.Diseinfo = tempDiaginfos
5236
+
5237
+
5238
+
5239
+		sickConfigTwo, _ := service.FindSickById(his.SickType)
5240
+		tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
5241
+		tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
5242
+		tempOpspdiseinfo2.OprnOprtCode = ""
5243
+		tempOpspdiseinfo2.OprnOprtName = ""
5244
+		tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
5245
+		struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
5246
+
5247
+		var iteminfo service.IteminfoStruct
5248
+
5249
+		var bedCostTotal float64 = 0         //床位总费
5250
+		var bedCostSelfTotal float64 = 0     //床位自费
5251
+		var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
5252
+
5253
+		var operationCostTotal float64 = 0         //手术费
5254
+		var operationCostSelfTotal float64 = 0     //手术费
5255
+		var operationCostPartSelfTotal float64 = 0 //手术费
5256
+
5257
+		var otherCostTotal float64 = 0         //其他费用
5258
+		var otherCostSelfTotal float64 = 0     //其他费用
5259
+		var otherCostPartSelfTotal float64 = 0 //其他费用
5260
+
5261
+		var materialCostTotal float64 = 0         //材料费
5262
+		var materialCostSelfTotal float64 = 0     //材料费
5263
+		var materialCostPartSelfTotal float64 = 0 //材料费
5264
+
5265
+		var westernMedicineCostTotal float64 = 0         //西药费
5266
+		var westernMedicineCostSelfTotal float64 = 0     //西药费
5267
+		var westernMedicineCostPartSelfTotal float64 = 0 //西药费
5268
+
5269
+		var chineseTraditionalMedicineCostTotal float64 = 0         //中成药
5270
+		var chineseTraditionalMedicineCostSelfTotal float64 = 0     //中成药
5271
+		var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
5272
+
5273
+		var checkCostTotal float64 = 0         //检查费
5274
+		var checkCostSelfTotal float64 = 0     //检查费
5275
+		var checkCostPartSelfTotal float64 = 0 //检查费
5276
+
5277
+		var laboratoryCostTotal float64 = 0         //化验费
5278
+		var laboratoryCostSelfTotal float64 = 0     //化验费
5279
+		var laboratoryCostPartSelfTotal float64 = 0 //化验费
5280
+
5281
+		var treatCostTotal float64 = 0         //治疗费用
5282
+		var treatCostSelfTotal float64 = 0     //治疗费用
5283
+		var treatCostPartSelfTotal float64 = 0 //治疗费用
5284
+
5285
+		decimal.DivisionPrecision = 2
5286
+
5287
+		var bed_fulamt_ownpay_amt float64 = 0
5288
+		var operation_fulamt_ownpay_amt float64 = 0
5289
+		var other_fulamt_ownpay_amt float64 = 0
5290
+		var westernMedicine_fulamt_ownpay_amt float64 = 0
5291
+		var chineseTraditional_fulamt_ownpay_amt float64 = 0
5292
+		var check_fulamt_ownpay_amt float64 = 0
5293
+		var material_fulamt_ownpay_amt float64 = 0
5294
+		var laboratory_fulamt_ownpay_amt float64 = 0
5295
+		var treat_fulamt_ownpay_amt float64 = 0
5296
+
5297
+		var bed_claa_sunmfee float64 = 0
5298
+		var bed_clab_amt float64 = 0
5299
+		var bed_other_amt float64 = 0
5300
+
5301
+		var operation_claa_sunmfee float64 = 0
5302
+		var operation_clab_amt float64 = 0
5303
+		var operation_other_amt float64 = 0
5304
+
5305
+		var other_claa_sunmfee float64 = 0
5306
+		var other_clab_amt float64 = 0
5307
+		var other_other_amt float64 = 0
5308
+
5309
+		var westernMedicine_claa_sunmfee float64 = 0
5310
+		var westernMedicine_clab_amt float64 = 0
5311
+		var westernMedicine_other_amt float64 = 0
5312
+
5313
+		var chineseTraditional_claa_sunmfee float64 = 0
5314
+		var chineseTraditional_clab_amt float64 = 0
5315
+		var chineseTraditional_other_amt float64 = 0
5316
+
5317
+		var check_claa_sunmfee float64 = 0
5318
+		var check_clab_amt float64 = 0
5319
+		var check_other_amt float64 = 0
5320
+
5321
+		var material_claa_sunmfee float64 = 0
5322
+		var material_clab_amt float64 = 0
5323
+		var material_other_amt float64 = 0
5324
+
5325
+		var laboratory_claa_sunmfee float64 = 0
5326
+		var laboratory_clab_amt float64 = 0
5327
+		var laboratory_other_amt float64 = 0
5328
+
5329
+		var treat_claa_sunmfee float64 = 0
5330
+		var treat_clab_amt float64 = 0
5331
+		var treat_other_amt float64 = 0
5332
+
5333
+		for _, item := range order.HisOrderInfo {
5334
+			if item.MedChrgitmType == "01" { //床位费
5335
+				bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5336
+				bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5337
+				bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5338
+				bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5339
+				if item.ChrgitmLv == "1" {
5340
+					bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5341
+				}
5342
+				if item.ChrgitmLv == "2" {
5343
+					bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5344
+
5345
+				}
5346
+				if item.ChrgitmLv == "3" {
5347
+					bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5348
+				}
5349
+
5350
+			}
5351
+
5352
+			if item.MedChrgitmType == "03" { //检查费
5353
+				checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5354
+				checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5355
+				checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5356
+				check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5357
+				if item.ChrgitmLv == "1" {
5358
+
5359
+					check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5360
+
5361
+				}
5362
+				if item.ChrgitmLv == "2" {
5363
+					check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5364
+
5365
+				}
5366
+				if item.ChrgitmLv == "3" {
5367
+					check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5368
+				}
5369
+			}
5370
+
5371
+			if item.MedChrgitmType == "04" { //化验费
5372
+				laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5373
+				laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5374
+				laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5375
+				laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5376
+				if item.ChrgitmLv == "1" {
5377
+
5378
+					laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5379
+
5380
+				}
5381
+				if item.ChrgitmLv == "2" {
5382
+					laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5383
+
5384
+				}
5385
+				if item.ChrgitmLv == "3" {
5386
+					laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5387
+				}
5388
+			}
5389
+
5390
+			if item.MedChrgitmType == "05" { //治疗费
5391
+				treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5392
+				treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5393
+				treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5394
+				treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5395
+				if item.ChrgitmLv == "1" {
5396
+
5397
+					treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5398
+
5399
+				}
5400
+				if item.ChrgitmLv == "2" {
5401
+					treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5402
+
5403
+				}
5404
+				if item.ChrgitmLv == "3" {
5405
+					treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5406
+				}
5407
+			}
5408
+
5409
+			if item.MedChrgitmType == "06" { //手术费
5410
+				operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5411
+				operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5412
+				operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5413
+				operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5414
+
5415
+				if item.ChrgitmLv == "1" {
5416
+
5417
+					operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5418
+
5419
+				}
5420
+				if item.ChrgitmLv == "2" {
5421
+					operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5422
+
5423
+				}
5424
+				if item.ChrgitmLv == "3" {
5425
+					operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5426
+				}
5427
+			}
5428
+
5429
+			if item.MedChrgitmType == "08" { //材料费
5430
+				materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5431
+				materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5432
+				materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5433
+				material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5434
+				if item.ChrgitmLv == "1" {
5435
+
5436
+					material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5437
+
5438
+				}
5439
+				if item.ChrgitmLv == "2" {
5440
+					material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5441
+
5442
+				}
5443
+				if item.ChrgitmLv == "3" {
5444
+					material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5445
+				}
5446
+			}
5447
+
5448
+			if item.MedChrgitmType == "09" { //西药费
5449
+				westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5450
+				westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5451
+				westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5452
+				westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5453
+				if item.ChrgitmLv == "1" {
5454
+
5455
+					westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5456
+
5457
+				}
5458
+				if item.ChrgitmLv == "2" {
5459
+					westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5460
+
5461
+				}
5462
+				if item.ChrgitmLv == "3" {
5463
+					westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5464
+				}
5465
+			}
5466
+
5467
+			if item.MedChrgitmType == "11" { //中成费
5468
+				chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5469
+				chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5470
+				chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5471
+				chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5472
+				if item.ChrgitmLv == "1" {
5473
+
5474
+					chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5475
+
5476
+				}
5477
+				if item.ChrgitmLv == "2" {
5478
+					chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5479
+
5480
+				}
5481
+				if item.ChrgitmLv == "3" {
5482
+					chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5483
+				}
5484
+			}
5485
+
5486
+			if item.MedChrgitmType == "14" { //其他费
5487
+				otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5488
+				otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5489
+				otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5490
+				other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
5491
+				if item.ChrgitmLv == "1" {
5492
+					other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5493
+
5494
+				}
5495
+				if item.ChrgitmLv == "2" {
5496
+					other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5497
+
5498
+				}
5499
+				if item.ChrgitmLv == "3" {
5500
+					other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5501
+				}
5502
+			}
5503
+
5504
+		}
5505
+
5506
+		var iteminfoStructs []service.IteminfoStruct
5507
+
5508
+		if bedCostTotal != 0 {
5509
+			iteminfo.MedChrgitm = "01"
5510
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
5511
+			iteminfo.Amt = bedCostTotal
5512
+			iteminfo.ClaaSumfee = bed_claa_sunmfee
5513
+			iteminfo.ClabAmt = bed_clab_amt
5514
+			iteminfo.OthAmt = bed_other_amt
5515
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5516
+		}
5517
+
5518
+		if checkCostTotal != 0 {
5519
+			iteminfo.MedChrgitm = "03"
5520
+			iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
5521
+			iteminfo.Amt = checkCostTotal
5522
+			iteminfo.ClaaSumfee = check_claa_sunmfee
5523
+			iteminfo.ClabAmt = check_clab_amt
5524
+			iteminfo.OthAmt = check_other_amt
5525
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5526
+
5527
+		}
5528
+
5529
+		if laboratoryCostTotal != 0 {
5530
+			iteminfo.MedChrgitm = "04"
5531
+			iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
5532
+			iteminfo.Amt = laboratoryCostTotal
5533
+			iteminfo.ClaaSumfee = laboratory_claa_sunmfee
5534
+			iteminfo.ClabAmt = laboratory_clab_amt
5535
+			iteminfo.OthAmt = laboratory_other_amt
5536
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5537
+
5538
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5539
+
5540
+		}
5541
+
5542
+		if treatCostTotal != 0 {
5543
+			iteminfo.MedChrgitm = "05"
5544
+			iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
5545
+			iteminfo.Amt = treatCostTotal
5546
+			iteminfo.ClaaSumfee = treat_claa_sunmfee
5547
+			iteminfo.ClabAmt = treat_clab_amt
5548
+			iteminfo.OthAmt = treat_other_amt
5549
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5550
+			//(struct4101.IteminfoStruct, iteminfo)
5551
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5552
+		}
5553
+
5554
+		if operationCostTotal != 0 {
5555
+			iteminfo.MedChrgitm = "06"
5556
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
5557
+			iteminfo.Amt = operationCostTotal
5558
+			iteminfo.ClaaSumfee = operation_claa_sunmfee
5559
+			iteminfo.ClabAmt = operation_clab_amt
5560
+			iteminfo.OthAmt = operation_other_amt
5561
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5562
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5563
+		}
5564
+
5565
+		if materialCostTotal != 0 {
5566
+			iteminfo.MedChrgitm = "08"
5567
+			iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
5568
+			iteminfo.Amt = materialCostTotal
5569
+			iteminfo.ClaaSumfee = material_claa_sunmfee
5570
+			iteminfo.ClabAmt = material_clab_amt
5571
+			iteminfo.OthAmt = material_other_amt
5572
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5573
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5574
+		}
5575
+
5576
+		if westernMedicineCostTotal != 0 {
5577
+			iteminfo.MedChrgitm = "09"
5578
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
5579
+			iteminfo.Amt = westernMedicineCostTotal
5580
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
5581
+			iteminfo.ClabAmt = westernMedicine_clab_amt
5582
+			iteminfo.OthAmt = westernMedicine_other_amt
5583
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5584
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5585
+		}
5586
+		if chineseTraditionalMedicineCostTotal != 0 {
5587
+			iteminfo.MedChrgitm = "11"
5588
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
5589
+			iteminfo.Amt = westernMedicineCostTotal
5590
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
5591
+			iteminfo.ClabAmt = westernMedicine_clab_amt
5592
+			iteminfo.OthAmt = westernMedicine_other_amt
5593
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5594
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5595
+		}
5596
+		if otherCostTotal != 0 {
5597
+			iteminfo.MedChrgitm = "14"
5598
+			iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
5599
+			iteminfo.Amt = otherCostTotal
5600
+			iteminfo.ClaaSumfee = other_claa_sunmfee
5601
+			iteminfo.ClabAmt = other_clab_amt
5602
+			iteminfo.OthAmt = other_other_amt
5603
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
5604
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
5605
+		}
5606
+		struct4101.IteminfoStruct = iteminfoStructs
5607
+		struct4101.Ntly = "中国"
5608
+		struct4101.AdmCaty = "A03.06"
5609
+		var resOther ResultSeventeenOther
5610
+		var res ResultSeventeen
5611
+		if miConfig.MdtrtareaAdmvs == "150499" {
5612
+			var pp models.PublicParams
5613
+			pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
5614
+			pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
5615
+			pp.FixmedinsName = miConfig.OrgName
5616
+			pp.FixmedinsCode = miConfig.Code
5617
+			pp.RequestUrl = miConfig.Url
5618
+			pp.Cainfo = miConfig.Cainfo
5619
+			pp.SecretKey = miConfig.SecretKey
5620
+			pp.AccessKey = miConfig.AccessKey
5621
+			pp.OpterName = curRoles.UserName
5622
+			client := &http.Client{}
5623
+			var req *http.Request
5624
+			data := make(map[string]interface{})
5625
+			data["struct4101"] = struct4101
5626
+			data["pp"] = pp
5627
+			bytesData, _ := json.Marshal(data)
5628
+			req, _ = http.NewRequest("POST", "http://172.16.13.254:9532/"+"nmyb/4101", bytes.NewReader(bytesData))
5629
+			resp, _ := client.Do(req)
5630
+			defer resp.Body.Close()
5631
+			body, ioErr := ioutil.ReadAll(resp.Body)
5632
+			if ioErr != nil {
5633
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5634
+
5635
+			}
5636
+			var respJSON map[string]interface{}
5637
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
5638
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5639
+			}
5640
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5641
+			userJSONBytes, _ := json.Marshal(respJSON)
5642
+			if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
5643
+				utils.ErrorLog("解析失败:%v", err)
5644
+
5645
+			}
5646
+			res.InfRefmsgid = resOther.InfRefmsgid
5647
+			res.Output = resOther.Output
5648
+			res.ErrMsg = resOther.ErrMsg
5649
+			infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
5650
+			res.Infcode = infocode
5651
+		}
5652
+		if res.Infcode != 0 {
5653
+			errlog := &models.HisOrderError{
5654
+				UserOrgId: 10265,
5655
+				Ctime:     time.Now().Unix(),
5656
+				Mtime:     time.Now().Unix(),
5657
+				ErrMsg:    res.ErrMsg,
5658
+				Status:    3000,
5659
+				PatientId: order_id,
5660
+				Stage:     10265,
5661
+			}
5662
+			service.CreateErrMsgLog(errlog)
5663
+			continue
5664
+		} else {
5665
+			hisFundSettleListResult := &models.HisFundSettleListResult{
5666
+				Number:    res.Output.SetlListId,
5667
+				Status:    1,
5668
+				Ctime:     time.Now().Unix(),
5669
+				Mtime:     time.Now().Unix(),
5670
+				UserOrgId: 10265,
5671
+				IsUpload:  1,
5672
+				OrderId:   order_id,
5673
+			}
5674
+			service.CreateUploadRecord(hisFundSettleListResult)
5675
+			continue
5676
+		}
5677
+	}
5678
+}
5679
+func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
5680
+	newArr = make([]string, 0)
5681
+	for i := 0; i < len(arr); i++ {
5682
+		repeat := false
5683
+		for j := i + 1; j < len(arr); j++ {
5684
+			if arr[i] == arr[j] {
5685
+				repeat = true
5686
+				break
5687
+			}
5688
+		}
5689
+		if !repeat {
5690
+			newArr = append(newArr, arr[i])
5691
+		}
5692
+	}
5693
+	return
5694
+}
5695
+func Get4202(){
5696
+	admin_user_id :=   int64(2738)
5697
+	var orders []*models.HisOrder
5698
+	orders, _ = service.GetAllHisOrder10265()
5699
+	for _,item := range orders{
5700
+		order_id := item.ID
5701
+		stas_type := "1"
5702
+		order, _ := service.GetHisOrderByID(order_id)
5703
+		miConfig, _ := service.FindMedicalInsuranceInfo(10265)
5704
+		var user_name string
5705
+		role, _ := service.GetAdminUserInfoByID(10265, admin_user_id)
5706
+		if role.ID == 0 {
5707
+			user_name = "管理员"
5708
+		} else {
5709
+			user_name = role.UserName
5710
+		}
5711
+		baseParams := models.BaseParams{
5712
+			SecretKey:      miConfig.SecretKey,
5713
+			FixmedinsCode:  miConfig.Code,
5714
+			InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
5715
+			MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
5716
+			OrgName:        miConfig.OrgName,
5717
+			Doctor:         user_name,
5718
+			RequestUrl:     miConfig.Url,
5719
+			AccessKey:      miConfig.AccessKey,
5720
+		}
5721
+
5722
+		businessParams := models.BusinessParams{
5723
+			PsnNo:    order.PsnNo,
5724
+			MdtrtId:  order.MdtrtId,
5725
+			SetlId:   order.SetlId,
5726
+			StasType: stas_type,
5727
+		}
5728
+
5729
+		api := "http://172.16.13.254:9532/" + "nmyb/4102?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
5730
+			"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
5731
+			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&stas_type=" + stas_type
5732
+		resp, _ := http.Get(api)
5733
+		body, ioErr := ioutil.ReadAll(resp.Body)
5734
+		if ioErr != nil {
5735
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5736
+
5737
+		}
5738
+		var respJSON map[string]interface{}
5739
+		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
5740
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5741
+		}
5742
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5743
+		result, _ := json.Marshal(respJSON)
5744
+		var res2 ResultSix
5745
+		var resEmpty10265 ResultEmpty10265
5746
+
5747
+		if err := json.Unmarshal(result, &resEmpty10265); err != nil {
5748
+			utils.ErrorLog("解析失败:%v", err)
5749
+		}
5750
+		Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
5751
+		res2.Infcode = Infcode
5752
+		res2.RespondTime = resEmpty10265.RespondTime
5753
+		res2.ErrMsg = resEmpty10265.ErrMsg
5754
+		res2.Output = resEmpty10265.Output
5755
+		res2.WarnMsg = resEmpty10265.WarnMsg
5756
+		if res2.Infcode == 0 {
5757
+			continue
5758
+		} else {
5759
+			errlog := &models.HisOrderError{
5760
+				UserOrgId: 10265,
5761
+				Ctime:     time.Now().Unix(),
5762
+				Mtime:     time.Now().Unix(),
5763
+				ErrMsg:    res2.ErrMsg,
5764
+				Status:    2000,
5765
+				PatientId: order_id,
5766
+				Stage:     10265,
5767
+			}
5768
+			service.CreateErrMsgLog(errlog)
5769
+			continue
5770
+		}
5771
+	}
5772
+}

+ 3 - 3
models/dialysis.go View File

922
 	Department                              string `gorm:"column:department" json:"department" form:"department"`
922
 	Department                              string `gorm:"column:department" json:"department" form:"department"`
923
 }
923
 }
924
 
924
 
925
-//func (SgjUserAdminRole) TableName() string {
926
-//	return "sgj_user_admin_role"
927
-//}
925
+func (SgjUserAdminRole) TableName() string {
926
+	return "sgj_user_admin_role"
927
+}
928
 
928
 
929
 type SgjUserAdmin struct {
929
 type SgjUserAdmin struct {
930
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`
930
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`

+ 4 - 0
models/drug_stock.go View File

42
 	Type             int64   `gorm:"column:type" json:"type" form:"type"`
42
 	Type             int64   `gorm:"column:type" json:"type" form:"type"`
43
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
43
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
44
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
44
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
45
+
46
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
47
+
48
+
45
 }
49
 }
46
 
50
 
47
 func (DrugWarehouseInfo) TableName() string {
51
 func (DrugWarehouseInfo) TableName() string {

+ 98 - 0
models/fapiao.go View File

1
+package models
2
+
3
+type FapiaoConfig struct {
4
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
5
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6
+	IsUse             int64  `gorm:"column:is_use" json:"is_use" form:"is_use"`
7
+	TaxpayerId        string `gorm:"column:taxpayer_id" json:"taxpayer_id" form:"taxpayer_id"`
8
+	TerminalCode      string `gorm:"column:terminal_code" json:"terminal_code" form:"terminal_code"`
9
+	SellerTaxpayerNum string `gorm:"column:seller_taxpayer_num" json:"seller_taxpayer_num" form:"seller_taxpayer_num"`
10
+	SellerAddress     string `gorm:"column:seller_address" json:"seller_address" form:"seller_address"`
11
+	SellerTel         string `gorm:"column:seller_tel" json:"seller_tel" form:"seller_tel"`
12
+	SellerBankName    string `gorm:"column:seller_bank_name" json:"seller_bank_name" form:"seller_bank_name"`
13
+	SellerBankAccount string `gorm:"column:seller_bank_account" json:"seller_bank_account" form:"seller_bank_account"`
14
+	TitleType         string `gorm:"column:title_type" json:"title_type" form:"title_type"`
15
+	BuyerTitle        string `gorm:"column:buyer_title" json:"buyer_title" form:"buyer_title"`
16
+	CallbackUrl       string `gorm:"column:callback_url" json:"callback_url" form:"callback_url"`
17
+	UserOpenid        string `gorm:"column:user_openid" json:"user_openid" form:"user_openid"`
18
+}
19
+
20
+func (FapiaoConfig) TableName() string {
21
+	return "fapiao_config"
22
+}
23
+
24
+type HisOrderByFaPiao struct {
25
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
26
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
27
+	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
28
+	SettleAccountsDate int64  `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
29
+	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
30
+	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
31
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
32
+	Number             string `gorm:"column:number" json:"number" form:"number"`
33
+	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
34
+	Infcode            int64  `gorm:"column:infcode" json:"infcode" form:"infcode"`
35
+	WarnMsg            string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
36
+	Cainfo             string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
37
+	ErrMsg             string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
38
+	RespondTime        string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
39
+	InfRefmsgid        string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
40
+	OrderStatus        int64  `gorm:"column:order_status" json:"order_status" form:"order_status"`
41
+	MdtrtId            string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
42
+	SetlId             string `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
43
+	PsnNo              string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
44
+	PsnName            string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
45
+	PsnCertType        string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
46
+	Certno             string `gorm:"column:certno" json:"certno" form:"certno"`
47
+	Gend               string `gorm:"column:gend" json:"gend" form:"gend"`
48
+	Insutype           string `gorm:"column:insutype" json:"insutype" form:"insutype"`
49
+	SetlTime           string `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
50
+	MedType            string `gorm:"column:med_type" json:"med_type" form:"med_type"`
51
+	FaPiaoSn           string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
52
+
53
+	MedfeeSumamt   float64        `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
54
+	FaPiaoCode     string         `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
55
+	FaPiaoNumber   string         `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
56
+	Patients       Patients       `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
57
+	HisPatient     HisPatient     `gorm:"ForeignKey:MdtrtId;AssociationForeignKey:Number" json:"his_patient"`
58
+	HisFaPiaoOrder HisFaPiaoOrder `gorm:"ForeignKey:FaPiaoSn;AssociationForeignKey:OrderSn" json:"result"`
59
+	Creator        int64          `gorm:"column:creator" json:"creator" form:"creator"`
60
+}
61
+
62
+func (HisOrderByFaPiao) TableName() string {
63
+	return "his_order"
64
+}
65
+
66
+type HisFaPiaoOrder struct {
67
+	ID                int64    `gorm:"column:id" json:"id" form:"id"`
68
+	InvoiceId         string   `gorm:"column:invoice_id" json:"invoice_id" form:"invoice_id"`
69
+	OrderSn           string   `gorm:"column:order_sn" json:"order_sn" form:"order_sn"`
70
+	TicketSn          string   `gorm:"column:ticket_sn" json:"ticket_sn" form:"ticket_sn"`
71
+	TicketDate        string   `gorm:"column:ticket_date" json:"ticket_date" form:"ticket_date"`
72
+	AmountWithTax     string   `gorm:"column:amount_with_tax" json:"amount_with_tax" form:"amount_with_tax"`
73
+	AmountWithoutTax  string   `gorm:"column:amount_without_tax" json:"amount_without_tax" form:"amount_without_tax"`
74
+	TaxAmount         string   `gorm:"column:tax_amount" json:"tax_amount" form:"tax_amount"`
75
+	IsRedWashed       string   `gorm:"column:is_red_washed" json:"is_red_washed" form:"is_red_washed"`
76
+	PdfUrl            string   `gorm:"column:pdf_url" json:"pdf_url" form:"pdf_url"`
77
+	OfdUrl            string   `gorm:"column:ofd_url" json:"ofd_url" form:"ofd_url"`
78
+	XmlUrl            string   `gorm:"column:xml_url" json:"xml_url" form:"xml_url"`
79
+	FapiaoStatus      string   `gorm:"column:fapiao_status" json:"fapiao_status" form:"fapiao_status"`
80
+	OrderIds          string   `gorm:"column:order_ids" json:"order_ids" form:"order_ids"`
81
+	UserOrgId         int64    `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
82
+	Status            int64    `gorm:"column:status" json:"status" form:"status"`
83
+	PatientId         int64    `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
84
+	Ctime             int64    `gorm:"column:ctime" json:"ctime" form:"ctime"`
85
+	Mtime             int64    `gorm:"column:mtime" json:"mtime" form:"mtime"`
86
+	Creator           string   `gorm:"column:creator" json:"creator" form:"creator"`
87
+	MedfeeSumamt      float64  `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
88
+	PsnCashPay        float64  `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
89
+	FundPaySumamt     float64  `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
90
+	RedInvoiceId      string   `gorm:"column:red_invoice_id" json:"red_invoice_id" form:"red_invoice_id"`
91
+	RedInvoiceCreator string   `gorm:"column:red_invoice_creator" json:"red_invoice_creator" form:"red_invoice_creator"`
92
+	Patients          Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
93
+	Message           string   `gorm:"column:message" json:"message" form:"message"`
94
+}
95
+
96
+func (HisFaPiaoOrder) TableName() string {
97
+	return "his_fapiao_order"
98
+}

+ 5 - 0
models/his_models.go View File

753
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
753
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
754
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
754
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
755
 	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
755
 	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
756
+	SickName   string `gorm:"column:sick_name" json:"sick_name" form:"sick_name"`
757
+
758
+	FaPiaoSn     string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
756
 }
759
 }
757
 
760
 
758
 func (HisOrder) TableName() string {
761
 func (HisOrder) TableName() string {
1603
 	IsPre               int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1606
 	IsPre               int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1604
 	PayWays             string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
1607
 	PayWays             string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
1605
 	OthDesc             string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1608
 	OthDesc             string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1609
+	SickName   string `gorm:"column:sick_name" json:"sick_name" form:"sick_name"`
1606
 
1610
 
1607
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1611
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1608
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
1612
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
1905
 	WechatPay    string `gorm:"wechat_pay" json:"wechat_pay" form:"wechat_pay"`
1909
 	WechatPay    string `gorm:"wechat_pay" json:"wechat_pay" form:"wechat_pay"`
1906
 	AliPay       string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
1910
 	AliPay       string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
1907
 	JifenPay     string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
1911
 	JifenPay     string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
1912
+	SickName   string `gorm:"column:sick_name" json:"sick_name" form:"sick_name"`
1908
 
1913
 
1909
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1914
 	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1910
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
1915
 	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`

+ 26 - 0
models/models_3501.go View File

32
 	AppSecret           string
32
 	AppSecret           string
33
 	SignKey             string
33
 	SignKey             string
34
 	Enckey              string
34
 	Enckey              string
35
+	DrugTracCodg		string
36
+	Code		string
37
+
35
 }
38
 }
36
 type Struct3502 struct {
39
 type Struct3502 struct {
37
 	MedListCodg         string
40
 	MedListCodg         string
63
 	AppSecret           string
66
 	AppSecret           string
64
 	SignKey             string
67
 	SignKey             string
65
 	Enckey              string
68
 	Enckey              string
69
+	DrugTracCodg		string
70
+	Code		string
71
+
72
+
66
 }
73
 }
67
 type Struct3503 struct {
74
 type Struct3503 struct {
68
 	MedListCodg         string
75
 	MedListCodg         string
100
 	AppSecret           string
107
 	AppSecret           string
101
 	SignKey             string
108
 	SignKey             string
102
 	Enckey              string
109
 	Enckey              string
110
+	DrugTracCodg		string
111
+	Code		string
112
+
113
+
103
 }
114
 }
104
 type Struct3504 struct {
115
 type Struct3504 struct {
105
 	MedListCodg         string
116
 	MedListCodg         string
133
 	AppSecret           string
144
 	AppSecret           string
134
 	SignKey             string
145
 	SignKey             string
135
 	Enckey              string
146
 	Enckey              string
147
+	DrugTracCodg		string
148
+	Code		string
149
+
150
+
136
 }
151
 }
137
 type Struct3505 struct {
152
 type Struct3505 struct {
138
 	MedListCodg         string
153
 	MedListCodg         string
186
 	AppSecret           string
201
 	AppSecret           string
187
 	SignKey             string
202
 	SignKey             string
188
 	Enckey              string
203
 	Enckey              string
204
+	Code		string
205
+
206
+
189
 }
207
 }
190
 type Struct3506 struct {
208
 type Struct3506 struct {
191
 	MedListCodg         string
209
 	MedListCodg         string
224
 	AppSecret           string
242
 	AppSecret           string
225
 	SignKey             string
243
 	SignKey             string
226
 	Enckey              string
244
 	Enckey              string
245
+	DrugTracCodg		string
246
+	Code		string
247
+
248
+
227
 }
249
 }
228
 type Struct3507 struct {
250
 type Struct3507 struct {
229
 	FixmedinsBchno string
251
 	FixmedinsBchno string
242
 	AppSecret      string
264
 	AppSecret      string
243
 	SignKey        string
265
 	SignKey        string
244
 	Enckey         string
266
 	Enckey         string
267
+	DrugTracCodg		string
268
+	Code		string
269
+
270
+
245
 }
271
 }
246
 
272
 
247
 type XtDrugInventory struct {
273
 type XtDrugInventory struct {

+ 6 - 1
models/new_stock_models.go View File

264
 	IsPc    int64  `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
264
 	IsPc    int64  `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265
 	IsBg    int64  `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
265
 	IsBg    int64  `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
266
 	Bchno   string `gorm:"column:bchno" json:"bchno" form:"bchno"`
266
 	Bchno   string `gorm:"column:bchno" json:"bchno" form:"bchno"`
267
-	PcDate  string `gorm:"column:pc_date" json:"pc_date" form:"pc_date"`
267
+	PcDate  int64 `gorm:"column:pc_date" json:"pc_date" form:"pc_date"`
268
 	BgBchno string `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
268
 	BgBchno string `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
269
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
270
+
269
 }
271
 }
270
 
272
 
271
 func (NewDrugWarehouseInfo) TableName() string {
273
 func (NewDrugWarehouseInfo) TableName() string {
443
 	Bchno                     string               `gorm:"column:bchno" json:"bchno" form:"bchno"`
445
 	Bchno                     string               `gorm:"column:bchno" json:"bchno" form:"bchno"`
444
 	SaleDate                  string               `gorm:"column:sale_date" json:"sale_date" form:"sale_date"`
446
 	SaleDate                  string               `gorm:"column:sale_date" json:"sale_date" form:"sale_date"`
445
 	BgBchno                   string               `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
447
 	BgBchno                   string               `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
448
+	DrugCode 	string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
449
+
450
+
446
 }
451
 }
447
 
452
 
448
 func (DrugFlow) TableName() string {
453
 func (DrugFlow) TableName() string {

+ 2 - 0
models/self_drug_models.go View File

394
 	Type             int64   `gorm:"column:type" json:"type" form:"type"`
394
 	Type             int64   `gorm:"column:type" json:"type" form:"type"`
395
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
395
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
396
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
396
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
397
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
398
+
397
 }
399
 }
398
 
400
 
399
 func (XtDrugWarehouseInfo) TableName() string {
401
 func (XtDrugWarehouseInfo) TableName() string {

+ 4 - 0
models/stock_models.go View File

828
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
828
 	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
829
 	BatchNumber      string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
829
 	BatchNumber      string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
830
 	StorehouseId     int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
830
 	StorehouseId     int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
831
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
832
+
831
 }
833
 }
832
 
834
 
833
 func (VsDrugWarehouseInfo) TableName() string {
835
 func (VsDrugWarehouseInfo) TableName() string {
1564
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
1566
 	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
1565
 	IsCheck          int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
1567
 	IsCheck          int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
1566
 	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
1568
 	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
1569
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
1570
+
1567
 }
1571
 }
1568
 
1572
 
1569
 func (StartDrugWarehouseInfo) TableName() string {
1573
 func (StartDrugWarehouseInfo) TableName() string {

+ 2 - 0
routers/router.go View File

28
 	}))
28
 	}))
29
 	sg.HisManagerApiRegistRouters()
29
 	sg.HisManagerApiRegistRouters()
30
 	sg.GdybRegistRouters()
30
 	sg.GdybRegistRouters()
31
+	sg.FaPiaoApiRegistRouters()
31
 	hb.HbybRegistRouters()
32
 	hb.HbybRegistRouters()
32
 	//sz.SZHisManagerApiRegistRouters()
33
 	//sz.SZHisManagerApiRegistRouters()
33
 	zh.ZHHisManagerApiRegistRouters()
34
 	zh.ZHHisManagerApiRegistRouters()
37
 	coordinate.CoordinateRcegistRouters()
38
 	coordinate.CoordinateRcegistRouters()
38
 	coordinate.CoordinatenetRcegistRouters()
39
 	coordinate.CoordinatenetRcegistRouters()
39
 
40
 
41
+
40
 }
42
 }

+ 2 - 2
service/ahyb_service.go View File

492
 		diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
492
 		diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
493
 		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
493
 		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
494
 		diseinfo_sun["diag_dept"] = department       // 诊断科室
494
 		diseinfo_sun["diag_dept"] = department       // 诊断科室
495
-		diseinfo_sun["dise_dor_no"] = doctor_name      // 诊断医生编码
496
-		diseinfo_sun["dise_dor_name"] = doctor_number       // 诊断医生姓名
495
+		diseinfo_sun["dise_dor_no"] = doctor_number      // 诊断医生编码
496
+		diseinfo_sun["dise_dor_name"] = doctor_name       // 诊断医生姓名
497
 		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
497
 		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
498
 		diseinfo_sun["vali_flag"] = "1"              // 有效标志
498
 		diseinfo_sun["vali_flag"] = "1"              // 有效标志
499
 		diseinfo = append(diseinfo, diseinfo_sun)
499
 		diseinfo = append(diseinfo, diseinfo_sun)

+ 7 - 0
service/coordinate_service.go View File

1511
 
1511
 
1512
 }
1512
 }
1513
 
1513
 
1514
+
1515
+func FindPatientPrescriptionInfoThree(org_id int64, patient_id int64, st_time int64,end_timne int64, p_type int64) (info []models.HisPrescriptionInfo, err error) {
1516
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? AND patient_id = ? AND p_type = ? ", org_id, st_time,end_timne, patient_id, p_type).Find(&info).Error
1517
+	return
1518
+
1519
+}
1520
+
1514
 func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
1521
 func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
1515
 	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
1522
 	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
1516
 	return
1523
 	return

+ 6 - 0
service/fapiao/bule.go View File

1
+package fapiao
2
+
3
+func Blue(postData map[string]interface{}) (string, map[string]interface{}) {
4
+	routerAddress := "/tax-api/invoice/blue/v1"
5
+	return routerAddress, postData
6
+}

+ 16 - 0
service/fapiao/invalid.go View File

1
+package fapiao
2
+
3
+func Invalid() (routerAddress string, postData map[string]interface{}) {
4
+
5
+	routerAddress = "/tax-api/invoice/invalid/v1"
6
+
7
+	postData = map[string]interface{}{
8
+		"seller_taxpayer_num": "500102010004038",
9
+		"order_sn":            "",
10
+		"order_id":            "gp_20190828115454_742_11296_31131",
11
+		"name":                "fff",
12
+		"is_red":              0,
13
+	}
14
+
15
+	return routerAddress, postData
16
+}

+ 13 - 0
service/fapiao/login.go View File

1
+package fapiao
2
+
3
+import "gdyb/models"
4
+
5
+func Login(code string, config models.FapiaoConfig) (routerAddress string, postData map[string]interface{}) {
6
+	routerAddress = "/tax-api/invoice/sms/upload/v1"
7
+	postData = map[string]interface{}{
8
+		"taxpayer_id":   config.TaxpayerId,
9
+		"terminal_code": config.TerminalCode,
10
+		"sms_code":      code,
11
+	}
12
+	return routerAddress, postData
13
+}

+ 18 - 0
service/fapiao/print.go View File

1
+package fapiao
2
+
3
+func Print() (routerAddress string, postData map[string]interface{}) {
4
+
5
+	routerAddress = "/tax-api/invoice/print/v1"
6
+
7
+	postData = map[string]interface{}{
8
+		"seller_taxpayer_num": "500102010004038",
9
+		"order_sn":            "",
10
+		"order_id":            "gp_20190828115454_742_11296_31131",
11
+		"print_type":          "",
12
+		"print_flag":          "",
13
+		"print_mode":          "",
14
+		"is_red":              0,
15
+	}
16
+
17
+	return routerAddress, postData
18
+}

+ 26 - 0
service/fapiao/qrcode.go View File

1
+package fapiao
2
+
3
+import "gdyb/models"
4
+
5
+func GetQRCode(config models.FapiaoConfig) (routerAddress string, postData map[string]interface{}) {
6
+
7
+	routerAddress = "/tax-api/invoice/auth/get-qrcode/v1"
8
+	postData = map[string]interface{}{
9
+		"taxpayer_id":   config.TaxpayerId,
10
+		"terminal_code": config.TerminalCode,
11
+	}
12
+
13
+	return routerAddress, postData
14
+}
15
+
16
+func GetQRStatus(auth_id string, config models.FapiaoConfig) (routerAddress string, postData map[string]interface{}) {
17
+
18
+	routerAddress = "/tax-api/invoice/auth/query-qrcode-status/v1"
19
+	postData = map[string]interface{}{
20
+		"taxpayer_id":   config.TaxpayerId,
21
+		"terminal_code": config.TerminalCode,
22
+		"auth_id":       auth_id,
23
+	}
24
+
25
+	return routerAddress, postData
26
+}

+ 27 - 0
service/fapiao/query.go View File

1
+package fapiao
2
+
3
+import "gdyb/models"
4
+
5
+func Query(seller_taxpayer_num string, order_sn string, order_id string) (routerAddress string, postData map[string]interface{}) {
6
+
7
+	routerAddress = "/tax-api/invoice/query/v1"
8
+
9
+	postData = map[string]interface{}{
10
+		"seller_taxpayer_num": seller_taxpayer_num,
11
+		"order_sn":            order_sn,
12
+		"order_id":            order_id,
13
+		"is_red":              0,
14
+	}
15
+
16
+	return routerAddress, postData
17
+}
18
+
19
+func QueryStock(config models.FapiaoConfig) (routerAddress string, postData map[string]interface{}) {
20
+	routerAddress = "/tax-api/invoice/query-stock/v1"
21
+	postData = map[string]interface{}{
22
+		"taxpayer_id":       config.TaxpayerId,
23
+		"terminal_code":     config.TerminalCode,
24
+		"invoice_type_code": "026",
25
+	}
26
+	return routerAddress, postData
27
+}

+ 22 - 0
service/fapiao/red.go View File

1
+package fapiao
2
+
3
+func Red(seller_taxpayer_num string, callback_url string, order_sn string) (routerAddress string, postData map[string]interface{}) {
4
+
5
+	routerAddress = "/tax-api/invoice/red/quick/v1"
6
+
7
+	invoices := make([]map[string]interface{}, 1)
8
+
9
+	invoice := make(map[string]interface{})
10
+	invoice["seller_taxpayer_num"] = seller_taxpayer_num
11
+	invoice["callback_url"] = callback_url
12
+	invoice["order_sn"] = order_sn
13
+	invoice["apply_reason"] = "2"
14
+
15
+	invoices[0] = invoice
16
+
17
+	postData = map[string]interface{}{
18
+		"invoices": invoices,
19
+	}
20
+
21
+	return routerAddress, postData
22
+}

+ 14 - 0
service/fapiao/sms.go View File

1
+package fapiao
2
+
3
+import "gdyb/models"
4
+
5
+func GetSMSCode(config models.FapiaoConfig) (routerAddress string, postData map[string]interface{}) {
6
+
7
+	routerAddress = "/tax-api/invoice/login/check/v1"
8
+	postData = map[string]interface{}{
9
+		"taxpayer_id":   config.TaxpayerId,
10
+		"terminal_code": config.TerminalCode,
11
+	}
12
+
13
+	return routerAddress, postData
14
+}

+ 14 - 0
service/fapiao/waitopen.go View File

1
+package fapiao
2
+
3
+func WaitOpen() (routerAddress string, postData map[string]interface{}) {
4
+
5
+	routerAddress = "/tax-api/invoice/wait-open/v1"
6
+
7
+	postData = map[string]interface{}{
8
+		"taxpayer_num":      "20181010000000865115391398242493",
9
+		"machine_no":        "125523523523",
10
+		"invoice_type_code": "026",
11
+	}
12
+
13
+	return routerAddress, postData
14
+}

+ 130 - 0
service/fapiao_service.go View File

1
+package service
2
+
3
+import (
4
+	"gdyb/models"
5
+	"fmt"
6
+)
7
+
8
+func FindFaPiaoConfigInfo(org_id int64) (config models.FapiaoConfig, err error) {
9
+	err = readDb.Model(&models.FapiaoConfig{}).Where("status = 1 AND user_org_id = ?", org_id).First(&config).Error
10
+	return
11
+}
12
+func GetAdminUserRole(id int64, orgid int64) (models.SgjUserAdminRole, error) {
13
+	role := models.SgjUserAdminRole{}
14
+	err := UserReadDB().Where("admin_user_id = ? and org_id = ? and status = 1", id, orgid).Find(&role).Error
15
+	return role, err
16
+}
17
+func GetFaPiaoSettleList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64, sort_type int64, start_time string, end_time string, is_open_fapiao int64, patient_id int64) (order []*models.HisOrderByFaPiao, err error, total int64) {
18
+	offset := (page - 1) * limit
19
+	db := readDb.Model(&models.HisOrderByFaPiao{})
20
+
21
+	// Join the patients table based on user_org_id
22
+	db = db.Joins("join xt_patients as patient on patient.id = his_order.patient_id and patient.user_org_id = ?", user_org_id)
23
+
24
+	// Handle the is_open_fapiao logic
25
+	if is_open_fapiao == 1 {
26
+		// is_open_fapiao == 1: Look for orders with a corresponding fa_piao_number
27
+		db = db.Joins("left join his_fapiao_order as fo on fo.ticket_sn = his_order.fa_piao_number and fo.user_org_id = ?", user_org_id).
28
+			Where("fo.id IS NOT NULL") // Ensure fa_piao_number exists
29
+	} else if is_open_fapiao == 2 {
30
+		// is_open_fapiao == 2: Look for orders without a corresponding fa_piao_number
31
+		db = db.Joins("left join his_fapiao_order as fo on fo.ticket_sn = his_order.fa_piao_number and fo.user_org_id = ?", user_org_id).
32
+			Where("fo.id IS NULL") // Ensure fa_piao_number does not exist
33
+	}
34
+
35
+	// Handle sorting logic
36
+	if sort_type == 1 {
37
+		if start_time_timestamp != 0 {
38
+			db = db.Where("his_order.settle_accounts_date >= ?", start_time_timestamp)
39
+		}
40
+		if end_time_timestamp != 0 {
41
+			db = db.Where("his_order.settle_accounts_date <= ?", end_time_timestamp)
42
+		}
43
+	} else {
44
+		if len(start_time) != 0 {
45
+			db = db.Where("his_order.setl_time >= ?", start_time+" 00:00:00")
46
+		}
47
+		if len(end_time) != 0 {
48
+			db = db.Where("his_order.setl_time <= ?", end_time+" 23:59:59")
49
+		}
50
+	}
51
+	if patient_id > 0 {
52
+		db = db.Where("his_order.patient_id = ?", patient_id)
53
+
54
+	}
55
+
56
+	// Preload related data
57
+	db = db.Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).
58
+		Preload("HisPatient", "status = 1 AND user_org_id = ?", user_org_id).
59
+		Preload("HisFaPiaoOrder", "status = 1")
60
+
61
+	// Count the total number of records
62
+	db = db.Count(&total)
63
+
64
+	// Apply pagination
65
+	db = db.Limit(limit).Offset(offset)
66
+
67
+	// Execute query and return results
68
+	err = db.Find(&order).Error
69
+	//
70
+	//for _, item := range order {
71
+	//	var hfpo models.HisFaPiaoOrder
72
+	//	readDb.Model(&models.HisFaPiaoOrder{}).Where("ticket_sn = ?", item.FaPiaoNumber).First(&hfpo)
73
+	//	item.HisFaPiaoOrder =
74
+	//}
75
+
76
+	return
77
+}
78
+
79
+func GetFaPiaoList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64) (order []*models.HisFaPiaoOrder, err error, total int64) {
80
+	offset := (page - 1) * limit
81
+	db := readDb.Model(&models.HisFaPiaoOrder{})
82
+	db = db.Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id)
83
+	db = db.Where("ctime >= ? and ctime <= ? and user_org_id = ? and status = 1", start_time_timestamp, end_time_timestamp, user_org_id)
84
+	// Count the total number of records
85
+	db = db.Count(&total)
86
+	// Apply pagination
87
+	db = db.Limit(limit).Offset(offset)
88
+	// Execute query and return results
89
+	err = db.Find(&order).Error
90
+	return
91
+}
92
+
93
+func GetFaPiaoOrderByIDS(ids []string) (orders []models.HisOrder, err error) {
94
+	err = readDb.Model(&models.HisOrder{}).Where("id in (?) AND status = 1", ids).Find(&orders).Error
95
+	return
96
+}
97
+
98
+func GetFaPiaoOrderById(id int64) (orders models.HisFaPiaoOrder, err error) {
99
+	err = readDb.Model(&models.HisFaPiaoOrder{}).Where("id = ?", id).Find(&orders).Error
100
+	return
101
+}
102
+
103
+func GetFaPiaoOrderInfoByNumbers(numbers []string) (infos []models.HisOrderInfo, err error) {
104
+	err = readDb.Model(&models.HisOrderInfo{}).Where("order_number in (?)", numbers).Find(&infos).Error
105
+	return
106
+}
107
+
108
+func SaveFaPiaoOrder(fapiao *models.HisFaPiaoOrder) (err error) {
109
+	err = writeDb.Save(&fapiao).Error
110
+	return
111
+}
112
+
113
+func UpdateFaPiaoNumber(number string, ids []string) (err error) {
114
+	err = XTWriteDB().Model(&models.HisOrder{}).Where("id in (?)", ids).Updates(map[string]interface{}{"fa_piao_number": number}).Error
115
+	return
116
+}
117
+
118
+func UpdateFaPiaoSN(number string, ids []string) (err error) {
119
+	fmt.Println(ids)
120
+	fmt.Println(number)
121
+
122
+	err = XTWriteDB().Model(&models.HisOrder{}).Where("id in (?)", ids).Updates(map[string]interface{}{"fa_piao_sn": number}).Error
123
+	return
124
+}
125
+
126
+func UpdateFaPiaoNumberByNumber(number string) (err error) {
127
+	err = XTWriteDB().Model(&models.HisOrder{}).Where("fa_piao_number = ?", number).Updates(map[string]interface{}{"fa_piao_number": ""}).Error
128
+	return
129
+}
130
+

+ 1 - 1
service/fj_service.go View File

3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039
 	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3039
 	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040
-	druginputData["drug_trac_codg"] = "12345678912345678901"
3040
+	druginputData["drug_trac_codg"] = struct3501.DrugTracCodg
3041
 	//druginputData2["drugtracinfo"] = druginputData
3041
 	//druginputData2["drugtracinfo"] = druginputData
3042
 	inputData["drug_trac_info"] = druginputData
3042
 	inputData["drug_trac_info"] = druginputData
3043
 	input["invinfo"] = inputData
3043
 	input["invinfo"] = inputData

+ 21 - 16
service/gdyb_service.go View File

443
 
443
 
444
 		return hex.EncodeToString(out), requestLog
444
 		return hex.EncodeToString(out), requestLog
445
 	} else {
445
 	} else {
446
+		fmt.Println(url)
447
+		fmt.Println(gdyb_paasid)
448
+		fmt.Println(secret_key)
449
+
446
 		request, err := http.NewRequest("POST", url, reader)
450
 		request, err := http.NewRequest("POST", url, reader)
447
 		if err != nil {
451
 		if err != nil {
448
 			fmt.Println(err.Error())
452
 			fmt.Println(err.Error())
1154
 					//randNum = rand.Intn(10000) + 1000
1158
 					//randNum = rand.Intn(10000) + 1000
1155
 					role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
1159
 					role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
1156
 					cus := &Custom{
1160
 					cus := &Custom{
1157
-						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
1158
-						Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
1161
+						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
1162
+						Cut:              fmt.Sprintf("%.2f", subItem.PrescribingNumber),
1159
 						FeedetlSn:        subItem.FeedetlSn,
1163
 						FeedetlSn:        subItem.FeedetlSn,
1160
-						Price:            fmt.Sprintf("%.4f", subItem.Price),
1164
+						Price:            fmt.Sprintf("%.2f", subItem.Price),
1161
 						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
1165
 						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
1162
 						HospApprFlag:     subItem.HospApprFlag,
1166
 						HospApprFlag:     subItem.HospApprFlag,
1163
 						DoctorNumber:     role.DoctorNumber,
1167
 						DoctorNumber:     role.DoctorNumber,
1620
 	inputMessage["infno"] = "2205" // 交易编码
1624
 	inputMessage["infno"] = "2205" // 交易编码
1621
 
1625
 
1622
 	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
1626
 	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
1623
-	inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的)
1627
+	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
1624
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
1628
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
1625
 
1629
 
1626
 	input["data"] = inputData
1630
 	input["data"] = inputData
3557
 	inputData["gend"] = struct4101.Gend                     // 性别  必填
3561
 	inputData["gend"] = struct4101.Gend                     // 性别  必填
3558
 	inputData["brdy"] = struct4101.Brdy                     // 出生日期  必填
3562
 	inputData["brdy"] = struct4101.Brdy                     // 出生日期  必填
3559
 	inputData["age"] = struct4101.Age                       // 年龄  必填
3563
 	inputData["age"] = struct4101.Age                       // 年龄  必填
3560
-	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
3564
+	inputData["ntly"] = "CHN"                  // 国籍  必填
3561
 	inputData["nwb_age"] = ""                               // 年龄  必填
3565
 	inputData["nwb_age"] = ""                               // 年龄  必填
3562
 	inputData["naty"] = struct4101.Naty                     // 民族  必填
3566
 	inputData["naty"] = struct4101.Naty                     // 民族  必填
3563
 
3567
 
3586
 	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
3590
 	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
3587
 	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
3591
 	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
3588
 	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
3592
 	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
3589
-	inputData["adm_way"] = ""                                 // 入院途径  必填
3590
-	inputData["trt_type"] = "10"                              // 治疗类别  必填
3591
-	inputData["adm_time"] = ""                                // 入院时间  必填
3593
+	inputData["adm_way"] = "2"                                 // 入院途径  必填
3594
+	inputData["trt_type"] = "1"                              // 治疗类别  必填
3595
+	inputData["adm_time"] = struct4101.SetlEndDate                                 // 入院时间  必填
3592
 	inputData["adm_caty"] = "A03.06"                          // 入院科别  必填
3596
 	inputData["adm_caty"] = "A03.06"                          // 入院科别  必填
3593
 	inputData["refldept_dept"] = ""                           // 转科科别  必填
3597
 	inputData["refldept_dept"] = ""                           // 转科科别  必填
3594
-	inputData["dscg_time"] = ""                               // 出院时间  必填
3598
+	inputData["dscg_time"] = struct4101.SetlBegnDate                               // 出院时间  必填
3595
 	inputData["dscg_caty"] = "A03.06"                         // 出院科别  必填
3599
 	inputData["dscg_caty"] = "A03.06"                         // 出院科别  必填
3596
 	inputData["caty"] = "A03.06"                              // 出院科别  必填
3600
 	inputData["caty"] = "A03.06"                              // 出院科别  必填
3597
 	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
3601
 	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
3615
 	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
3619
 	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
3616
 	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
3620
 	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
3617
 	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
3621
 	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
3618
-	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
3619
-	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
3622
+	inputData["days_rinp_flag_31"] = "1"                       // 出院 31 天内再住院计划标志  必填
3623
+	inputData["days_rinp_pup_31"] = "1"                        // 出院 31 天内再住院目的  必填
3620
 	inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
3624
 	inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
3621
 	inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
3625
 	inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
3622
 	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
3626
 	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
3630
 	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3634
 	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3631
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3635
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3632
 	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
3636
 	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
3637
+	inputData["resp_nurs_code"] = "N440307016120" // 民族  必填
3638
+
3633
 
3639
 
3634
 	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
3640
 	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
3635
 	for _, item := range struct4101.CustomStruct {
3641
 	for _, item := range struct4101.CustomStruct {
3641
 		}
3647
 		}
3642
 	}
3648
 	}
3643
 	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
3649
 	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
3644
-
3645
 	opspdiseinfotemp := make(map[string]interface{})
3650
 	opspdiseinfotemp := make(map[string]interface{})
3646
 	opspdiseinfotemp["diag_name"] = "慢性肾功能不全(血透治疗)" // 诊断名称  必填
3651
 	opspdiseinfotemp["diag_name"] = "慢性肾功能不全(血透治疗)" // 诊断名称  必填
3647
 	opspdiseinfotemp["diag_code"] = "N18.904"       // 诊断代码 必填
3652
 	opspdiseinfotemp["diag_code"] = "N18.904"       // 诊断代码 必填
3685
 
3690
 
3686
 	input["setlinfo"] = inputData
3691
 	input["setlinfo"] = inputData
3687
 	input["payinfo"] = payinfo
3692
 	input["payinfo"] = payinfo
3688
-	input["opspdiseinfo"] = opspdiseinfo
3693
+	//input["opspdiseinfo"] = opspdiseinfo
3689
 	input["diseinfo"] = diseinfo
3694
 	input["diseinfo"] = diseinfo
3690
 	inputMessage["input"] = input //交易输入
3695
 	inputMessage["input"] = input //交易输入
3691
 
3696
 
4683
 	inputMessage["inf_time"] = timeFormatOne                                                    // 交易时间
4688
 	inputMessage["inf_time"] = timeFormatOne                                                    // 交易时间
4684
 	inputMessage["fixmedins_code"] = fixmedins_code                                             // 定点医药机构编号
4689
 	inputMessage["fixmedins_code"] = fixmedins_code                                             // 定点医药机构编号
4685
 	inputMessage["fixmedins_name"] = org_name
4690
 	inputMessage["fixmedins_name"] = org_name
4686
-		inputMessage["sign_no"] = "" //交易签到流水号
4691
+		inputMessage["sign_no"] = "489925883" //交易签到流水号
4687
 
4692
 
4688
 	//定点医药机构名称
4693
 	//定点医药机构名称
4689
 	//if mdtrtarea_admvs == "440100" {
4694
 	//if mdtrtarea_admvs == "440100" {
6050
 
6055
 
6051
 	for _, subitem := range result3260 {
6056
 	for _, subitem := range result3260 {
6052
 		for _, item := range subitem.Output.Data {
6057
 		for _, item := range subitem.Output.Data {
6053
-			if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" && item.MdtrtId != "out202404174009254" &&  item.MdtrtId != "out202405154379275"   {
6058
+			if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868"  {
6054
 				feedetailInfo := make(map[string]interface{})
6059
 				feedetailInfo := make(map[string]interface{})
6055
 				feedetailInfo["certno"] = item.Certno
6060
 				feedetailInfo["certno"] = item.Certno
6056
 				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
6061
 				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
6239
 
6244
 
6240
 	for _, subitem := range result3260 {
6245
 	for _, subitem := range result3260 {
6241
 		for _, item := range subitem.Output.Data {
6246
 		for _, item := range subitem.Output.Data {
6242
-			if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" && item.MdtrtId != "out202404174009254" {
6247
+			if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868"  {
6243
 				feedetailInfo := make(map[string]interface{})
6248
 				feedetailInfo := make(map[string]interface{})
6244
 				feedetailInfo["certno"] = item.Certno
6249
 				feedetailInfo["certno"] = item.Certno
6245
 				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
6250
 				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)

+ 184 - 109
service/hbyb_service.go View File

16
 	"encoding/xml"
16
 	"encoding/xml"
17
 	"github.com/go-ole/go-ole/oleutil"
17
 	"github.com/go-ole/go-ole/oleutil"
18
 	"github.com/go-ole/go-ole"
18
 	"github.com/go-ole/go-ole"
19
+	"regexp"
19
 
20
 
20
 )
21
 )
21
 
22
 
78
 	input["data"] = inputData
79
 	input["data"] = inputData
79
 	inputMessage["input"] = input //交易输入
80
 	inputMessage["input"] = input //交易输入
80
 
81
 
81
-	var inputLog string
82
+	//var inputLog string
82
 	bytesData, err := json.Marshal(inputMessage)
83
 	bytesData, err := json.Marshal(inputMessage)
83
-	inputLog = string(bytesData)
84
+	//inputLog = string(bytesData)
84
 	fmt.Println(string(bytesData))
85
 	fmt.Println(string(bytesData))
85
 	if err != nil {
86
 	if err != nil {
86
 		fmt.Println(err.Error())
87
 		fmt.Println(err.Error())
87
 		return err.Error(), ""
88
 		return err.Error(), ""
88
 	}
89
 	}
89
 
90
 
90
-	//var json2 string
91
 
91
 
92
 	out := GetoleInfo("1101",string(bytesData))
92
 	out := GetoleInfo("1101",string(bytesData))
93
-
94
-	//cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
95
-	//out, err := cmd.CombinedOutput()
96
-	//if err != nil {
97
-	//	fmt.Println("error:", err.Error())
98
-	//}
99
-	return out, inputLog
93
+	aa := ""
94
+	// Regular expression to find JSON part
95
+	re := regexp.MustCompile(`\{.*\}`)
96
+
97
+	// Find the first match
98
+	match := re.Find([]byte(ConvertToString(string(out), "gbk", "utf-8")))
99
+
100
+	if match != nil {
101
+		// Convert bytes to string
102
+		jsonStr := string(match)
103
+
104
+		// Parse JSON
105
+		var jsonData interface{}
106
+		err := json.Unmarshal([]byte(jsonStr), &jsonData)
107
+		if err != nil {
108
+			fmt.Println("Error parsing JSON:", err)
109
+		} else {
110
+			// Print formatted JSON
111
+			jsonBytes, err := json.MarshalIndent(jsonData, "", "    ")
112
+			if err != nil {
113
+				fmt.Println("Error formatting JSON:", err)
114
+			} else {
115
+				aa = string(jsonBytes)
116
+				//fmt.Println(string(jsonBytes))
117
+			}
118
+		}
119
+	} else {
120
+		fmt.Println("No valid JSON found in the input string.")
121
+	}
122
+	return aa, ConvertToString(string(bytesData), "gbk", "utf-8")
100
 
123
 
101
 }
124
 }
102
 
125
 
264
 		fmt.Println(err.Error())
287
 		fmt.Println(err.Error())
265
 		return err.Error(), ""
288
 		return err.Error(), ""
266
 	}
289
 	}
267
-
290
+	//
268
 	//var json2 string
291
 	//var json2 string
269
 	//cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
292
 	//cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
270
 	//out, err := cmd.Output()
293
 	//out, err := cmd.Output()
999
 }
1022
 }
1000
 
1023
 
1001
 
1024
 
1025
+func Hbyb3204(baseParams models.BaseParams, id string) string {
1026
+	// 生成签名
1027
+	nonce := GetRandomString(32)
1028
+	timestamp := time.Now().Unix()
1029
+
1030
+	// 生成输入报文
1031
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1032
+	input := make(map[string]interface{})
1033
+	inputData := make(map[string]interface{})
1034
+
1035
+	inputMessage["infno"] = "3204" // 交易编码
1036
+	inputData["clr_appy_evt_id"] = id                       // 险种
1037
+	input["data"] = inputData
1038
+	inputMessage["input"] = input //交易输入
1039
+	bytesData, _ := json.Marshal(inputMessage)
1040
+	fmt.Println(string(bytesData))
1041
+	out := GetoleInfo("3204",string(bytesData))
1042
+	fmt.Println(string(out))
1043
+	return  out
1044
+}
1045
+
1046
+
1047
+func Hbyb8404(baseParams models.BaseParams, month string) string {
1048
+	// 生成签名
1049
+	nonce := GetRandomString(32)
1050
+	timestamp := time.Now().Unix()
1051
+
1052
+	// 生成输入报文
1053
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1054
+	input := make(map[string]interface{})
1055
+	inputData := make(map[string]interface{})
1056
+	inputMessage["infno"] = "8404" // 交易编码
1057
+	inputData["nurscare_org_no"] = baseParams.FixmedinsCode
1058
+	inputData["setl_mon"] = month
1059
+	inputData["page_num"] = "1"
1060
+	inputData["page_size"] = "10"
1061
+	inputData["Longterm_dcla_rea"] = "查询"
1062
+	// 险种
1063
+	input["data"] = inputData
1064
+	inputMessage["input"] = input //交易输入
1065
+	bytesData, _ := json.Marshal(inputMessage)
1066
+	fmt.Println(string(bytesData))
1067
+	out := GetoleInfo("8404",string(bytesData))
1068
+	fmt.Println(string(out))
1069
+	return  out
1070
+}
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+
1002
 func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1077
 func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1003
 
1078
 
1004
 	fmt.Println(baseParams)
1079
 	fmt.Println(baseParams)
1018
 		inputData := make(map[string]interface{})
1093
 		inputData := make(map[string]interface{})
1019
 		inputData["insutype"] = ""                        // 险种
1094
 		inputData["insutype"] = ""                        // 险种
1020
 		inputData["clr_type"] = ""                        // 就诊 ID(来自2201接口返回)
1095
 		inputData["clr_type"] = ""                        // 就诊 ID(来自2201接口返回)
1021
-		inputData["setl_optins"] = item.SetlOptins                     // 结算经办机构
1096
+		inputData["setl_optins"] = "420922"                     // 结算经办机构
1022
 		inputData["stmt_begndate"] = item.StmtBegndate    // 对帐开始时间
1097
 		inputData["stmt_begndate"] = item.StmtBegndate    // 对帐开始时间
1023
 		inputData["stmt_enddate"] = item.StmtEnddate      //对帐结束时间
1098
 		inputData["stmt_enddate"] = item.StmtEnddate      //对帐结束时间
1024
 		inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
1099
 		inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
1029
 	input["clrdata"] = inputDatas
1104
 	input["clrdata"] = inputDatas
1030
 	inputMessage["input"] = input //交易输入
1105
 	inputMessage["input"] = input //交易输入
1031
 
1106
 
1032
-	bytesData, err := json.Marshal(inputMessage)
1107
+	//bytesData, err := json.Marshal(inputMessage)
1108
+	bytesData, _ := json.Marshal(inputMessage)
1033
 	fmt.Println(string(bytesData))
1109
 	fmt.Println(string(bytesData))
1034
-	if err != nil {
1035
-		fmt.Println(err.Error())
1036
-		return err.Error()
1037
-	}
1038
-	var json2 string
1039
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "3202a", string(bytesData), json2)
1040
-	out, err := cmd.Output()
1041
-	if err != nil {
1042
-		fmt.Println("error:", err.Error())
1110
+	out := GetoleInfo("3202a",string(bytesData))
1111
+	return  out
1112
+}
1113
+
1114
+
1115
+func Hbyb3204a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1116
+
1117
+	fmt.Println(baseParams)
1118
+	fmt.Println(businessParams)
1119
+	// 生成签名
1120
+	nonce := GetRandomString(32)
1121
+	timestamp := time.Now().Unix()
1122
+
1123
+	// 生成输入报文
1124
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1125
+	input := make(map[string]interface{})
1126
+	//inputDatas := []make(map[string]interface{})
1127
+	inputDatas := make([]map[string]interface{}, 0)
1128
+
1129
+	inputMessage["infno"] = "3204a" // 交易编码
1130
+	for _, item := range businessParams {
1131
+		inputData := make(map[string]interface{})
1132
+		inputData["insutype"] = ""                        // 险种
1133
+		inputData["clr_type"] = ""                        // 就诊 ID(来自2201接口返回)
1134
+		inputData["setl_optins"] = ""                     // 结算经办机构
1135
+		inputData["stmt_begndate"] = item.StmtBegndate    // 对帐开始时间
1136
+		inputData["stmt_enddate"] = item.StmtEnddate      //对帐结束时间
1137
+		inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
1138
+		inputData["acct_pay"] = item.AcctPay              //个人账户支付金额
1139
+		inputData["med_type"] = "14"                        //个人账户支付金额
1140
+		inputDatas = append(inputDatas, inputData)
1043
 	}
1141
 	}
1044
-	fmt.Println(string(out))
1045
-	return ConvertToString(string(out), "gbk", "utf-8")
1142
+	input["clrdata"] = inputDatas
1143
+	inputMessage["input"] = input //交易输入
1046
 
1144
 
1145
+	//bytesData, err := json.Marshal(inputMessage)
1146
+	bytesData, _ := json.Marshal(inputMessage)
1147
+	out := GetoleInfo("3204a",string(bytesData))
1148
+	fmt.Println(out)
1149
+	return  out
1047
 }
1150
 }
1151
+
1152
+
1153
+
1048
 func Hbyb3202b(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1154
 func Hbyb3202b(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1049
 
1155
 
1050
 	fmt.Println(baseParams)
1156
 	fmt.Println(baseParams)
1075
 	input["clrdata"] = inputDatas
1181
 	input["clrdata"] = inputDatas
1076
 	inputMessage["input"] = input //交易输入
1182
 	inputMessage["input"] = input //交易输入
1077
 
1183
 
1078
-	bytesData, err := json.Marshal(inputMessage)
1079
-	fmt.Println(string(bytesData))
1080
-	if err != nil {
1081
-		fmt.Println(err.Error())
1082
-		return err.Error()
1083
-	}
1084
-	var json2 string
1085
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "3202a", string(bytesData), json2)
1086
-	out, err := cmd.Output()
1087
-	if err != nil {
1088
-		fmt.Println("error:", err.Error())
1089
-	}
1090
-	fmt.Println(string(out))
1091
-	return ConvertToString(string(out), "gbk", "utf-8")
1092
-
1184
+	bytesData, _ := json.Marshal(inputMessage)
1185
+	out := GetoleInfo("3202a",string(bytesData))
1186
+	return  out
1093
 }
1187
 }
1094
 
1188
 
1095
 
1189
 
1119
 	input["data"] = inputData
1213
 	input["data"] = inputData
1120
 	inputMessage["input"] = input //交易输入
1214
 	inputMessage["input"] = input //交易输入
1121
 
1215
 
1122
-	bytesData, err := json.Marshal(inputMessage)
1123
-	fmt.Println(string(bytesData))
1124
-	if err != nil {
1125
-		fmt.Println(err.Error())
1126
-		return err.Error()
1127
-	}
1128
-	var json2 string
1129
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5262", string(bytesData), json2)
1130
-	out, err := cmd.Output()
1131
-	if err != nil {
1132
-		fmt.Println("error:", err.Error())
1133
-	}
1134
-	fmt.Println(string(out))
1135
-	return ConvertToString(string(out), "gbk", "utf-8")
1216
+	//bytesData, err := json.Marshal(inputMessage)
1217
+	bytesData, _ := json.Marshal(inputMessage)
1218
+	out := GetoleInfo("5262",string(bytesData))
1219
+	return  out
1136
 }
1220
 }
1137
 
1221
 
1138
 func Hbyb5267(baseParams models.BaseParams, businessParams models.BusinessParams5262, page string , limit string) string {
1222
 func Hbyb5267(baseParams models.BaseParams, businessParams models.BusinessParams5262, page string , limit string) string {
1159
 	input["data"] = inputData
1243
 	input["data"] = inputData
1160
 	inputMessage["input"] = input //交易输入
1244
 	inputMessage["input"] = input //交易输入
1161
 
1245
 
1162
-	bytesData, err := json.Marshal(inputMessage)
1163
-	fmt.Println(string(bytesData))
1164
-	if err != nil {
1165
-		fmt.Println(err.Error())
1166
-		return err.Error()
1167
-	}
1168
-	var json2 string
1169
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5267", string(bytesData), json2)
1170
-	out, err := cmd.Output()
1171
-	if err != nil {
1172
-		fmt.Println("error:", err.Error())
1173
-	}
1174
-	fmt.Println(string(out))
1175
-	return ConvertToString(string(out), "gbk", "utf-8")
1246
+	//bytesData, err := json.Marshal(inputMessage)
1247
+
1248
+	//bytesData, err := json.Marshal(inputMessage)
1249
+	bytesData, _ := json.Marshal(inputMessage)
1250
+	out := GetoleInfo("5267",string(bytesData))
1251
+	return  out
1176
 }
1252
 }
1177
 
1253
 
1178
 //文件上传
1254
 //文件上传
1310
 	// 生成签名
1386
 	// 生成签名
1311
 	nonce := GetRandomString(32)
1387
 	nonce := GetRandomString(32)
1312
 	timestamp := time.Now().Unix()
1388
 	timestamp := time.Now().Unix()
1313
-	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1389
+	//signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1314
 
1390
 
1315
 	// 生成输入报文
1391
 	// 生成输入报文
1316
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1392
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1318
 	inputData := make(map[string]interface{})
1394
 	inputData := make(map[string]interface{})
1319
 	inputMessage["infno"] = "3202"                                    // 交易编码
1395
 	inputMessage["infno"] = "3202"                                    // 交易编码
1320
 	inputData["file_qury_no"] = businessParams.FileQuryNo             // 险种
1396
 	inputData["file_qury_no"] = businessParams.FileQuryNo             // 险种
1321
-	inputData["setl_optins"] = baseParams.InsuplcAdmdvs               // 结算经办机构
1397
+	inputData["setl_optins"] = ""              // 结算经办机构
1322
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间
1398
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间
1323
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1399
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1324
 	inputData["medfee_sumamt"] = businessParams.MedfeeSumamt          //医疗费总额
1400
 	inputData["medfee_sumamt"] = businessParams.MedfeeSumamt          //医疗费总额
1330
 
1406
 
1331
 	input["data"] = inputData
1407
 	input["data"] = inputData
1332
 	inputMessage["input"] = input //交易输入
1408
 	inputMessage["input"] = input //交易输入
1333
-	bytesData, err := json.Marshal(inputMessage)
1409
+	//mjson, _ := json.Marshal(inputMessage)
1410
+	//str2 := string(mjson)
1411
+	bytesData, _ := json.Marshal(inputMessage)
1334
 	fmt.Println(string(bytesData))
1412
 	fmt.Println(string(bytesData))
1335
-	if err != nil {
1336
-		fmt.Println(err.Error())
1337
-		return err.Error()
1338
-	}
1339
-	reader := bytes.NewReader(bytesData)
1340
-	gdyb_url := beego.AppConfig.String("gdyb_url")
1341
-	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1342
-
1343
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
1344
-	url := gdyb_url + "3202"
1345
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3202"
1346
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
1347
-
1348
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
1349
-	request, err := http.NewRequest("POST", url, reader)
1350
-	if err != nil {
1351
-		fmt.Println(err.Error())
1352
-		return err.Error()
1353
-	}
1354
-	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1355
-	request.Header.Set("x-tif-paasid", gdyb_paasid)
1356
-	request.Header.Set("x-tif-signature", signature)
1357
-	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1358
-	request.Header.Set("x-tif-nonce", nonce)
1359
-	client := http.Client{}
1360
-	resp, err := client.Do(request)
1361
-	if err != nil {
1362
-		fmt.Println(err.Error())
1363
-		return err.Error()
1364
-	}
1365
-	respBytes, err := ioutil.ReadAll(resp.Body)
1366
-	if err != nil {
1367
-		fmt.Println(err.Error())
1368
-		return err.Error()
1369
-	}
1370
-	str := string(respBytes)
1371
-	fmt.Println(str)
1372
-	return str
1413
+	out := GetoleInfo("3202",string(bytesData))
1414
+	return out
1373
 }
1415
 }
1374
 
1416
 
1375
 //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
1417
 //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
3168
 	if err != nil {
3210
 	if err != nil {
3169
 		fmt.Println("error:", err.Error())
3211
 		fmt.Println("error:", err.Error())
3170
 	}
3212
 	}
3171
-	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3213
+	//if id_card_type == 4 {
3214
+			aa := ""
3215
+		// Regular expression to find JSON part
3216
+		re := regexp.MustCompile(`\{.*\}`)
3217
+
3218
+		// Find the first match
3219
+		match := re.Find([]byte(ConvertToString(string(out), "gbk", "utf-8")))
3220
+
3221
+		if match != nil {
3222
+			// Convert bytes to string
3223
+			jsonStr := string(match)
3172
 
3224
 
3225
+			// Parse JSON
3226
+			var jsonData interface{}
3227
+			err := json.Unmarshal([]byte(jsonStr), &jsonData)
3228
+			if err != nil {
3229
+				fmt.Println("Error parsing JSON:", err)
3230
+			} else {
3231
+				// Print formatted JSON
3232
+				jsonBytes, err := json.MarshalIndent(jsonData, "", "    ")
3233
+				if err != nil {
3234
+					fmt.Println("Error formatting JSON:", err)
3235
+				} else {
3236
+					aa = string(jsonBytes)
3237
+					//fmt.Println(string(jsonBytes))
3238
+				}
3239
+			}
3240
+		} else {
3241
+			fmt.Println("No valid JSON found in the input string.")
3242
+		}
3243
+		return aa, ConvertToString(string(bytesData), "gbk", "utf-8")
3244
+	//}else{
3245
+
3246
+		//return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3247
+	//}
3173
 	//return string(out), string(bytesData)
3248
 	//return string(out), string(bytesData)
3174
 }
3249
 }
3175
 
3250
 

+ 333 - 8
service/his_service.go View File

5
 	"gdyb/models"
5
 	"gdyb/models"
6
 	"github.com/jinzhu/gorm"
6
 	"github.com/jinzhu/gorm"
7
 	"time"
7
 	"time"
8
+	"strconv"
8
 )
9
 )
9
 
10
 
10
 type HisPatient struct {
11
 type HisPatient struct {
320
 	WarehousingCount int64 `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
321
 	WarehousingCount int64 `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
321
 	Status           int64 `gorm:"column:status" json:"status" form:"status"`
322
 	Status           int64 `gorm:"column:status" json:"status" form:"status"`
322
 	OrgId            int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
323
 	OrgId            int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
324
+	DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
325
+
323
 }
326
 }
324
 
327
 
325
 func (OtherDrugWarehouseInfo) TableName() string {
328
 func (OtherDrugWarehouseInfo) TableName() string {
628
 	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
631
 	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
629
 	OthDesc                 string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
632
 	OthDesc                 string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
630
 	SetlDetail              string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
633
 	SetlDetail              string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
634
+	FaPiaoSn     string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
635
+	//FaPiaoSn     string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
631
 
636
 
632
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
637
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
633
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
638
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
969
 	return
974
 	return
970
 }
975
 }
971
 
976
 
977
+func GetFaPiaoHisOrderByID(order_id int64) (order models.HisFaPiaoOrder, err error) {
978
+	str := strconv.FormatInt(order_id, 10)
979
+	key := "%" + str +"%"
980
+	err = readDb.Model(&models.HisFaPiaoOrder{}).Where("order_ids like ? and status = 1", key).First(&order).Error
981
+	return
982
+}
983
+
972
 func GetHisOrderByIDTwo(order_id int64) (order models.HisOrder, err error) {
984
 func GetHisOrderByIDTwo(order_id int64) (order models.HisOrder, err error) {
973
 	err = readDb.Model(&models.HisOrder{}).Preload("HisOrderInfo", "status = 1").Preload("HisPatient", "status = 1").Where("id = ? AND status = 1", order_id).First(&order).Error
985
 	err = readDb.Model(&models.HisOrder{}).Preload("HisOrderInfo", "status = 1").Preload("HisPatient", "status = 1").Where("id = ? AND status = 1", order_id).First(&order).Error
974
 	return
986
 	return
1061
 	return
1073
 	return
1062
 }
1074
 }
1063
 
1075
 
1076
+func GetOrderByTimeTenaaa(start_time int64, end_time int64, org_id int64,org string) (orders []*models.HisOrder, err error) {
1077
+	db := readDb.Model(&models.HisOrder{})
1078
+	db = db.Where("clr_options = ?  and user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? ", org,org_id, end_time, start_time)
1079
+	err = db.Find(&orders).Error
1080
+	return
1081
+}
1082
+
1083
+
1064
 func GetOrderByTime11222(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1084
 func GetOrderByTime11222(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1065
 	db := readDb.Model(&models.HisOrder{})
1085
 	db := readDb.Model(&models.HisOrder{})
1066
-	db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ?", org_id, end_time, start_time)
1086
+	db = db.Where("psn_name = '付云芳' and user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ?", org_id, end_time, start_time)
1067
 	err = db.Find(&orders).Error
1087
 	err = db.Find(&orders).Error
1068
 	return
1088
 	return
1069
 }
1089
 }
1539
 	return
1559
 	return
1540
 }
1560
 }
1541
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1561
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1542
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' AND setl_time <= '2024-07-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1562
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1543
 	fmt.Println(err)
1563
 	fmt.Println(err)
1544
 	return
1564
 	return
1545
 }
1565
 }
1549
 }
1569
 }
1550
 
1570
 
1551
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1571
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1552
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-01-01 00:00:00' AND setl_time <= '2024-03-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1572
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' AND setl_time <= '2024-09-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1553
 	fmt.Println(err)
1573
 	fmt.Println(err)
1554
 	return
1574
 	return
1555
 }
1575
 }
1556
 
1576
 
1557
 func GetAllHisOrder10265() (his []*models.HisOrder, err error) {
1577
 func GetAllHisOrder10265() (his []*models.HisOrder, err error) {
1558
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2023-09-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1578
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-09-01 00:00:00' AND setl_time <= '2024-09-30 23:59:00'").Order("setl_time asc").Find(&his).Error
1559
 	fmt.Println(err)
1579
 	fmt.Println(err)
1560
 	return
1580
 	return
1561
 }
1581
 }
1562
 
1582
 
1583
+//func GetAllHisOrder10265() (his []*models.HisOrder, err error) {
1584
+//	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2023-09-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1585
+//	fmt.Println(err)
1586
+//	return
1587
+//}
1588
+
1563
 //	func GetAllHisOrder2(org_id int64) (his []models.HisOrder, err error) {
1589
 //	func GetAllHisOrder2(org_id int64) (his []models.HisOrder, err error) {
1564
 //		err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1590
 //		err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1565
 //		return
1591
 //		return
1703
 	return
1729
 	return
1704
 }
1730
 }
1705
 
1731
 
1706
-func GetNewDrugWarehouseInfo(id_arr []string) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1707
-	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and id in (?) ", 10191, id_arr).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", 10191).Preload("Dealers", "status = 1 AND org_id = ?", 10191).Find(&newDrugWarehouse)
1732
+func GetNewDrugWarehouseInfo(org_id int64, id_arr []string) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1733
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and id in (?) ", org_id, id_arr).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&newDrugWarehouse)
1734
+	return
1735
+}
1736
+
1737
+func GetNewDrugFlowInfo(org_id int64,id_arr []string) (flows []*models.DrugFlow, err error) {
1738
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1 and id in (?)", org_id, id_arr).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1739
+		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1740
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1708
 	return
1741
 	return
1709
 }
1742
 }
1710
 
1743
 
1711
-func GetNewDrugFlowInfo(id_arr []string) (flows []*models.DrugFlow, err error) {
1712
-	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1 and id in (?)", 10191, id_arr).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1744
+
1745
+func GetNewDrugFlowInfotwo() (flows []*models.DrugFlow, err error) {
1746
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = 10188 and status = 1 and id >= ? and consumable_type = 3 and is_sale = 0", 2394762).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1713
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1747
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1714
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1748
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1715
 	return
1749
 	return
1716
 }
1750
 }
1717
 
1751
 
1752
+
1753
+func GetNewDrugFlowInfothree() (flows []*models.DrugFlow, err error) {
1754
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = 10217 and status = 1 and id >= ?  and consumable_type = 3 and is_sale = 0", 2328112).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1755
+		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1756
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1757
+	return
1758
+}
1718
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1759
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1719
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1760
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1720
 	return
1761
 	return
1754
 	err = readDb.Model(&models.XtHisProjectTeam{}).Where("id = ?", team_id).First(&team).Error
1795
 	err = readDb.Model(&models.XtHisProjectTeam{}).Where("id = ?", team_id).First(&team).Error
1755
 	return
1796
 	return
1756
 }
1797
 }
1798
+func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
1799
+	err = readDb.Model(&HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1800
+		return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("VMHisProject", "status = 1 AND user_org_id = ?", org_id).Preload("VMGoodInfo", "status = 1 AND org_id = ?", org_id)
1801
+	}).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1802
+		return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status = 1 AND org_id = ?", org_id)
1803
+	}).Find(&order).Error
1804
+	return
1805
+}
1806
+
1807
+
1808
+type HisOrderInfo struct {
1809
+	ID                     int64                  `gorm:"column:id" json:"id" form:"id"`
1810
+	OrderNumber            string                 `gorm:"column:order_number" json:"order_number" form:"order_number"`
1811
+	UploadDate             int64                  `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1812
+	AdviceId               int64                  `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1813
+	DetItemFeeSumamt       float64                `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1814
+	Cnt                    float64                `gorm:"column:cnt" json:"cnt" form:"cnt"`
1815
+	Pric                   float64                `gorm:"column:pric" json:"pric" form:"pric"`
1816
+	PatientId              int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1817
+	MedChrgitmType         string                 `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1818
+	Status                 int64                  `gorm:"column:status" json:"status" form:"status"`
1819
+	FeedetlSn              string                 `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1820
+	ChldMedcFlag           string                 `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1821
+	ChrgitmLv              string                 `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1822
+	UserOrgId              int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1823
+	ProjectId              int64                  `gorm:"column:project_id" json:"project_id" form:"project_id"`
1824
+	SelfpayProp            float64                `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
1825
+	ItemId                 int64                  `gorm:"column:item_id" json:"item_id" form:"item_id"`
1826
+	FulamtOwnpayAmt        float64                `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1827
+	HisPrescriptionProject HisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1828
+	HisDoctorAdviceInfo    HisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
1829
+}
1830
+
1831
+func (HisOrderInfo) TableName() string {
1832
+	return "his_order_info"
1833
+}
1834
+
1835
+
1836
+type HisDoctorAdviceInfo struct {
1837
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
1838
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1839
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1840
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
1841
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
1842
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
1843
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1844
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
1845
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
1846
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
1847
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1848
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1849
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
1850
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
1851
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1852
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
1853
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
1854
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1855
+
1856
+	Price                float64              `gorm:"column:price" json:"price" form:"price"`
1857
+	DrugId               int64                `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1858
+	Drug                 Drug                 `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
1859
+
1860
+	IsMedicine           int64                `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1861
+	ExecutionFrequencyId int64                `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1862
+	IsSelfDrug           int64                `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1863
+}
1864
+
1865
+type Drug struct {
1866
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
1867
+	DrugName                    string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
1868
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
1869
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
1870
+	DrugAlias                   string  `gorm:"column:drug_alias" json:"drug_alias" form:"drug_alias"`
1871
+	DrugAliasPinyin             string  `gorm:"column:drug_alias_pinyin" json:"drug_alias_pinyin" form:"drug_alias_pinyin"`
1872
+	DrugAliasWubi               string  `gorm:"column:drug_alias_wubi" json:"drug_alias_wubi" form:"drug_alias_wubi"`
1873
+	DrugCategory                int64   `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
1874
+	DrugSpec                    string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
1875
+	DrugType                    int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
1876
+	DrugStockLimit              string  `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
1877
+	DrugOriginPlace             string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
1878
+	DrugDosageForm              int64   `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
1879
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
1880
+	MaxUnit                     string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
1881
+	MinNumber                   int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
1882
+	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
1883
+	Dose                        string  `gorm:"column:dose" json:"dose" form:"dose"`
1884
+	DoseUnit                    string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
1885
+	UnitMatrixing               string  `gorm:"column:unit_matrixing" json:"unit_matrixing" form:"unit_matrixing"`
1886
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
1887
+	MinPrice                    float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
1888
+	LastPrice                   float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1889
+	DrugControl                 int64   `gorm:"column:drug_control" json:"drug_control" form:"drug_control"`
1890
+	Number                      string  `gorm:"column:number" json:"number" form:"number"`
1891
+	DrugClassify                string  `gorm:"column:drug_classify" json:"drug_classify" form:"drug_classify"`
1892
+	DrugDose                    float64 `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
1893
+	DrugDoseUnit                int64   `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
1894
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
1895
+	ProvincesCode               string  `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
1896
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
1897
+	PharmacologyCategory        int64   `gorm:"column:pharmacology_category" json:"pharmacology_category" form:"pharmacology_category"`
1898
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
1899
+	Code                        string  `gorm:"column:code" json:"code" form:"code"`
1900
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
1901
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
1902
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
1903
+	DrugStatus                  string  `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
1904
+	LimitRemark                 string  `gorm:"column:limit_remark" json:"limit_remark" form:"limit_remark"`
1905
+	DeliveryWay                 string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1906
+	ExecutionFrequency          string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1907
+	SingleDose                  float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1908
+	PrescribingNumber           float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
1909
+	Label                       int64   `gorm:"column:label" json:"label" form:"label"`
1910
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
1911
+	IsUseDoctorAdvice           int64   `gorm:"column:is_use_doctor_advice" json:"is_use_doctor_advice" form:"is_use_doctor_advice"`
1912
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
1913
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
1914
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
1915
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
1916
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
1917
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1918
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
1919
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
1920
+	DrugCode                    string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
1921
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
1922
+	PrescriptionMark            int64   `gorm:"column:prescription_mark" json:"prescription_mark" form:"prescription_mark"`
1923
+	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1924
+	DrugRemark                  string  `gorm:"column:drug_remark" json:"drug_remark" form:"drug_remark"`
1925
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
1926
+	DoseCode                    string  `gorm:"column:dose_code" json:"dose_code" form:"dose_code"`
1927
+	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
1928
+	HospApprFlag                int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
1929
+	LmtUsedFlag                 int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
1930
+	Dosage                      string  `gorm:"column:dosage" json:"dosage" form:"dosage"`
1931
+	Unval                       string  `gorm:"column:unval" json:"unval" form:"unval"`
1932
+	PackingUnit                 string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
1933
+	PackingPrice                float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1934
+	DrugDay                     string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
1935
+	Total                       float64 `gorm:"column:total" json:"total" form:"total"`
1936
+	PrescribingNumberUnit       string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
1937
+	IsUser                      int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
1938
+	Bck01b                      string  `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
1939
+	Bby01                       string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
1940
+	Bbx01                       string  `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
1941
+}
1942
+
1943
+func (Drug) TableName() string {
1944
+	return "xt_base_drug"
1945
+}
1946
+
1947
+type VMHisProject struct {
1948
+	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
1949
+	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
1950
+	Price                     float64 `gorm:"column:price" json:"price" form:"price"`
1951
+	Unit                      string  `gorm:"column:unit" json:"unit" form:"unit"`
1952
+	CostClassify              int64   `gorm:"column:cost_classify" json:"cost_classify" form:"cost_classify"`
1953
+	StatisticalClassification int64   `gorm:"column:statistical_classification" json:"statistical_classification" form:"statistical_classification"`
1954
+	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1955
+	Status                    int64   `gorm:"column:status" json:"status" form:"status"`
1956
+	SingleDose                string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1957
+	ExecutionFrequency        string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1958
+	DeliveryWay               string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1959
+	NumberDays                string  `gorm:"column:number_days" json:"number_days" form:"number_days"`
1960
+	MedicalCode               string  `gorm:"column:medical_code" json:"medical_code" form:"medical_code"`
1961
+}
1962
+
1963
+func (VMHisProject) TableName() string {
1964
+	return "xt_his_project"
1965
+}
1966
+
1967
+type VMGoodInfo struct {
1968
+	ID                     int64   `gorm:"column:id" json:"id"`
1969
+	SpecificationName      string  `gorm:"column:specification_name" json:"specification_name"`
1970
+	GoodTypeId             int64   `gorm:"column:good_type_id" json:"good_type_id"`
1971
+	OrgId                  int64   `gorm:"column:org_id" json:"org_id"`
1972
+	GoodName               string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
1973
+	GoodUnit               int64   `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
1974
+	Total                  float64 `gorm:"column:total" json:"total" form:"total"`
1975
+	PackingUnit            string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
1976
+	MedicalInsuranceNumber string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
1977
+}
1978
+
1979
+func (VMGoodInfo) TableName() string {
1980
+	return "xt_good_information"
1981
+}
1982
+
1983
+
1984
+func (HisDoctorAdviceInfo) TableName() string {
1985
+	return "his_doctor_advice_info"
1986
+}
1987
+type VMHisPatient struct {
1988
+	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
1989
+	BalanceAccountsType    int64   `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
1990
+	MedicalInsuranceNumber string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
1991
+	Name                   string  `gorm:"column:name" json:"name" form:"name"`
1992
+	Gender                 int64   `gorm:"column:gender" json:"gender" form:"gender"`
1993
+	IdType                 int64   `gorm:"column:id_type" json:"id_type" form:"id_type"`
1994
+	MedicalTreatmentType   int64   `gorm:"column:medical_treatment_type" json:"medical_treatment_type" form:"medical_treatment_type"`
1995
+	Birthday               int64   `gorm:"column:birthday" json:"birthday" form:"birthday"`
1996
+	RecordDate             int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1997
+	Age                    float64 `gorm:"column:age" json:"age" form:"age"`
1998
+	PhoneNumber            string  `gorm:"column:phone_number" json:"phone_number" form:"phone_number"`
1999
+	IdCardNo               string  `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
2000
+	RegisterType           int64   `gorm:"column:register_type" json:"register_type" form:"register_type"`
2001
+	AdminUserId            int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2002
+	Departments            int64   `gorm:"column:departments" json:"departments" form:"departments"`
2003
+	IsNeedCostOfProduction int64   `gorm:"column:is_need_cost_of_production" json:"is_need_cost_of_production" form:"is_need_cost_of_production"`
2004
+	RegisterCost           float64 `gorm:"column:register_cost" json:"register_cost" form:"register_cost"`
2005
+	TreatmentCost          float64 `gorm:"column:treatment_cost" json:"treatment_cost" form:"treatment_cost"`
2006
+	CostOfProduction       float64 `gorm:"column:cost_of_production" json:"cost_of_production" form:"cost_of_production"`
2007
+	Total                  float64 `gorm:"column:total" json:"total" form:"total"`
2008
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2009
+	Status                 int64   `gorm:"column:status" json:"status" form:"status"`
2010
+	Ctime                  int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
2011
+	Mtime                  int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
2012
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2013
+	Number                 string  `gorm:"column:number" json:"number" form:"number"`
2014
+	Doctor                 int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
2015
+	IsReturn               int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
2016
+	PsnNo                  string  `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
2017
+	PsnCertType            string  `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
2018
+	Certno                 string  `gorm:"column:certno" json:"certno" form:"certno"`
2019
+	PsnName                string  `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
2020
+	Gend                   string  `gorm:"column:gend" json:"gend" form:"gend"`
2021
+	Naty                   string  `gorm:"column:naty" json:"naty" form:"naty"`
2022
+	Brdy                   string  `gorm:"column:brdy" json:"brdy" form:"brdy"`
2023
+	Iinfo                  string  `gorm:"column:iinfo" json:"iinfo" form:"iinfo"`
2024
+	Idetinfo               string  `gorm:"column:idetinfo" json:"idetinfo" form:"idetinfo"`
2025
+	IptOtpNo               string  `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
2026
+	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
2027
+	Diagnosis              string  `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
2028
+	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
2029
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
2030
+}
2031
+
2032
+func (VMHisPatient) TableName() string {
2033
+	return "his_patient"
2034
+}
2035
+
2036
+type HisPrescriptionProject struct {
2037
+	ID                 int64        `gorm:"column:id" json:"id" form:"id"`
2038
+	ProjectId          int64        `gorm:"column:project_id" json:"project_id" form:"project_id"`
2039
+	Price              float64      `gorm:"column:price" json:"price" form:"price"`
2040
+	UserOrgId          int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2041
+	Status             int64        `gorm:"column:status" json:"status" form:"status"`
2042
+	Ctime              int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
2043
+	Mtime              int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
2044
+	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2045
+	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
2046
+	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
2047
+	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
2048
+	Count              string       `gorm:"column:count" json:"count" form:"count"`
2049
+	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
2050
+	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
2051
+	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
2052
+	DeliveryWay        string       `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
2053
+	ExecutionFrequency string       `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
2054
+	Day                string       `gorm:"column:day" json:"day" form:"day"`
2055
+	VMHisProject       VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
2056
+	VMGoodInfo         VMGoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
2057
+
2058
+	Remark               string               `gorm:"column:remark" json:"remark" form:"remark"`
2059
+	Unit                 string               `gorm:"column:unit" json:"unit" form:"unit"`
2060
+
2061
+	Type                 int64                `gorm:"column:type" json:"type" form:"type"`
2062
+
2063
+	Doctor         int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
2064
+	ExecutionTime  int64 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
2065
+	ExecutionStaff int64 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
2066
+	ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
2067
+	CheckTime      int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
2068
+	CheckState     int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
2069
+	Checker        int64 `gorm:"column:checker" json:"checker" form:"checker"`
2070
+	StartTime      int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
2071
+	TeamId         int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
2072
+
2073
+	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
2074
+	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
2075
+	WeekDay              string `gorm:"column:week_day" json:"week_day" form:"week_day"`
2076
+	ExecutionFrequencyId int64  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
2077
+}
2078
+
2079
+func (HisPrescriptionProject) TableName() string {
2080
+	return "his_prescription_project"
2081
+}

+ 46 - 12
service/jsyb_service.go View File

8
 	"gdyb/utils/csbhttp"
8
 	"gdyb/utils/csbhttp"
9
 	//"io/ioutil"
9
 	//"io/ioutil"
10
 	"net"
10
 	"net"
11
+	"strings"
11
 	//"net/http"
12
 	//"net/http"
12
 	"strconv"
13
 	"strconv"
13
 	"time"
14
 	"time"
241
 	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
242
 	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
242
 	inputData["card_sn"] = ""           // 卡识别码
243
 	inputData["card_sn"] = ""           // 卡识别码
243
 	inputData["certno"] = id_card_no    // 证件号码
244
 	inputData["certno"] = id_card_no    // 证件号码
244
-	inputData["psn_cert_type"] = "1"    // 人员证件类型
245
+	inputData["psn_cert_type"] = "01"    // 人员证件类型
245
 
246
 
246
 	inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
247
 	inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
247
 	inputData["begntime"] = ""         // 开始时间
248
 	inputData["begntime"] = ""         // 开始时间
1718
 
1719
 
1719
 func Jsyb3501(struct3501 models.Struct3501) (string, string) {
1720
 func Jsyb3501(struct3501 models.Struct3501) (string, string) {
1720
 	timestamp := time.Now().Unix()
1721
 	timestamp := time.Now().Unix()
1722
+
1721
 	// 生成输入报文
1723
 	// 生成输入报文
1722
-	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
1724
+	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.Code, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
1723
 	input := make(map[string]interface{})
1725
 	input := make(map[string]interface{})
1724
 	inputData := make(map[string]interface{})
1726
 	inputData := make(map[string]interface{})
1725
 	inputMessage["infno"] = "3501"                                  // 交易编码
1727
 	inputMessage["infno"] = "3501"                                  // 交易编码
1726
 	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
1728
 	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
1727
 	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
1729
 	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
1728
-	inputData["fixmedins_hilist_name"] = struct3501.OrgName         // 定点医药机构目录名称
1730
+	inputData["fixmedins_hilist_name"] = struct3501.FixmedinsHilistName         // 定点医药机构目录名称
1729
 	inputData["rx_flag"] = struct3501.RxFlag                        //
1731
 	inputData["rx_flag"] = struct3501.RxFlag                        //
1730
 	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
1732
 	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
1731
 	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
1733
 	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
1734
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
1736
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
1735
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
1737
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
1736
 	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
1738
 	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
1739
+	feedetail := make([]map[string]interface{}, 0)
1740
+	druginputData := make(map[string]interface{})
1741
+	druginputData["drug_trac_codg"] = struct3501.DrugTracCodg
1742
+	feedetail = append(feedetail,druginputData)
1743
+	inputData["drugtracinfo"] = feedetail
1737
 	input["invinfo"] = inputData
1744
 	input["invinfo"] = inputData
1738
 	inputMessage["input"] = input //交易输入
1745
 	inputMessage["input"] = input //交易输入
1739
 
1746
 
1750
 func Jsyb3502(struct3502 models.Struct3502) (string, string) {
1757
 func Jsyb3502(struct3502 models.Struct3502) (string, string) {
1751
 	timestamp := time.Now().Unix()
1758
 	timestamp := time.Now().Unix()
1752
 	// 生成输入报文
1759
 	// 生成输入报文
1753
-	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
1760
+	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.Code, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
1754
 	input := make(map[string]interface{})
1761
 	input := make(map[string]interface{})
1755
 	inputData := make(map[string]interface{})
1762
 	inputData := make(map[string]interface{})
1756
 	inputMessage["infno"] = "3502"                      // 交易编码
1763
 	inputMessage["infno"] = "3502"                      // 交易编码
1758
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
1765
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
1759
 
1766
 
1760
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
1767
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
1761
-	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
1768
+	inputData["fixmedins_hilist_name"] = struct3502.FixmedinsHilistName     // 定点医药机构目录名称
1762
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
1769
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
1763
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
1770
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
1764
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
1771
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
1769
 	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
1776
 	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
1770
 	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
1777
 	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
1771
 
1778
 
1779
+	input["invinfo"] = inputData
1780
+	feedetail := make([]map[string]interface{}, 0)
1781
+	druginputData := make(map[string]interface{})
1782
+	druginputData["drug_trac_codg"] = struct3502.DrugTracCodg
1783
+	feedetail = append(feedetail,druginputData)
1784
+	inputData["drugtracinfo"] = feedetail
1772
 	input["invinfo"] = inputData
1785
 	input["invinfo"] = inputData
1773
 	inputMessage["input"] = input //交易输入
1786
 	inputMessage["input"] = input //交易输入
1774
 
1787
 
1786
 	timestamp := time.Now().Unix()
1799
 	timestamp := time.Now().Unix()
1787
 	// 生成输入报文
1800
 	// 生成输入报文
1788
 	fmt.Println(struct3503)
1801
 	fmt.Println(struct3503)
1789
-	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
1802
+	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.Code, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
1790
 
1803
 
1791
 	input := make(map[string]interface{})
1804
 	input := make(map[string]interface{})
1792
 
1805
 
1832
 func Jsyb3504(struct3504 models.Struct3504) (string, string) {
1845
 func Jsyb3504(struct3504 models.Struct3504) (string, string) {
1833
 	timestamp := time.Now().Unix()
1846
 	timestamp := time.Now().Unix()
1834
 	// 生成输入报文
1847
 	// 生成输入报文
1835
-	inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
1848
+	inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.Code, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
1836
 	input := make(map[string]interface{})
1849
 	input := make(map[string]interface{})
1837
 	inputData := make(map[string]interface{})
1850
 	inputData := make(map[string]interface{})
1838
 	inputMessage["infno"] = "3504"                                      // 交易编码
1851
 	inputMessage["infno"] = "3504"                                      // 交易编码
1870
 func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1883
 func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1871
 	timestamp := time.Now().Unix()
1884
 	timestamp := time.Now().Unix()
1872
 	// 生成输入报文
1885
 	// 生成输入报文
1873
-	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1886
+	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1874
 	input := make(map[string]interface{})
1887
 	input := make(map[string]interface{})
1875
 	inputData := make(map[string]interface{})
1888
 	inputData := make(map[string]interface{})
1876
 	inputMessage["infno"] = "3505"                                  // 交易编码
1889
 	inputMessage["infno"] = "3505"                                  // 交易编码
1877
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
1890
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
1878
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
1891
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
1879
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
1892
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName         // 定点医药机构目录名称
1880
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1893
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1881
 
1894
 
1882
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
1895
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
1916
 	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
1929
 	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
1917
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
1930
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
1918
 	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
1931
 	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
1932
+	//input["selinfo"] = inputData
1933
+	feedetail := make([]map[string]interface{}, 0)
1934
+
1935
+	codes := strings.Split(struct3505.DrugTracCodg,",")
1936
+	for _,item := range codes{
1937
+		druginputData := make(map[string]interface{})
1938
+		druginputData["drug_trac_codg"] = item
1939
+		feedetail = append(feedetail,druginputData)
1940
+	}
1941
+	inputData["drugtracinfo"] = feedetail
1919
 	input["selinfo"] = inputData
1942
 	input["selinfo"] = inputData
1920
 	inputMessage["input"] = input //交易输入
1943
 	inputMessage["input"] = input //交易输入
1921
 
1944
 
1932
 func Jsyb3506(struct3506 models.Struct3506) (string, string) {
1955
 func Jsyb3506(struct3506 models.Struct3506) (string, string) {
1933
 	timestamp := time.Now().Unix()
1956
 	timestamp := time.Now().Unix()
1934
 	// 生成输入报文
1957
 	// 生成输入报文
1935
-	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
1958
+	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.Code, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
1936
 	input := make(map[string]interface{})
1959
 	input := make(map[string]interface{})
1937
 	inputData := make(map[string]interface{})
1960
 	inputData := make(map[string]interface{})
1938
 	inputMessage["infno"] = "3506"                                  // 交易编码
1961
 	inputMessage["infno"] = "3506"                                  // 交易编码
1939
 	inputData["med_list_codg"] = struct3506.MedListCodg             // 定点医药机构目录编号
1962
 	inputData["med_list_codg"] = struct3506.MedListCodg             // 定点医药机构目录编号
1940
 	inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
1963
 	inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
1941
-	inputData["fixmedins_hilist_name"] = struct3506.OrgName         // 定点医药机构目录名称
1964
+	inputData["fixmedins_hilist_name"] = struct3506.FixmedinsHilistName         // 定点医药机构目录名称
1942
 	inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1965
 	inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1943
 
1966
 
1944
 	inputData["setl_id"] = struct3506.SetlId                       // 人员编号 (来自1101接口返回)
1967
 	inputData["setl_id"] = struct3506.SetlId                       // 人员编号 (来自1101接口返回)
1958
 	inputData["memo"] = ""                                         // 人员编号 (来自1101接口返回)
1981
 	inputData["memo"] = ""                                         // 人员编号 (来自1101接口返回)
1959
 	inputData["medins_prod_sel_no"] = ""                           // 人员编号 (来自1101接口返回)
1982
 	inputData["medins_prod_sel_no"] = ""                           // 人员编号 (来自1101接口返回)
1960
 
1983
 
1984
+	feedetail := make([]map[string]interface{}, 0)
1985
+
1986
+	codes := strings.Split(struct3506.DrugTracCodg,",")
1987
+	for _,item := range codes{
1988
+		druginputData := make(map[string]interface{})
1989
+		druginputData["drug_trac_codg"] = item
1990
+		feedetail = append(feedetail,druginputData)
1991
+	}
1992
+	//input["drugtracinfo"] = feedetail
1993
+	//input["drugtracinfo"] = struct3506.DrugTracCodg
1994
+	inputData["drugtracinfo"] = feedetail
1961
 	input["selinfo"] = inputData
1995
 	input["selinfo"] = inputData
1962
 	inputMessage["input"] = input //交易输入
1996
 	inputMessage["input"] = input //交易输入
1963
 
1997
 
1978
 	input := make(map[string]interface{})
2012
 	input := make(map[string]interface{})
1979
 	inputData := make(map[string]interface{})
2013
 	inputData := make(map[string]interface{})
1980
 	inputMessage["infno"] = "3507"                          // 交易编码
2014
 	inputMessage["infno"] = "3507"                          // 交易编码
1981
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
2015
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
1982
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
2016
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
1983
 
2017
 
1984
 	input["data"] = inputData
2018
 	input["data"] = inputData

+ 4 - 4
service/jx_service.go View File

1027
 func Jxyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1027
 func Jxyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1028
 	timestamp := time.Now().Unix()
1028
 	timestamp := time.Now().Unix()
1029
 	// 生成输入报文
1029
 	// 生成输入报文
1030
-	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1030
+	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, "440300", baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1031
 	input := make(map[string]interface{})
1031
 	input := make(map[string]interface{})
1032
 	inputData := make(map[string]interface{})
1032
 	inputData := make(map[string]interface{})
1033
 	inputMessage["infno"] = "5203" // 交易编码
1033
 	inputMessage["infno"] = "5203" // 交易编码
1050
 func Jxyb5202(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1050
 func Jxyb5202(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1051
 	timestamp := time.Now().Unix()
1051
 	timestamp := time.Now().Unix()
1052
 	// 生成输入报文
1052
 	// 生成输入报文
1053
-	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1053
+	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, "440300", baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1054
 	input := make(map[string]interface{})
1054
 	input := make(map[string]interface{})
1055
 	inputData := make(map[string]interface{})
1055
 	inputData := make(map[string]interface{})
1056
 	inputMessage["infno"] = "5202" // 交易编码
1056
 	inputMessage["infno"] = "5202" // 交易编码
1931
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
1931
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
1932
 	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
1932
 	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
1933
 	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
1933
 	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
1934
-	inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
1935
-	inputData["refd_setl_flag"] = 0                      //
1934
+	inputData["fixmedins_setl_cnt"] = 20 //定点医药机构结算笔数
1935
+	inputData["refd_setl_flag"] = 1                  //
1936
 
1936
 
1937
 	input["data"] = inputData
1937
 	input["data"] = inputData
1938
 	inputMessage["input"] = input //交易输入
1938
 	inputMessage["input"] = input //交易输入

+ 3 - 1
utils/csbhttp/httpcaller.go View File

19
 package csbhttp
19
 package csbhttp
20
 
20
 
21
 import (
21
 import (
22
+	//
22
 	"fmt"
23
 	"fmt"
23
-	//"crypto/tls"
24
+	"crypto/tls"
24
 	"bytes"
25
 	"bytes"
25
 	"encoding/json"
26
 	"encoding/json"
26
 	"io/ioutil"
27
 	"io/ioutil"
179
 
180
 
180
 	client := &http.Client{
181
 	client := &http.Client{
181
 		Transport: &http.Transport{
182
 		Transport: &http.Transport{
183
+			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
182
 			Dial: func(netw, addr string) (net.Conn, error) {
184
 			Dial: func(netw, addr string) (net.Conn, error) {
183
 				conn, err := net.DialTimeout(netw, addr, defaultSetting.ConnectTimeout) //设置建立连接超时
185
 				conn, err := net.DialTimeout(netw, addr, defaultSetting.ConnectTimeout) //设置建立连接超时
184
 				if err != nil {
186
 				if err != nil {