Преглед на файлове

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx преди 4 години
родител
ревизия
f16aa5662f
променени са 6 файла, в които са добавени 660 реда и са изтрити 418 реда
  1. 5 5
      controllers/dialysis_api_controller.go
  2. 17 6
      controllers/gdyb_controller.go
  3. 530 362
      controllers/his_api_controller.go
  4. 38 6
      models/his_models.go
  5. 27 37
      service/gdyb_service.go
  6. 43 2
      service/his_service.go

+ 5 - 5
controllers/dialysis_api_controller.go Целия файл

@@ -322,7 +322,7 @@ func (c *DialysisApiController) PostPrescription() {
322 322
 		PreImpulse:                 preImpules,
323 323
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
324 324
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
325
-		Blood:                      blood,
325
+		Blood: blood,
326 326
 	}
327 327
 
328 328
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -578,7 +578,7 @@ func (c *DialysisApiController) PostSoulution() {
578 578
 
579 579
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
580 580
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
581
-		Blood:                     blood,
581
+		Blood: blood,
582 582
 	}
583 583
 
584 584
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -2512,8 +2512,8 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
2512 2512
 	}
2513 2513
 	utils.ErrorLog("%v", dataBody)
2514 2514
 
2515
-	//timeLayout := "2006-01-02 15:04"
2516
-	//loc, _ := time.LoadLocation("Local")
2515
+	timeLayout := "2006-01-02 15:04"
2516
+	loc, _ := time.LoadLocation("Local")
2517 2517
 
2518 2518
 	timeLayout2 := "2006-01-02"
2519 2519
 	loc2, _ := time.LoadLocation("Local")
@@ -2543,7 +2543,7 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
2543 2543
 		utils.ErrorLog("len(start_time) == 0")
2544 2544
 		return
2545 2545
 	}
2546
-	theTimeUnix, err := time.ParseInLocation(timeLayout2, startTime, loc2)
2546
+	theTimeUnix, err := time.ParseInLocation(timeLayout, startTime, loc)
2547 2547
 	if err != nil {
2548 2548
 		utils.ErrorLog(err.Error())
2549 2549
 		return

+ 17 - 6
controllers/gdyb_controller.go Целия файл

@@ -70,8 +70,9 @@ func (c *GdybController) PostOne() {
70 70
 	certNo := c.GetString("cert_no")
71 71
 	org_name := c.GetString("org_name")
72 72
 	doctor := c.GetString("doctor")
73
+	fixmedins_code := c.GetString("fixmedins_code")
73 74
 
74
-	result := service.Gdyb1101(certNo, org_name, doctor)
75
+	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code)
75 76
 
76 77
 	var dat map[string]interface{}
77 78
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -91,8 +92,9 @@ func (c *GdybController) PostTwo() {
91 92
 	doctor := c.GetString("doctor")
92 93
 	ipt_otp_no := c.GetString("ipt_otp_no")
93 94
 	dept := c.GetString("dept")
95
+	fixmedins_code := c.GetString("fixmedins_code")
94 96
 
95
-	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept)
97
+	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code)
96 98
 
97 99
 	var dat map[string]interface{}
98 100
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -125,10 +127,17 @@ func (c *GdybController) PostFour() {
125 127
 	department := c.GetString("department")
126 128
 	diag := c.GetString("diag")
127 129
 	org_name := c.GetString("org_name")
130
+	med_type := c.GetString("med_type")
131
+	doctor_id, _ := c.GetInt64("doctor_id", 0)
132
+	fixmedins_code := c.GetString("fixmedins_code")
128 133
 
129
-	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name)
134
+	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code)
135
+	var dat map[string]interface{}
136
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
137
+	} else {
138
+	}
130 139
 	c.ServeSuccessJSON(map[string]interface{}{
131
-		"pre": result,
140
+		"pre": dat,
132 141
 	})
133 142
 }
134 143
 
@@ -169,7 +178,8 @@ func (c *GdybController) PostFive() {
169 178
 		utils.ErrorLog("解析失败:%v", err)
170 179
 		return
171 180
 	}
172
-	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string), respJSON["doctor"].(string), respJSON["dept"].(string))
181
+
182
+	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string), respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string))
173 183
 
174 184
 	var dat map[string]interface{}
