|
@@ -5,15 +5,9 @@ import (
|
5
|
5
|
"XT_New/models"
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"XT_New/utils"
|
8
|
|
- "bytes"
|
9
|
|
- "encoding/json"
|
10
|
|
- "encoding/xml"
|
11
|
8
|
"fmt"
|
12
|
9
|
"github.com/astaxie/beego"
|
13
|
|
- "io/ioutil"
|
14
|
|
- "net/http"
|
15
|
10
|
"os"
|
16
|
|
- "strconv"
|
17
|
11
|
"strings"
|
18
|
12
|
"time"
|
19
|
13
|
)
|
|
@@ -32,205 +26,205 @@ func HisPrintApiRegistRouters() {
|
32
|
26
|
beego.Router("/api/his/prescription/summary", &HisPrintApiController{}, "get:GetUnChargePrescriptionSummary")
|
33
|
27
|
beego.Router("/api/his/label/create", &HisPrintApiController{}, "get:CreateLablePrint")
|
34
|
28
|
beego.Router("/api/his/label/get", &HisPrintApiController{}, "get:GetLablePrint")
|
35
|
|
- beego.Router("/api/his/label/send", &HisPrintApiController{}, "get:SendApplyCode")
|
|
29
|
+ //beego.Router("/api/his/label/send", &HisPrintApiController{}, "get:SendApplyCode")
|
36
|
30
|
}
|
37
|
31
|
|
38
|
|
-func (c *HisPrintApiController) SendApplyCode() {
|
39
|
|
- list, _ := service.GetAllLisDataFor10191(c.GetAdminUserInfo().CurrentOrgId)
|
40
|
|
- if len(list) > 0 {
|
41
|
|
- //插入中间库中
|
42
|
|
- for _, item := range list {
|
43
|
|
- if len(item.ApplyCode) == 0 {
|
44
|
|
- var apply models.JYApply
|
45
|
|
- apply.BedCode = ""
|
46
|
|
- apply.PatientName = item.Patient.Name
|
47
|
|
- idCard := item.Patient.IdCardNo // 身份证号码示例
|
48
|
|
- age, err := GetAge(idCard)
|
49
|
|
- if err != nil {
|
50
|
|
- age = int(item.Patient.Age)
|
51
|
|
- fmt.Println("计算年龄时出错:", err)
|
52
|
|
- }
|
53
|
|
-
|
54
|
|
- apply.Age = strconv.FormatInt(int64(age), 10)
|
55
|
|
- apply.AgeUnit = "岁"
|
56
|
|
- if item.Patient.Gender == 1 {
|
57
|
|
- apply.Sex = "男"
|
58
|
|
- } else if item.Patient.Gender == 2 {
|
59
|
|
- apply.Sex = "女"
|
60
|
|
- } else {
|
61
|
|
- apply.Sex = "不详"
|
62
|
|
- }
|
63
|
|
- apply.RegisterCode = ""
|
64
|
|
- apply.Diagnosis = ""
|
65
|
|
- apply.Ward = ""
|
66
|
|
- role, _ := service.GetAdminUserRole(2398, c.GetAdminUserInfo().CurrentOrgId)
|
67
|
|
- apply.SendDoctor = role.UserName
|
68
|
|
- apply.PatientType = 1
|
69
|
|
- apply.PatientPhone = item.Patient.Phone
|
70
|
|
- //applys = append(applys, apply)
|
71
|
|
- var jYApplyDetails []models.CustomerApplyDetail
|
72
|
|
-
|
73
|
|
- if len(item.ItemIds) > 0 {
|
74
|
|
- team_ids := strings.Split(item.ItemIds, ",")
|
75
|
|
- for index, subItem := range team_ids {
|
76
|
|
- //判断一些需要拆分的组套 血透体检(定量):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定量)
|
77
|
|
- if subItem == "267" {
|
78
|
|
- //血透体检(定量)
|
79
|
|
- var jYApplyDetail models.CustomerApplyDetail
|
80
|
|
- id, _ := strconv.ParseInt(subItem, 10, 64)
|
81
|
|
- jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
82
|
|
- jYApplyDetail.RowIndex = int64(index + 1)
|
83
|
|
- jYApplyDetail.Barcode = ""
|
84
|
|
- jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
85
|
|
- jYApplyDetail.Comment = ""
|
86
|
|
- jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
87
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
88
|
|
-
|
89
|
|
- //丙型肝炎抗体测定
|
90
|
|
- var jYApplyDetail2 models.CustomerApplyDetail
|
91
|
|
- id2, _ := strconv.ParseInt("26701", 10, 64)
|
92
|
|
- jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
|
93
|
|
- jYApplyDetail2.RowIndex = int64(index + 1)
|
94
|
|
- jYApplyDetail2.Barcode = ""
|
95
|
|
- jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
96
|
|
- jYApplyDetail2.Comment = ""
|
97
|
|
- jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
98
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
|
99
|
|
-
|
100
|
|
- //传染病检查(定性)
|
101
|
|
- var jYApplyDetail3 models.CustomerApplyDetail
|
102
|
|
- id3, _ := strconv.ParseInt("26700", 10, 64)
|
103
|
|
- jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
|
104
|
|
- jYApplyDetail3.RowIndex = int64(index + 1)
|
105
|
|
- jYApplyDetail3.Barcode = ""
|
106
|
|
- jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
107
|
|
- jYApplyDetail3.Comment = ""
|
108
|
|
- jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
109
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
|
110
|
|
-
|
111
|
|
- }
|
112
|
|
-
|
113
|
|
- //判断一些需要拆分的组套 血透体检(定性):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定性)
|
114
|
|
- if subItem == "424" {
|
115
|
|
- //血透体检(定性)
|
116
|
|
- var jYApplyDetail models.CustomerApplyDetail
|
117
|
|
- id, _ := strconv.ParseInt(subItem, 10, 64)
|
118
|
|
- jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
119
|
|
- jYApplyDetail.RowIndex = int64(index + 1)
|
120
|
|
- jYApplyDetail.Barcode = ""
|
121
|
|
- jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
122
|
|
- jYApplyDetail.Comment = ""
|
123
|
|
- jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
124
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
125
|
|
-
|
126
|
|
- //丙型肝炎抗体测定
|
127
|
|
- var jYApplyDetail2 models.CustomerApplyDetail
|
128
|
|
- id2, _ := strconv.ParseInt("42401", 10, 64)
|
129
|
|
- jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
|
130
|
|
- jYApplyDetail2.RowIndex = int64(index + 1)
|
131
|
|
- jYApplyDetail2.Barcode = ""
|
132
|
|
- jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
133
|
|
- jYApplyDetail2.Comment = ""
|
134
|
|
- jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
135
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
|
136
|
|
-
|
137
|
|
- //传染病检查(定性)
|
138
|
|
- var jYApplyDetail3 models.CustomerApplyDetail
|
139
|
|
- id3, _ := strconv.ParseInt("42400", 10, 64)
|
140
|
|
- jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
|
141
|
|
- jYApplyDetail3.RowIndex = int64(index + 1)
|
142
|
|
- jYApplyDetail3.Barcode = ""
|
143
|
|
- jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
144
|
|
- jYApplyDetail3.Comment = ""
|
145
|
|
- jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
146
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
|
147
|
|
-
|
148
|
|
- }
|
149
|
|
- var jYApplyDetail models.CustomerApplyDetail
|
150
|
|
- id, _ := strconv.ParseInt(subItem, 10, 64)
|
151
|
|
- jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
152
|
|
- jYApplyDetail.RowIndex = int64(index + 1)
|
153
|
|
- jYApplyDetail.Barcode = ""
|
154
|
|
- jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
155
|
|
- jYApplyDetail.Comment = ""
|
156
|
|
- jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
157
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
158
|
|
- }
|
159
|
|
- }
|
160
|
|
-
|
161
|
|
- if len(item.ProjectIds) > 0 {
|
162
|
|
- team_ids := strings.Split(item.ProjectIds, ",")
|
163
|
|
- for index, subItem := range team_ids {
|
164
|
|
- var jYApplyDetail models.CustomerApplyDetail
|
165
|
|
- id, _ := strconv.ParseInt(subItem, 10, 64)
|
166
|
|
- jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
167
|
|
- jYApplyDetail.RowIndex = int64(index)
|
168
|
|
- jYApplyDetail.Barcode = ""
|
169
|
|
- jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
170
|
|
- jYApplyDetail.Comment = ""
|
171
|
|
- jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
172
|
|
- jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
173
|
|
- }
|
174
|
|
- }
|
175
|
|
- result := PostInspectApply(key, apply, jYApplyDetails)
|
176
|
|
- if result.Res == 0 {
|
177
|
|
- item.ApplyCode = result.JYApplyResult.ApplyCode
|
178
|
|
- jsonData, err := json.Marshal(apply)
|
179
|
|
- if err != nil {
|
180
|
|
- fmt.Println("转换为JSON时发生错误:", err)
|
181
|
|
- }
|
182
|
|
- jsonStr := string(jsonData)
|
183
|
|
- jsonData2, err2 := json.Marshal(jYApplyDetails)
|
184
|
|
- if err2 != nil {
|
185
|
|
- fmt.Println("转换为JSON时发生错误:", err2)
|
186
|
|
- }
|
187
|
|
- jsonStr2 := string(jsonData2)
|
188
|
|
-
|
189
|
|
- jsonData3, err3 := json.Marshal(result)
|
190
|
|
- if err3 != nil {
|
191
|
|
- fmt.Println("转换为JSON时发生错误:", err3)
|
192
|
|
- }
|
193
|
|
- jsonStr3 := string(jsonData3)
|
194
|
|
- saveSuccessLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单成功日志", "申清单")
|
195
|
|
- err1 := service.CreateLabelPrint(&item)
|
196
|
|
- if err1 == nil {
|
197
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
198
|
|
- "msg": "发送成功",
|
199
|
|
- })
|
200
|
|
- }
|
201
|
|
- return
|
202
|
|
- } else {
|
203
|
|
- jsonData, err := json.Marshal(apply)
|
204
|
|
- if err != nil {
|
205
|
|
- fmt.Println("转换为JSON时发生错误:", err)
|
206
|
|
-
|
207
|
|
- }
|
208
|
|
- jsonStr := string(jsonData)
|
209
|
|
-
|
210
|
|
- jsonData2, err2 := json.Marshal(jYApplyDetails)
|
211
|
|
- if err2 != nil {
|
212
|
|
- fmt.Println("转换为JSON时发生错误:", err2)
|
213
|
|
-
|
214
|
|
- }
|
215
|
|
- jsonStr2 := string(jsonData2)
|
216
|
|
-
|
217
|
|
- jsonData3, err3 := json.Marshal(result)
|
218
|
|
- if err3 != nil {
|
219
|
|
- fmt.Println("转换为JSON时发生错误:", err3)
|
220
|
|
-
|
221
|
|
- }
|
222
|
|
- jsonStr3 := string(jsonData3)
|
223
|
|
-
|
224
|
|
- SaveErrorLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单错误日志", "申清单")
|
225
|
|
-
|
226
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
227
|
|
- return
|
228
|
|
- }
|
229
|
|
- }
|
230
|
|
- }
|
231
|
|
-
|
232
|
|
- }
|
233
|
|
-}
|
|
32
|
+//func (c *HisPrintApiController) SendApplyCode() {
|
|
33
|
+// list, _ := service.GetAllLisDataFor10191(c.GetAdminUserInfo().CurrentOrgId)
|
|
34
|
+// if len(list) > 0 {
|
|
35
|
+// //插入中间库中
|
|
36
|
+// for _, item := range list {
|
|
37
|
+// if len(item.ApplyCode) == 0 {
|
|
38
|
+// var apply models.JYApply
|
|
39
|
+// apply.BedCode = ""
|
|
40
|
+// apply.PatientName = item.Patient.Name
|
|
41
|
+// idCard := item.Patient.IdCardNo // 身份证号码示例
|
|
42
|
+// age, err := GetAge(idCard)
|
|
43
|
+// if err != nil {
|
|
44
|
+// age = int(item.Patient.Age)
|
|
45
|
+// fmt.Println("计算年龄时出错:", err)
|
|
46
|
+// }
|
|
47
|
+//
|
|
48
|
+// apply.Age = strconv.FormatInt(int64(age), 10)
|
|
49
|
+// apply.AgeUnit = "岁"
|
|
50
|
+// if item.Patient.Gender == 1 {
|
|
51
|
+// apply.Sex = "男"
|
|
52
|
+// } else if item.Patient.Gender == 2 {
|
|
53
|
+// apply.Sex = "女"
|
|
54
|
+// } else {
|
|
55
|
+// apply.Sex = "不详"
|
|
56
|
+// }
|
|
57
|
+// apply.RegisterCode = ""
|
|
58
|
+// apply.Diagnosis = ""
|
|
59
|
+// apply.Ward = ""
|
|
60
|
+// role, _ := service.GetAdminUserRole(2398, c.GetAdminUserInfo().CurrentOrgId)
|
|
61
|
+// apply.SendDoctor = role.UserName
|
|
62
|
+// apply.PatientType = 1
|
|
63
|
+// apply.PatientPhone = item.Patient.Phone
|
|
64
|
+// //applys = append(applys, apply)
|
|
65
|
+// var jYApplyDetails []models.CustomerApplyDetail
|
|
66
|
+//
|
|
67
|
+// if len(item.ItemIds) > 0 {
|
|
68
|
+// team_ids := strings.Split(item.ItemIds, ",")
|
|
69
|
+// for index, subItem := range team_ids {
|
|
70
|
+// //判断一些需要拆分的组套 血透体检(定量):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定量)
|
|
71
|
+// if subItem == "267" {
|
|
72
|
+// //血透体检(定量)
|
|
73
|
+// var jYApplyDetail models.CustomerApplyDetail
|
|
74
|
+// id, _ := strconv.ParseInt(subItem, 10, 64)
|
|
75
|
+// jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
|
76
|
+// jYApplyDetail.RowIndex = int64(index + 1)
|
|
77
|
+// jYApplyDetail.Barcode = ""
|
|
78
|
+// jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
79
|
+// jYApplyDetail.Comment = ""
|
|
80
|
+// jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
81
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
|
82
|
+//
|
|
83
|
+// //丙型肝炎抗体测定
|
|
84
|
+// var jYApplyDetail2 models.CustomerApplyDetail
|
|
85
|
+// id2, _ := strconv.ParseInt("26701", 10, 64)
|
|
86
|
+// jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
|
|
87
|
+// jYApplyDetail2.RowIndex = int64(index + 1)
|
|
88
|
+// jYApplyDetail2.Barcode = ""
|
|
89
|
+// jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
90
|
+// jYApplyDetail2.Comment = ""
|
|
91
|
+// jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
92
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
|
|
93
|
+//
|
|
94
|
+// //传染病检查(定性)
|
|
95
|
+// var jYApplyDetail3 models.CustomerApplyDetail
|
|
96
|
+// id3, _ := strconv.ParseInt("26700", 10, 64)
|
|
97
|
+// jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
|
|
98
|
+// jYApplyDetail3.RowIndex = int64(index + 1)
|
|
99
|
+// jYApplyDetail3.Barcode = ""
|
|
100
|
+// jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
101
|
+// jYApplyDetail3.Comment = ""
|
|
102
|
+// jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
103
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
|
|
104
|
+//
|
|
105
|
+// }
|
|
106
|
+//
|
|
107
|
+// //判断一些需要拆分的组套 血透体检(定性):需要拆分出传染病检查(定性),丙型肝炎抗体测试,血透体检(定性)
|
|
108
|
+// if subItem == "424" {
|
|
109
|
+// //血透体检(定性)
|
|
110
|
+// var jYApplyDetail models.CustomerApplyDetail
|
|
111
|
+// id, _ := strconv.ParseInt(subItem, 10, 64)
|
|
112
|
+// jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
|
113
|
+// jYApplyDetail.RowIndex = int64(index + 1)
|
|
114
|
+// jYApplyDetail.Barcode = ""
|
|
115
|
+// jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
116
|
+// jYApplyDetail.Comment = ""
|
|
117
|
+// jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
118
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
|
119
|
+//
|
|
120
|
+// //丙型肝炎抗体测定
|
|
121
|
+// var jYApplyDetail2 models.CustomerApplyDetail
|
|
122
|
+// id2, _ := strconv.ParseInt("42401", 10, 64)
|
|
123
|
+// jYApplyDetail2.CustomerChargeItemCode = strconv.FormatInt(id2, 10)
|
|
124
|
+// jYApplyDetail2.RowIndex = int64(index + 1)
|
|
125
|
+// jYApplyDetail2.Barcode = ""
|
|
126
|
+// jYApplyDetail2.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
127
|
+// jYApplyDetail2.Comment = ""
|
|
128
|
+// jYApplyDetail2.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
129
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail2)
|
|
130
|
+//
|
|
131
|
+// //传染病检查(定性)
|
|
132
|
+// var jYApplyDetail3 models.CustomerApplyDetail
|
|
133
|
+// id3, _ := strconv.ParseInt("42400", 10, 64)
|
|
134
|
+// jYApplyDetail3.CustomerChargeItemCode = strconv.FormatInt(id3, 10)
|
|
135
|
+// jYApplyDetail3.RowIndex = int64(index + 1)
|
|
136
|
+// jYApplyDetail3.Barcode = ""
|
|
137
|
+// jYApplyDetail3.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
138
|
+// jYApplyDetail3.Comment = ""
|
|
139
|
+// jYApplyDetail3.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
140
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail3)
|
|
141
|
+//
|
|
142
|
+// }
|
|
143
|
+// var jYApplyDetail models.CustomerApplyDetail
|
|
144
|
+// id, _ := strconv.ParseInt(subItem, 10, 64)
|
|
145
|
+// jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
|
146
|
+// jYApplyDetail.RowIndex = int64(index + 1)
|
|
147
|
+// jYApplyDetail.Barcode = ""
|
|
148
|
+// jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
149
|
+// jYApplyDetail.Comment = ""
|
|
150
|
+// jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
151
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
|
152
|
+// }
|
|
153
|
+// }
|
|
154
|
+//
|
|
155
|
+// if len(item.ProjectIds) > 0 {
|
|
156
|
+// team_ids := strings.Split(item.ProjectIds, ",")
|
|
157
|
+// for index, subItem := range team_ids {
|
|
158
|
+// var jYApplyDetail models.CustomerApplyDetail
|
|
159
|
+// id, _ := strconv.ParseInt(subItem, 10, 64)
|
|
160
|
+// jYApplyDetail.CustomerChargeItemCode = strconv.FormatInt(id, 10)
|
|
161
|
+// jYApplyDetail.RowIndex = int64(index)
|
|
162
|
+// jYApplyDetail.Barcode = ""
|
|
163
|
+// jYApplyDetail.CustomerBarcode = strconv.FormatInt(item.ID, 10)
|
|
164
|
+// jYApplyDetail.Comment = ""
|
|
165
|
+// jYApplyDetail.TakeSampleTime = time.Unix(item.Ctime, 0).Format("2006-01-02 15:04:05")
|
|
166
|
+// jYApplyDetails = append(jYApplyDetails, jYApplyDetail)
|
|
167
|
+// }
|
|
168
|
+// }
|
|
169
|
+// result := PostInspectApply(key, apply, jYApplyDetails)
|
|
170
|
+// if result.Res == 0 {
|
|
171
|
+// item.ApplyCode = result.JYApplyResult.ApplyCode
|
|
172
|
+// jsonData, err := json.Marshal(apply)
|
|
173
|
+// if err != nil {
|
|
174
|
+// fmt.Println("转换为JSON时发生错误:", err)
|
|
175
|
+// }
|
|
176
|
+// jsonStr := string(jsonData)
|
|
177
|
+// jsonData2, err2 := json.Marshal(jYApplyDetails)
|
|
178
|
+// if err2 != nil {
|
|
179
|
+// fmt.Println("转换为JSON时发生错误:", err2)
|
|
180
|
+// }
|
|
181
|
+// jsonStr2 := string(jsonData2)
|
|
182
|
+//
|
|
183
|
+// jsonData3, err3 := json.Marshal(result)
|
|
184
|
+// if err3 != nil {
|
|
185
|
+// fmt.Println("转换为JSON时发生错误:", err3)
|
|
186
|
+// }
|
|
187
|
+// jsonStr3 := string(jsonData3)
|
|
188
|
+// saveSuccessLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单成功日志", "申清单")
|
|
189
|
+// err1 := service.CreateLabelPrint(&item)
|
|
190
|
+// if err1 == nil {
|
|
191
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
192
|
+// "msg": "发送成功",
|
|
193
|
+// })
|
|
194
|
+// }
|
|
195
|
+// return
|
|
196
|
+// } else {
|
|
197
|
+// jsonData, err := json.Marshal(apply)
|
|
198
|
+// if err != nil {
|
|
199
|
+// fmt.Println("转换为JSON时发生错误:", err)
|
|
200
|
+//
|
|
201
|
+// }
|
|
202
|
+// jsonStr := string(jsonData)
|
|
203
|
+//
|
|
204
|
+// jsonData2, err2 := json.Marshal(jYApplyDetails)
|
|
205
|
+// if err2 != nil {
|
|
206
|
+// fmt.Println("转换为JSON时发生错误:", err2)
|
|
207
|
+//
|
|
208
|
+// }
|
|
209
|
+// jsonStr2 := string(jsonData2)
|
|
210
|
+//
|
|
211
|
+// jsonData3, err3 := json.Marshal(result)
|
|
212
|
+// if err3 != nil {
|
|
213
|
+// fmt.Println("转换为JSON时发生错误:", err3)
|
|
214
|
+//
|
|
215
|
+// }
|
|
216
|
+// jsonStr3 := string(jsonData3)
|
|
217
|
+//
|
|
218
|
+// SaveErrorLog(jsonStr3, jsonStr+"\r\n"+jsonStr2, "申清单错误日志", "申清单")
|
|
219
|
+//
|
|
220
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
221
|
+// return
|
|
222
|
+// }
|
|
223
|
+// }
|
|
224
|
+// }
|
|
225
|
+//
|
|
226
|
+// }
|
|
227
|
+//}
|
234
|
228
|
|
235
|
229
|
func (c *HisPrintApiController) GetLablePrint() {
|
236
|
230
|
patient_id, _ := c.GetInt64("patient_id")
|
|
@@ -431,86 +425,86 @@ func calculateAge(birthDate time.Time) int {
|
431
|
425
|
}
|
432
|
426
|
|
433
|
427
|
// 送检单
|
434
|
|
-func PostInspectApply(key string, apply models.JYApply, list []models.CustomerApplyDetail) models.InspectApplyData {
|
435
|
|
- // 构建SOAP请求数据
|
436
|
|
- requestData := &models.JYApplyEnvelope{
|
437
|
|
- Soap: "http://schemas.xmlsoap.org/soap/envelope/",
|
438
|
|
- Xsi: "http://www.w3.org/2001/XMLSchema-instance",
|
439
|
|
- Xsd: "http://www.w3.org/2001/XMLSchema",
|
440
|
|
- Body: models.JYApplyBody{
|
441
|
|
- InspectApplyReq: models.InspectApplyReq{
|
442
|
|
- XMLName: xml.Name{Local: "InspectApplyByInstituteItemCode", Space: "http://tempuri.org/"},
|
443
|
|
- ApiKey: key,
|
444
|
|
- Apply: apply,
|
445
|
|
- ApplyDetailList: struct {
|
446
|
|
- CustomerApplyDetail []models.CustomerApplyDetail `xml:"CustomerApplyDetail"`
|
447
|
|
- }{
|
448
|
|
- CustomerApplyDetail: list,
|
449
|
|
- },
|
450
|
|
- ApplyAdditional: nil,
|
451
|
|
- },
|
452
|
|
- },
|
453
|
|
- }
|
454
|
|
-
|
455
|
|
- // 将SOAP请求数据转换为XML格式
|
456
|
|
- requestBody, err := xml.Marshal(requestData)
|
457
|
|
- if err != nil {
|
458
|
|
- fmt.Println("XML Marshal error:", err)
|
459
|
|
- }
|
460
|
|
- fmt.Println(string(requestBody))
|
461
|
|
-
|
462
|
|
- // 创建POST请求
|
463
|
|
- url := "http://gpis.cnhiqc.com:9799/InstituteLISService.asmx"
|
464
|
|
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
|
465
|
|
- if err != nil {
|
466
|
|
- fmt.Println("Request creation error:", err)
|
467
|
|
- }
|
468
|
|
-
|
469
|
|
- // 设置请求头
|
470
|
|
- req.Header.Set("Content-Type", "text/xml; charset=utf-8")
|
471
|
|
- req.Header.Set("Content-Length", "length")
|
472
|
|
- req.Header.Set("SOAPAction", "http://tempuri.org/InspectApplyByInstituteItemCode")
|
473
|
|
-
|
474
|
|
- // 发送请求
|
475
|
|
- client := &http.Client{}
|
476
|
|
- resp, err := client.Do(req)
|
477
|
|
- if err != nil {
|
478
|
|
- fmt.Println("Request error:", err)
|
479
|
|
- }
|
480
|
|
- defer resp.Body.Close()
|
481
|
|
-
|
482
|
|
- // 读取响应数据
|
483
|
|
- responseBody, err := ioutil.ReadAll(resp.Body)
|
484
|
|
- if err != nil {
|
485
|
|
- fmt.Println("Response read error:", err)
|
486
|
|
-
|
487
|
|
- }
|
488
|
|
- fmt.Println(string(responseBody))
|
489
|
|
-
|
490
|
|
- // 解析XML数据
|
491
|
|
- var envelope_four models.EnvelopeFour
|
492
|
|
- err2 := xml.Unmarshal(responseBody, &envelope_four)
|
493
|
|
- if err2 != nil {
|
494
|
|
- fmt.Println("XML Unmarshal error:", err2)
|
495
|
|
-
|
496
|
|
- }
|
497
|
|
-
|
498
|
|
- // 获取GetReportListResult的JSON字符串
|
499
|
|
- jsonStr := envelope_four.Body.InspectApplyByInstituteItemCodeResponse.InspectApply
|
500
|
|
-
|
501
|
|
- // 解析JSON字符串到结构体
|
502
|
|
- var reportData models.InspectApplyData
|
503
|
|
- err = json.Unmarshal([]byte(jsonStr), &reportData)
|
504
|
|
-
|
505
|
|
- if err != nil {
|
506
|
|
- fmt.Println("JSON Unmarshal error:", err)
|
507
|
|
- }
|
508
|
|
- if reportData.Res != 0 {
|
509
|
|
- fmt.Println("Data:", reportData)
|
510
|
|
- //return reportData.JYApplyResult
|
511
|
|
- }
|
512
|
|
- return reportData
|
513
|
|
-}
|
|
428
|
+//func PostInspectApply(key string, apply models.JYApply, list []models.CustomerApplyDetail) models.InspectApplyData {
|
|
429
|
+// // 构建SOAP请求数据
|
|
430
|
+// requestData := &models.JYApplyEnvelope{
|
|
431
|
+// Soap: "http://schemas.xmlsoap.org/soap/envelope/",
|
|
432
|
+// Xsi: "http://www.w3.org/2001/XMLSchema-instance",
|
|
433
|
+// Xsd: "http://www.w3.org/2001/XMLSchema",
|
|
434
|
+// Body: models.JYApplyBody{
|
|
435
|
+// InspectApplyReq: models.InspectApplyReq{
|
|
436
|
+// XMLName: xml.Name{Local: "InspectApplyByInstituteItemCode", Space: "http://tempuri.org/"},
|
|
437
|
+// ApiKey: key,
|
|
438
|
+// Apply: apply,
|
|
439
|
+// ApplyDetailList: struct {
|
|
440
|
+// CustomerApplyDetail []models.CustomerApplyDetail `xml:"CustomerApplyDetail"`
|
|
441
|
+// }{
|
|
442
|
+// CustomerApplyDetail: list,
|
|
443
|
+// },
|
|
444
|
+// ApplyAdditional: nil,
|
|
445
|
+// },
|
|
446
|
+// },
|
|
447
|
+// }
|
|
448
|
+//
|
|
449
|
+// // 将SOAP请求数据转换为XML格式
|
|
450
|
+// requestBody, err := xml.Marshal(requestData)
|
|
451
|
+// if err != nil {
|
|
452
|
+// fmt.Println("XML Marshal error:", err)
|
|
453
|
+// }
|
|
454
|
+// fmt.Println(string(requestBody))
|
|
455
|
+//
|
|
456
|
+// // 创建POST请求
|
|
457
|
+// url := "http://gpis.cnhiqc.com:9799/InstituteLISService.asmx"
|
|
458
|
+// req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
|
|
459
|
+// if err != nil {
|
|
460
|
+// fmt.Println("Request creation error:", err)
|
|
461
|
+// }
|
|
462
|
+//
|
|
463
|
+// // 设置请求头
|
|
464
|
+// req.Header.Set("Content-Type", "text/xml; charset=utf-8")
|
|
465
|
+// req.Header.Set("Content-Length", "length")
|
|
466
|
+// req.Header.Set("SOAPAction", "http://tempuri.org/InspectApplyByInstituteItemCode")
|
|
467
|
+//
|
|
468
|
+// // 发送请求
|
|
469
|
+// client := &http.Client{}
|
|
470
|
+// resp, err := client.Do(req)
|
|
471
|
+// if err != nil {
|
|
472
|
+// fmt.Println("Request error:", err)
|
|
473
|
+// }
|
|
474
|
+// defer resp.Body.Close()
|
|
475
|
+//
|
|
476
|
+// // 读取响应数据
|
|
477
|
+// responseBody, err := ioutil.ReadAll(resp.Body)
|
|
478
|
+// if err != nil {
|
|
479
|
+// fmt.Println("Response read error:", err)
|
|
480
|
+//
|
|
481
|
+// }
|
|
482
|
+// fmt.Println(string(responseBody))
|
|
483
|
+//
|
|
484
|
+// // 解析XML数据
|
|
485
|
+// var envelope_four models.EnvelopeFour
|
|
486
|
+// err2 := xml.Unmarshal(responseBody, &envelope_four)
|
|
487
|
+// if err2 != nil {
|
|
488
|
+// fmt.Println("XML Unmarshal error:", err2)
|
|
489
|
+//
|
|
490
|
+// }
|
|
491
|
+//
|
|
492
|
+// // 获取GetReportListResult的JSON字符串
|
|
493
|
+// jsonStr := envelope_four.Body.InspectApplyByInstituteItemCodeResponse.InspectApply
|
|
494
|
+//
|
|
495
|
+// // 解析JSON字符串到结构体
|
|
496
|
+// var reportData models.InspectApplyData
|
|
497
|
+// err = json.Unmarshal([]byte(jsonStr), &reportData)
|
|
498
|
+//
|
|
499
|
+// if err != nil {
|
|
500
|
+// fmt.Println("JSON Unmarshal error:", err)
|
|
501
|
+// }
|
|
502
|
+// if reportData.Res != 0 {
|
|
503
|
+// fmt.Println("Data:", reportData)
|
|
504
|
+// //return reportData.JYApplyResult
|
|
505
|
+// }
|
|
506
|
+// return reportData
|
|
507
|
+//}
|
514
|
508
|
|
515
|
509
|
func SaveErrorLog(result string, request string, infno string, desc string) {
|
516
|
510
|
//org_id, _ := beego.AppConfig.Int64("org_id")
|