Browse Source

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

csx 3 years ago
parent
commit
2162843fb7

+ 3 - 7
controllers/sg/his_api_controller.go View File

48
 	//beego.Router("/api/patient/info", &HisApiController{}, "get:GetHisPatientInfo")
48
 	//beego.Router("/api/patient/info", &HisApiController{}, "get:GetHisPatientInfo")
49
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
49
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
50
 	//beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
50
 	//beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
51
-
52
 	beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
51
 	beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
53
-
54
 	//beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
52
 	//beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
55
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
53
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
56
-
57
 	//beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
54
 	//beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
58
-
59
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
55
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
60
-
61
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
56
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
62
-
63
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
57
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
64
 	//备案撤销相关接口
58
 	//备案撤销相关接口
65
 	beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
59
 	beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
6396
 	end_time := c.GetString("end_time")
6390
 	end_time := c.GetString("end_time")
6397
 	insutype := c.GetString("insutype")
6391
 	insutype := c.GetString("insutype")
6398
 	clr_type := c.GetString("clr_type")
6392
 	clr_type := c.GetString("clr_type")
6393
+	clr_org := c.GetString("clr_optins")
6394
+
6399
 	admin_user_id, _ := c.GetInt64("admin_user_id")
6395
 	admin_user_id, _ := c.GetInt64("admin_user_id")
6400
 
6396
 
6401
 	adminUser := c.GetAdminUserInfo()
6397
 	adminUser := c.GetAdminUserInfo()
6406
 	loc, _ := time.LoadLocation("Local")
6402
 	loc, _ := time.LoadLocation("Local")
6407
 	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
6403
 	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
6408
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
6404
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
6409
-	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
6405
+	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_org)
6410
 	//orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
6406
 	//orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
6411
 	fixmedins_setl_cnt := int64(len(orders))
6407
 	fixmedins_setl_cnt := int64(len(orders))
6412
 	//
6408
 	//

+ 3 - 1
controllers/zh/zh_his_api_controller.go View File

622
 
622
 
623
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
623
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
624
 	role, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
624
 	role, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
625
-	result := service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, name)
625
+	result, request_log, result_log := service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, name)
626
+	fmt.Println(request_log)
627
+	fmt.Println(result_log)
626
 
628
 
627
 	doctorInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
629
 	doctorInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
628
 
630
 

+ 6 - 2
service/his_service.go View File

964
 	return
964
 	return
965
 }
965
 }
966
 
966
 
967
-func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
968
-	err = readDb.Model(&models.HisOrder{}).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) >= ? AND insutype = ?", org_id, end_time, start_time, insutype).Find(&orders).Error
967
+func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_org string) (orders []*models.HisOrder, err error) {
968
+	if len(clr_org) > 0 {
969
+		err = readDb.Model(&models.HisOrder{}).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) >= ? AND insutype = ? AND clr_org = ?", org_id, end_time, start_time, insutype, clr_org).Find(&orders).Error
970
+	} else {
971
+		err = readDb.Model(&models.HisOrder{}).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) >= ? AND insutype = ? ", org_id, end_time, start_time, insutype).Find(&orders).Error
972
+	}
969
 	return
973
 	return
970
 }
974
 }
971
 
975
 

+ 10 - 6
service/zh_his_service.go View File

15
 )
15
 )
16
 
16
 
17
 // 人员基本信息
17
 // 人员基本信息
18
-func ZHGdyb1101(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 int64, name string) string {
18
+func ZHGdyb1101(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 int64, name string) (string, string, string) {
19
 	//生成签名
19
 	//生成签名
20
+	var requestLog string
21
+	var resultLog string
20
 	nonce := GetRandomString(32)
22
 	nonce := GetRandomString(32)
21
 	timestamp := time.Now().Unix()
23
 	timestamp := time.Now().Unix()
22
 	signature := setSignature(timestamp, nonce, secret_key)
24
 	signature := setSignature(timestamp, nonce, secret_key)
54
 
56
 
55
 	bytesData, err := json.Marshal(inputMessage)
57
 	bytesData, err := json.Marshal(inputMessage)
56
 	fmt.Println(string(bytesData))
58
 	fmt.Println(string(bytesData))
59
+	requestLog = string(bytesData)
57
 	if err != nil {
60
 	if err != nil {
58
 		fmt.Println(err.Error())
61
 		fmt.Println(err.Error())
59
-		return err.Error()
62
+		return err.Error(), "", ""
60
 	}
63
 	}
61
 	reader := bytes.NewReader(bytesData)
64
 	reader := bytes.NewReader(bytesData)
62
 	gdyb_url := beego.AppConfig.String("gdyb_url")
65
 	gdyb_url := beego.AppConfig.String("gdyb_url")
71
 	request, err := http.NewRequest("POST", url, reader)
74
 	request, err := http.NewRequest("POST", url, reader)
72
 	if err != nil {
75
 	if err != nil {
73
 		fmt.Println(err.Error())
76
 		fmt.Println(err.Error())
74
-		return err.Error()
77
+		return err.Error(), "", ""
75
 	}
78
 	}
76
 
79
 
77
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
80
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
84
 	resp, err := client.Do(request)
87
 	resp, err := client.Do(request)
85
 	if err != nil {
88
 	if err != nil {
86
 		fmt.Println(err.Error())
89
 		fmt.Println(err.Error())
87
-		return err.Error()
90
+		return err.Error(), "", ""
88
 	}
91
 	}
89
 	respBytes, err := ioutil.ReadAll(resp.Body)
92
 	respBytes, err := ioutil.ReadAll(resp.Body)
90
 	if err != nil {
93
 	if err != nil {
91
 		fmt.Println(err.Error())
94
 		fmt.Println(err.Error())
92
-		return err.Error()
95
+		return err.Error(), "", ""
93
 	}
96
 	}
94
 	fmt.Println(string(respBytes))
97
 	fmt.Println(string(respBytes))
95
 	str := string(respBytes)
98
 	str := string(respBytes)
96
-	return str
99
+	resultLog = str
100
+	return str, requestLog, resultLog
97
 }
101
 }
98
 
102
 
99
 type DiseinfoStruct struct {
103
 type DiseinfoStruct struct {