3 Commits 394cc2c2f5 ... 52858b51d6

Author SHA1 Message Date
  test_user 52858b51d6 更新 1 week ago
  test_user 993b97da72 Merge branch 'master' of http://git.shengws.com/csx/gdyb 1 week ago
  test_user 29042f0d64 更新 1 week ago
3 changed files with 72 additions and 30 deletions
  1. 29 17
      controllers/sg/his_api_controller.go
  2. 42 12
      service/ah_dianzichufang.go
  3. 1 1
      service/his_service.go

+ 29 - 17
controllers/sg/his_api_controller.go View File

@@ -34,6 +34,8 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
38
+
37 39
 )
38 40
 
39 41
 type HisApiController struct {
@@ -8004,7 +8006,6 @@ func (c *HisApiController) GetCFYLJG001() {
8004 8006
 	patient_id, _ := c.GetInt64("patient_id")
8005 8007
 	his_patient_id, _ := c.GetInt64("his_patient_id")
8006 8008
 	record_time := c.GetString("record_time")
8007
-	admin_user_id = 3626
8008 8009
 	his, _ := service.GetHisPatientRecord(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
8009 8010
 	psn, _ := service.GetPsnByPatientId(patient_id)
8010 8011
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
@@ -8067,9 +8068,9 @@ func (c *HisApiController) GetCFYLJG001() {
8067 8068
 			}
8068 8069
 		}
8069 8070
 		cFYLJG001.RxDrugCnt = count
8070
-		cFYLJG001.ValiDays = "5"
8071
+		cFYLJG001.ValiDays = "2"
8071 8072
 		ts := time.Unix(item.PreTime, 0)
8072
-		record_time2 := ts.AddDate(0, 0, int(5)).Unix()
8073
+		record_time2 := ts.AddDate(0, 0, int(2)).Unix()
8073 8074
 		tempTime3 := time.Unix(record_time2, 0)
8074 8075
 		timeFormat3 := tempTime3.Format("2006-01-02 15:04:05")
8075 8076
 		cFYLJG001.ValiEndTime = timeFormat3
@@ -8147,10 +8148,10 @@ func (c *HisApiController) GetCFYLJG001() {
8147 8148
 		tempTime6 := time.Unix(tempTime2, 0)
8148 8149
 		timeFormatTwo := tempTime6.Format("2006-01-02 15:04:05")
8149 8150
 		cFYLJG001.Mdtrtinfo.MdtrtTime = timeFormatTwo
8150
-		cFYLJG001.Mdtrtinfo.DiseCodg = "M07803"
8151
+		cFYLJG001.Mdtrtinfo.DiseCodg = ""
8151 8152
 		cFYLJG001.Mdtrtinfo.SpDiseFlag = "1"
8152
-		cFYLJG001.Mdtrtinfo.MaindiagCode = "N18.500"
8153
-		cFYLJG001.Mdtrtinfo.MaindiagName = "慢性肾脏病5期"
8153
+		cFYLJG001.Mdtrtinfo.MaindiagCode = "I10.x00x002"
8154
+		cFYLJG001.Mdtrtinfo.MaindiagName = "高血压"
8154 8155
 
8155 8156
 		diagnosis_ids := strings.Split(info.Diagnosis, ",")
8156 8157
 		var config []*models.HisXtDiagnoseConfig
@@ -8193,7 +8194,7 @@ func (c *HisApiController) GetCFYLJG001() {
8193 8194
 		if miConfig.MdtrtareaAdmvs == "340699" {
8194 8195
 			result, request := service.GetAHCFYLJG001("http://10.66.149.64:8080/epc/api", cFYLJG001, his.Insutype)
8195 8196
 			saveLog(result, request, "GetCFYLJG001", "GetCFYLJG001")
8196
-			var res ResultCFYLJG001
8197
+			var res ResultCFYLJG001AH
8197 8198
 			var respJSON2 map[string]interface{}
8198 8199
 			if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
8199 8200
 				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
@@ -8206,19 +8207,12 @@ func (c *HisApiController) GetCFYLJG001() {
8206 8207
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8207 8208
 				return
8208 8209
 			}
8209
-			if res.Infcode == -1 {
8210
-				c.ServeSuccessJSON(map[string]interface{}{
8211
-					"failed_code": -10,
8212
-					"msg":         res.ErrMsg,
8213
-				})
8214
-				return
8215 8210
 
8216
-			} else {
8217 8211
 				var flow models.HisPrescriptionFlow
8218 8212
 				flow.Ctime = time.Now().Unix()
8219 8213
 				flow.SignDigest = ""
8220
-				flow.RxTraceCode = res.Output.RxTraceCode
8221
-				flow.HiRxno = res.Output.HiRxno
8214
+				flow.RxTraceCode = res.RxTraceCode
8215
+				flow.HiRxno = res.HiRxno
8222 8216
 				flow.MID = his.Number
8223 8217
 				flow.Status = 1
8224 8218
 				flow.DCode = doctor_info.DoctorNumber
@@ -8233,7 +8227,7 @@ func (c *HisApiController) GetCFYLJG001() {
8233 8227
 				c.ServeSuccessJSON(map[string]interface{}{
8234 8228
 					"msg": "上传成功",
8235 8229
 				})
8236
-			}
8230
+
8237 8231
 
8238 8232
 		} else {
8239 8233
 			result, request := service.GetCFYLJG001(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, cFYLJG001, his.Insutype)
@@ -25398,6 +25392,12 @@ type ResultCFYLJG001 struct {
25398 25392
 	WarnInfo    interface{} `json:"warn_info"`
25399 25393
 }
25400 25394
 
25395
+type ResultCFYLJG001AH struct {
25396
+		RxTraceCode string `json:"rxTraceCode"`
25397
+		HiRxno      string `json:"hiRxno"`
25398
+
25399
+}
25400
+
25401 25401
 type ResultCFYLJG007 struct {
25402 25402
 	ErrMsg      string `json:"err_msg"`
25403 25403
 	InfRefmsgid string `json:"inf_refmsgid"`
@@ -32231,6 +32231,11 @@ func (c *HisApiController) GetPreUploadInfo() {
32231 32231
 				data["sick_code"] = sickConfig.CountryCode
32232 32232
 				data["sick_name"] = sickConfig.ClassName
32233 32233
 			}
32234
+			if reg_type == 11 {
32235
+				med_type = "11"
32236
+				data["sick_code"] = sickConfig.CountryCode
32237
+				data["sick_name"] = sickConfig.ClassName
32238
+			}
32234 32239
 		} else if his.Insutype == "310" {
32235 32240
 			if reg_type == 992102 {
32236 32241
 				med_type = "992102"
@@ -32253,6 +32258,12 @@ func (c *HisApiController) GetPreUploadInfo() {
32253 32258
 				data["sick_code"] = sickConfig.CountryCode
32254 32259
 				data["sick_name"] = sickConfig.ClassName
32255 32260
 			}
32261
+
32262
+			if reg_type == 11 {
32263
+				med_type = "11"
32264
+				data["sick_code"] = sickConfig.CountryCode
32265
+				data["sick_name"] = sickConfig.ClassName
32266
+			}
32256 32267
 		}
32257 32268
 
32258 32269
 		data["med_type"] = med_type
@@ -35082,6 +35093,7 @@ func (c *HisApiController) Refund() {
35082 35093
 		})
35083 35094
 		return
35084 35095
 	}
35096
+	return
35085 35097
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
35086 35098
 	if order.ID == 0 {
35087 35099
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 42 - 12
service/ah_dianzichufang.go View File

@@ -8,6 +8,7 @@ import (
8 8
 	"io/ioutil"
9 9
 	"net/http"
10 10
 	"os/exec"
11
+	"strings"
11 12
 )
12 13
 
13 14
 func GetAHCFYLJG001(url string, cFYLJG001 models.CFYLJG001, isu string) (string, string) {
@@ -161,16 +162,21 @@ func GetAHCFYLJG001(url string, cFYLJG001 models.CFYLJG001, isu string) (string,
161 162
 	var inputLog string
162 163
 	bytesData, err := json.Marshal(inputData)
163 164
 	inputLog = string(bytesData)
164
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
165
+	fmt.Println(inputLog)
166
+
167
+	cmd := exec.Command("java", "-jar", "encrypt-utils-all.jar", "encrypt", "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
168
+
165 169
 	out, err := cmd.Output()
166
-	fmt.Println(string(out))
167
-	if err != nil {
168
-		fmt.Println("error:", err.Error())
169
-		return err.Error(), ""
170
-	}
171
-	reader := bytes.NewReader(out)
170
+
171
+	aa := strings.Split(string(out),"======")
172
+	fmt.Println(aa[1])
173
+
174
+	reader := bytes.NewReader([]byte(aa[1]))
172 175
 	url = url + "/fixmedins/uploadChk"
176
+	fmt.Println(url)
177
+
173 178
 	request, err := http.NewRequest("POST", url, reader)
179
+
174 180
 	if err != nil {
175 181
 		fmt.Println(err.Error())
176 182
 		return err.Error(), ""
@@ -178,17 +184,41 @@ func GetAHCFYLJG001(url string, cFYLJG001 models.CFYLJG001, isu string) (string,
178 184
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
179 185
 	client := http.Client{}
180 186
 	resp, err := client.Do(request)
187
+
188
+
181 189
 	if err != nil {
182 190
 		fmt.Println(err.Error())
183 191
 		return err.Error(), ""
184 192
 	}
185 193
 	respBytes, err := ioutil.ReadAll(resp.Body)
194
+
186 195
 	if err != nil {
187 196
 		fmt.Println(err.Error())
188 197
 		return err.Error(), ""
189 198
 	}
190 199
 	str := string(respBytes)
191
-	return str, inputLog
200
+
201
+	var data2 map[string]interface{}
202
+
203
+	// 解析 JSON 字符串到 map
204
+	 json.Unmarshal([]byte(str), &data2)
205
+
206
+	// 检查 code 字段是否存在,并将其转换为字符串
207
+	if val, ok := data2["code"]; ok {
208
+		data2["code"] = fmt.Sprintf("%v", val) // 将 code 转换为字符串
209
+	}
210
+
211
+	// 将处理后的数据重新转换为 JSON 字符串
212
+	updatedJSON2, _ := json.Marshal(data2)
213
+
214
+
215
+	fmt.Println(string(updatedJSON2))
216
+	cmd2 := exec.Command("java", "-jar", "encrypt-utils-all.jar", "decrypt", "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "BDoCErhDkP7KEG/BqNpjKIG5a3CapA8wbhXMNemzu+/fQD2kiW9rIDVLHxOEpAwnCuftjdZqf4Bz3x2gFShyk/8=", string(updatedJSON2))
217
+	out2, _ := cmd2.Output()
218
+	fmt.Println(string(out2))
219
+	bb := strings.Split(string(out2),"======")
220
+	fmt.Println(bb[1])
221
+	return bb[1], inputLog
192 222
 }
193 223
 
194 224
 func GetAHCFYLJG002(fixmedins_code string, url string, original_value string, original_rx_file string, extras string) (string, string) {
@@ -207,7 +237,7 @@ func GetAHCFYLJG002(fixmedins_code string, url string, original_value string, or
207 237
 		fmt.Println(err.Error())
208 238
 		return err.Error(), ""
209 239
 	}
210
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
240
+	cmd := exec.Command("java", "-jar", "encrypt-utils-all.jar", "encrypt",  "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
211 241
 	out, err := cmd.Output()
212 242
 	fmt.Println(string(out))
213 243
 	reader := bytes.NewReader(out)
@@ -263,15 +293,15 @@ func GetAHCFYLJG003(url string, cFYLJG003 models.CFYLJG003) (string, string) {
263 293
 	var inputLog string
264 294
 	bytesData, err := json.Marshal(inputData)
265 295
 	inputLog = string(bytesData)
266
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
296
+	cmd := exec.Command("java", "-jar", "encrypt-utils-all.jar", "encrypt",  "19D43125C3E64BB784601F7B19A8D785", "6014F1F2CA6247F8960AF61A306B5DCC", "Ns0K7Gsxk1WSfxYYyBcCL3J4Q/2Tvp1bMe8JbakA9Fg=", inputLog)
267 297
 	out, err := cmd.Output()
268 298
 	fmt.Println(string(out))
269
-
299
+	aa := strings.Split(string(out),"======")
270 300
 	if err != nil {
271 301
 		fmt.Println(err.Error())
272 302
 		return err.Error(), ""
273 303
 	}
274
-	reader := bytes.NewReader(bytesData)
304
+	reader := bytes.NewReader([]byte(aa[1]))
275 305
 	url = url + "/fixmedins/rxFileUpld"
276 306
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
277 307
 	request, err := http.NewRequest("POST", url, reader)

+ 1 - 1
service/his_service.go View File

@@ -1679,7 +1679,7 @@ func GetHisPrescriptionForMedType(org_id int64, patient_id int64, record_date in
1679 1679
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1680 1680
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
1681 1681
 		}).
1682
-		Where("(user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND p_type <> 1 and med_type = 148801) or (user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND p_type <> 1 and med_type = 118801)", org_id, record_date, patient_id, org_id, record_date, patient_id).
1682
+		Where("(user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND p_type <> 1 ) or (user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND p_type <> 1 )", org_id, record_date, patient_id, org_id, record_date, patient_id).
1683 1683
 		Find(&prescription).Error
1684 1684
 	return
1685 1685
 }