Sfoglia il codice sorgente

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

csx 2 anni fa
parent
commit
5ad27ba60d

+ 3 - 1
controllers/hb/hbyb_controller.go Vedi File

@@ -365,6 +365,8 @@ func (c *HBybController) PostTen() {
365 365
 	setlId := c.GetString("setl_id")
366 366
 	org_name := c.GetString("org_name")
367 367
 	doctor := c.GetString("doctor")
368
+	med_type := c.GetString("med_type")
369
+
368 370
 	secret_key := c.GetString("secret_key")
369 371
 	fixmedins_code := c.GetString("fixmedins_code")
370 372
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
@@ -385,7 +387,7 @@ func (c *HBybController) PostTen() {
385 387
 		SetlId:  setlId,
386 388
 	}
387 389
 
388
-	result := service.Hbyb5203(baseParams, businessParams)
390
+	result := service.Hbyb5203(baseParams, businessParams, med_type)
389 391
 	var dat map[string]interface{}
390 392
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
391 393
 		fmt.Println(dat)

+ 160 - 136
controllers/sg/his_api_controller.go Vedi File

@@ -270,6 +270,27 @@ func (c *HisApiController) ReadCard() {
270 270
 					return
271 271
 
272 272
 				} else {
273
+
274
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
275
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
276
+					infoStr := string(Iinfos)
277
+					idetinfoStr := string(Idetinfos)
278
+					psn := &models.HisPsn{
279
+						PsnNo:       res.Output.Baseinfo.PsnNo,
280
+						Age:         res.Output.Baseinfo.Age,
281
+						PatientId:   patient.ID,
282
+						Certno:      res.Output.Baseinfo.Certno,
283
+						Brdy:        res.Output.Baseinfo.Brdy,
284
+						Gend:        res.Output.Baseinfo.Gend,
285
+						Naty:        res.Output.Baseinfo.Naty,
286
+						PsnCertType: res.Output.Baseinfo.PsnCertType,
287
+						PsnName:     res.Output.Baseinfo.PsnName,
288
+						Idetinfo:    idetinfoStr,
289
+						Insuinfo:    infoStr,
290
+						UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
291
+					}
292
+					service.CreateHisPsn(psn)
293
+
273 294
 					c.ServeSuccessJSON(map[string]interface{}{
274 295
 						"patient": patient,
275 296
 						"number":  res.Output.Baseinfo.Certno,
@@ -1817,39 +1838,30 @@ func (c *HisApiController) GetRegisterInfo() {
1817 1838
 
1818 1839
 	if config.IsOpen == 1 {
1819 1840
 		var res ResultTwo
1841
+		var PsnNo string
1842
+		var PsnCertType string
1843
+		var Certno string
1844
+		var PsnName string
1845
+		var Gend string
1846
+		var Naty string
1847
+		var Brdy string
1848
+		var Age float64
1849
+		var infoStr string
1850
+		var idetinfoStr string
1820 1851
 		if miConfig.MdtrtareaAdmvs == "421300" {
1821
-			api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + id_card +
1822
-				"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
1823
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10)
1824
-			resp, requestErr := http.Get(api)
1825
-			if requestErr != nil {
1826
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1827
-				return
1828
-			}
1829
-
1830
-			body, ioErr := ioutil.ReadAll(resp.Body)
1831
-			if ioErr != nil {
1832
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1833
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1834
-				return
1835
-			}
1836
-			var respJSON map[string]interface{}
1837
-			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
1838
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1839
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1840
-				return
1841
-			}
1842
-
1843
-			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1844
-			result, _ := json.Marshal(respJSON)
1845
-			fmt.Println("log")
1846
-			fmt.Println(string(result))
1847
-
1848
-			if err := json.Unmarshal([]byte(result), &res); err != nil {
1849
-				utils.ErrorLog("解析失败:%v", err)
1850
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1851
-				return
1852
-			}
1852
+			psn_info, _ := service.GetPsnByPatientId(id)
1853
+			PsnNo = psn_info.PsnNo
1854
+			PsnCertType = psn_info.PsnCertType
1855
+			Certno = psn_info.Certno
1856
+			PsnName = psn_info.PsnName
1857
+			Gend = psn_info.Gend
1858
+			Naty = psn_info.Naty
1859
+			Brdy = psn_info.Brdy
1860
+			Age = psn_info.Age
1861
+			Iinfos, _ := json.Marshal(psn_info.Insuinfo)
1862
+			Idetinfos, _ := json.Marshal(psn_info.Idetinfo)
1863
+			infoStr = string(Iinfos)
1864
+			idetinfoStr = string(Idetinfos)
1853 1865
 
1854 1866
 		} else {
1855 1867
 			result, requestLog := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10))
@@ -1860,12 +1872,20 @@ func (c *HisApiController) GetRegisterInfo() {
1860 1872
 				return
1861 1873
 			}
1862 1874
 
1863
-		}
1875
+			PsnNo = res.Output.Baseinfo.PsnNo
1876
+			PsnCertType = res.Output.Baseinfo.PsnCertType
1877
+			Certno = res.Output.Baseinfo.Certno
1878
+			PsnName = res.Output.Baseinfo.PsnName
1879
+			Gend = res.Output.Baseinfo.Gend
1880
+			Naty = res.Output.Baseinfo.Naty
1881
+			Brdy = res.Output.Baseinfo.Brdy
1882
+			Age = res.Output.Baseinfo.Age
1883
+			Iinfos, _ := json.Marshal(res.Output.Iinfo)
1884
+			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
1885
+			infoStr = string(Iinfos)
1886
+			idetinfoStr = string(Idetinfos)
1864 1887
 
1865
-		Iinfos, _ := json.Marshal(res.Output.Iinfo)
1866
-		Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
1867
-		infoStr := string(Iinfos)
1868
-		idetinfoStr := string(Idetinfos)
1888
+		}
1869 1889
 
1870 1890
 		if res.Infcode == 0 {
1871 1891
 			his := models.VMHisPatient{
@@ -1884,14 +1904,14 @@ func (c *HisApiController) GetRegisterInfo() {
1884 1904
 				Status:                 1,
1885 1905
 				Ctime:                  time.Now().Unix(),
1886 1906
 				Mtime:                  time.Now().Unix(),
1887
-				PsnNo:                  res.Output.Baseinfo.PsnNo,
1888
-				PsnCertType:            res.Output.Baseinfo.PsnCertType,
1889
-				Certno:                 res.Output.Baseinfo.Certno,
1890
-				PsnName:                res.Output.Baseinfo.PsnName,
1891
-				Gend:                   res.Output.Baseinfo.Gend,
1892
-				Naty:                   res.Output.Baseinfo.Naty,
1893
-				Brdy:                   res.Output.Baseinfo.Brdy,
1894
-				Age:                    res.Output.Baseinfo.Age,
1907
+				PsnNo:                  PsnNo,
1908
+				PsnCertType:            PsnCertType,
1909
+				Certno:                 Certno,
1910
+				PsnName:                PsnName,
1911
+				Gend:                   Gend,
1912
+				Naty:                   Naty,
1913
+				Brdy:                   Brdy,
1914
+				Age:                    Age,
1895 1915
 				Iinfo:                  infoStr,
1896 1916
 				Idetinfo:               idetinfoStr,
1897 1917
 				PatientId:              patient.ID,
@@ -5253,7 +5273,7 @@ func (c *HisApiController) GetSettleAccounts() {
5253 5273
 
5254 5274
 			api := "http://192.168.124.4:9532/" + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
5255 5275
 				"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
5256
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
5276
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&med_type=" + order.MedType
5257 5277
 			resp, requestErr := http.Get(api)
5258 5278
 			if requestErr != nil {
5259 5279
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -5262,14 +5282,14 @@ func (c *HisApiController) GetSettleAccounts() {
5262 5282
 
5263 5283
 			body, ioErr := ioutil.ReadAll(resp.Body)
5264 5284
 			if ioErr != nil {
5265
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5266
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5285
+				//utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5286
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5267 5287
 				return
5268 5288
 			}
5269 5289
 			var respJSON map[string]interface{}
5270 5290
 			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
5271
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5272
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5291
+				//utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5292
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5273 5293
 				return
5274 5294
 			}
5275 5295
 
@@ -5278,11 +5298,15 @@ func (c *HisApiController) GetSettleAccounts() {
5278 5298
 			fmt.Println("log")
5279 5299
 			fmt.Println(string(result))
5280 5300
 			if err := json.Unmarshal([]byte(result), &res); err != nil {
5281
-				utils.ErrorLog("解析失败:%v", err)
5282
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5301
+				//utils.ErrorLog("解析失败:%v", err)
5302
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5283 5303
 				return
5284 5304
 			}
5285 5305
 
5306
+			c.ServeSuccessJSON(map[string]interface{}{
5307
+				"msg": "成功",
5308
+			})
5309
+
5286 5310
 		} else {
5287 5311
 			result := service.Gdyb5203(baseParams, businessParams)
5288 5312
 			var dat map[string]interface{}
@@ -5297,97 +5321,97 @@ func (c *HisApiController) GetSettleAccounts() {
5297 5321
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5298 5322
 				return
5299 5323
 			}
5300
-		}
5301 5324
 
5302
-		printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
5303
-		charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
5325
+			printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
5326
+			charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
5304 5327
 
5305
-		patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, order.PatientId, order.SettleAccountsDate)
5306
-		adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
5328
+			patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, order.PatientId, order.SettleAccountsDate)
5329
+			adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
5307 5330
 
5308
-		roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
5331
+			roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
5309 5332
 
5310
-		var doctor_name string
5311
-		if roles.ID == 0 {
5312
-			doctor_name = "管理员"
5313
-		} else {
5314
-			doctor_name = roles.UserName
5315
-		}
5333
+			var doctor_name string
5334
+			if roles.ID == 0 {
5335
+				doctor_name = "管理员"
5336
+			} else {
5337
+				doctor_name = roles.UserName
5338
+			}
5316 5339
 
5317
-		yiliao_leibie := ""
5340
+			yiliao_leibie := ""
5318 5341
 
5319
-		switch order.MedType {
5320
-		case "11":
5321
-			yiliao_leibie = "普通门诊"
5322
-			break
5323
-		case "12":
5324
-			yiliao_leibie = "门诊挂号"
5325
-			break
5326
-		case "13":
5327
-			yiliao_leibie = "急诊"
5328
-			break
5329
-		case "14":
5330
-			yiliao_leibie = "门诊特殊病"
5331
-			break
5332
-		case "15":
5333
-			yiliao_leibie = "门诊统筹"
5334
-			break
5335
-		case "16":
5336
-			yiliao_leibie = "门诊慢性病"
5337
-			break
5338
-		case "21":
5339
-			yiliao_leibie = "普通住院"
5340
-			break
5341
-		}
5342
-		departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
5342
+			switch order.MedType {
5343
+			case "11":
5344
+				yiliao_leibie = "普通门诊"
5345
+				break
5346
+			case "12":
5347
+				yiliao_leibie = "门诊挂号"
5348
+				break
5349
+			case "13":
5350
+				yiliao_leibie = "急诊"
5351
+				break
5352
+			case "14":
5353
+				yiliao_leibie = "门诊特殊病"
5354
+				break
5355
+			case "15":
5356
+				yiliao_leibie = "门诊统筹"
5357
+				break
5358
+			case "16":
5359
+				yiliao_leibie = "门诊慢性病"
5360
+				break
5361
+			case "21":
5362
+				yiliao_leibie = "普通住院"
5363
+				break
5364
+			}
5365
+			departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
5343 5366
 
5344
-		if res.Infcode == 0 {
5345
-			c.ServeSuccessJSON(map[string]interface{}{
5346
-				"diagnosis":                                   name,
5347
-				"order_infos":                                 orderInfos,
5348
-				"number":                                      order.MdtrtId,
5349
-				"date":                                        order.SettleAccountsDate,
5350
-				"charge_admin":                                charge_admin,
5351
-				"printor_admin":                               printor_admin,
5352
-				"info":                                        res.Output.Setlinfo,
5353
-				"bedCostTotal":                                bedCostTotal,
5354
-				"bedCostSelfTotal":                            bedCostSelfTotal,
5355
-				"bedCostPartSelfTotal":                        bedCostPartSelfTotal,
5356
-				"operationCostTotal":                          operationCostTotal,
5357
-				"operationCostSelfTotal":                      operationCostSelfTotal,
5358
-				"operationCostPartSelfTotal":                  operationCostPartSelfTotal,
5359
-				"otherCostTotal":                              otherCostTotal,
5360
-				"otherCostSelfTotal":                          otherCostSelfTotal,
5361
-				"otherCostPartSelfTotal":                      otherCostPartSelfTotal,
5362
-				"materialCostTotal":                           materialCostTotal,
5363
-				"materialCostSelfTotal":                       materialCostSelfTotal,
5364
-				"materialCostPartSelfTotal":                   materialCostPartSelfTotal,
5365
-				"westernMedicineCostTotal":                    westernMedicineCostTotal,
5366
-				"westernMedicineCostSelfTotal":                westernMedicineCostSelfTotal,
5367
-				"westernMedicineCostPartSelfTotal":            westernMedicineCostPartSelfTotal,
5368
-				"chineseTraditionalMedicineCostTotal":         chineseTraditionalMedicineCostTotal,
5369
-				"chineseTraditionalMedicineCostSelfTotal":     chineseTraditionalMedicineCostSelfTotal,
5370
-				"chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
5371
-				"checkCostTotal":                              checkCostTotal,
5372
-				"checkCostSelfTotal":                          checkCostSelfTotal,
5373
-				"checkCostPartSelfTotal":                      checkCostPartSelfTotal,
5374
-				"laboratoryCostTotal":                         laboratoryCostTotal,
5375
-				"laboratoryCostSelfTotal":                     laboratoryCostSelfTotal,
5376
-				"laboratoryCostPartSelfTotal":                 laboratoryCostPartSelfTotal,
5377
-				"treatCostTotal":                              treatCostTotal,
5378
-				"treatCostSelfTotal":                          treatCostSelfTotal,
5379
-				"treatCostPartSelfTotal":                      treatCostPartSelfTotal,
5380
-				"doctor_code":                                 adminRole_two.DoctorCode,
5381
-				"doctor_name":                                 doctor_name,
5382
-				"health_card_no":                              order.PsnNo,
5383
-				"department":                                  departments.Name,
5384
-				"yiliao_leibie":                               yiliao_leibie,
5385
-				"after_money":                                 order.AccountPrice,
5386
-				"patient":                                     patient,
5387
-				"org_name":                                    miConfig.OrgName,
5388
-				"org_code":                                    miConfig.Code,
5389
-				"order_number":                                order.Number,
5390
-			})
5367
+			if res.Infcode == 0 {
5368
+				c.ServeSuccessJSON(map[string]interface{}{
5369
+					"diagnosis":                                   name,
5370
+					"order_infos":                                 orderInfos,
5371
+					"number":                                      order.MdtrtId,
5372
+					"date":                                        order.SettleAccountsDate,
5373
+					"charge_admin":                                charge_admin,
5374
+					"printor_admin":                               printor_admin,
5375
+					"info":                                        res.Output.Setlinfo,
5376
+					"bedCostTotal":                                bedCostTotal,
5377
+					"bedCostSelfTotal":                            bedCostSelfTotal,
5378
+					"bedCostPartSelfTotal":                        bedCostPartSelfTotal,
5379
+					"operationCostTotal":                          operationCostTotal,
5380
+					"operationCostSelfTotal":                      operationCostSelfTotal,
5381
+					"operationCostPartSelfTotal":                  operationCostPartSelfTotal,
5382
+					"otherCostTotal":                              otherCostTotal,
5383
+					"otherCostSelfTotal":                          otherCostSelfTotal,
5384
+					"otherCostPartSelfTotal":                      otherCostPartSelfTotal,
5385
+					"materialCostTotal":                           materialCostTotal,
5386
+					"materialCostSelfTotal":                       materialCostSelfTotal,
5387
+					"materialCostPartSelfTotal":                   materialCostPartSelfTotal,
5388
+					"westernMedicineCostTotal":                    westernMedicineCostTotal,
5389
+					"westernMedicineCostSelfTotal":                westernMedicineCostSelfTotal,
5390
+					"westernMedicineCostPartSelfTotal":            westernMedicineCostPartSelfTotal,
5391
+					"chineseTraditionalMedicineCostTotal":         chineseTraditionalMedicineCostTotal,
5392
+					"chineseTraditionalMedicineCostSelfTotal":     chineseTraditionalMedicineCostSelfTotal,
5393
+					"chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
5394
+					"checkCostTotal":                              checkCostTotal,
5395
+					"checkCostSelfTotal":                          checkCostSelfTotal,
5396
+					"checkCostPartSelfTotal":                      checkCostPartSelfTotal,
5397
+					"laboratoryCostTotal":                         laboratoryCostTotal,
5398
+					"laboratoryCostSelfTotal":                     laboratoryCostSelfTotal,
5399
+					"laboratoryCostPartSelfTotal":                 laboratoryCostPartSelfTotal,
5400
+					"treatCostTotal":                              treatCostTotal,
5401
+					"treatCostSelfTotal":                          treatCostSelfTotal,
5402
+					"treatCostPartSelfTotal":                      treatCostPartSelfTotal,
5403
+					"doctor_code":                                 adminRole_two.DoctorCode,
5404
+					"doctor_name":                                 doctor_name,
5405
+					"health_card_no":                              order.PsnNo,
5406
+					"department":                                  departments.Name,
5407
+					"yiliao_leibie":                               yiliao_leibie,
5408
+					"after_money":                                 order.AccountPrice,
5409
+					"patient":                                     patient,
5410
+					"org_name":                                    miConfig.OrgName,
5411
+					"org_code":                                    miConfig.Code,
5412
+					"order_number":                                order.Number,
5413
+				})
5414
+			}
5391 5415
 		}
5392 5416
 	}
5393 5417
 

+ 20 - 0
models/his_models.go Vedi File

@@ -1262,3 +1262,23 @@ type NewCustom struct {
1262 1262
 	LmtUsedFlag      int64
1263 1263
 	HospApprFlag     int64
1264 1264
 }
1265
+
1266
+type HisPsn struct {
1267
+	ID          int64   `gorm:"column:id" json:"id" form:"id"`
1268
+	PsnNo       string  `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1269
+	Age         float64 `gorm:"column:age" json:"age" form:"age"`
1270
+	PatientId   int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1271
+	Certno      string  `gorm:"column:certno" json:"certno" form:"certno"`
1272
+	Brdy        string  `gorm:"column:brdy" json:"brdy" form:"brdy"`
1273
+	Gend        string  `gorm:"column:gend" json:"gend" form:"gend"`
1274
+	Naty        string  `gorm:"column:naty" json:"naty" form:"naty"`
1275
+	PsnCertType string  `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1276
+	PsnName     string  `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1277
+	Idetinfo    string  `gorm:"column:idetinfo" json:"idetinfo" form:"idetinfo"`
1278
+	Insuinfo    string  `gorm:"column:insuinfo" json:"insuinfo" form:"insuinfo"`
1279
+	UserOrgId   int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1280
+}
1281
+
1282
+func (HisPsn) TableName() string {
1283
+	return "his_psn"
1284
+}

+ 4 - 2
service/hbyb_service.go Vedi File

@@ -621,7 +621,7 @@ func Hbyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
621 621
 
622 622
 }
623 623
 
624
-func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) string {
624
+func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, med_type string) string {
625 625
 	// 生成签名
626 626
 	nonce := GetRandomString(32)
627 627
 	timestamp := time.Now().Unix()
@@ -630,10 +630,12 @@ func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
630 630
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
631 631
 	input := make(map[string]interface{})
632 632
 	inputData := make(map[string]interface{})
633
-	inputMessage["infno"] = "5203" // 交易编码
633
+	inputMessage["infno"] = "YH03" // 交易编码
634 634
 	inputData["psn_no"] = businessParams.PsnNo
635 635
 	inputData["setl_id"] = businessParams.SetlId
636 636
 	inputData["mdtrt_id"] = businessParams.MdtrtId
637
+	inputData["med_type"] = med_type
638
+
637 639
 	input["data"] = inputData
638 640
 	inputMessage["input"] = input //交易输入
639 641
 	bytesData, err := json.Marshal(inputMessage)

+ 9 - 0
service/his_service.go Vedi File

@@ -1330,3 +1330,12 @@ func GetOrderCountByNumber(org_id int64, patient_id int64, record_time int64, nu
1330 1330
 
1331 1331
 	return
1332 1332
 }
1333
+
1334
+func CreateHisPsn(psn *models.HisPsn) {
1335
+	writeDb.Save(&psn)
1336
+}
1337
+
1338
+func GetPsnByPatientId(patient_id int64) (psn models.HisPsn, err error) {
1339
+	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ?", patient_id).Last(&psn).Error
1340
+	return
1341
+}