Browse Source

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

csx 3 years ago
parent
commit
136d644c51
4 changed files with 128 additions and 11 deletions
  1. 107 4
      controllers/sg/his_api_controller.go
  2. 2 2
      models/his_models.go
  3. 5 5
      service/gdyb_service.go
  4. 14 0
      service/his_service.go

+ 107 - 4
controllers/sg/his_api_controller.go View File

71
 
71
 
72
 	//beego.Router("/api/reversal/one", &HisApiController{}, "get:ReversalOtherOneData")
72
 	//beego.Router("/api/reversal/one", &HisApiController{}, "get:ReversalOtherOneData")
73
 
73
 
74
+	//beego.Router("/api/settlelist/get", &HisApiController{}, "get:GetSettleList")
75
+
76
+}
77
+
78
+type CustomFundPay struct {
79
+	FundPayType string  `json:"fund_pay_type"`
80
+	FundPayamt  float64 `json:"fund_payamt"`
74
 }
81
 }
75
 
82
 
83
+//func (c *HisApiController) GetSettleList() {
84
+//	order_id, _ := c.GetInt64("order_id")
85
+//	order, _ := service.GetHisOrderByIDTwo(order_id)
86
+//
87
+//	roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
88
+//
89
+//	admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
90
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
91
+//	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
92
+//
93
+//	depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
94
+//
95
+//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
96
+//
97
+//	if order.ID == 0 {
98
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
99
+//		return
100
+//	}
101
+//	struct4101 := &service.Struct4101{
102
+//		PsnNo:          order.PsnNo,
103
+//		MdtrtId:        order.MdtrtId,
104
+//		SetlId:         order.SetlId,
105
+//		PsnName:        order.PsnName,
106
+//		Gend:           order.Gend,
107
+//		Brdy:           order.HisPatient.Brdy,
108
+//		Naty:           order.Naty,
109
+//		PatnCertType:   order.MdtrtCertType,
110
+//		Certno:         order.Certno,
111
+//		Prfs:           "90",
112
+//		ConerName:      roles[0].UserName,
113
+//		PatnRlts:       "99",
114
+//		ConerAddr:      miConfig.OrgName,
115
+//		ConerTel:       admin.Mobile,
116
+//		HiType:         order.Insutype,
117
+//		Insuplc:        miConfig.InsuplcAdmdvs,
118
+//		MaindiagFlag:   "1",
119
+//		BillCode:       "",
120
+//		BizSn:          "",
121
+//		BillNo:         "",
122
+//		PsnSelfPay:     order.PsnPartAmt,
123
+//		PsnOwnPay:      order.PsnPartAmt,
124
+//		AcctPay:        order.AcctPay,
125
+//		PsnCashpay:     order.PsnCashPay,
126
+//		HiPaymtd:       "1",
127
+//		Hsorg:          "医保中心",
128
+//		HsorgOpter:     "医保中心",
129
+//		MedinsFillPsn:  curRoles.UserName,
130
+//		MedinsFillDept: depart.Name,
131
+//	}
132
+//	if order.SettleType == 1 {
133
+//		t := time.Unix(int64(order.SettleAccountsDate), 0)
134
+//		dateStr := t.Format("2006-01-02")
135
+//		struct4101.SetlBegnDate = dateStr
136
+//		struct4101.SetlEndDate = dateStr
137
+//	} else {
138
+//		t := time.Unix(int64(order.SettleStartTime), 0)
139
+//		t2 := time.Unix(int64(order.SettleEndTime), 0)
140
+//		dateStartStr := t.Format("2006-01-02")
141
+//		dateEndStr := t2.Format("2006-01-02")
142
+//		struct4101.SetlBegnDate = dateStartStr
143
+//		struct4101.SetlEndDate = dateEndStr
144
+//	}
145
+//
146
+//	var rf []*CustomFundPay
147
+//	json.Unmarshal([]byte(order.SetlDetail), &rf)
148
+//
149
+//	for _, item := range rf {
150
+//		var  tempFunPay service.CustomStruct
151
+//		tempFunPay.FundPayamt = item.FundPayamt
152
+//		tempFunPay.FundPayType = item.FundPayType
153
+//		struct4101.CustomStruct = append(struct4101.CustomStruct,tempFunPay)
154
+//	}
155
+//
156
+//	var  tempOpspdiseinfo service.OpspdiseinfoStruct
157
+//
158
+//	tempOpspdiseinfo.DiagCode = "M07801"
159
+//	tempOpspdiseinfo.DiagName = ""
160
+//	tempOpspdiseinfo.MaindiagFlag = "1"
161
+//	tempOpspdiseinfo.OprnOprtCode = ""
162
+//	tempOpspdiseinfo.OprnOprtName = ""
163
+//	struct4101.OpspdiseinfoStruct = append(struct4101.OpspdiseinfoStruct,tempOpspdiseinfo)
164
+//
165
+//	var  iteminfo service.IteminfoStruct
166
+//
167
+//
168
+//	for _, item := range order.HisOrderInfo{
169
+//
170
+//		iteminfo.MedChrgitm = item.MedChrgitmType
171
+//		iteminfo.Amt = item.DetItemFeeSumamt
172
+//		iteminfo.ClaaSumfee = item.
173
+//
174
+//	}
175
+//
176
+//
177
+//
178
+//	service.Gdyb4101()
179
+//
180
+//}
181
+
76
 func (c *HisApiController) TestGetBasBaseInfo() {
182
 func (c *HisApiController) TestGetBasBaseInfo() {
77
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
183
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
78
 	Iinit := DllDef.MustFindProc("Init")
184
 	Iinit := DllDef.MustFindProc("Init")
1191
 			his.Ctime = time.Now().Unix()
1297
 			his.Ctime = time.Now().Unix()
1192
 			his.Mtime = time.Now().Unix()
1298
 			his.Mtime = time.Now().Unix()
1193
 			his.Status = 1
1299
 			his.Status = 1
1194
-			err := service.CreateHisPatientTwo(&his)
1195
 
1300
 
1196
 			lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1301
 			lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1197
 			if len(lists) == 1 {
1302
 			if len(lists) == 1 {
1249
 					return
1354
 					return
1250
 
1355
 
1251
 				} else {
1356
 				} else {
1252
-
1357
+					err := service.CreateHisPatientTwo(&his)
1253
 					c.ServeSuccessJSON(map[string]interface{}{
1358
 					c.ServeSuccessJSON(map[string]interface{}{
1254
 						"his_info": his,
1359
 						"his_info": his,
1255
 					})
1360
 					})
2689
 			return
2794
 			return
2690
 		}
2795
 		}
2691
 		if res.Infcode == 0 {
2796
 		if res.Infcode == 0 {
2692
-
2693
 			result := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
2797
 			result := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
2694
-
2695
 			var dat map[string]interface{}
2798
 			var dat map[string]interface{}
2696
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2799
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2697
 				fmt.Println(dat)
2800
 				fmt.Println(dat)

+ 2 - 2
models/his_models.go View File

678
 	RequestLog       string `gorm:"column:request_log" json:"request_log" form:"request_log"`
678
 	RequestLog       string `gorm:"column:request_log" json:"request_log" form:"request_log"`
679
 	RefundRequestLog string `gorm:"column:refund_request_log" json:"refund_request_log" form:"refund_request_log"`
679
 	RefundRequestLog string `gorm:"column:refund_request_log" json:"refund_request_log" form:"refund_request_log"`
680
 
680
 
681
-	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
681
+	HisOrderInfo        []*HisOrderInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
682
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
682
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
683
-	HisPatient          HisPatient          `gorm:"ForeignKey:HisPatientId;AssociationForeignKey:ID" json:"his_patient"`
683
+	HisPatient          HisPatient          `gorm:"ForeignKey:MdtrtId;AssociationForeignKey:Number" json:"his_patient"`
684
 	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
684
 	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
685
 }
685
 }
686
 
686
 

+ 5 - 5
service/gdyb_service.go View File

2094
 
2094
 
2095
 type CustomStruct struct {
2095
 type CustomStruct struct {
2096
 	FundPayType string
2096
 	FundPayType string
2097
-	FundPayamt  string
2097
+	FundPayamt  float64
2098
 }
2098
 }
2099
 
2099
 
2100
 type OpspdiseinfoStruct struct {
2100
 type OpspdiseinfoStruct struct {
2141
 	BizSn              string
2141
 	BizSn              string
2142
 	SetlBegnDate       string
2142
 	SetlBegnDate       string
2143
 	SetlEndDate        string
2143
 	SetlEndDate        string
2144
-	PsnSelfPay         string
2145
-	PsnOwnPay          string
2146
-	AcctPay            string
2147
-	PsnCashpay         string
2144
+	PsnSelfPay         float64
2145
+	PsnOwnPay          float64
2146
+	AcctPay            float64
2147
+	PsnCashpay         float64
2148
 	HiPaymtd           string
2148
 	HiPaymtd           string
2149
 	Hsorg              string
2149
 	Hsorg              string
2150
 	HsorgOpter         string
2150
 	HsorgOpter         string

+ 14 - 0
service/his_service.go View File

885
 	return
885
 	return
886
 }
886
 }
887
 
887
 
888
+func GetHisOrderByIDTwo(order_id int64) (order models.HisOrder, err error) {
889
+	err = readDb.Model(&models.HisOrder{}).Preload("HisOrderInfo", "status = 1").Preload("HisPatient", "status = 1").Where("id = ? AND status = 1", order_id).First(&order).Error
890
+	return
891
+}
892
+
888
 func GetHisOrderInfoByNumber(order_number string) (order []*models.HisOrderInfo, err error) {
893
 func GetHisOrderInfoByNumber(order_number string) (order []*models.HisOrderInfo, err error) {
889
 	err = readDb.Model(&models.HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Find(&order).Error
894
 	err = readDb.Model(&models.HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Find(&order).Error
890
 	return
895
 	return
1034
 	return role, err
1039
 	return role, err
1035
 }
1040
 }
1036
 
1041
 
1042
+func GetDoctorListTwo(orgid int64) (role []*models.SgjUserAdminRole, err error) {
1043
+
1044
+	db := UserReadDB().Table("sgj_user_admin_role as x").Where("x.status =1 AND x.user_type = 2")
1045
+	table := UserReadDB().Table("sgj_user_admin as a")
1046
+	fmt.Println(table)
1047
+	err = db.Select("x.id,x.admin_user_id,x.org_id,x.app_id,x.role_id,x.user_name,x.avatar,x.user_type,x.user_title,x.intro,x.user_title_name,x.role_ids,x.message,x.sex,x.birthday,x.sort,x.is_sort,x.department,x.department_id,x.age,x.nation,x.card_type,x.id_card,x.education,x.study_major_name,x.work_major_name,x.role_type,x.medical_code,x.doctor_code,x.licensing,x.job_number,x.prescription_qualification_identification,x.identification_outpatients,x.start_time,x.medical_range_code,x.medical_level,x.medical_type_job,x.pharmacist_registration_number,x.doctor_range_code,x.doctor_level,x.doctor_type_job,x.doctor_number,x.outpatient_illness_category,x.is_active,x.active_status,a.mobile").Joins("left join sgj_user_admin as a on a.id = x.admin_user_id").Scan(&role).Error
1048
+	return role, err
1049
+}
1050
+
1037
 func GetRoleList(orgid int64) (role []*models.SgjUserRole, err error) {
1051
 func GetRoleList(orgid int64) (role []*models.SgjUserRole, err error) {
1038
 
1052
 
1039
 	err = UserReadDB().Model(&role).Where("org_id = ? and status =1", orgid).Find(&role).Error
1053
 	err = UserReadDB().Model(&role).Where("org_id = ? and status =1", orgid).Find(&role).Error