175 185
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -227,8 +237,9 @@ func (c *GdybController) PostEight() {
227 237
 	total := c.GetString("total")
228 238
 	org_name := c.GetString("org_name")
229 239
 	doctor := c.GetString("doctor")
240
+	fixmedins_code := c.GetString("fixmedins_code")
230 241
 
231
-	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor)
242
+	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code)
232 243
 	var dat map[string]interface{}
233 244
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
234 245
 		fmt.Println(dat)

Файловите разлики са ограничени, защото са твърде много
+ 530 - 362
controllers/his_api_controller.go


+ 38 - 6
models/his_models.go Целия файл

@@ -264,6 +264,7 @@ type HisPrescriptionInfo struct {
264 264
 	PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
265 265
 	PrescriptionStatus int64  `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
266 266
 	BatchNumber        string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
267
+	DoctorId           int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
267 268
 }
268 269
 
269 270
 func (HisPrescriptionInfo) TableName() string {
@@ -553,7 +554,7 @@ type HisOrder struct {
553 554
 	Insutype           string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
554 555
 	PsnType            string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
555 556
 	CvlservFlag        string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
556
-	SetlTime           time.Time `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
557
+	SetlTime           string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
557 558
 	MdtrtCertType      string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
558 559
 	MedType            string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
559 560
 	MedfeeSumamt       float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
@@ -581,11 +582,7 @@ type HisOrder struct {
581 582
 	ClrOptins          string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
582 583
 	ClrWay             string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
583 584
 	ClrType            string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
584
-	FundPayType        string    `gorm:"column:fund_pay_type" json:"fund_pay_type" form:"fund_pay_type"`
585
-	CrtPaybLmtAmt      float64   `gorm:"column:crt_payb_lmt_amt" json:"crt_payb_lmt_amt" form:"crt_payb_lmt_amt"`
586
-	FundPayamt         float64   `gorm:"column:fund_payamt" json:"fund_payamt" form:"fund_payamt"`
587
-	FundPayTypeName    string    `gorm:"column:fund_pay_type_name" json:"fund_pay_type_name" form:"fund_pay_type_name"`
588
-	SetlProcInfo       string    `gorm:"column:setl_proc_info" json:"setl_proc_info" form:"setl_proc_info"`
585
+	SetlDetail         string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
589 586
 
590 587
 	HisOrderInfo        HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
591 588
 	Patients            Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -693,3 +690,38 @@ type MedicalInsuranceConfig struct {
693 690
 func (MedicalInsuranceConfig) TableName() string {
694 691
 	return "medical_insurance_config"
695 692
 }
693
+
694
+type HisOrderError struct {
695
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
696
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
697
+	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
698
+	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
699
+	Number     string `gorm:"column:number" json:"number" form:"number"`
700
+	ErrMsg     string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
701
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
702
+	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
703
+	RecordTime int64  `gorm:"column:record_time" json:"record_time" form:"record_time"`
704
+	Stage      int64  `gorm:"column:stage" json:"stage" form:"stage"`
705
+}
706
+
707
+func (HisOrderError) TableName() string {
708
+	return "his_order_error"
709
+}
710
+
711
+type MedicalInsuranceOrgConfig struct {
712
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
713
+	Code          string `gorm:"column:code" json:"code" form:"code"`
714
+	OrgName       string `gorm:"column:org_name" json:"org_name" form:"org_name"`
715
+	Vpn           string `gorm:"column:vpn" json:"vpn" form:"vpn"`
716
+	EleCardId     string `gorm:"column:ele_card_id" json:"ele_card_id" form:"ele_card_id"`
717
+	EleCardKey    string `gorm:"column:ele_card_key" json:"ele_card_key" form:"ele_card_key"`
718
+	ChannelNumber string `gorm:"column:channel_number" json:"channel_number" form:"channel_number"`
719
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
720
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
721
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
722
+	UserOrgId     int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
723
+}
724
+
725
+func (MedicalInsuranceOrgConfig) TableName() string {
726
+	return "medical_insurance_org_config"
727
+}

+ 27 - 37
service/gdyb_service.go Целия файл

@@ -16,19 +16,18 @@ import (
16 16
 )
17 17
 
18 18
 const (
19
-	SceretKey     = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" //     secretKey 私钥
20
-	FixmedinsCOde = "H44022900158"                     // 定点医药机构编号
19
+	SceretKey = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" //     secretKey 私钥
21 20
 )
22 21
 
23 22
 // 人员基本信息
24
-func Gdyb1101(certNo string, org_name string, doctor string) string {
23
+func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code string) string {
25 24
 	// 生成签名
26 25
 	nonce := GetRandomString(32)
27 26
 	timestamp := time.Now().Unix()
28 27
 	signature := setSignature(timestamp, nonce)
29 28
 
30 29
 	// 生成输入报文
31
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
30
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
32 31
 	input := make(map[string]interface{})
33 32
 	inputData := make(map[string]interface{})
34 33
 	inputMessage["infno"] = "1101"      // 交易编码
@@ -80,7 +79,7 @@ func Gdyb1101(certNo string, org_name string, doctor string) string {
80 79
 }
81 80
 
82 81
 // 门诊挂号
83
-func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string) string {
82
+func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string, fixmedins_code string) string {
84 83
 	// 生成签名
85 84
 	nonce := GetRandomString(32)
86 85
 	timestamp := time.Now().Unix()
@@ -89,7 +88,7 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
89 88
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
90 89
 
91 90
 	// 生成输入报文
92
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
91
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
93 92
 	input := make(map[string]interface{})
94 93
 	inputData := make(map[string]interface{})
95 94
 	inputMessage["infno"] = "2201"        // 交易编码
@@ -153,7 +152,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
153 152
 	signature := setSignature(timestamp, nonce)
154 153
 
155 154
 	// 生成输入报文
156
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
155
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
157 156
 	input := make(map[string]interface{})
158 157
 	inputData := make(map[string]interface{})
159 158
 	inputMessage["infno"] = "2202"       // 交易编码
@@ -202,7 +201,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
202 201
 }
203 202
 
204 203
 // 门诊就诊信息上传
205
-func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string) string {
204
+func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string) string {
206 205
 	// 生成签名
207 206
 	nonce := GetRandomString(32)
208 207
 	timestamp := time.Now().Unix()
@@ -211,7 +210,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
211 210
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
212 211
 
213 212
 	// 生成输入报文
214
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
213
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
215 214
 	input := make(map[string]interface{})
216 215
 	inputData := make(map[string]interface{})
217 216
 	diseinfo := make([]map[string]interface{}, 0)
@@ -219,7 +218,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
219 218
 	inputMessage["infno"] = "2203"        // 交易编码
220 219
 	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
221 220
 	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
222
-	inputData["med_type"] = "11"          // 医疗类别 16门诊特殊病
221
+	inputData["med_type"] = med_type      // 医疗类别 16门诊特殊病
223 222
 	inputData["begntime"] = timeFormatOne // 开始时间
224 223
 	inputData["main_cond_dscr"] = ""      // 主要病情描述
225 224
 	inputData["dise_codg"] = ""           // 病种编码
@@ -233,7 +232,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
233 232
 	diseinfo_sun["diag_code"] = "A04.902"     // 诊断代码
234 233
 	diseinfo_sun["diag_name"] = diag          // 诊断名称
235 234
 	diseinfo_sun["diag_dept"] = department    // 诊断科室
236
-	diseinfo_sun["dise_dor_no"] = "1002"      // 诊断医生编码
235
+	diseinfo_sun["dise_dor_no"] = doctor_id   // 诊断医生编码
237 236
 	diseinfo_sun["dise_dor_name"] = doctor    // 诊断医生姓名
238 237
 	diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
239 238
 	diseinfo_sun["vali_flag"] = "1"           // 有效标志
@@ -335,7 +334,7 @@ type Result struct {
335 334
 }
336 335
 
337 336
 //  门诊费用明细信息上传
338
-func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string) string {
337
+func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string) string {
339 338
 	// 生成签名
340 339
 	nonce := GetRandomString(32)
341 340
 	timestamp := time.Now().Unix()
@@ -383,10 +382,8 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
383 382
 		}
384 383
 	}
385 384
 
386
-	fmt.Println(customs)
387
-
388 385
 	// 生成输入报文
389
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
386
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
390 387
 	input := make(map[string]interface{})
391 388
 	feedetail := make([]map[string]interface{}, 0)
392 389
 	inputMessage["infno"] = "2204" // 交易编码
@@ -403,7 +400,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
403 400
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
404 401
 		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
405 402
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
406
-		feedetailInfo["medins_list_codg"] = FixmedinsCOde            // 医药机构目录编码
403
+		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
407 404
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
408 405
 		feedetailInfo["cnt"] = item.Cut                              // 数量
409 406
 		feedetailInfo["pric"] = item.Price                           // 单价
@@ -479,7 +476,7 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
479 476
 	signature := setSignature(timestamp, nonce)
480 477
 
481 478
 	// 生成输入报文
482
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
479
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
483 480
 	input := make(map[string]interface{})
484 481
 	inputData := make(map[string]interface{})
485 482
 	inputMessage["infno"] = "2205" // 交易编码
@@ -539,7 +536,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
539 536
 	signature := setSignature(timestamp, nonce)
540 537
 
541 538
 	// 生成输入报文
542
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
539
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
543 540
 	input := make(map[string]interface{})
544 541
 	inputData := make(map[string]interface{})
545 542
 	inputMessage["infno"] = "2206" // 交易编码
@@ -596,14 +593,14 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
596 593
 }
