test_user 1 month ago
parent
commit
d31706da74

+ 1 - 1
controllers/nm/nm_controller.go View File

@@ -68,7 +68,7 @@ func NmybRegistRouters() {
68 68
 	beego.Router("/nmyb/3502", &NmController{}, "get:Post3502")
69 69
 	beego.Router("/nmyb/3503", &NmController{}, "get:Post3503")
70 70
 	beego.Router("/nmyb/3504", &NmController{}, "get:Post3504")
71
-	beego.Router("/nmyb/3505", &NmController{}, "get:Post3505")
71
+	beego.Router("/nmyb/3505", &NmController{}, "post:Post3505")
72 72
 	beego.Router("/nmyb/3506", &NmController{}, "get:Post3506")
73 73
 	beego.Router("/nmyb/3507", &NmController{}, "get:Post3507")
74 74
 	beego.Router("/nmyb/3508", &NmController{}, "get:Post3508")

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


+ 11 - 0
controllers/zh/zh_his_api_controller.go View File

@@ -1709,6 +1709,16 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1709 1709
 		if len(insutypes) == 0 {
1710 1710
 			insutype = "310"
1711 1711
 		}
1712
+		var InsuplcAdmdvs string
1713
+		for _, item := range res.Output.Iinfo {
1714
+			utils.ErrorLog("解析失败:%v", item.Insutype)
1715
+			utils.ErrorLog("解析失败:%v", insutype)
1716
+
1717
+			if item.Insutype == insutype {
1718
+				InsuplcAdmdvs = item.InsuplcAdmdvs
1719
+			}
1720
+		}
1721
+		utils.ErrorLog("解析失败:%v", InsuplcAdmdvs)
1712 1722
 
1713 1723
 		Iinfos, _ := json.Marshal(res.Output.Iinfo)
1714 1724
 		Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
@@ -1727,6 +1737,7 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1727 1737
 			Insuinfo:     infoStr,
1728 1738
 			UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
1729 1739
 			VerifyNumber: "",
1740
+			InsuplcAdmdvs: InsuplcAdmdvs,
1730 1741
 		}
1731 1742
 		service.CreateHisPsn(psn)
1732 1743
 

+ 11 - 11
main.go View File

