Browse Source

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

csx 3 years ago
parent
commit
c4a474a700
3 changed files with 19 additions and 7 deletions
  1. 3 3
      controllers/sg/his_api_controller.go
  2. 4 4
      models/his_models.go
  3. 12 0
      service/his_service.go

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

2074
 
2074
 
2075
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2075
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2076
 	fmt.Println(his_patient_id)
2076
 	fmt.Println(his_patient_id)
2077
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
2077
+	his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2078
 	timestamp := time.Now().Unix()
2078
 	timestamp := time.Now().Unix()
2079
 	tempTime := time.Unix(timestamp, 0)
2079
 	tempTime := time.Unix(timestamp, 0)
2080
 	timeFormat := tempTime.Format("20060102150405")
2080
 	timeFormat := tempTime.Format("20060102150405")
2081
 	chrgBchno := rand.Intn(100000) + 10000
2081
 	chrgBchno := rand.Intn(100000) + 10000
2082
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
2082
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
2083
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2083
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2084
-	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
2084
+	patientPrescription, _ := service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2085
 	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
2085
 	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
2086
 	strconv.FormatInt(his.PatientId, 10)
2086
 	strconv.FormatInt(his.PatientId, 10)
2087
 
2087
 
2232
 
2232
 
2233
 			}
2233
 			}
2234
 			service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
2234
 			service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
2235
-			service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, chrg_bchno, recordDateTime)
2235
+			service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
2236
 
2236
 
2237
 			var total float64
2237
 			var total float64
2238
 			for _, item := range prescriptions {
2238
 			for _, item := range prescriptions {

+ 4 - 4
models/his_models.go View File

1
 package models
1
 package models
2
 
2
 
3
-import "time"
4
-
5
 type XtHisProject struct {
3
 type XtHisProject struct {
6
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
4
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
7
 	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
5
 	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
117
 	IptOtpNo               string  `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
115
 	IptOtpNo               string  `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
118
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
116
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
119
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
117
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
118
+	IdCardType             int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
119
+	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
120
+	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
121
+	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
120
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
122
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
121
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
123
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
122
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
124
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
123
-	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
124
-	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
125
 }
125
 }
126
 
126
 
127
 func (HisPatient) TableName() string {
127
 func (HisPatient) TableName() string {

+ 12 - 0
service/his_service.go View File

508
 
508
 
509
 }
509
 }
510
 
510
 
511
+func FindHisPatientPrescriptionInfo(org_id int64, his_patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
512
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND his_patient_id = ?", org_id, record_date, his_patient_id).First(&info).Error
513
+	return
514
+
515
+}
516
+
511
 func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
517
 func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
512
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
518
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
513
 	return
519
 	return
564
 	return
570
 	return
565
 }
571
 }
566
 
572
 
573
+func UpDateHisPrescriptionInfoNumber(user_org_id int64, his_patient_id int64, number string, record_time int64) (err error) {
574
+	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND his_patient_id = ? AND record_date = ?", user_org_id, his_patient_id, record_time).Updates(map[string]interface{}{"batch_number": number, "prescription_status": 2, "mtime": time.Now().Unix()}).Error
575
+
576
+	return
577
+}
578
+
567
 type HisOrder struct {
579
 type HisOrder struct {
568
 	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
580
 	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
569
 	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
581
 	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`