597 594
 
598 595
 //  门诊结算
599
-func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string) string {
596
+func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string) string {
600 597
 	// 生成签名
601 598
 	nonce := GetRandomString(32)
602 599
 	timestamp := time.Now().Unix()
603 600
 	signature := setSignature(timestamp, nonce)
604 601
 
605 602
 	// 生成输入报文
606
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
603
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code)
607 604
 	input := make(map[string]interface{})
608 605
 	inputData := make(map[string]interface{})
609 606
 	inputMessage["infno"] = "2207" // 交易编码
@@ -668,7 +665,7 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
668 665
 	signature := setSignature(timestamp, nonce)
669 666
 
670 667
 	// 生成输入报文
671
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
668
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
672 669
 	input := make(map[string]interface{})
673 670
 	inputData := make(map[string]interface{})
674 671
 	inputMessage["infno"] = "2208" // 交易编码
@@ -938,7 +935,7 @@ func GetRandomString(l int) string {
938 935
 }
939 936
 
940 937
 // 生成基础报文
941
-func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string) map[string]interface{} {
938
+func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string) map[string]interface{} {
942 939
 	// 生成签名
943 940
 	tempTime := time.Unix(timestamp, 0)
944 941
 	timeFormat := tempTime.Format("20060102150405")
@@ -949,7 +946,7 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
949 946
 	inputMessage := make(map[string]interface{})
950 947
 
951 948
 	inputMessage["infno"] = "1101"                                                              // 交易编码
952
-	inputMessage["msgid"] = "H44022900158" + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
949
+	inputMessage["msgid"] = fixmedins_code + timeFormat + strconv.FormatInt(int64(randNum), 10) // 发送方报文 ID
953 950
 	inputMessage["mdtrtarea_admvs"] = "440200"                                                  // 就医地医保区划
954 951
 	inputMessage["insuplc_admdvs"] = "440200"                                                   // 参保地医保区划
955 952
 	inputMessage["recer_sys_code"] = "01"                                                       // 接收方系统代码
@@ -962,19 +959,12 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
962 959
 	inputMessage["opter"] = "mockuser"                                                          // 经办人
963 960
 	inputMessage["opter_name"] = doctor                                                         // 经办人姓名
964 961
 	inputMessage["inf_time"] = timeFormatOne                                                    // 交易时间
965
-	inputMessage["fixmedins_code"] = FixmedinsCOde                                              // 定点医药机构编号
966
-	inputMessage["fixmedins_name"] = ""                                                         //定点医药机构名称
962
+	inputMessage["fixmedins_code"] = fixmedins_code                                             // 定点医药机构编号
963
+	inputMessage["fixmedins_name"] = org_name                                                   //定点医药机构名称
967 964
 	inputMessage["sign_no"] = ""                                                                //交易签到流水号
968 965
 	return inputMessage
969 966
 }