@@ -57,7 +57,7 @@ type ResultEmpty10265 struct {
57 57
 
58 58
 func init() {
59 59
 	//service.ConnectNMMSDB()
60
-	service.ConnectDB()
60
+	//service.ConnectDB()
61 61
 	//org_id, _ := beego.AppConfig.Int64("org_id")
62 62
 	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63 63
 	//////CreateLog(miConfig)
@@ -79,7 +79,7 @@ func main() {
79 79
 	//GetblBatchSettleList()
80 80
 	//GetblbrBatchSettleList()
81 81
 	//深圳百霖贝尔
82
-	//GetbrBatchSettleList()
82
+	//GetblbrBatchSettleList()
83 83
 
84 84
 	//a, _ := service.GetResultRecord("2023-01-01")
85 85
 	//ticker := time.Tick(2 * time.Hour)
@@ -924,7 +924,7 @@ type ResultSeventeen struct {
924 924
 
925 925
 func GetblbrBatchSettleList() {
926 926
 	org_id, _ := beego.AppConfig.Int64("org_id")
927
-	org_id = 10278
927
+	org_id = 10537
928 928
 	var orders []*models.HisOrder
929 929
 	//var orders []*models.HisOrderError
930 930
 	orders, _ = service.GetAllHisOrder10278()
@@ -933,26 +933,26 @@ func GetblbrBatchSettleList() {
933 933
 		order, _ := service.GetHisOrderByIDTwo(order_id)
934 934
 		if order.MedType == "14" {
935 935
 			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
936
-			var patientPrescription models.HisPrescriptionInfo
937
-			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
938
-			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
939
-			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
936
+			//var patientPrescription models.HisPrescriptionInfo
937
+			//patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
938
+			//doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
939
+			//department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
940 940
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
941 941
 			var configTwo []*models.HisXtDiagnoseConfig
942 942
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
943
-			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2791)
943
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2234)
944 944
 			for _, item := range diagnosis_idstwo {
945 945
 				id, _ := strconv.ParseInt(item, 10, 64)
946 946
 				diagnosisConfig, _ := service.FindDiagnoseById(id)
947 947
 				configTwo = append(configTwo, &diagnosisConfig)
948 948
 			}
949
-			patient, _ := service.GetPatientByIDTwo(10278, order.PatientId)
949
+			patient, _ := service.GetPatientByIDTwo(10537, order.PatientId)
950 950
 
951
-			sickConfig, _ := service.FindSickById(his.SickType)
951
+			//sickConfig, _ := service.FindSickById(his.SickType)
952 952
 			//if order.MedType == "1111" || order.MedType == "1112" {
953 953
 			//	order.MedType = "11"
954 954
 			//}
955
-			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
955
+			//service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
956 956
 
957 957
 			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
958 958
 			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)

+ 1 - 1
models/new_stock_models.go View File

@@ -423,7 +423,7 @@ type DrugFlow struct {
423 423
 	LastStockMaxNumber        int64                `gorm:"column:last_stock_max_number" json:"last_stock_max_number" form:"last_stock_max_number"`
424 424
 	LastStockMinNumber        int64                `gorm:"column:last_stock_min_number" json:"last_stock_min_number" form:"last_stock_min_number"`
425 425
 	AdviceId                  int64                `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
426
-	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
426
+	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:PatientId,RecordDate,DrugId;AssociationForeignKey:PatientId,SystemTime,DrugId" json:"advice"`
427 427
 	SupplyWarehouseId         int64                `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
428 428
 	SupplyCancelOutId         int64                `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
429 429
 	SupplyWarehouseDetailInfo int64                `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`

+ 1 - 1
service/ahyb_service.go View File

@@ -87,7 +87,7 @@ func AHyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
87 87
 	//request.Header.Set("_api_version", "1.0.0")
88 88
 	//request.Header.Set("_api_access_key", access_key)
89 89
 	//request.Header.Set("_api_signature", "")
90
-	AHyb1901(request_url)
90
+	//AHyb1901(request_url)
91 91
 	client := http.Client{}
92 92
 	resp, err := client.Do(request)
93 93
 	if err != nil {

+ 17 - 2
service/his_service.go View File

@@ -1430,6 +1430,11 @@ func UpdateHisPatientStatus(his *models.VMHisPatient) {
1430 1430
 	writeDb.Save(&his)
1431 1431
 }
1432 1432
 
1433
+func UpdateHisPatient123(his *Patients) {
1434
+	writeDb.Save(&his)
1435
+}
1436
+
1437
+
1433 1438
 func GetLastHisOrder(org_id int64) (his models.HisOrder, err error) {
1434 1439
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND order_status = 2 AND fa_piao_code <> '' AND fa_piao_number <> ''", org_id).Last(&his).Error
1435 1440
 	return
@@ -1532,6 +1537,10 @@ func GetPsnByPatientIdtWO(patient_id int64, record_date int64) (psn models.HisPs
1532 1537
 	return
1533 1538
 }
1534 1539
 
1540
+func GetHisPatientByPatientId(patient_id int64) (psn models.HisPatient, err error) {
1541
+	err = readDb.Model(&models.HisPatient{}).Where("patient_id = ?", patient_id).Last(&psn).Error
1542
+	return
1543
+}
1535 1544
 //func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
1536 1545
 //	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
1537 1546
 //	return
@@ -1570,7 +1579,7 @@ func GetOrderError10138() (order []*models.HisOrderError, err error) {
1570 1579
 }
1571 1580
 
1572 1581
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1573
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-10-01 00:00:00' AND setl_time <= '2024-10-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1582
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10537  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-09-01 00:00:00' AND setl_time <= '2024-10-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574 1583
 	fmt.Println(err)
1575 1584
 	return
1576 1585
 }
@@ -1735,6 +1744,12 @@ func GetNewDrugWarehouseInfo(org_id int64, id_arr []string) (newDrugWarehouse []
1735 1744
 	return
1736 1745
 }
1737 1746
 
1747
+
1748
+func GetNewDrugWarehouseInfobytime(org_id int64, s_time int64,e_time int64 ) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1749
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and ctime > ? and ctime < ? and drug_code <> '' ", org_id, s_time,e_time).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&newDrugWarehouse)
1750
+	return
1751
+}
1752
+
1738 1753
 func GetNewDrugFlowInfo(org_id int64, id_arr []string) (flows []*models.DrugFlow, err error) {
1739 1754
 	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 {
1740 1755
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
@@ -1771,7 +1786,7 @@ func GetNewDrugFlowInfothree() (flows []*models.DrugFlow, err error) {
1771 1786
 }
1772 1787
 
1773 1788
 func GetNewDrugFlowInfothree123() (flows []*models.DrugFlow, err error) {
1774
-	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = 10217 and status = 1 and length(drug_code) > 0   and consumable_type = 3 and is_sale = 0").Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1789
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = 10217 and status = 1 and length(drug_code) > 0   and consumable_type = 3 and is_sale = 0 and id > 2739716").Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775 1790
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1776 1791
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1777 1792
 	return

+ 9 - 2
service/jsyb_service.go View File

@@ -9,6 +9,7 @@ import (
9 9
 	//"io/ioutil"
10 10
 	"net"
11 11
 	"strings"
12
+	"regexp"
12 13
 	//"net/http"
13 14
 	"strconv"
14 15
 	"time"
@@ -1920,7 +1921,7 @@ func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1920 1921
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
1921 1922
 	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
1922 1923
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
1923
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
1924
+	inputData["drug_trac_codg"] = "---"          // 人员编号 (来自1101接口返回)
1924 1925
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
1925 1926
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
1926 1927
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
@@ -1933,8 +1934,14 @@ func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1933 1934
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
1934 1935
 	for _, item := range codes {
1935 1936
 		if len(item) > 0 {
1937
+			fmt.Println(item)
1938
+
1939
+			re := regexp.MustCompile("[^0-9]")
1940
+			// 替换所有非数字字符为空字符串
1941
+			fmt.Println(re.ReplaceAllString(item, ""))
1942
+
1936 1943
 			druginputData := make(map[string]interface{})
1937
-			druginputData["drug_trac_codg"] = item
1944
+			druginputData["drug_trac_codg"] = re.ReplaceAllString(item, "")
1938 1945
 			feedetail = append(feedetail, druginputData)
1939 1946
 		}
1940 1947
 	}

+ 56 - 0
service/jx_service.go View File

@@ -69,6 +69,62 @@ func Jxyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
69 69
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
70 70
 }
71 71
 
72
+
73
+func Jxyb1101bycard(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, name string,id_card_no string) (string, string) {
74
+	timestamp := time.Now().Unix()
75
+	//生成输入报文
76
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
77
+
78
+	input := make(map[string]interface{})
79
+	inputData := make(map[string]interface{})
80
+	inputMessage["infno"] = "1101" // 交易编码
81
+
82
+	if certificates == "3" {
83
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
84
+		inputData["certno"] = certNo        // 证件号码
85
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
86
+
87
+	} else {
88
+		if id_card_type == 1 {
89
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
90
+			inputData["card_sn"] = card_sn      // 卡识别码
91
+			inputData["certno"] = id_card_no        // 证件号码
92
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
93
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
94
+
95
+
96
+		} else if id_card_type == 4 {
97
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
98
+			inputData["card_sn"] = ""      // 卡识别码
99
+			inputData["certno"] = certNo        // 证件号码
100
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
101
+			inputData["mdtrt_cert_no"] = card_sn // 就诊凭证编号
102
+
103
+		}else {
104
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
105
+			inputData["card_sn"] = ""           // 卡识别码
106
+			inputData["certno"] = certNo        // 证件号码
107
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
108
+		}
109
+	}
110
+
111
+	inputData["begntime"] = ""          // 开始时间
112
+	inputData["psn_name"] = name          // 人员姓名
113
+	input["data"] = inputData
114
+	inputMessage["input"] = input //交易输入
115
+
116
+	var inputLog string
117
+	bytesData, _ := json.Marshal(inputMessage)
118
+	inputLog = string(bytesData)
119
+	fmt.Println(string(bytesData))
120
+	if err != nil {
121
+		fmt.Println(err.Error())
122
+		return err.Error(), ""
123
+	}
124
+	request_url = request_url + "1101"
125
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
126
+}
127
+
72 128
 //人员基本信息版本2
73 129
 func Jxyb1101A(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
74 130
 	timestamp := time.Now().Unix()

+ 13 - 2
service/nm_service.go View File

@@ -1288,7 +1288,7 @@ func NMyb3505(struct3505 models.Struct3505, secret_key string) (string,string) {
1288 1288
 	signature := setSignature(timestamp, nonce, secret_key)
1289 1289
 
1290 1290
 	// 生成输入报文
1291
-	inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1291
+	inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1292 1292
 	input := make(map[string]interface{})
1293 1293
 	inputData := make(map[string]interface{})
1294 1294
 	inputMessage["infno"] = "3505"                                  // 交易编码
@@ -1327,13 +1327,24 @@ func NMyb3505(struct3505 models.Struct3505, secret_key string) (string,string) {
1327 1327
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
1328 1328
 
1329 1329
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
1330
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
1330
+	inputData["drug_trac_codg"] = "---"         // 人员编号 (来自1101接口返回)
1331 1331
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
1332 1332
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
1333 1333
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
1334 1334
 	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
1335 1335
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
1336 1336
 	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
1337
+	feedetail := make([]map[string]interface{}, 0)
1338
+
1339
+	codes := strings.Split(struct3505.DrugTracCodg, ",")
1340
+	for _, item := range codes {
1341
+		if len(item) > 0 {
1342
+			druginputData := make(map[string]interface{})
1343
+			druginputData["drug_trac_codg"] = item
1344
+			feedetail = append(feedetail, druginputData)
1345
+		}
1346
+	}
1347
+	inputData["drugtracinfo"] = feedetail
1337 1348
 	input["selinfo"] = inputData
1338 1349
 	inputMessage["input"] = input //交易输入
1339 1350