970 967
 
971
-func FindHisRegisterRecord(record_time int64, patient_id int64, org_id int64) (total int64, err error) {
972
-
973
-	err = readDb.Model(&models.VMHisPatient{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND record_date = ?", org_id, patient_id, record_time).Count(&total).Error
974
-
975
-	return
976
-}
977
-
978 968
 func Gdyb1201(psnNo string, org_name string, doctor string) string {
979 969
 	// 生成签名
980 970
 	nonce := GetRandomString(32)
@@ -982,13 +972,13 @@ func Gdyb1201(psnNo string, org_name string, doctor string) string {
982 972
 	signature := setSignature(timestamp, nonce)
983 973
 
984 974
 	// 生成输入报文
985
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor)
975
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
986 976
 	input := make(map[string]interface{})
987 977
 	inputData := make(map[string]interface{})
988
-	inputMessage["infno"] = "1201"             // 交易编码
989
-	inputData["fixmedins_type"] = psnNo        // 人员编号 (来自1101接口返回)
990
-	inputData["fixmedins_name"] = "翁源沅胜血液透析中心" // 人员编号 (来自1101接口返回)
991
-	inputData["fixmedins_code"] = ""           // 人员编号 (来自1101接口返回)
978
+	inputMessage["infno"] = "1201"         // 交易编码
979
+	inputData["fixmedins_type"] = psnNo    // 人员编号 (来自1101接口返回)
980
+	inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
981
+	inputData["fixmedins_code"] = ""       // 人员编号 (来自1101接口返回)
992 982
 
993 983
 	input["medinsinfo"] = inputData
994 984
 	inputMessage["input"] = input //交易输入

+ 43 - 2
service/his_service.go Целия файл

@@ -265,7 +265,7 @@ func UpDatePrescriptionNumber(user_org_id int64, ids []int64, number string) (er
265 265
 }
266 266
 
267 267
 func UpDatePrescriptionInfoNumber(user_org_id int64, id int64, number string, record_time int64) (err error) {
268
-	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND record_date = ?", user_org_id, id, record_time).Updates(map[string]interface{}{"batch_number": number, "status": 2, "mtime": time.Now().Unix()}).Error
268
+	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND record_date = ?", user_org_id, id, record_time).Updates(map[string]interface{}{"batch_number": number, "prescription_status": 3, "mtime": time.Now().Unix()}).Error
269 269
 
270 270
 	return
271 271
 }
@@ -335,6 +335,7 @@ type HisPrescriptionInfo struct {
335 335
 	PrescriptionNumber string            `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
336 336
 	BatchNumber        string            `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
337 337
 	PrescriptionStatus int64             `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
338
+	DoctorId           int64             `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
338 339
 }
339 340
 
340 341
 func (HisPrescriptionInfo) TableName() string {
@@ -377,7 +378,47 @@ func GetMedicalInsuranceConfig(org_id int64) (medicalInsuranceConfig models.Medi
377 378
 func UpdataOrderStatus(id int64, number string, user_org_id int64) (err error) {
378 379
 	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix()}).Error
379 380
 	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix()}).Error
380
-	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 4, "mtime": time.Now().Unix()}).Error
381
+	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 4, "mtime": time.Now().Unix()}).Error
382
+
383
+	return
384
+
385
+}
386
+
387
+func GetAdminUserInfoByID(org_id int64, admin_user_id int64) (role models.UserAdminRole, err error) {
388
+	err = readUserDb.Model(&models.UserAdminRole{}).Where("org_id = ? AND status = 1 AND admin_user_id = ?", org_id, admin_user_id).First(&role).Error
389
+	return
390
+}
391
+
392
+func GetHisOrderTwo(user_org_id int64, number string, patient_id int64) (order models.HisOrder, err error) {
393
+	err = readDb.Model(&HisOrder{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND number=?", user_org_id, patient_id, number).
394
+		First(&order).Error
395
+	return
396
+}
397
+
398
+func UpDateOrder(order models.HisOrder) (err error) {
399
+	err = writeDb.Save(&order).Error
400
+	return
401
+}
402
+
403
+func UpdataOrderStatusTwo(number string, user_org_id int64) (err error) {
404
+	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix()}).Error
405
+	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 3, "mtime": time.Now().Unix()}).Error
381 406
 	return
407
+}
408
+
409
+func CreateErrMsgLog(log *models.HisOrderError) {
410
+	writeDb.Model(&models.HisOrderError{}).Create(&log)
411
+
412
+}
382 413
 
414
+func FindHisRegisterRecord(record_time int64, patient_id int64, org_id int64) (total int64, err error) {
415
+
416
+	err = readDb.Model(&models.VMHisPatient{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND record_date = ?", org_id, patient_id, record_time).Count(&total).Error
417
+
418
+	return
419
+}
420
+
421
+func FindMedicalInsuranceInfo(org_id int64) (config models.MedicalInsuranceOrgConfig, err error) {
422
+	err = readDb.Model(&models.MedicalInsuranceOrgConfig{}).Where("status = 1 AND user_org_id = ?", org_id).First(&config).Error
423
+	return
383 424
 }